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

874 lines
18 KiB
JSON

{
"type": "Script",
"span": {
"start": 0,
"end": 192,
"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": "VariableDeclaration",
"span": {
"start": 25,
"end": 39,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 29,
"end": 38,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 29,
"end": 30,
"ctxt": 0
},
"value": "n",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 30,
"end": 38,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 32,
"end": 38,
"ctxt": 0
},
"kind": "number"
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 40,
"end": 51,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 44,
"end": 50,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 44,
"end": 45,
"ctxt": 0
},
"value": "a",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 45,
"end": 50,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 47,
"end": 50,
"ctxt": 0
},
"kind": "any"
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 52,
"end": 61,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 56,
"end": 60,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 56,
"end": 57,
"ctxt": 0
},
"value": "e",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 57,
"end": 60,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 59,
"end": 60,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 59,
"end": 60,
"ctxt": 0
},
"value": "E",
"optional": false
},
"typeParams": null
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "ExpressionStatement",
"span": {
"start": 63,
"end": 69,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 63,
"end": 68,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "Identifier",
"span": {
"start": 63,
"end": 64,
"ctxt": 0
},
"value": "n",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "Identifier",
"span": {
"start": 67,
"end": 68,
"ctxt": 0
},
"value": "e",
"optional": false
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 70,
"end": 78,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 70,
"end": 77,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "Identifier",
"span": {
"start": 70,
"end": 71,
"ctxt": 0
},
"value": "n",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "MemberExpression",
"span": {
"start": 74,
"end": 77,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 74,
"end": 75,
"ctxt": 0
},
"value": "E",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 76,
"end": 77,
"ctxt": 0
},
"value": "A",
"optional": false
}
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 80,
"end": 86,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 80,
"end": 85,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "Identifier",
"span": {
"start": 80,
"end": 81,
"ctxt": 0
},
"value": "a",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "Identifier",
"span": {
"start": 84,
"end": 85,
"ctxt": 0
},
"value": "n",
"optional": false
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 87,
"end": 93,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 87,
"end": 92,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "Identifier",
"span": {
"start": 87,
"end": 88,
"ctxt": 0
},
"value": "a",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "Identifier",
"span": {
"start": 91,
"end": 92,
"ctxt": 0
},
"value": "e",
"optional": false
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 94,
"end": 102,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 94,
"end": 101,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "Identifier",
"span": {
"start": 94,
"end": 95,
"ctxt": 0
},
"value": "a",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "MemberExpression",
"span": {
"start": 98,
"end": 101,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 98,
"end": 99,
"ctxt": 0
},
"value": "E",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 100,
"end": 101,
"ctxt": 0
},
"value": "A",
"optional": false
}
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 104,
"end": 110,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 104,
"end": 109,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "Identifier",
"span": {
"start": 104,
"end": 105,
"ctxt": 0
},
"value": "e",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "Identifier",
"span": {
"start": 108,
"end": 109,
"ctxt": 0
},
"value": "e",
"optional": false
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 111,
"end": 119,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 111,
"end": 118,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "Identifier",
"span": {
"start": 111,
"end": 112,
"ctxt": 0
},
"value": "e",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "MemberExpression",
"span": {
"start": 115,
"end": 118,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 115,
"end": 116,
"ctxt": 0
},
"value": "E",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 117,
"end": 118,
"ctxt": 0
},
"value": "A",
"optional": false
}
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 120,
"end": 128,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 120,
"end": 127,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "Identifier",
"span": {
"start": 120,
"end": 121,
"ctxt": 0
},
"value": "e",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "MemberExpression",
"span": {
"start": 124,
"end": 127,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 124,
"end": 125,
"ctxt": 0
},
"value": "E",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 126,
"end": 127,
"ctxt": 0
},
"value": "B",
"optional": false
}
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 129,
"end": 135,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 129,
"end": 134,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "Identifier",
"span": {
"start": 129,
"end": 130,
"ctxt": 0
},
"value": "e",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "Identifier",
"span": {
"start": 133,
"end": 134,
"ctxt": 0
},
"value": "n",
"optional": false
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 136,
"end": 145,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 136,
"end": 144,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "Identifier",
"span": {
"start": 136,
"end": 137,
"ctxt": 0
},
"value": "e",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "NullLiteral",
"span": {
"start": 140,
"end": 144,
"ctxt": 0
}
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 146,
"end": 160,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 146,
"end": 159,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "Identifier",
"span": {
"start": 146,
"end": 147,
"ctxt": 0
},
"value": "e",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "Identifier",
"span": {
"start": 150,
"end": 159,
"ctxt": 0
},
"value": "undefined",
"optional": false
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 161,
"end": 167,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 161,
"end": 166,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "Identifier",
"span": {
"start": 161,
"end": 162,
"ctxt": 0
},
"value": "e",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "NumericLiteral",
"span": {
"start": 165,
"end": 166,
"ctxt": 0
},
"value": 1.0
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 168,
"end": 175,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 168,
"end": 174,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "Identifier",
"span": {
"start": 168,
"end": 169,
"ctxt": 0
},
"value": "e",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "NumericLiteral",
"span": {
"start": 172,
"end": 174,
"ctxt": 0
},
"value": 1.0
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 176,
"end": 184,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 176,
"end": 183,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "Identifier",
"span": {
"start": 176,
"end": 177,
"ctxt": 0
},
"value": "e",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "NumericLiteral",
"span": {
"start": 180,
"end": 183,
"ctxt": 0
},
"value": 1.0
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 185,
"end": 192,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 185,
"end": 191,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "Identifier",
"span": {
"start": 185,
"end": 186,
"ctxt": 0
},
"value": "e",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "UnaryExpression",
"span": {
"start": 189,
"end": 191,
"ctxt": 0
},
"operator": "-",
"argument": {
"type": "NumericLiteral",
"span": {
"start": 190,
"end": 191,
"ctxt": 0
},
"value": 1.0
}
}
}
}
],
"interpreter": null
}