swc/crates/swc_ecma_parser/tests/tsc/invalidNumberAssignments.json

1076 lines
25 KiB
JSON

{
"type": "Script",
"span": {
"start": 0,
"end": 318,
"ctxt": 0
},
"body": [
{
"type": "VariableDeclaration",
"span": {
"start": 0,
"end": 10,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 4,
"end": 9,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 4,
"end": 5,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "NumericLiteral",
"span": {
"start": 8,
"end": 9,
"ctxt": 0
},
"value": 1.0
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 12,
"end": 31,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 16,
"end": 30,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 16,
"end": 17,
"ctxt": 0
},
"value": "a",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 17,
"end": 26,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 19,
"end": 26,
"ctxt": 0
},
"kind": "boolean"
}
}
},
"init": {
"type": "Identifier",
"span": {
"start": 29,
"end": 30,
"ctxt": 0
},
"value": "x",
"optional": false
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 32,
"end": 50,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 36,
"end": 49,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 36,
"end": 37,
"ctxt": 0
},
"value": "b",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 37,
"end": 45,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 39,
"end": 45,
"ctxt": 0
},
"kind": "string"
}
}
},
"init": {
"type": "Identifier",
"span": {
"start": 48,
"end": 49,
"ctxt": 0
},
"value": "x",
"optional": false
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 51,
"end": 67,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 55,
"end": 66,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 55,
"end": 56,
"ctxt": 0
},
"value": "c",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 56,
"end": 62,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 58,
"end": 62,
"ctxt": 0
},
"kind": "void"
}
}
},
"init": {
"type": "Identifier",
"span": {
"start": 65,
"end": 66,
"ctxt": 0
},
"value": "x",
"optional": false
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 68,
"end": 96,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 72,
"end": 95,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 72,
"end": 73,
"ctxt": 0
},
"value": "d",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 73,
"end": 91,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeQuery",
"span": {
"start": 75,
"end": 91,
"ctxt": 0
},
"exprName": {
"type": "Identifier",
"span": {
"start": 82,
"end": 91,
"ctxt": 0
},
"value": "undefined",
"optional": false
},
"typeArguments": null
}
}
},
"init": {
"type": "Identifier",
"span": {
"start": 94,
"end": 95,
"ctxt": 0
},
"value": "x",
"optional": false
},
"definite": false
}
]
},
{
"type": "ClassDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 104,
"end": 105,
"ctxt": 0
},
"value": "C",
"optional": false
},
"declare": false,
"span": {
"start": 98,
"end": 122,
"ctxt": 0
},
"decorators": [],
"body": [
{
"type": "ClassProperty",
"span": {
"start": 108,
"end": 120,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 108,
"end": 111,
"ctxt": 0
},
"value": "foo",
"optional": false
},
"value": null,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 111,
"end": 119,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 113,
"end": 119,
"ctxt": 0
},
"kind": "string"
}
},
"isStatic": false,
"decorators": [],
"accessibility": null,
"isAbstract": false,
"isOptional": false,
"isOverride": false,
"readonly": false,
"declare": false,
"definite": false
}
],
"superClass": null,
"isAbstract": false,
"typeParams": null,
"superTypeParams": null,
"implements": []
},
{
"type": "VariableDeclaration",
"span": {
"start": 123,
"end": 136,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 127,
"end": 135,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 127,
"end": 128,
"ctxt": 0
},
"value": "e",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 128,
"end": 131,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 130,
"end": 131,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 130,
"end": 131,
"ctxt": 0
},
"value": "C",
"optional": false
},
"typeParams": null
}
}
},
"init": {
"type": "Identifier",
"span": {
"start": 134,
"end": 135,
"ctxt": 0
},
"value": "x",
"optional": false
},
"definite": false
}
]
},
{
"type": "TsInterfaceDeclaration",
"span": {
"start": 138,
"end": 166,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 148,
"end": 149,
"ctxt": 0
},
"value": "I",
"optional": false
},
"declare": false,
"typeParams": null,
"extends": [],
"body": {
"type": "TsInterfaceBody",
"span": {
"start": 150,
"end": 166,
"ctxt": 0
},
"body": [
{
"type": "TsPropertySignature",
"span": {
"start": 152,
"end": 164,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 152,
"end": 155,
"ctxt": 0
},
"value": "bar",
"optional": false
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 155,
"end": 163,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 157,
"end": 163,
"ctxt": 0
},
"kind": "string"
}
},
"typeParams": null
}
]
}
},
{
"type": "VariableDeclaration",
"span": {
"start": 167,
"end": 180,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 171,
"end": 179,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 171,
"end": 172,
"ctxt": 0
},
"value": "f",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 172,
"end": 175,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 174,
"end": 175,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 174,
"end": 175,
"ctxt": 0
},
"value": "I",
"optional": false
},
"typeParams": null
}
}
},
"init": {
"type": "Identifier",
"span": {
"start": 178,
"end": 179,
"ctxt": 0
},
"value": "x",
"optional": false
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 182,
"end": 209,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 186,
"end": 208,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 186,
"end": 187,
"ctxt": 0
},
"value": "g",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 187,
"end": 204,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeLiteral",
"span": {
"start": 189,
"end": 204,
"ctxt": 0
},
"members": [
{
"type": "TsPropertySignature",
"span": {
"start": 191,
"end": 202,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 191,
"end": 194,
"ctxt": 0
},
"value": "baz",
"optional": false
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 194,
"end": 202,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 196,
"end": 202,
"ctxt": 0
},
"kind": "string"
}
},
"typeParams": null
}
]
}
}
},
"init": {
"type": "NumericLiteral",
"span": {
"start": 207,
"end": 208,
"ctxt": 0
},
"value": 1.0
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 210,
"end": 236,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 214,
"end": 235,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 214,
"end": 216,
"ctxt": 0
},
"value": "g2",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 216,
"end": 231,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeLiteral",
"span": {
"start": 218,
"end": 231,
"ctxt": 0
},
"members": [
{
"type": "TsPropertySignature",
"span": {
"start": 220,
"end": 229,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "NumericLiteral",
"span": {
"start": 220,
"end": 221,
"ctxt": 0
},
"value": 0.0
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 221,
"end": 229,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 223,
"end": 229,
"ctxt": 0
},
"kind": "number"
}
},
"typeParams": null
}
]
}
}
},
"init": {
"type": "NumericLiteral",
"span": {
"start": 234,
"end": 235,
"ctxt": 0
},
"value": 1.0
},
"definite": false
}
]
},
{
"type": "TsModuleDeclaration",
"span": {
"start": 238,
"end": 268,
"ctxt": 0
},
"declare": false,
"global": false,
"id": {
"type": "Identifier",
"span": {
"start": 245,
"end": 246,
"ctxt": 0
},
"value": "M",
"optional": false
},
"body": {
"type": "TsModuleBlock",
"span": {
"start": 247,
"end": 268,
"ctxt": 0
},
"body": [
{
"type": "ExportDeclaration",
"span": {
"start": 249,
"end": 266,
"ctxt": 0
},
"declaration": {
"type": "VariableDeclaration",
"span": {
"start": 256,
"end": 266,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 260,
"end": 265,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 260,
"end": 261,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "NumericLiteral",
"span": {
"start": 264,
"end": 265,
"ctxt": 0
},
"value": 1.0
},
"definite": false
}
]
}
}
]
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 269,
"end": 275,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 269,
"end": 274,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "Identifier",
"span": {
"start": 269,
"end": 270,
"ctxt": 0
},
"value": "M",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "Identifier",
"span": {
"start": 273,
"end": 274,
"ctxt": 0
},
"value": "x",
"optional": false
}
}
},
{
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 286,
"end": 287,
"ctxt": 0
},
"value": "i",
"optional": false
},
"declare": false,
"params": [
{
"type": "Parameter",
"span": {
"start": 291,
"end": 295,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 291,
"end": 295,
"ctxt": 0
},
"value": "a",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 292,
"end": 295,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 294,
"end": 295,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 294,
"end": 295,
"ctxt": 0
},
"value": "T",
"optional": false
},
"typeParams": null
}
}
}
}
],
"decorators": [],
"span": {
"start": 277,
"end": 311,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 297,
"end": 311,
"ctxt": 0
},
"stmts": [
{
"type": "ExpressionStatement",
"span": {
"start": 303,
"end": 309,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 303,
"end": 308,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "Identifier",
"span": {
"start": 303,
"end": 304,
"ctxt": 0
},
"value": "a",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "Identifier",
"span": {
"start": 307,
"end": 308,
"ctxt": 0
},
"value": "x",
"optional": false
}
}
}
]
},
"generator": false,
"async": false,
"typeParameters": {
"type": "TsTypeParameterDeclaration",
"span": {
"start": 287,
"end": 290,
"ctxt": 0
},
"parameters": [
{
"type": "TsTypeParameter",
"span": {
"start": 288,
"end": 289,
"ctxt": 0
},
"name": {
"type": "Identifier",
"span": {
"start": 288,
"end": 289,
"ctxt": 0
},
"value": "T",
"optional": false
},
"constraint": null,
"default": null
}
]
},
"returnType": null
},
{
"type": "ExpressionStatement",
"span": {
"start": 312,
"end": 318,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 312,
"end": 317,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "Identifier",
"span": {
"start": 312,
"end": 313,
"ctxt": 0
},
"value": "i",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "Identifier",
"span": {
"start": 316,
"end": 317,
"ctxt": 0
},
"value": "x",
"optional": false
}
}
}
],
"interpreter": null
}