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

1628 lines
54 KiB
JSON

{
"type": "Script",
"span": {
"start": 20,
"end": 708,
"ctxt": 0
},
"body": [
{
"type": "ClassDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 26,
"end": 28,
"ctxt": 0
},
"value": "AA",
"optional": false
},
"declare": false,
"span": {
"start": 20,
"end": 708,
"ctxt": 0
},
"decorators": [],
"body": [
{
"type": "PrivateMethod",
"span": {
"start": 35,
"end": 61,
"ctxt": 0
},
"key": {
"type": "PrivateName",
"span": {
"start": 35,
"end": 42,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 36,
"end": 42,
"ctxt": 0
},
"value": "method",
"optional": false
}
},
"function": {
"params": [],
"decorators": [],
"span": {
"start": 35,
"end": 61,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 45,
"end": 61,
"ctxt": 0
},
"stmts": [
{
"type": "ExpressionStatement",
"span": {
"start": 47,
"end": 59,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 47,
"end": 58,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "MemberExpression",
"span": {
"start": 47,
"end": 53,
"ctxt": 0
},
"object": {
"type": "ThisExpression",
"span": {
"start": 47,
"end": 51,
"ctxt": 0
}
},
"property": {
"type": "Identifier",
"span": {
"start": 52,
"end": 53,
"ctxt": 0
},
"value": "x",
"optional": false
}
},
"right": {
"type": "NumericLiteral",
"span": {
"start": 56,
"end": 58,
"ctxt": 0
},
"value": 10.0
}
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
},
"kind": "method",
"isStatic": false,
"accessibility": null,
"isAbstract": false,
"isOptional": false,
"isOverride": false
},
{
"type": "EmptyStatement",
"span": {
"start": 61,
"end": 62,
"ctxt": 0
}
},
{
"type": "PrivateMethod",
"span": {
"start": 67,
"end": 87,
"ctxt": 0
},
"key": {
"type": "PrivateName",
"span": {
"start": 67,
"end": 75,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 68,
"end": 75,
"ctxt": 0
},
"value": "method2",
"optional": false
}
},
"function": {
"params": [
{
"type": "Parameter",
"span": {
"start": 76,
"end": 77,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 76,
"end": 77,
"ctxt": 0
},
"value": "a",
"optional": false,
"typeAnnotation": null
}
},
{
"type": "Parameter",
"span": {
"start": 79,
"end": 83,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "RestElement",
"span": {
"start": 79,
"end": 83,
"ctxt": 0
},
"rest": {
"start": 79,
"end": 82,
"ctxt": 0
},
"argument": {
"type": "Identifier",
"span": {
"start": 82,
"end": 83,
"ctxt": 0
},
"value": "b",
"optional": false,
"typeAnnotation": null
},
"typeAnnotation": null
}
}
],
"decorators": [],
"span": {
"start": 67,
"end": 87,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 85,
"end": 87,
"ctxt": 0
},
"stmts": []
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
},
"kind": "method",
"isStatic": false,
"accessibility": null,
"isAbstract": false,
"isOptional": false,
"isOverride": false
},
{
"type": "EmptyStatement",
"span": {
"start": 87,
"end": 88,
"ctxt": 0
}
},
{
"type": "ClassProperty",
"span": {
"start": 93,
"end": 99,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 93,
"end": 94,
"ctxt": 0
},
"value": "x",
"optional": false
},
"value": {
"type": "NumericLiteral",
"span": {
"start": 97,
"end": 98,
"ctxt": 0
},
"value": 1.0
},
"typeAnnotation": null,
"isStatic": false,
"decorators": [],
"accessibility": null,
"isAbstract": false,
"isOptional": false,
"isOverride": false,
"readonly": false,
"declare": false,
"definite": false
},
{
"type": "ClassMethod",
"span": {
"start": 104,
"end": 667,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 104,
"end": 108,
"ctxt": 0
},
"value": "test",
"optional": false
},
"function": {
"params": [],
"decorators": [],
"span": {
"start": 104,
"end": 667,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 111,
"end": 667,
"ctxt": 0
},
"stmts": [
{
"type": "ExpressionStatement",
"span": {
"start": 121,
"end": 136,
"ctxt": 0
},
"expression": {
"type": "CallExpression",
"span": {
"start": 121,
"end": 135,
"ctxt": 0
},
"callee": {
"type": "MemberExpression",
"span": {
"start": 121,
"end": 133,
"ctxt": 0
},
"object": {
"type": "ThisExpression",
"span": {
"start": 121,
"end": 125,
"ctxt": 0
}
},
"property": {
"type": "PrivateName",
"span": {
"start": 126,
"end": 133,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 127,
"end": 133,
"ctxt": 0
},
"value": "method",
"optional": false
}
}
},
"arguments": [],
"typeArguments": null
}
},
{
"type": "VariableDeclaration",
"span": {
"start": 145,
"end": 171,
"ctxt": 0
},
"kind": "const",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 151,
"end": 170,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 151,
"end": 155,
"ctxt": 0
},
"value": "func",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "MemberExpression",
"span": {
"start": 158,
"end": 170,
"ctxt": 0
},
"object": {
"type": "ThisExpression",
"span": {
"start": 158,
"end": 162,
"ctxt": 0
}
},
"property": {
"type": "PrivateName",
"span": {
"start": 163,
"end": 170,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 164,
"end": 170,
"ctxt": 0
},
"value": "method",
"optional": false
}
}
},
"definite": false
}
]
},
{
"type": "ExpressionStatement",
"span": {
"start": 180,
"end": 187,
"ctxt": 0
},
"expression": {
"type": "CallExpression",
"span": {
"start": 180,
"end": 186,
"ctxt": 0
},
"callee": {
"type": "Identifier",
"span": {
"start": 180,
"end": 184,
"ctxt": 0
},
"value": "func",
"optional": false
},
"arguments": [],
"typeArguments": null
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 196,
"end": 215,
"ctxt": 0
},
"expression": {
"type": "NewExpression",
"span": {
"start": 196,
"end": 214,
"ctxt": 0
},
"callee": {
"type": "MemberExpression",
"span": {
"start": 200,
"end": 212,
"ctxt": 0
},
"object": {
"type": "ThisExpression",
"span": {
"start": 200,
"end": 204,
"ctxt": 0
}
},
"property": {
"type": "PrivateName",
"span": {
"start": 205,
"end": 212,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 206,
"end": 212,
"ctxt": 0
},
"value": "method",
"optional": false
}
}
},
"arguments": [],
"typeArguments": null
}
},
{
"type": "VariableDeclaration",
"span": {
"start": 225,
"end": 246,
"ctxt": 0
},
"kind": "const",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 231,
"end": 245,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 231,
"end": 234,
"ctxt": 0
},
"value": "arr",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "ArrayExpression",
"span": {
"start": 237,
"end": 245,
"ctxt": 0
},
"elements": [
{
"spread": null,
"expression": {
"type": "NumericLiteral",
"span": {
"start": 239,
"end": 240,
"ctxt": 0
},
"value": 1.0
}
},
{
"spread": null,
"expression": {
"type": "NumericLiteral",
"span": {
"start": 242,
"end": 243,
"ctxt": 0
},
"value": 2.0
}
}
]
},
"definite": false
}
]
},
{
"type": "ExpressionStatement",
"span": {
"start": 255,
"end": 283,
"ctxt": 0
},
"expression": {
"type": "CallExpression",
"span": {
"start": 255,
"end": 282,
"ctxt": 0
},
"callee": {
"type": "MemberExpression",
"span": {
"start": 255,
"end": 268,
"ctxt": 0
},
"object": {
"type": "ThisExpression",
"span": {
"start": 255,
"end": 259,
"ctxt": 0
}
},
"property": {
"type": "PrivateName",
"span": {
"start": 260,
"end": 268,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 261,
"end": 268,
"ctxt": 0
},
"value": "method2",
"optional": false
}
}
},
"arguments": [
{
"spread": null,
"expression": {
"type": "NumericLiteral",
"span": {
"start": 269,
"end": 270,
"ctxt": 0
},
"value": 0.0
}
},
{
"spread": {
"start": 272,
"end": 275,
"ctxt": 0
},
"expression": {
"type": "Identifier",
"span": {
"start": 275,
"end": 278,
"ctxt": 0
},
"value": "arr",
"optional": false
}
},
{
"spread": null,
"expression": {
"type": "NumericLiteral",
"span": {
"start": 280,
"end": 281,
"ctxt": 0
},
"value": 3.0
}
}
],
"typeArguments": null
}
},
{
"type": "VariableDeclaration",
"span": {
"start": 293,
"end": 335,
"ctxt": 0
},
"kind": "const",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 299,
"end": 334,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 299,
"end": 300,
"ctxt": 0
},
"value": "b",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "NewExpression",
"span": {
"start": 303,
"end": 334,
"ctxt": 0
},
"callee": {
"type": "MemberExpression",
"span": {
"start": 307,
"end": 320,
"ctxt": 0
},
"object": {
"type": "ThisExpression",
"span": {
"start": 307,
"end": 311,
"ctxt": 0
}
},
"property": {
"type": "PrivateName",
"span": {
"start": 312,
"end": 320,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 313,
"end": 320,
"ctxt": 0
},
"value": "method2",
"optional": false
}
}
},
"arguments": [
{
"spread": null,
"expression": {
"type": "NumericLiteral",
"span": {
"start": 321,
"end": 322,
"ctxt": 0
},
"value": 0.0
}
},
{
"spread": {
"start": 324,
"end": 327,
"ctxt": 0
},
"expression": {
"type": "Identifier",
"span": {
"start": 327,
"end": 330,
"ctxt": 0
},
"value": "arr",
"optional": false
}
},
{
"spread": null,
"expression": {
"type": "NumericLiteral",
"span": {
"start": 332,
"end": 333,
"ctxt": 0
},
"value": 3.0
}
}
],
"typeArguments": null
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 353,
"end": 403,
"ctxt": 0
},
"kind": "const",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 359,
"end": 402,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 359,
"end": 362,
"ctxt": 0
},
"value": "str",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "TaggedTemplateExpression",
"span": {
"start": 365,
"end": 402,
"ctxt": 0
},
"tag": {
"type": "MemberExpression",
"span": {
"start": 365,
"end": 378,
"ctxt": 0
},
"object": {
"type": "ThisExpression",
"span": {
"start": 365,
"end": 369,
"ctxt": 0
}
},
"property": {
"type": "PrivateName",
"span": {
"start": 370,
"end": 378,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 371,
"end": 378,
"ctxt": 0
},
"value": "method2",
"optional": false
}
}
},
"typeParameters": null,
"template": {
"type": "TemplateLiteral",
"span": {
"start": 378,
"end": 402,
"ctxt": 0
},
"expressions": [
{
"type": "NumericLiteral",
"span": {
"start": 385,
"end": 386,
"ctxt": 0
},
"value": 1.0
},
{
"type": "NumericLiteral",
"span": {
"start": 395,
"end": 396,
"ctxt": 0
},
"value": 2.0
}
],
"quasis": [
{
"type": "TemplateElement",
"span": {
"start": 379,
"end": 383,
"ctxt": 0
},
"tail": false,
"cooked": "head",
"raw": "head"
},
{
"type": "TemplateElement",
"span": {
"start": 387,
"end": 393,
"ctxt": 0
},
"tail": false,
"cooked": "middle",
"raw": "middle"
},
{
"type": "TemplateElement",
"span": {
"start": 397,
"end": 401,
"ctxt": 0
},
"tail": true,
"cooked": "tail",
"raw": "tail"
}
]
}
},
"definite": false
}
]
},
{
"type": "ExpressionStatement",
"span": {
"start": 412,
"end": 457,
"ctxt": 0
},
"expression": {
"type": "TaggedTemplateExpression",
"span": {
"start": 412,
"end": 456,
"ctxt": 0
},
"tag": {
"type": "MemberExpression",
"span": {
"start": 412,
"end": 439,
"ctxt": 0
},
"object": {
"type": "CallExpression",
"span": {
"start": 412,
"end": 430,
"ctxt": 0
},
"callee": {
"type": "MemberExpression",
"span": {
"start": 412,
"end": 428,
"ctxt": 0
},
"object": {
"type": "ThisExpression",
"span": {
"start": 412,
"end": 416,
"ctxt": 0
}
},
"property": {
"type": "Identifier",
"span": {
"start": 417,
"end": 428,
"ctxt": 0
},
"value": "getInstance",
"optional": false
}
},
"arguments": [],
"typeArguments": null
},
"property": {
"type": "PrivateName",
"span": {
"start": 431,
"end": 439,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 432,
"end": 439,
"ctxt": 0
},
"value": "method2",
"optional": false
}
}
},
"typeParameters": null,
"template": {
"type": "TemplateLiteral",
"span": {
"start": 439,
"end": 456,
"ctxt": 0
},
"expressions": [
{
"type": "NumericLiteral",
"span": {
"start": 446,
"end": 447,
"ctxt": 0
},
"value": 1.0
},
{
"type": "NumericLiteral",
"span": {
"start": 453,
"end": 454,
"ctxt": 0
},
"value": 2.0
}
],
"quasis": [
{
"type": "TemplateElement",
"span": {
"start": 440,
"end": 444,
"ctxt": 0
},
"tail": false,
"cooked": "test",
"raw": "test"
},
{
"type": "TemplateElement",
"span": {
"start": 448,
"end": 451,
"ctxt": 0
},
"tail": false,
"cooked": "and",
"raw": "and"
},
{
"type": "TemplateElement",
"span": {
"start": 455,
"end": 455,
"ctxt": 0
},
"tail": true,
"cooked": "",
"raw": ""
}
]
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 467,
"end": 509,
"ctxt": 0
},
"expression": {
"type": "CallExpression",
"span": {
"start": 467,
"end": 508,
"ctxt": 0
},
"callee": {
"type": "MemberExpression",
"span": {
"start": 467,
"end": 494,
"ctxt": 0
},
"object": {
"type": "CallExpression",
"span": {
"start": 467,
"end": 485,
"ctxt": 0
},
"callee": {
"type": "MemberExpression",
"span": {
"start": 467,
"end": 483,
"ctxt": 0
},
"object": {
"type": "ThisExpression",
"span": {
"start": 467,
"end": 471,
"ctxt": 0
}
},
"property": {
"type": "Identifier",
"span": {
"start": 472,
"end": 483,
"ctxt": 0
},
"value": "getInstance",
"optional": false
}
},
"arguments": [],
"typeArguments": null
},
"property": {
"type": "PrivateName",
"span": {
"start": 486,
"end": 494,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 487,
"end": 494,
"ctxt": 0
},
"value": "method2",
"optional": false
}
}
},
"arguments": [
{
"spread": null,
"expression": {
"type": "NumericLiteral",
"span": {
"start": 495,
"end": 496,
"ctxt": 0
},
"value": 0.0
}
},
{
"spread": {
"start": 498,
"end": 501,
"ctxt": 0
},
"expression": {
"type": "Identifier",
"span": {
"start": 501,
"end": 504,
"ctxt": 0
},
"value": "arr",
"optional": false
}
},
{
"spread": null,
"expression": {
"type": "NumericLiteral",
"span": {
"start": 506,
"end": 507,
"ctxt": 0
},
"value": 3.0
}
}
],
"typeArguments": null
}
},
{
"type": "VariableDeclaration",
"span": {
"start": 519,
"end": 578,
"ctxt": 0
},
"kind": "const",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 525,
"end": 577,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 525,
"end": 527,
"ctxt": 0
},
"value": "b2",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "NewExpression",
"span": {
"start": 530,
"end": 577,
"ctxt": 0
},
"callee": {
"type": "ParenthesisExpression",
"span": {
"start": 534,
"end": 563,
"ctxt": 0
},
"expression": {
"type": "MemberExpression",
"span": {
"start": 535,
"end": 562,
"ctxt": 0
},
"object": {
"type": "CallExpression",
"span": {
"start": 535,
"end": 553,
"ctxt": 0
},
"callee": {
"type": "MemberExpression",
"span": {
"start": 535,
"end": 551,
"ctxt": 0
},
"object": {
"type": "ThisExpression",
"span": {
"start": 535,
"end": 539,
"ctxt": 0
}
},
"property": {
"type": "Identifier",
"span": {
"start": 540,
"end": 551,
"ctxt": 0
},
"value": "getInstance",
"optional": false
}
},
"arguments": [],
"typeArguments": null
},
"property": {
"type": "PrivateName",
"span": {
"start": 554,
"end": 562,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 555,
"end": 562,
"ctxt": 0
},
"value": "method2",
"optional": false
}
}
}
},
"arguments": [
{
"spread": null,
"expression": {
"type": "NumericLiteral",
"span": {
"start": 564,
"end": 565,
"ctxt": 0
},
"value": 0.0
}
},
{
"spread": {
"start": 567,
"end": 570,
"ctxt": 0
},
"expression": {
"type": "Identifier",
"span": {
"start": 570,
"end": 573,
"ctxt": 0
},
"value": "arr",
"optional": false
}
},
{
"spread": null,
"expression": {
"type": "NumericLiteral",
"span": {
"start": 575,
"end": 576,
"ctxt": 0
},
"value": 3.0
}
}
],
"typeArguments": null
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 596,
"end": 661,
"ctxt": 0
},
"kind": "const",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 602,
"end": 660,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 602,
"end": 606,
"ctxt": 0
},
"value": "str2",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "TaggedTemplateExpression",
"span": {
"start": 609,
"end": 660,
"ctxt": 0
},
"tag": {
"type": "MemberExpression",
"span": {
"start": 609,
"end": 636,
"ctxt": 0
},
"object": {
"type": "CallExpression",
"span": {
"start": 609,
"end": 627,
"ctxt": 0
},
"callee": {
"type": "MemberExpression",
"span": {
"start": 609,
"end": 625,
"ctxt": 0
},
"object": {
"type": "ThisExpression",
"span": {
"start": 609,
"end": 613,
"ctxt": 0
}
},
"property": {
"type": "Identifier",
"span": {
"start": 614,
"end": 625,
"ctxt": 0
},
"value": "getInstance",
"optional": false
}
},
"arguments": [],
"typeArguments": null
},
"property": {
"type": "PrivateName",
"span": {
"start": 628,
"end": 636,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 629,
"end": 636,
"ctxt": 0
},
"value": "method2",
"optional": false
}
}
},
"typeParameters": null,
"template": {
"type": "TemplateLiteral",
"span": {
"start": 636,
"end": 660,
"ctxt": 0
},
"expressions": [
{
"type": "NumericLiteral",
"span": {
"start": 643,
"end": 644,
"ctxt": 0
},
"value": 1.0
},
{
"type": "NumericLiteral",
"span": {
"start": 653,
"end": 654,
"ctxt": 0
},
"value": 2.0
}
],
"quasis": [
{
"type": "TemplateElement",
"span": {
"start": 637,
"end": 641,
"ctxt": 0
},
"tail": false,
"cooked": "head",
"raw": "head"
},
{
"type": "TemplateElement",
"span": {
"start": 645,
"end": 651,
"ctxt": 0
},
"tail": false,
"cooked": "middle",
"raw": "middle"
},
{
"type": "TemplateElement",
"span": {
"start": 655,
"end": 659,
"ctxt": 0
},
"tail": true,
"cooked": "tail",
"raw": "tail"
}
]
}
},
"definite": false
}
]
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
},
"kind": "method",
"isStatic": false,
"accessibility": null,
"isAbstract": false,
"isOptional": false,
"isOverride": false
},
{
"type": "ClassMethod",
"span": {
"start": 672,
"end": 706,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 672,
"end": 683,
"ctxt": 0
},
"value": "getInstance",
"optional": false
},
"function": {
"params": [],
"decorators": [],
"span": {
"start": 672,
"end": 706,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 686,
"end": 706,
"ctxt": 0
},
"stmts": [
{
"type": "ReturnStatement",
"span": {
"start": 688,
"end": 704,
"ctxt": 0
},
"argument": {
"type": "NewExpression",
"span": {
"start": 695,
"end": 703,
"ctxt": 0
},
"callee": {
"type": "Identifier",
"span": {
"start": 699,
"end": 701,
"ctxt": 0
},
"value": "AA",
"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
}