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

545 lines
12 KiB
JSON

{
"type": "Script",
"span": {
"start": 249,
"end": 483,
"ctxt": 0
},
"body": [
{
"type": "TsEnumDeclaration",
"span": {
"start": 249,
"end": 316,
"ctxt": 0
},
"declare": false,
"isConst": true,
"id": {
"type": "Identifier",
"span": {
"start": 260,
"end": 261,
"ctxt": 0
},
"value": "G",
"optional": false
},
"members": [
{
"type": "TsEnumMember",
"span": {
"start": 268,
"end": 273,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 268,
"end": 269,
"ctxt": 0
},
"value": "A",
"optional": false
},
"init": {
"type": "NumericLiteral",
"span": {
"start": 272,
"end": 273,
"ctxt": 0
},
"value": 1.0,
"raw": "1"
}
},
{
"type": "TsEnumMember",
"span": {
"start": 279,
"end": 284,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 279,
"end": 280,
"ctxt": 0
},
"value": "B",
"optional": false
},
"init": {
"type": "NumericLiteral",
"span": {
"start": 283,
"end": 284,
"ctxt": 0
},
"value": 2.0,
"raw": "2"
}
},
{
"type": "TsEnumMember",
"span": {
"start": 290,
"end": 299,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 290,
"end": 291,
"ctxt": 0
},
"value": "C",
"optional": false
},
"init": {
"type": "BinaryExpression",
"span": {
"start": 294,
"end": 299,
"ctxt": 0
},
"operator": "+",
"left": {
"type": "Identifier",
"span": {
"start": 294,
"end": 295,
"ctxt": 0
},
"value": "A",
"optional": false
},
"right": {
"type": "Identifier",
"span": {
"start": 298,
"end": 299,
"ctxt": 0
},
"value": "B",
"optional": false
}
}
},
{
"type": "TsEnumMember",
"span": {
"start": 305,
"end": 314,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 305,
"end": 306,
"ctxt": 0
},
"value": "D",
"optional": false
},
"init": {
"type": "BinaryExpression",
"span": {
"start": 309,
"end": 314,
"ctxt": 0
},
"operator": "*",
"left": {
"type": "Identifier",
"span": {
"start": 309,
"end": 310,
"ctxt": 0
},
"value": "A",
"optional": false
},
"right": {
"type": "NumericLiteral",
"span": {
"start": 313,
"end": 314,
"ctxt": 0
},
"value": 2.0,
"raw": "2"
}
}
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 400,
"end": 410,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 404,
"end": 409,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 404,
"end": 405,
"ctxt": 0
},
"value": "z",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "Identifier",
"span": {
"start": 408,
"end": 409,
"ctxt": 0
},
"value": "G",
"optional": false
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 411,
"end": 427,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 415,
"end": 426,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 415,
"end": 417,
"ctxt": 0
},
"value": "z1",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "MemberExpression",
"span": {
"start": 420,
"end": 426,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 420,
"end": 421,
"ctxt": 0
},
"value": "G",
"optional": false
},
"property": {
"type": "Computed",
"span": {
"start": 421,
"end": 426,
"ctxt": 0
},
"expression": {
"type": "MemberExpression",
"span": {
"start": 422,
"end": 425,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 422,
"end": 423,
"ctxt": 0
},
"value": "G",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 424,
"end": 425,
"ctxt": 0
},
"value": "A",
"optional": false
}
}
}
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 428,
"end": 437,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 432,
"end": 436,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 432,
"end": 433,
"ctxt": 0
},
"value": "g",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 433,
"end": 436,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 435,
"end": 436,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 435,
"end": 436,
"ctxt": 0
},
"value": "G",
"optional": false
},
"typeParams": null
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "ExpressionStatement",
"span": {
"start": 438,
"end": 451,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 438,
"end": 450,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "Identifier",
"span": {
"start": 438,
"end": 439,
"ctxt": 0
},
"value": "g",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "StringLiteral",
"span": {
"start": 442,
"end": 450,
"ctxt": 0
},
"value": "string",
"raw": "\"string\""
}
}
},
{
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 461,
"end": 464,
"ctxt": 0
},
"value": "foo",
"optional": false
},
"declare": false,
"params": [
{
"type": "Parameter",
"span": {
"start": 465,
"end": 469,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 465,
"end": 469,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 466,
"end": 469,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 468,
"end": 469,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 468,
"end": 469,
"ctxt": 0
},
"value": "G",
"optional": false
},
"typeParams": null
}
}
}
}
],
"decorators": [],
"span": {
"start": 452,
"end": 474,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 471,
"end": 474,
"ctxt": 0
},
"stmts": []
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
},
{
"type": "ExpressionStatement",
"span": {
"start": 475,
"end": 483,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 475,
"end": 482,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "MemberExpression",
"span": {
"start": 475,
"end": 478,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 475,
"end": 476,
"ctxt": 0
},
"value": "G",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 477,
"end": 478,
"ctxt": 0
},
"value": "B",
"optional": false
}
},
"right": {
"type": "NumericLiteral",
"span": {
"start": 481,
"end": 482,
"ctxt": 0
},
"value": 3.0,
"raw": "3"
}
}
}
],
"interpreter": null
}