swc/crates/swc_ecma_parser/tests/tsc/constEnumPropertyAccess1.json
2022-03-22 07:54:08 +00:00

829 lines
20 KiB
JSON

{
"type": "Script",
"span": {
"start": 264,
"end": 547,
"ctxt": 0
},
"body": [
{
"type": "TsEnumDeclaration",
"span": {
"start": 264,
"end": 331,
"ctxt": 0
},
"declare": false,
"isConst": true,
"id": {
"type": "Identifier",
"span": {
"start": 275,
"end": 276,
"ctxt": 0
},
"value": "G",
"optional": false
},
"members": [
{
"type": "TsEnumMember",
"span": {
"start": 283,
"end": 288,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 283,
"end": 284,
"ctxt": 0
},
"value": "A",
"optional": false
},
"init": {
"type": "NumericLiteral",
"span": {
"start": 287,
"end": 288,
"ctxt": 0
},
"value": 1.0
}
},
{
"type": "TsEnumMember",
"span": {
"start": 294,
"end": 299,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 294,
"end": 295,
"ctxt": 0
},
"value": "B",
"optional": false
},
"init": {
"type": "NumericLiteral",
"span": {
"start": 298,
"end": 299,
"ctxt": 0
},
"value": 2.0
}
},
{
"type": "TsEnumMember",
"span": {
"start": 305,
"end": 314,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 305,
"end": 306,
"ctxt": 0
},
"value": "C",
"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": "Identifier",
"span": {
"start": 313,
"end": 314,
"ctxt": 0
},
"value": "B",
"optional": false
}
}
},
{
"type": "TsEnumMember",
"span": {
"start": 320,
"end": 329,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 320,
"end": 321,
"ctxt": 0
},
"value": "D",
"optional": false
},
"init": {
"type": "BinaryExpression",
"span": {
"start": 324,
"end": 329,
"ctxt": 0
},
"operator": "*",
"left": {
"type": "Identifier",
"span": {
"start": 324,
"end": 325,
"ctxt": 0
},
"value": "A",
"optional": false
},
"right": {
"type": "NumericLiteral",
"span": {
"start": 328,
"end": 329,
"ctxt": 0
},
"value": 2.0
}
}
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 333,
"end": 397,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 337,
"end": 396,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 337,
"end": 338,
"ctxt": 0
},
"value": "o",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 338,
"end": 370,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeLiteral",
"span": {
"start": 340,
"end": 370,
"ctxt": 0
},
"members": [
{
"type": "TsIndexSignature",
"params": [
{
"type": "Identifier",
"span": {
"start": 347,
"end": 358,
"ctxt": 0
},
"value": "idx",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 350,
"end": 358,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 352,
"end": 358,
"ctxt": 0
},
"kind": "number"
}
}
}
],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 359,
"end": 368,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 361,
"end": 368,
"ctxt": 0
},
"kind": "boolean"
}
},
"readonly": false,
"static": false,
"span": {
"start": 346,
"end": 368,
"ctxt": 0
}
}
]
}
}
},
"init": {
"type": "ObjectExpression",
"span": {
"start": 373,
"end": 396,
"ctxt": 0
},
"properties": [
{
"type": "KeyValueProperty",
"key": {
"type": "NumericLiteral",
"span": {
"start": 383,
"end": 384,
"ctxt": 0
},
"value": 1.0
},
"value": {
"type": "BooleanLiteral",
"span": {
"start": 386,
"end": 390,
"ctxt": 0
},
"value": true
}
}
]
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 399,
"end": 411,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 403,
"end": 410,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 403,
"end": 404,
"ctxt": 0
},
"value": "a",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "MemberExpression",
"span": {
"start": 407,
"end": 410,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 407,
"end": 408,
"ctxt": 0
},
"value": "G",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 409,
"end": 410,
"ctxt": 0
},
"value": "A",
"optional": false
}
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 412,
"end": 428,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 416,
"end": 427,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 416,
"end": 418,
"ctxt": 0
},
"value": "a1",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "MemberExpression",
"span": {
"start": 421,
"end": 427,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 421,
"end": 422,
"ctxt": 0
},
"value": "G",
"optional": false
},
"property": {
"type": "Computed",
"span": {
"start": 422,
"end": 427,
"ctxt": 0
},
"expression": {
"type": "StringLiteral",
"span": {
"start": 423,
"end": 426,
"ctxt": 0
},
"value": "A",
"raw": "\"A\""
}
}
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 429,
"end": 444,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 433,
"end": 443,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 433,
"end": 434,
"ctxt": 0
},
"value": "g",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "MemberExpression",
"span": {
"start": 437,
"end": 443,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 437,
"end": 438,
"ctxt": 0
},
"value": "o",
"optional": false
},
"property": {
"type": "Computed",
"span": {
"start": 438,
"end": 443,
"ctxt": 0
},
"expression": {
"type": "MemberExpression",
"span": {
"start": 439,
"end": 442,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 439,
"end": 440,
"ctxt": 0
},
"value": "G",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 441,
"end": 442,
"ctxt": 0
},
"value": "A",
"optional": false
}
}
}
},
"definite": false
}
]
},
{
"type": "ClassDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 452,
"end": 453,
"ctxt": 0
},
"value": "C",
"optional": false
},
"declare": false,
"span": {
"start": 446,
"end": 547,
"ctxt": 0
},
"decorators": [],
"body": [
{
"type": "ClassMethod",
"span": {
"start": 460,
"end": 471,
"ctxt": 0
},
"key": {
"type": "Computed",
"span": {
"start": 460,
"end": 465,
"ctxt": 0
},
"expression": {
"type": "MemberExpression",
"span": {
"start": 461,
"end": 464,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 461,
"end": 462,
"ctxt": 0
},
"value": "G",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 463,
"end": 464,
"ctxt": 0
},
"value": "A",
"optional": false
}
}
},
"function": {
"params": [],
"decorators": [],
"span": {
"start": 460,
"end": 471,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 468,
"end": 471,
"ctxt": 0
},
"stmts": []
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
},
"kind": "method",
"isStatic": false,
"accessibility": null,
"isAbstract": false,
"isOptional": false,
"isOverride": false
},
{
"type": "ClassMethod",
"span": {
"start": 476,
"end": 516,
"ctxt": 0
},
"key": {
"type": "Computed",
"span": {
"start": 480,
"end": 485,
"ctxt": 0
},
"expression": {
"type": "MemberExpression",
"span": {
"start": 481,
"end": 484,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 481,
"end": 482,
"ctxt": 0
},
"value": "G",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 483,
"end": 484,
"ctxt": 0
},
"value": "B",
"optional": false
}
}
},
"function": {
"params": [],
"decorators": [],
"span": {
"start": 476,
"end": 516,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 488,
"end": 516,
"ctxt": 0
},
"stmts": [
{
"type": "ReturnStatement",
"span": {
"start": 498,
"end": 510,
"ctxt": 0
},
"argument": {
"type": "BooleanLiteral",
"span": {
"start": 505,
"end": 509,
"ctxt": 0
},
"value": true
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
},
"kind": "getter",
"isStatic": false,
"accessibility": null,
"isAbstract": false,
"isOptional": false,
"isOverride": false
},
{
"type": "ClassMethod",
"span": {
"start": 521,
"end": 545,
"ctxt": 0
},
"key": {
"type": "Computed",
"span": {
"start": 525,
"end": 530,
"ctxt": 0
},
"expression": {
"type": "MemberExpression",
"span": {
"start": 526,
"end": 529,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 526,
"end": 527,
"ctxt": 0
},
"value": "G",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 528,
"end": 529,
"ctxt": 0
},
"value": "B",
"optional": false
}
}
},
"function": {
"params": [
{
"type": "Parameter",
"span": {
"start": 531,
"end": 540,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 531,
"end": 540,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 532,
"end": 540,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 534,
"end": 540,
"ctxt": 0
},
"kind": "number"
}
}
}
}
],
"decorators": [],
"span": {
"start": 521,
"end": 545,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 542,
"end": 545,
"ctxt": 0
},
"stmts": []
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
},
"kind": "setter",
"isStatic": false,
"accessibility": null,
"isAbstract": false,
"isOptional": false,
"isOverride": false
}
],
"superClass": null,
"isAbstract": false,
"typeParams": null,
"superTypeParams": null,
"implements": []
}
],
"interpreter": null
}