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

1255 lines
40 KiB
JSON

{
"type": "Script",
"span": {
"start": 21,
"end": 571,
"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": 571,
"ctxt": 0
},
"decorators": [],
"body": [
{
"type": "PrivateProperty",
"span": {
"start": 35,
"end": 76,
"ctxt": 0
},
"key": {
"type": "PrivateName",
"span": {
"start": 35,
"end": 45,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 36,
"end": 45,
"ctxt": 0
},
"value": "fieldFunc",
"optional": false
}
},
"value": {
"type": "FunctionExpression",
"identifier": null,
"params": [],
"decorators": [],
"span": {
"start": 48,
"end": 75,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 59,
"end": 75,
"ctxt": 0
},
"stmts": [
{
"type": "ExpressionStatement",
"span": {
"start": 61,
"end": 73,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 61,
"end": 72,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "MemberExpression",
"span": {
"start": 61,
"end": 67,
"ctxt": 0
},
"object": {
"type": "ThisExpression",
"span": {
"start": 61,
"end": 65,
"ctxt": 0
}
},
"property": {
"type": "Identifier",
"span": {
"start": 66,
"end": 67,
"ctxt": 0
},
"value": "x",
"optional": false
}
},
"right": {
"type": "NumericLiteral",
"span": {
"start": 70,
"end": 72,
"ctxt": 0
},
"value": 10.0,
"raw": "10"
}
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
},
"typeAnnotation": null,
"isStatic": false,
"decorators": [],
"accessibility": null,
"isOptional": false,
"isOverride": false,
"readonly": false,
"definite": false
},
{
"type": "PrivateProperty",
"span": {
"start": 81,
"end": 116,
"ctxt": 0
},
"key": {
"type": "PrivateName",
"span": {
"start": 81,
"end": 92,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 82,
"end": 92,
"ctxt": 0
},
"value": "fieldFunc2",
"optional": false
}
},
"value": {
"type": "FunctionExpression",
"identifier": null,
"params": [
{
"type": "Parameter",
"span": {
"start": 104,
"end": 105,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 104,
"end": 105,
"ctxt": 0
},
"value": "a",
"optional": false,
"typeAnnotation": null
}
},
{
"type": "Parameter",
"span": {
"start": 107,
"end": 111,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "RestElement",
"span": {
"start": 107,
"end": 111,
"ctxt": 0
},
"rest": {
"start": 107,
"end": 110,
"ctxt": 0
},
"argument": {
"type": "Identifier",
"span": {
"start": 110,
"end": 111,
"ctxt": 0
},
"value": "b",
"optional": false,
"typeAnnotation": null
},
"typeAnnotation": null
}
}
],
"decorators": [],
"span": {
"start": 95,
"end": 115,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 113,
"end": 115,
"ctxt": 0
},
"stmts": []
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
},
"typeAnnotation": null,
"isStatic": false,
"decorators": [],
"accessibility": null,
"isOptional": false,
"isOverride": false,
"readonly": false,
"definite": false
},
{
"type": "ClassProperty",
"span": {
"start": 121,
"end": 127,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 121,
"end": 122,
"ctxt": 0
},
"value": "x",
"optional": false
},
"value": {
"type": "NumericLiteral",
"span": {
"start": 125,
"end": 126,
"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": 132,
"end": 531,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 132,
"end": 136,
"ctxt": 0
},
"value": "test",
"optional": false
},
"function": {
"params": [],
"decorators": [],
"span": {
"start": 132,
"end": 531,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 139,
"end": 531,
"ctxt": 0
},
"stmts": [
{
"type": "ExpressionStatement",
"span": {
"start": 149,
"end": 167,
"ctxt": 0
},
"expression": {
"type": "CallExpression",
"span": {
"start": 149,
"end": 166,
"ctxt": 0
},
"callee": {
"type": "MemberExpression",
"span": {
"start": 149,
"end": 164,
"ctxt": 0
},
"object": {
"type": "ThisExpression",
"span": {
"start": 149,
"end": 153,
"ctxt": 0
}
},
"property": {
"type": "PrivateName",
"span": {
"start": 154,
"end": 164,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 155,
"end": 164,
"ctxt": 0
},
"value": "fieldFunc",
"optional": false
}
}
},
"arguments": [],
"typeArguments": null
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 176,
"end": 196,
"ctxt": 0
},
"expression": {
"type": "OptionalChainingExpression",
"span": {
"start": 176,
"end": 195,
"ctxt": 0
},
"questionDotToken": {
"start": 191,
"end": 192,
"ctxt": 0
},
"base": {
"type": "CallExpression",
"span": {
"start": 176,
"end": 195,
"ctxt": 0
},
"callee": {
"type": "MemberExpression",
"span": {
"start": 176,
"end": 191,
"ctxt": 0
},
"object": {
"type": "ThisExpression",
"span": {
"start": 176,
"end": 180,
"ctxt": 0
}
},
"property": {
"type": "PrivateName",
"span": {
"start": 181,
"end": 191,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 182,
"end": 191,
"ctxt": 0
},
"value": "fieldFunc",
"optional": false
}
}
},
"arguments": [],
"typeArguments": null
}
}
},
{
"type": "VariableDeclaration",
"span": {
"start": 205,
"end": 234,
"ctxt": 0
},
"kind": "const",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 211,
"end": 233,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 211,
"end": 215,
"ctxt": 0
},
"value": "func",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "MemberExpression",
"span": {
"start": 218,
"end": 233,
"ctxt": 0
},
"object": {
"type": "ThisExpression",
"span": {
"start": 218,
"end": 222,
"ctxt": 0
}
},
"property": {
"type": "PrivateName",
"span": {
"start": 223,
"end": 233,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 224,
"end": 233,
"ctxt": 0
},
"value": "fieldFunc",
"optional": false
}
}
},
"definite": false
}
]
},
{
"type": "ExpressionStatement",
"span": {
"start": 243,
"end": 250,
"ctxt": 0
},
"expression": {
"type": "CallExpression",
"span": {
"start": 243,
"end": 249,
"ctxt": 0
},
"callee": {
"type": "Identifier",
"span": {
"start": 243,
"end": 247,
"ctxt": 0
},
"value": "func",
"optional": false
},
"arguments": [],
"typeArguments": null
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 259,
"end": 281,
"ctxt": 0
},
"expression": {
"type": "NewExpression",
"span": {
"start": 259,
"end": 280,
"ctxt": 0
},
"callee": {
"type": "MemberExpression",
"span": {
"start": 263,
"end": 278,
"ctxt": 0
},
"object": {
"type": "ThisExpression",
"span": {
"start": 263,
"end": 267,
"ctxt": 0
}
},
"property": {
"type": "PrivateName",
"span": {
"start": 268,
"end": 278,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 269,
"end": 278,
"ctxt": 0
},
"value": "fieldFunc",
"optional": false
}
}
},
"arguments": [],
"typeArguments": null
}
},
{
"type": "VariableDeclaration",
"span": {
"start": 291,
"end": 312,
"ctxt": 0
},
"kind": "const",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 297,
"end": 311,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 297,
"end": 300,
"ctxt": 0
},
"value": "arr",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "ArrayExpression",
"span": {
"start": 303,
"end": 311,
"ctxt": 0
},
"elements": [
{
"spread": null,
"expression": {
"type": "NumericLiteral",
"span": {
"start": 305,
"end": 306,
"ctxt": 0
},
"value": 1.0,
"raw": "1"
}
},
{
"spread": null,
"expression": {
"type": "NumericLiteral",
"span": {
"start": 308,
"end": 309,
"ctxt": 0
},
"value": 2.0,
"raw": "2"
}
}
]
},
"definite": false
}
]
},
{
"type": "ExpressionStatement",
"span": {
"start": 321,
"end": 352,
"ctxt": 0
},
"expression": {
"type": "CallExpression",
"span": {
"start": 321,
"end": 351,
"ctxt": 0
},
"callee": {
"type": "MemberExpression",
"span": {
"start": 321,
"end": 337,
"ctxt": 0
},
"object": {
"type": "ThisExpression",
"span": {
"start": 321,
"end": 325,
"ctxt": 0
}
},
"property": {
"type": "PrivateName",
"span": {
"start": 326,
"end": 337,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 327,
"end": 337,
"ctxt": 0
},
"value": "fieldFunc2",
"optional": false
}
}
},
"arguments": [
{
"spread": null,
"expression": {
"type": "NumericLiteral",
"span": {
"start": 338,
"end": 339,
"ctxt": 0
},
"value": 0.0,
"raw": "0"
}
},
{
"spread": {
"start": 341,
"end": 344,
"ctxt": 0
},
"expression": {
"type": "Identifier",
"span": {
"start": 344,
"end": 347,
"ctxt": 0
},
"value": "arr",
"optional": false
}
},
{
"spread": null,
"expression": {
"type": "NumericLiteral",
"span": {
"start": 349,
"end": 350,
"ctxt": 0
},
"value": 3.0,
"raw": "3"
}
}
],
"typeArguments": null
}
},
{
"type": "VariableDeclaration",
"span": {
"start": 361,
"end": 406,
"ctxt": 0
},
"kind": "const",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 367,
"end": 405,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 367,
"end": 368,
"ctxt": 0
},
"value": "b",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "NewExpression",
"span": {
"start": 371,
"end": 405,
"ctxt": 0
},
"callee": {
"type": "MemberExpression",
"span": {
"start": 375,
"end": 391,
"ctxt": 0
},
"object": {
"type": "ThisExpression",
"span": {
"start": 375,
"end": 379,
"ctxt": 0
}
},
"property": {
"type": "PrivateName",
"span": {
"start": 380,
"end": 391,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 381,
"end": 391,
"ctxt": 0
},
"value": "fieldFunc2",
"optional": false
}
}
},
"arguments": [
{
"spread": null,
"expression": {
"type": "NumericLiteral",
"span": {
"start": 392,
"end": 393,
"ctxt": 0
},
"value": 0.0,
"raw": "0"
}
},
{
"spread": {
"start": 395,
"end": 398,
"ctxt": 0
},
"expression": {
"type": "Identifier",
"span": {
"start": 398,
"end": 401,
"ctxt": 0
},
"value": "arr",
"optional": false
}
},
{
"spread": null,
"expression": {
"type": "NumericLiteral",
"span": {
"start": 403,
"end": 404,
"ctxt": 0
},
"value": 3.0,
"raw": "3"
}
}
],
"typeArguments": null
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 415,
"end": 468,
"ctxt": 0
},
"kind": "const",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 421,
"end": 467,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 421,
"end": 424,
"ctxt": 0
},
"value": "str",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "TaggedTemplateExpression",
"span": {
"start": 427,
"end": 467,
"ctxt": 0
},
"tag": {
"type": "MemberExpression",
"span": {
"start": 427,
"end": 443,
"ctxt": 0
},
"object": {
"type": "ThisExpression",
"span": {
"start": 427,
"end": 431,
"ctxt": 0
}
},
"property": {
"type": "PrivateName",
"span": {
"start": 432,
"end": 443,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 433,
"end": 443,
"ctxt": 0
},
"value": "fieldFunc2",
"optional": false
}
}
},
"typeParameters": null,
"template": {
"type": "TemplateLiteral",
"span": {
"start": 443,
"end": 467,
"ctxt": 0
},
"expressions": [
{
"type": "NumericLiteral",
"span": {
"start": 450,
"end": 451,
"ctxt": 0
},
"value": 1.0,
"raw": "1"
},
{
"type": "NumericLiteral",
"span": {
"start": 460,
"end": 461,
"ctxt": 0
},
"value": 2.0,
"raw": "2"
}
],
"quasis": [
{
"type": "TemplateElement",
"span": {
"start": 444,
"end": 448,
"ctxt": 0
},
"tail": false,
"cooked": "head",
"raw": "head"
},
{
"type": "TemplateElement",
"span": {
"start": 452,
"end": 458,
"ctxt": 0
},
"tail": false,
"cooked": "middle",
"raw": "middle"
},
{
"type": "TemplateElement",
"span": {
"start": 462,
"end": 466,
"ctxt": 0
},
"tail": true,
"cooked": "tail",
"raw": "tail"
}
]
}
},
"definite": false
}
]
},
{
"type": "ExpressionStatement",
"span": {
"start": 477,
"end": 525,
"ctxt": 0
},
"expression": {
"type": "TaggedTemplateExpression",
"span": {
"start": 477,
"end": 524,
"ctxt": 0
},
"tag": {
"type": "MemberExpression",
"span": {
"start": 477,
"end": 507,
"ctxt": 0
},
"object": {
"type": "CallExpression",
"span": {
"start": 477,
"end": 495,
"ctxt": 0
},
"callee": {
"type": "MemberExpression",
"span": {
"start": 477,
"end": 493,
"ctxt": 0
},
"object": {
"type": "ThisExpression",
"span": {
"start": 477,
"end": 481,
"ctxt": 0
}
},
"property": {
"type": "Identifier",
"span": {
"start": 482,
"end": 493,
"ctxt": 0
},
"value": "getInstance",
"optional": false
}
},
"arguments": [],
"typeArguments": null
},
"property": {
"type": "PrivateName",
"span": {
"start": 496,
"end": 507,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 497,
"end": 507,
"ctxt": 0
},
"value": "fieldFunc2",
"optional": false
}
}
},
"typeParameters": null,
"template": {
"type": "TemplateLiteral",
"span": {
"start": 507,
"end": 524,
"ctxt": 0
},
"expressions": [
{
"type": "NumericLiteral",
"span": {
"start": 514,
"end": 515,
"ctxt": 0
},
"value": 1.0,
"raw": "1"
},
{
"type": "NumericLiteral",
"span": {
"start": 521,
"end": 522,
"ctxt": 0
},
"value": 2.0,
"raw": "2"
}
],
"quasis": [
{
"type": "TemplateElement",
"span": {
"start": 508,
"end": 512,
"ctxt": 0
},
"tail": false,
"cooked": "test",
"raw": "test"
},
{
"type": "TemplateElement",
"span": {
"start": 516,
"end": 519,
"ctxt": 0
},
"tail": false,
"cooked": "and",
"raw": "and"
},
{
"type": "TemplateElement",
"span": {
"start": 523,
"end": 523,
"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": 536,
"end": 569,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 536,
"end": 547,
"ctxt": 0
},
"value": "getInstance",
"optional": false
},
"function": {
"params": [],
"decorators": [],
"span": {
"start": 536,
"end": 569,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 550,
"end": 569,
"ctxt": 0
},
"stmts": [
{
"type": "ReturnStatement",
"span": {
"start": 552,
"end": 567,
"ctxt": 0
},
"argument": {
"type": "NewExpression",
"span": {
"start": 559,
"end": 566,
"ctxt": 0
},
"callee": {
"type": "Identifier",
"span": {
"start": 563,
"end": 564,
"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
}