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

1248 lines
41 KiB
JSON

{
"type": "Script",
"span": {
"start": 21,
"end": 573,
"ctxt": 0
},
"body": [
{
"type": "ClassDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 27,
"end": 28,
"ctxt": 0
},
"value": "A",
"optional": false
},
"declare": false,
"span": {
"start": 21,
"end": 573,
"ctxt": 0
},
"decorators": [],
"body": [
{
"type": "PrivateMethod",
"span": {
"start": 35,
"end": 91,
"ctxt": 0
},
"key": {
"type": "PrivateName",
"span": {
"start": 39,
"end": 49,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 40,
"end": 49,
"ctxt": 0
},
"value": "fieldFunc",
"optional": false
}
},
"function": {
"params": [],
"decorators": [],
"span": {
"start": 35,
"end": 91,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 52,
"end": 91,
"ctxt": 0
},
"stmts": [
{
"type": "ReturnStatement",
"span": {
"start": 55,
"end": 89,
"ctxt": 0
},
"argument": {
"type": "FunctionExpression",
"identifier": null,
"params": [],
"decorators": [],
"span": {
"start": 62,
"end": 89,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 73,
"end": 89,
"ctxt": 0
},
"stmts": [
{
"type": "ExpressionStatement",
"span": {
"start": 75,
"end": 87,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 75,
"end": 86,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "MemberExpression",
"span": {
"start": 75,
"end": 81,
"ctxt": 0
},
"object": {
"type": "ThisExpression",
"span": {
"start": 75,
"end": 79,
"ctxt": 0
}
},
"property": {
"type": "Identifier",
"span": {
"start": 80,
"end": 81,
"ctxt": 0
},
"value": "x",
"optional": false
}
},
"right": {
"type": "NumericLiteral",
"span": {
"start": 84,
"end": 86,
"ctxt": 0
},
"value": 10.0,
"raw": "10"
}
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
},
"kind": "getter",
"isStatic": false,
"accessibility": null,
"isAbstract": false,
"isOptional": false,
"isOverride": false
},
{
"type": "PrivateMethod",
"span": {
"start": 96,
"end": 147,
"ctxt": 0
},
"key": {
"type": "PrivateName",
"span": {
"start": 100,
"end": 111,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 101,
"end": 111,
"ctxt": 0
},
"value": "fieldFunc2",
"optional": false
}
},
"function": {
"params": [],
"decorators": [],
"span": {
"start": 96,
"end": 147,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 114,
"end": 147,
"ctxt": 0
},
"stmts": [
{
"type": "ReturnStatement",
"span": {
"start": 116,
"end": 145,
"ctxt": 0
},
"argument": {
"type": "FunctionExpression",
"identifier": null,
"params": [
{
"type": "Parameter",
"span": {
"start": 133,
"end": 134,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 133,
"end": 134,
"ctxt": 0
},
"value": "a",
"optional": false,
"typeAnnotation": null
}
},
{
"type": "Parameter",
"span": {
"start": 136,
"end": 140,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "RestElement",
"span": {
"start": 136,
"end": 140,
"ctxt": 0
},
"rest": {
"start": 136,
"end": 139,
"ctxt": 0
},
"argument": {
"type": "Identifier",
"span": {
"start": 139,
"end": 140,
"ctxt": 0
},
"value": "b",
"optional": false,
"typeAnnotation": null
},
"typeAnnotation": null
}
}
],
"decorators": [],
"span": {
"start": 124,
"end": 144,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 142,
"end": 144,
"ctxt": 0
},
"stmts": []
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
},
"kind": "getter",
"isStatic": false,
"accessibility": null,
"isAbstract": false,
"isOptional": false,
"isOverride": false
},
{
"type": "ClassProperty",
"span": {
"start": 152,
"end": 158,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 152,
"end": 153,
"ctxt": 0
},
"value": "x",
"optional": false
},
"value": {
"type": "NumericLiteral",
"span": {
"start": 156,
"end": 157,
"ctxt": 0
},
"value": 1.0,
"raw": "1"
},
"typeAnnotation": null,
"isStatic": false,
"decorators": [],
"accessibility": null,
"isAbstract": false,
"isOptional": false,
"isOverride": false,
"readonly": false,
"declare": false,
"definite": false
},
{
"type": "ClassMethod",
"span": {
"start": 163,
"end": 533,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 163,
"end": 167,
"ctxt": 0
},
"value": "test",
"optional": false
},
"function": {
"params": [],
"decorators": [],
"span": {
"start": 163,
"end": 533,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 170,
"end": 533,
"ctxt": 0
},
"stmts": [
{
"type": "ExpressionStatement",
"span": {
"start": 180,
"end": 198,
"ctxt": 0
},
"expression": {
"type": "CallExpression",
"span": {
"start": 180,
"end": 197,
"ctxt": 0
},
"callee": {
"type": "MemberExpression",
"span": {
"start": 180,
"end": 195,
"ctxt": 0
},
"object": {
"type": "ThisExpression",
"span": {
"start": 180,
"end": 184,
"ctxt": 0
}
},
"property": {
"type": "PrivateName",
"span": {
"start": 185,
"end": 195,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 186,
"end": 195,
"ctxt": 0
},
"value": "fieldFunc",
"optional": false
}
}
},
"arguments": [],
"typeArguments": null
}
},
{
"type": "VariableDeclaration",
"span": {
"start": 207,
"end": 236,
"ctxt": 0
},
"kind": "const",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 213,
"end": 235,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 213,
"end": 217,
"ctxt": 0
},
"value": "func",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "MemberExpression",
"span": {
"start": 220,
"end": 235,
"ctxt": 0
},
"object": {
"type": "ThisExpression",
"span": {
"start": 220,
"end": 224,
"ctxt": 0
}
},
"property": {
"type": "PrivateName",
"span": {
"start": 225,
"end": 235,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 226,
"end": 235,
"ctxt": 0
},
"value": "fieldFunc",
"optional": false
}
}
},
"definite": false
}
]
},
{
"type": "ExpressionStatement",
"span": {
"start": 245,
"end": 252,
"ctxt": 0
},
"expression": {
"type": "CallExpression",
"span": {
"start": 245,
"end": 251,
"ctxt": 0
},
"callee": {
"type": "Identifier",
"span": {
"start": 245,
"end": 249,
"ctxt": 0
},
"value": "func",
"optional": false
},
"arguments": [],
"typeArguments": null
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 261,
"end": 283,
"ctxt": 0
},
"expression": {
"type": "NewExpression",
"span": {
"start": 261,
"end": 282,
"ctxt": 0
},
"callee": {
"type": "MemberExpression",
"span": {
"start": 265,
"end": 280,
"ctxt": 0
},
"object": {
"type": "ThisExpression",
"span": {
"start": 265,
"end": 269,
"ctxt": 0
}
},
"property": {
"type": "PrivateName",
"span": {
"start": 270,
"end": 280,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 271,
"end": 280,
"ctxt": 0
},
"value": "fieldFunc",
"optional": false
}
}
},
"arguments": [],
"typeArguments": null
}
},
{
"type": "VariableDeclaration",
"span": {
"start": 293,
"end": 314,
"ctxt": 0
},
"kind": "const",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 299,
"end": 313,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 299,
"end": 302,
"ctxt": 0
},
"value": "arr",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "ArrayExpression",
"span": {
"start": 305,
"end": 313,
"ctxt": 0
},
"elements": [
{
"spread": null,
"expression": {
"type": "NumericLiteral",
"span": {
"start": 307,
"end": 308,
"ctxt": 0
},
"value": 1.0,
"raw": "1"
}
},
{
"spread": null,
"expression": {
"type": "NumericLiteral",
"span": {
"start": 310,
"end": 311,
"ctxt": 0
},
"value": 2.0,
"raw": "2"
}
}
]
},
"definite": false
}
]
},
{
"type": "ExpressionStatement",
"span": {
"start": 323,
"end": 354,
"ctxt": 0
},
"expression": {
"type": "CallExpression",
"span": {
"start": 323,
"end": 353,
"ctxt": 0
},
"callee": {
"type": "MemberExpression",
"span": {
"start": 323,
"end": 339,
"ctxt": 0
},
"object": {
"type": "ThisExpression",
"span": {
"start": 323,
"end": 327,
"ctxt": 0
}
},
"property": {
"type": "PrivateName",
"span": {
"start": 328,
"end": 339,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 329,
"end": 339,
"ctxt": 0
},
"value": "fieldFunc2",
"optional": false
}
}
},
"arguments": [
{
"spread": null,
"expression": {
"type": "NumericLiteral",
"span": {
"start": 340,
"end": 341,
"ctxt": 0
},
"value": 0.0,
"raw": "0"
}
},
{
"spread": {
"start": 343,
"end": 346,
"ctxt": 0
},
"expression": {
"type": "Identifier",
"span": {
"start": 346,
"end": 349,
"ctxt": 0
},
"value": "arr",
"optional": false
}
},
{
"spread": null,
"expression": {
"type": "NumericLiteral",
"span": {
"start": 351,
"end": 352,
"ctxt": 0
},
"value": 3.0,
"raw": "3"
}
}
],
"typeArguments": null
}
},
{
"type": "VariableDeclaration",
"span": {
"start": 363,
"end": 408,
"ctxt": 0
},
"kind": "const",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 369,
"end": 407,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 369,
"end": 370,
"ctxt": 0
},
"value": "b",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "NewExpression",
"span": {
"start": 373,
"end": 407,
"ctxt": 0
},
"callee": {
"type": "MemberExpression",
"span": {
"start": 377,
"end": 393,
"ctxt": 0
},
"object": {
"type": "ThisExpression",
"span": {
"start": 377,
"end": 381,
"ctxt": 0
}
},
"property": {
"type": "PrivateName",
"span": {
"start": 382,
"end": 393,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 383,
"end": 393,
"ctxt": 0
},
"value": "fieldFunc2",
"optional": false
}
}
},
"arguments": [
{
"spread": null,
"expression": {
"type": "NumericLiteral",
"span": {
"start": 394,
"end": 395,
"ctxt": 0
},
"value": 0.0,
"raw": "0"
}
},
{
"spread": {
"start": 397,
"end": 400,
"ctxt": 0
},
"expression": {
"type": "Identifier",
"span": {
"start": 400,
"end": 403,
"ctxt": 0
},
"value": "arr",
"optional": false
}
},
{
"spread": null,
"expression": {
"type": "NumericLiteral",
"span": {
"start": 405,
"end": 406,
"ctxt": 0
},
"value": 3.0,
"raw": "3"
}
}
],
"typeArguments": null
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 417,
"end": 470,
"ctxt": 0
},
"kind": "const",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 423,
"end": 469,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 423,
"end": 426,
"ctxt": 0
},
"value": "str",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "TaggedTemplateExpression",
"span": {
"start": 429,
"end": 469,
"ctxt": 0
},
"tag": {
"type": "MemberExpression",
"span": {
"start": 429,
"end": 445,
"ctxt": 0
},
"object": {
"type": "ThisExpression",
"span": {
"start": 429,
"end": 433,
"ctxt": 0
}
},
"property": {
"type": "PrivateName",
"span": {
"start": 434,
"end": 445,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 435,
"end": 445,
"ctxt": 0
},
"value": "fieldFunc2",
"optional": false
}
}
},
"typeParameters": null,
"template": {
"type": "TemplateLiteral",
"span": {
"start": 445,
"end": 469,
"ctxt": 0
},
"expressions": [
{
"type": "NumericLiteral",
"span": {
"start": 452,
"end": 453,
"ctxt": 0
},
"value": 1.0,
"raw": "1"
},
{
"type": "NumericLiteral",
"span": {
"start": 462,
"end": 463,
"ctxt": 0
},
"value": 2.0,
"raw": "2"
}
],
"quasis": [
{
"type": "TemplateElement",
"span": {
"start": 446,
"end": 450,
"ctxt": 0
},
"tail": false,
"cooked": "head",
"raw": "head"
},
{
"type": "TemplateElement",
"span": {
"start": 454,
"end": 460,
"ctxt": 0
},
"tail": false,
"cooked": "middle",
"raw": "middle"
},
{
"type": "TemplateElement",
"span": {
"start": 464,
"end": 468,
"ctxt": 0
},
"tail": true,
"cooked": "tail",
"raw": "tail"
}
]
}
},
"definite": false
}
]
},
{
"type": "ExpressionStatement",
"span": {
"start": 479,
"end": 527,
"ctxt": 0
},
"expression": {
"type": "TaggedTemplateExpression",
"span": {
"start": 479,
"end": 526,
"ctxt": 0
},
"tag": {
"type": "MemberExpression",
"span": {
"start": 479,
"end": 509,
"ctxt": 0
},
"object": {
"type": "CallExpression",
"span": {
"start": 479,
"end": 497,
"ctxt": 0
},
"callee": {
"type": "MemberExpression",
"span": {
"start": 479,
"end": 495,
"ctxt": 0
},
"object": {
"type": "ThisExpression",
"span": {
"start": 479,
"end": 483,
"ctxt": 0
}
},
"property": {
"type": "Identifier",
"span": {
"start": 484,
"end": 495,
"ctxt": 0
},
"value": "getInstance",
"optional": false
}
},
"arguments": [],
"typeArguments": null
},
"property": {
"type": "PrivateName",
"span": {
"start": 498,
"end": 509,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 499,
"end": 509,
"ctxt": 0
},
"value": "fieldFunc2",
"optional": false
}
}
},
"typeParameters": null,
"template": {
"type": "TemplateLiteral",
"span": {
"start": 509,
"end": 526,
"ctxt": 0
},
"expressions": [
{
"type": "NumericLiteral",
"span": {
"start": 516,
"end": 517,
"ctxt": 0
},
"value": 1.0,
"raw": "1"
},
{
"type": "NumericLiteral",
"span": {
"start": 523,
"end": 524,
"ctxt": 0
},
"value": 2.0,
"raw": "2"
}
],
"quasis": [
{
"type": "TemplateElement",
"span": {
"start": 510,
"end": 514,
"ctxt": 0
},
"tail": false,
"cooked": "test",
"raw": "test"
},
{
"type": "TemplateElement",
"span": {
"start": 518,
"end": 521,
"ctxt": 0
},
"tail": false,
"cooked": "and",
"raw": "and"
},
{
"type": "TemplateElement",
"span": {
"start": 525,
"end": 525,
"ctxt": 0
},
"tail": true,
"cooked": "",
"raw": ""
}
]
}
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
},
"kind": "method",
"isStatic": false,
"accessibility": null,
"isAbstract": false,
"isOptional": false,
"isOverride": false
},
{
"type": "ClassMethod",
"span": {
"start": 538,
"end": 571,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 538,
"end": 549,
"ctxt": 0
},
"value": "getInstance",
"optional": false
},
"function": {
"params": [],
"decorators": [],
"span": {
"start": 538,
"end": 571,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 552,
"end": 571,
"ctxt": 0
},
"stmts": [
{
"type": "ReturnStatement",
"span": {
"start": 554,
"end": 569,
"ctxt": 0
},
"argument": {
"type": "NewExpression",
"span": {
"start": 561,
"end": 568,
"ctxt": 0
},
"callee": {
"type": "Identifier",
"span": {
"start": 565,
"end": 566,
"ctxt": 0
},
"value": "A",
"optional": false
},
"arguments": [],
"typeArguments": null
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
},
"kind": "method",
"isStatic": false,
"accessibility": null,
"isAbstract": false,
"isOptional": false,
"isOverride": false
}
],
"superClass": null,
"isAbstract": false,
"typeParams": null,
"superTypeParams": null,
"implements": []
}
],
"interpreter": null
}