swc/crates/swc_ecma_parser/tests/tsc/invalidStringAssignments.json
2022-02-04 17:08:38 +09:00

1189 lines
28 KiB
JSON

{
"type": "Script",
"span": {
"start": 0,
"end": 372,
"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": 15,
"end": 34,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 19,
"end": 33,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 19,
"end": 20,
"ctxt": 0
},
"value": "a",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 20,
"end": 29,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 22,
"end": 29,
"ctxt": 0
},
"kind": "boolean"
}
}
},
"init": {
"type": "Identifier",
"span": {
"start": 32,
"end": 33,
"ctxt": 0
},
"value": "x",
"optional": false
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 36,
"end": 54,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 40,
"end": 53,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 40,
"end": 41,
"ctxt": 0
},
"value": "b",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 41,
"end": 49,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 43,
"end": 49,
"ctxt": 0
},
"kind": "number"
}
}
},
"init": {
"type": "Identifier",
"span": {
"start": 52,
"end": 53,
"ctxt": 0
},
"value": "x",
"optional": false
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 56,
"end": 72,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 60,
"end": 71,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 60,
"end": 61,
"ctxt": 0
},
"value": "c",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 61,
"end": 67,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 63,
"end": 67,
"ctxt": 0
},
"kind": "void"
}
}
},
"init": {
"type": "Identifier",
"span": {
"start": 70,
"end": 71,
"ctxt": 0
},
"value": "x",
"optional": false
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 74,
"end": 102,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 78,
"end": 101,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 78,
"end": 79,
"ctxt": 0
},
"value": "d",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 79,
"end": 97,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeQuery",
"span": {
"start": 81,
"end": 97,
"ctxt": 0
},
"exprName": {
"type": "Identifier",
"span": {
"start": 88,
"end": 97,
"ctxt": 0
},
"value": "undefined",
"optional": false
}
}
}
},
"init": {
"type": "Identifier",
"span": {
"start": 100,
"end": 101,
"ctxt": 0
},
"value": "x",
"optional": false
},
"definite": false
}
]
},
{
"type": "ClassDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 112,
"end": 113,
"ctxt": 0
},
"value": "C",
"optional": false
},
"declare": false,
"span": {
"start": 106,
"end": 130,
"ctxt": 0
},
"decorators": [],
"body": [
{
"type": "ClassProperty",
"span": {
"start": 116,
"end": 128,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 116,
"end": 119,
"ctxt": 0
},
"value": "foo",
"optional": false
},
"value": null,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 119,
"end": 127,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 121,
"end": 127,
"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": 132,
"end": 145,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 136,
"end": 144,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 136,
"end": 137,
"ctxt": 0
},
"value": "e",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 137,
"end": 140,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 139,
"end": 140,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 139,
"end": 140,
"ctxt": 0
},
"value": "C",
"optional": false
},
"typeParams": null
}
}
},
"init": {
"type": "Identifier",
"span": {
"start": 143,
"end": 144,
"ctxt": 0
},
"value": "x",
"optional": false
},
"definite": false
}
]
},
{
"type": "TsInterfaceDeclaration",
"span": {
"start": 149,
"end": 177,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 159,
"end": 160,
"ctxt": 0
},
"value": "I",
"optional": false
},
"declare": false,
"typeParams": null,
"extends": [],
"body": {
"type": "TsInterfaceBody",
"span": {
"start": 161,
"end": 177,
"ctxt": 0
},
"body": [
{
"type": "TsPropertySignature",
"span": {
"start": 163,
"end": 175,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 163,
"end": 166,
"ctxt": 0
},
"value": "bar",
"optional": false
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 166,
"end": 174,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 168,
"end": 174,
"ctxt": 0
},
"kind": "string"
}
},
"typeParams": null
}
]
}
},
{
"type": "VariableDeclaration",
"span": {
"start": 179,
"end": 192,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 183,
"end": 191,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 183,
"end": 184,
"ctxt": 0
},
"value": "f",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 184,
"end": 187,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 186,
"end": 187,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 186,
"end": 187,
"ctxt": 0
},
"value": "I",
"optional": false
},
"typeParams": null
}
}
},
"init": {
"type": "Identifier",
"span": {
"start": 190,
"end": 191,
"ctxt": 0
},
"value": "x",
"optional": false
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 196,
"end": 223,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 200,
"end": 222,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 200,
"end": 201,
"ctxt": 0
},
"value": "g",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 201,
"end": 218,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeLiteral",
"span": {
"start": 203,
"end": 218,
"ctxt": 0
},
"members": [
{
"type": "TsPropertySignature",
"span": {
"start": 205,
"end": 216,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 205,
"end": 208,
"ctxt": 0
},
"value": "baz",
"optional": false
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 208,
"end": 216,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 210,
"end": 216,
"ctxt": 0
},
"kind": "string"
}
},
"typeParams": null
}
]
}
}
},
"init": {
"type": "NumericLiteral",
"span": {
"start": 221,
"end": 222,
"ctxt": 0
},
"value": 1.0
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 225,
"end": 251,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 229,
"end": 250,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 229,
"end": 231,
"ctxt": 0
},
"value": "g2",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 231,
"end": 246,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeLiteral",
"span": {
"start": 233,
"end": 246,
"ctxt": 0
},
"members": [
{
"type": "TsPropertySignature",
"span": {
"start": 235,
"end": 244,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "NumericLiteral",
"span": {
"start": 235,
"end": 236,
"ctxt": 0
},
"value": 0.0
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 236,
"end": 244,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 238,
"end": 244,
"ctxt": 0
},
"kind": "number"
}
},
"typeParams": null
}
]
}
}
},
"init": {
"type": "NumericLiteral",
"span": {
"start": 249,
"end": 250,
"ctxt": 0
},
"value": 1.0
},
"definite": false
}
]
},
{
"type": "TsModuleDeclaration",
"span": {
"start": 255,
"end": 285,
"ctxt": 0
},
"declare": false,
"global": false,
"id": {
"type": "Identifier",
"span": {
"start": 262,
"end": 263,
"ctxt": 0
},
"value": "M",
"optional": false
},
"body": {
"type": "TsModuleBlock",
"span": {
"start": 264,
"end": 285,
"ctxt": 0
},
"body": [
{
"type": "ExportDeclaration",
"span": {
"start": 266,
"end": 283,
"ctxt": 0
},
"declaration": {
"type": "VariableDeclaration",
"span": {
"start": 273,
"end": 283,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 277,
"end": 282,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 277,
"end": 278,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "NumericLiteral",
"span": {
"start": 281,
"end": 282,
"ctxt": 0
},
"value": 1.0
},
"definite": false
}
]
}
}
]
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 287,
"end": 293,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 287,
"end": 292,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "Identifier",
"span": {
"start": 287,
"end": 288,
"ctxt": 0
},
"value": "M",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "Identifier",
"span": {
"start": 291,
"end": 292,
"ctxt": 0
},
"value": "x",
"optional": false
}
}
},
{
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 306,
"end": 307,
"ctxt": 0
},
"value": "i",
"optional": false
},
"declare": false,
"params": [
{
"type": "Parameter",
"span": {
"start": 311,
"end": 315,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 311,
"end": 315,
"ctxt": 0
},
"value": "a",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 312,
"end": 315,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 314,
"end": 315,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 314,
"end": 315,
"ctxt": 0
},
"value": "T",
"optional": false
},
"typeParams": null
}
}
}
}
],
"decorators": [],
"span": {
"start": 297,
"end": 333,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 317,
"end": 333,
"ctxt": 0
},
"stmts": [
{
"type": "ExpressionStatement",
"span": {
"start": 324,
"end": 330,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 324,
"end": 329,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "Identifier",
"span": {
"start": 324,
"end": 325,
"ctxt": 0
},
"value": "a",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "Identifier",
"span": {
"start": 328,
"end": 329,
"ctxt": 0
},
"value": "x",
"optional": false
}
}
}
]
},
"generator": false,
"async": false,
"typeParameters": {
"type": "TsTypeParameterDeclaration",
"span": {
"start": 307,
"end": 310,
"ctxt": 0
},
"parameters": [
{
"type": "TsTypeParameter",
"span": {
"start": 308,
"end": 309,
"ctxt": 0
},
"name": {
"type": "Identifier",
"span": {
"start": 308,
"end": 309,
"ctxt": 0
},
"value": "T",
"optional": false
},
"constraint": null,
"default": null
}
]
},
"returnType": null
},
{
"type": "ExpressionStatement",
"span": {
"start": 335,
"end": 341,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 335,
"end": 340,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "Identifier",
"span": {
"start": 335,
"end": 336,
"ctxt": 0
},
"value": "i",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "Identifier",
"span": {
"start": 339,
"end": 340,
"ctxt": 0
},
"value": "x",
"optional": false
}
}
},
{
"type": "TsEnumDeclaration",
"span": {
"start": 345,
"end": 357,
"ctxt": 0
},
"declare": false,
"isConst": false,
"id": {
"type": "Identifier",
"span": {
"start": 350,
"end": 351,
"ctxt": 0
},
"value": "E",
"optional": false
},
"members": [
{
"type": "TsEnumMember",
"span": {
"start": 354,
"end": 355,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 354,
"end": 355,
"ctxt": 0
},
"value": "A",
"optional": false
},
"init": null
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 359,
"end": 372,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 363,
"end": 371,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 363,
"end": 364,
"ctxt": 0
},
"value": "j",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 364,
"end": 367,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 366,
"end": 367,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 366,
"end": 367,
"ctxt": 0
},
"value": "E",
"optional": false
},
"typeParams": null
}
}
},
"init": {
"type": "Identifier",
"span": {
"start": 370,
"end": 371,
"ctxt": 0
},
"value": "x",
"optional": false
},
"definite": false
}
]
}
],
"interpreter": null
}