swc/crates/swc_ecma_parser/tests/tsc/invalidEnumAssignments.json
2022-02-04 20:17:42 +09:00

643 lines
14 KiB
JSON

{
"type": "Script",
"span": {
"start": 0,
"end": 161,
"ctxt": 0
},
"body": [
{
"type": "TsEnumDeclaration",
"span": {
"start": 0,
"end": 23,
"ctxt": 0
},
"declare": false,
"isConst": false,
"id": {
"type": "Identifier",
"span": {
"start": 5,
"end": 6,
"ctxt": 0
},
"value": "E",
"optional": false
},
"members": [
{
"type": "TsEnumMember",
"span": {
"start": 13,
"end": 14,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 13,
"end": 14,
"ctxt": 0
},
"value": "A",
"optional": false
},
"init": null
},
{
"type": "TsEnumMember",
"span": {
"start": 20,
"end": 21,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 20,
"end": 21,
"ctxt": 0
},
"value": "B",
"optional": false
},
"init": null
}
]
},
{
"type": "TsEnumDeclaration",
"span": {
"start": 25,
"end": 49,
"ctxt": 0
},
"declare": false,
"isConst": false,
"id": {
"type": "Identifier",
"span": {
"start": 30,
"end": 32,
"ctxt": 0
},
"value": "E2",
"optional": false
},
"members": [
{
"type": "TsEnumMember",
"span": {
"start": 39,
"end": 40,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 39,
"end": 40,
"ctxt": 0
},
"value": "A",
"optional": false
},
"init": null
},
{
"type": "TsEnumMember",
"span": {
"start": 46,
"end": 47,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 46,
"end": 47,
"ctxt": 0
},
"value": "B",
"optional": false
},
"init": null
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 51,
"end": 60,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 55,
"end": 59,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 55,
"end": 56,
"ctxt": 0
},
"value": "e",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 56,
"end": 59,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 58,
"end": 59,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 58,
"end": 59,
"ctxt": 0
},
"value": "E",
"optional": false
},
"typeParams": null
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 61,
"end": 72,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 65,
"end": 71,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 65,
"end": 67,
"ctxt": 0
},
"value": "e2",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 67,
"end": 71,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 69,
"end": 71,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 69,
"end": 71,
"ctxt": 0
},
"value": "E2",
"optional": false
},
"typeParams": null
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "ExpressionStatement",
"span": {
"start": 74,
"end": 83,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 74,
"end": 82,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "Identifier",
"span": {
"start": 74,
"end": 75,
"ctxt": 0
},
"value": "e",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "MemberExpression",
"span": {
"start": 78,
"end": 82,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 78,
"end": 80,
"ctxt": 0
},
"value": "E2",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 81,
"end": 82,
"ctxt": 0
},
"value": "A",
"optional": false
}
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 84,
"end": 93,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 84,
"end": 92,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "Identifier",
"span": {
"start": 84,
"end": 86,
"ctxt": 0
},
"value": "e2",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "MemberExpression",
"span": {
"start": 89,
"end": 92,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 89,
"end": 90,
"ctxt": 0
},
"value": "E",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 91,
"end": 92,
"ctxt": 0
},
"value": "A",
"optional": false
}
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 94,
"end": 109,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 94,
"end": 108,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "Identifier",
"span": {
"start": 94,
"end": 95,
"ctxt": 0
},
"value": "e",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "TsTypeAssertion",
"span": {
"start": 98,
"end": 108,
"ctxt": 0
},
"expression": {
"type": "NullLiteral",
"span": {
"start": 104,
"end": 108,
"ctxt": 0
}
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 99,
"end": 103,
"ctxt": 0
},
"kind": "void"
}
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 110,
"end": 117,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 110,
"end": 116,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "Identifier",
"span": {
"start": 110,
"end": 111,
"ctxt": 0
},
"value": "e",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "ObjectExpression",
"span": {
"start": 114,
"end": 116,
"ctxt": 0
},
"properties": []
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 118,
"end": 125,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 118,
"end": 124,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "Identifier",
"span": {
"start": 118,
"end": 119,
"ctxt": 0
},
"value": "e",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "StringLiteral",
"span": {
"start": 122,
"end": 124,
"ctxt": 0
},
"value": "",
"hasEscape": false,
"kind": {
"type": "normal",
"containsQuote": true
}
}
}
},
{
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 136,
"end": 137,
"ctxt": 0
},
"value": "f",
"optional": false
},
"declare": false,
"params": [
{
"type": "Parameter",
"span": {
"start": 141,
"end": 145,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 141,
"end": 145,
"ctxt": 0
},
"value": "a",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 142,
"end": 145,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 144,
"end": 145,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 144,
"end": 145,
"ctxt": 0
},
"value": "T",
"optional": false
},
"typeParams": null
}
}
}
}
],
"decorators": [],
"span": {
"start": 127,
"end": 161,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 147,
"end": 161,
"ctxt": 0
},
"stmts": [
{
"type": "ExpressionStatement",
"span": {
"start": 153,
"end": 159,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 153,
"end": 158,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "Identifier",
"span": {
"start": 153,
"end": 154,
"ctxt": 0
},
"value": "e",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "Identifier",
"span": {
"start": 157,
"end": 158,
"ctxt": 0
},
"value": "a",
"optional": false
}
}
}
]
},
"generator": false,
"async": false,
"typeParameters": {
"type": "TsTypeParameterDeclaration",
"span": {
"start": 137,
"end": 140,
"ctxt": 0
},
"parameters": [
{
"type": "TsTypeParameter",
"span": {
"start": 138,
"end": 139,
"ctxt": 0
},
"name": {
"type": "Identifier",
"span": {
"start": 138,
"end": 139,
"ctxt": 0
},
"value": "T",
"optional": false
},
"constraint": null,
"default": null
}
]
},
"returnType": null
}
],
"interpreter": null
}