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

833 lines
20 KiB
JSON
Raw Normal View History

{
"type": "Script",
"span": {
"start": 265,
"end": 548,
"ctxt": 0
},
"body": [
{
"type": "TsEnumDeclaration",
"span": {
"start": 265,
"end": 332,
"ctxt": 0
},
"declare": false,
"isConst": true,
"id": {
"type": "Identifier",
"span": {
"start": 276,
"end": 277,
"ctxt": 0
},
"value": "G",
"optional": false
},
"members": [
{
"type": "TsEnumMember",
"span": {
"start": 284,
"end": 289,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 284,
"end": 285,
"ctxt": 0
},
"value": "A",
"optional": false
},
"init": {
"type": "NumericLiteral",
"span": {
"start": 288,
"end": 289,
"ctxt": 0
},
"value": 1.0,
"raw": "1"
}
},
{
"type": "TsEnumMember",
"span": {
"start": 295,
"end": 300,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 295,
"end": 296,
"ctxt": 0
},
"value": "B",
"optional": false
},
"init": {
"type": "NumericLiteral",
"span": {
"start": 299,
"end": 300,
"ctxt": 0
},
"value": 2.0,
"raw": "2"
}
},
{
"type": "TsEnumMember",
"span": {
"start": 306,
"end": 315,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 306,
"end": 307,
"ctxt": 0
},
"value": "C",
"optional": false
},
"init": {
"type": "BinaryExpression",
"span": {
"start": 310,
"end": 315,
"ctxt": 0
},
"operator": "+",
"left": {
"type": "Identifier",
"span": {
"start": 310,
"end": 311,
"ctxt": 0
},
"value": "A",
"optional": false
},
"right": {
"type": "Identifier",
"span": {
"start": 314,
"end": 315,
"ctxt": 0
},
"value": "B",
"optional": false
}
}
},
{
"type": "TsEnumMember",
"span": {
"start": 321,
"end": 330,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 321,
"end": 322,
"ctxt": 0
},
"value": "D",
"optional": false
},
"init": {
"type": "BinaryExpression",
"span": {
"start": 325,
"end": 330,
"ctxt": 0
},
"operator": "*",
"left": {
"type": "Identifier",
"span": {
"start": 325,
"end": 326,
"ctxt": 0
},
"value": "A",
"optional": false
},
"right": {
"type": "NumericLiteral",
"span": {
"start": 329,
"end": 330,
"ctxt": 0
},
"value": 2.0,
"raw": "2"
}
}
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 334,
"end": 398,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 338,
"end": 397,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 338,
"end": 339,
"ctxt": 0
},
"value": "o",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 339,
"end": 371,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeLiteral",
"span": {
"start": 341,
"end": 371,
"ctxt": 0
},
"members": [
{
"type": "TsIndexSignature",
"params": [
{
"type": "Identifier",
"span": {
"start": 348,
"end": 359,
"ctxt": 0
},
"value": "idx",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 351,
"end": 359,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 353,
"end": 359,
"ctxt": 0
},
"kind": "number"
}
}
}
],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 360,
"end": 369,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 362,
"end": 369,
"ctxt": 0
},
"kind": "boolean"
}
},
"readonly": false,
"static": false,
"span": {
"start": 347,
"end": 369,
"ctxt": 0
}
}
]
}
}
},
"init": {
"type": "ObjectExpression",
"span": {
"start": 374,
"end": 397,
"ctxt": 0
},
"properties": [
{
"type": "KeyValueProperty",
"key": {
"type": "NumericLiteral",
"span": {
"start": 384,
"end": 385,
"ctxt": 0
},
"value": 1.0,
"raw": "1"
},
"value": {
"type": "BooleanLiteral",
"span": {
"start": 387,
"end": 391,
"ctxt": 0
},
"value": true
}
}
]
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 400,
"end": 412,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 404,
"end": 411,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 404,
"end": 405,
"ctxt": 0
},
"value": "a",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "MemberExpression",
"span": {
"start": 408,
"end": 411,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 408,
"end": 409,
"ctxt": 0
},
"value": "G",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 410,
"end": 411,
"ctxt": 0
},
"value": "A",
"optional": false
}
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 413,
"end": 429,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 417,
"end": 428,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 417,
"end": 419,
"ctxt": 0
},
"value": "a1",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "MemberExpression",
"span": {
"start": 422,
"end": 428,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 422,
"end": 423,
"ctxt": 0
},
"value": "G",
"optional": false
},
"property": {
"type": "Computed",
"span": {
"start": 423,
"end": 428,
"ctxt": 0
},
"expression": {
"type": "StringLiteral",
"span": {
"start": 424,
"end": 427,
"ctxt": 0
},
"value": "A",
"raw": "\"A\""
}
}
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 430,
"end": 445,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 434,
"end": 444,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 434,
"end": 435,
"ctxt": 0
},
"value": "g",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "MemberExpression",
"span": {
"start": 438,
"end": 444,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 438,
"end": 439,
"ctxt": 0
},
"value": "o",
"optional": false
},
"property": {
"type": "Computed",
"span": {
"start": 439,
"end": 444,
"ctxt": 0
},
"expression": {
"type": "MemberExpression",
"span": {
"start": 440,
"end": 443,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 440,
"end": 441,
"ctxt": 0
},
"value": "G",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 442,
"end": 443,
"ctxt": 0
},
"value": "A",
"optional": false
}
}
}
},
"definite": false
}
]
},
{
"type": "ClassDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 453,
"end": 454,
"ctxt": 0
},
"value": "C",
"optional": false
},
"declare": false,
"span": {
"start": 447,
"end": 548,
"ctxt": 0
},
"decorators": [],
"body": [
{
"type": "ClassMethod",
"span": {
"start": 461,
"end": 472,
"ctxt": 0
},
"key": {
"type": "Computed",
"span": {
"start": 461,
"end": 466,
"ctxt": 0
},
"expression": {
"type": "MemberExpression",
"span": {
"start": 462,
"end": 465,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 462,
"end": 463,
"ctxt": 0
},
"value": "G",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 464,
"end": 465,
"ctxt": 0
},
"value": "A",
"optional": false
}
}
},
"function": {
"params": [],
"decorators": [],
"span": {
"start": 461,
"end": 472,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 469,
"end": 472,
"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": 477,
"end": 517,
"ctxt": 0
},
"key": {
"type": "Computed",
"span": {
"start": 481,
"end": 486,
"ctxt": 0
},
"expression": {
"type": "MemberExpression",
"span": {
"start": 482,
"end": 485,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 482,
"end": 483,
"ctxt": 0
},
"value": "G",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 484,
"end": 485,
"ctxt": 0
},
"value": "B",
"optional": false
}
}
},
"function": {
"params": [],
"decorators": [],
"span": {
"start": 477,
"end": 517,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 489,
"end": 517,
"ctxt": 0
},
"stmts": [
{
"type": "ReturnStatement",
"span": {
"start": 499,
"end": 511,
"ctxt": 0
},
"argument": {
"type": "BooleanLiteral",
"span": {
"start": 506,
"end": 510,
"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": 522,
"end": 546,
"ctxt": 0
},
"key": {
"type": "Computed",
"span": {
"start": 526,
"end": 531,
"ctxt": 0
},
"expression": {
"type": "MemberExpression",
"span": {
"start": 527,
"end": 530,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 527,
"end": 528,
"ctxt": 0
},
"value": "G",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 529,
"end": 530,
"ctxt": 0
},
"value": "B",
"optional": false
}
}
},
"function": {
"params": [
{
"type": "Parameter",
"span": {
"start": 532,
"end": 541,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 532,
"end": 541,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 533,
"end": 541,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 535,
"end": 541,
"ctxt": 0
},
"kind": "number"
}
}
}
}
],
"decorators": [],
"span": {
"start": 522,
"end": 546,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 543,
"end": 546,
"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
}