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

1189 lines
28 KiB
JSON

{
"type": "Script",
"span": {
"start": 0,
"end": 347,
"ctxt": 0
},
"body": [
{
"type": "VariableDeclaration",
"span": {
"start": 0,
"end": 11,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 4,
"end": 10,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 4,
"end": 5,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "StringLiteral",
"span": {
"start": 8,
"end": 10,
"ctxt": 0
},
"value": "",
"hasEscape": false,
"kind": {
"type": "normal",
"containsQuote": true
}
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 13,
"end": 32,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 17,
"end": 31,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 17,
"end": 18,
"ctxt": 0
},
"value": "a",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 18,
"end": 27,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 20,
"end": 27,
"ctxt": 0
},
"kind": "boolean"
}
}
},
"init": {
"type": "Identifier",
"span": {
"start": 30,
"end": 31,
"ctxt": 0
},
"value": "x",
"optional": false
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 33,
"end": 51,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 37,
"end": 50,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 37,
"end": 38,
"ctxt": 0
},
"value": "b",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 38,
"end": 46,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 40,
"end": 46,
"ctxt": 0
},
"kind": "number"
}
}
},
"init": {
"type": "Identifier",
"span": {
"start": 49,
"end": 50,
"ctxt": 0
},
"value": "x",
"optional": false
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 52,
"end": 68,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 56,
"end": 67,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 56,
"end": 57,
"ctxt": 0
},
"value": "c",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 57,
"end": 63,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 59,
"end": 63,
"ctxt": 0
},
"kind": "void"
}
}
},
"init": {
"type": "Identifier",
"span": {
"start": 66,
"end": 67,
"ctxt": 0
},
"value": "x",
"optional": false
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 69,
"end": 97,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 73,
"end": 96,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 73,
"end": 74,
"ctxt": 0
},
"value": "d",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 74,
"end": 92,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeQuery",
"span": {
"start": 76,
"end": 92,
"ctxt": 0
},
"exprName": {
"type": "Identifier",
"span": {
"start": 83,
"end": 92,
"ctxt": 0
},
"value": "undefined",
"optional": false
}
}
}
},
"init": {
"type": "Identifier",
"span": {
"start": 95,
"end": 96,
"ctxt": 0
},
"value": "x",
"optional": false
},
"definite": false
}
]
},
{
"type": "ClassDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 105,
"end": 106,
"ctxt": 0
},
"value": "C",
"optional": false
},
"declare": false,
"span": {
"start": 99,
"end": 123,
"ctxt": 0
},
"decorators": [],
"body": [
{
"type": "ClassProperty",
"span": {
"start": 109,
"end": 121,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 109,
"end": 112,
"ctxt": 0
},
"value": "foo",
"optional": false
},
"value": null,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 112,
"end": 120,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 114,
"end": 120,
"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": 124,
"end": 137,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 128,
"end": 136,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 128,
"end": 129,
"ctxt": 0
},
"value": "e",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 129,
"end": 132,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 131,
"end": 132,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 131,
"end": 132,
"ctxt": 0
},
"value": "C",
"optional": false
},
"typeParams": null
}
}
},
"init": {
"type": "Identifier",
"span": {
"start": 135,
"end": 136,
"ctxt": 0
},
"value": "x",
"optional": false
},
"definite": false
}
]
},
{
"type": "TsInterfaceDeclaration",
"span": {
"start": 139,
"end": 167,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 149,
"end": 150,
"ctxt": 0
},
"value": "I",
"optional": false
},
"declare": false,
"typeParams": null,
"extends": [],
"body": {
"type": "TsInterfaceBody",
"span": {
"start": 151,
"end": 167,
"ctxt": 0
},
"body": [
{
"type": "TsPropertySignature",
"span": {
"start": 153,
"end": 165,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 153,
"end": 156,
"ctxt": 0
},
"value": "bar",
"optional": false
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 156,
"end": 164,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 158,
"end": 164,
"ctxt": 0
},
"kind": "string"
}
},
"typeParams": null
}
]
}
},
{
"type": "VariableDeclaration",
"span": {
"start": 168,
"end": 181,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 172,
"end": 180,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 172,
"end": 173,
"ctxt": 0
},
"value": "f",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 173,
"end": 176,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 175,
"end": 176,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 175,
"end": 176,
"ctxt": 0
},
"value": "I",
"optional": false
},
"typeParams": null
}
}
},
"init": {
"type": "Identifier",
"span": {
"start": 179,
"end": 180,
"ctxt": 0
},
"value": "x",
"optional": false
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 183,
"end": 210,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 187,
"end": 209,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 187,
"end": 188,
"ctxt": 0
},
"value": "g",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 188,
"end": 205,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeLiteral",
"span": {
"start": 190,
"end": 205,
"ctxt": 0
},
"members": [
{
"type": "TsPropertySignature",
"span": {
"start": 192,
"end": 203,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 192,
"end": 195,
"ctxt": 0
},
"value": "baz",
"optional": false
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 195,
"end": 203,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 197,
"end": 203,
"ctxt": 0
},
"kind": "string"
}
},
"typeParams": null
}
]
}
}
},
"init": {
"type": "NumericLiteral",
"span": {
"start": 208,
"end": 209,
"ctxt": 0
},
"value": 1.0
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 211,
"end": 237,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 215,
"end": 236,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 215,
"end": 217,
"ctxt": 0
},
"value": "g2",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 217,
"end": 232,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeLiteral",
"span": {
"start": 219,
"end": 232,
"ctxt": 0
},
"members": [
{
"type": "TsPropertySignature",
"span": {
"start": 221,
"end": 230,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "NumericLiteral",
"span": {
"start": 221,
"end": 222,
"ctxt": 0
},
"value": 0.0
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 222,
"end": 230,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 224,
"end": 230,
"ctxt": 0
},
"kind": "number"
}
},
"typeParams": null
}
]
}
}
},
"init": {
"type": "NumericLiteral",
"span": {
"start": 235,
"end": 236,
"ctxt": 0
},
"value": 1.0
},
"definite": false
}
]
},
{
"type": "TsModuleDeclaration",
"span": {
"start": 239,
"end": 269,
"ctxt": 0
},
"declare": false,
"global": false,
"id": {
"type": "Identifier",
"span": {
"start": 246,
"end": 247,
"ctxt": 0
},
"value": "M",
"optional": false
},
"body": {
"type": "TsModuleBlock",
"span": {
"start": 248,
"end": 269,
"ctxt": 0
},
"body": [
{
"type": "ExportDeclaration",
"span": {
"start": 250,
"end": 267,
"ctxt": 0
},
"declaration": {
"type": "VariableDeclaration",
"span": {
"start": 257,
"end": 267,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 261,
"end": 266,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 261,
"end": 262,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "NumericLiteral",
"span": {
"start": 265,
"end": 266,
"ctxt": 0
},
"value": 1.0
},
"definite": false
}
]
}
}
]
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 270,
"end": 276,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 270,
"end": 275,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "Identifier",
"span": {
"start": 270,
"end": 271,
"ctxt": 0
},
"value": "M",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "Identifier",
"span": {
"start": 274,
"end": 275,
"ctxt": 0
},
"value": "x",
"optional": false
}
}
},
{
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 287,
"end": 288,
"ctxt": 0
},
"value": "i",
"optional": false
},
"declare": false,
"params": [
{
"type": "Parameter",
"span": {
"start": 292,
"end": 296,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 292,
"end": 296,
"ctxt": 0
},
"value": "a",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 293,
"end": 296,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 295,
"end": 296,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 295,
"end": 296,
"ctxt": 0
},
"value": "T",
"optional": false
},
"typeParams": null
}
}
}
}
],
"decorators": [],
"span": {
"start": 278,
"end": 312,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 298,
"end": 312,
"ctxt": 0
},
"stmts": [
{
"type": "ExpressionStatement",
"span": {
"start": 304,
"end": 310,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 304,
"end": 309,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "Identifier",
"span": {
"start": 304,
"end": 305,
"ctxt": 0
},
"value": "a",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "Identifier",
"span": {
"start": 308,
"end": 309,
"ctxt": 0
},
"value": "x",
"optional": false
}
}
}
]
},
"generator": false,
"async": false,
"typeParameters": {
"type": "TsTypeParameterDeclaration",
"span": {
"start": 288,
"end": 291,
"ctxt": 0
},
"parameters": [
{
"type": "TsTypeParameter",
"span": {
"start": 289,
"end": 290,
"ctxt": 0
},
"name": {
"type": "Identifier",
"span": {
"start": 289,
"end": 290,
"ctxt": 0
},
"value": "T",
"optional": false
},
"constraint": null,
"default": null
}
]
},
"returnType": null
},
{
"type": "ExpressionStatement",
"span": {
"start": 313,
"end": 319,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 313,
"end": 318,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "Identifier",
"span": {
"start": 313,
"end": 314,
"ctxt": 0
},
"value": "i",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "Identifier",
"span": {
"start": 317,
"end": 318,
"ctxt": 0
},
"value": "x",
"optional": false
}
}
},
{
"type": "TsEnumDeclaration",
"span": {
"start": 321,
"end": 333,
"ctxt": 0
},
"declare": false,
"isConst": false,
"id": {
"type": "Identifier",
"span": {
"start": 326,
"end": 327,
"ctxt": 0
},
"value": "E",
"optional": false
},
"members": [
{
"type": "TsEnumMember",
"span": {
"start": 330,
"end": 331,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 330,
"end": 331,
"ctxt": 0
},
"value": "A",
"optional": false
},
"init": null
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 334,
"end": 347,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 338,
"end": 346,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 338,
"end": 339,
"ctxt": 0
},
"value": "j",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 339,
"end": 342,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 341,
"end": 342,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 341,
"end": 342,
"ctxt": 0
},
"value": "E",
"optional": false
},
"typeParams": null
}
}
},
"init": {
"type": "Identifier",
"span": {
"start": 345,
"end": 346,
"ctxt": 0
},
"value": "x",
"optional": false
},
"definite": false
}
]
}
],
"interpreter": null
}