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

1403 lines
47 KiB
JSON

{
"type": "Script",
"span": {
"start": 20,
"end": 553,
"ctxt": 0
},
"body": [
{
"type": "ClassDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 26,
"end": 27,
"ctxt": 0
},
"value": "A",
"optional": false
},
"declare": false,
"span": {
"start": 20,
"end": 553,
"ctxt": 0
},
"decorators": [],
"body": [
{
"type": "PrivateProperty",
"span": {
"start": 34,
"end": 83,
"ctxt": 0
},
"key": {
"type": "PrivateName",
"span": {
"start": 41,
"end": 51,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 42,
"end": 51,
"ctxt": 0
},
"value": "fieldFunc",
"optional": false
}
},
"value": {
"type": "FunctionExpression",
"identifier": null,
"params": [],
"decorators": [],
"span": {
"start": 54,
"end": 82,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 66,
"end": 82,
"ctxt": 0
},
"stmts": [
{
"type": "ExpressionStatement",
"span": {
"start": 68,
"end": 80,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 68,
"end": 79,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "MemberExpression",
"span": {
"start": 68,
"end": 74,
"ctxt": 0
},
"object": {
"type": "ThisExpression",
"span": {
"start": 68,
"end": 72,
"ctxt": 0
}
},
"property": {
"type": "Identifier",
"span": {
"start": 73,
"end": 74,
"ctxt": 0
},
"value": "x",
"optional": false
}
},
"right": {
"type": "NumericLiteral",
"span": {
"start": 77,
"end": 79,
"ctxt": 0
},
"value": 10.0
}
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
},
"typeAnnotation": null,
"isStatic": true,
"decorators": [],
"accessibility": null,
"isOptional": false,
"isOverride": false,
"readonly": false,
"definite": false
},
{
"type": "PrivateProperty",
"span": {
"start": 88,
"end": 131,
"ctxt": 0
},
"key": {
"type": "PrivateName",
"span": {
"start": 95,
"end": 106,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 96,
"end": 106,
"ctxt": 0
},
"value": "fieldFunc2",
"optional": false
}
},
"value": {
"type": "FunctionExpression",
"identifier": null,
"params": [
{
"type": "Parameter",
"span": {
"start": 119,
"end": 120,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 119,
"end": 120,
"ctxt": 0
},
"value": "a",
"optional": false,
"typeAnnotation": null
}
},
{
"type": "Parameter",
"span": {
"start": 122,
"end": 126,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "RestElement",
"span": {
"start": 122,
"end": 126,
"ctxt": 0
},
"rest": {
"start": 122,
"end": 125,
"ctxt": 0
},
"argument": {
"type": "Identifier",
"span": {
"start": 125,
"end": 126,
"ctxt": 0
},
"value": "b",
"optional": false,
"typeAnnotation": null
},
"typeAnnotation": null
}
}
],
"decorators": [],
"span": {
"start": 109,
"end": 130,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 128,
"end": 130,
"ctxt": 0
},
"stmts": []
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
},
"typeAnnotation": null,
"isStatic": true,
"decorators": [],
"accessibility": null,
"isOptional": false,
"isOverride": false,
"readonly": false,
"definite": false
},
{
"type": "ClassProperty",
"span": {
"start": 136,
"end": 142,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 136,
"end": 137,
"ctxt": 0
},
"value": "x",
"optional": false
},
"value": {
"type": "NumericLiteral",
"span": {
"start": 140,
"end": 141,
"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": 147,
"end": 522,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 147,
"end": 151,
"ctxt": 0
},
"value": "test",
"optional": false
},
"function": {
"params": [],
"decorators": [],
"span": {
"start": 147,
"end": 522,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 154,
"end": 522,
"ctxt": 0
},
"stmts": [
{
"type": "ExpressionStatement",
"span": {
"start": 164,
"end": 179,
"ctxt": 0
},
"expression": {
"type": "CallExpression",
"span": {
"start": 164,
"end": 178,
"ctxt": 0
},
"callee": {
"type": "MemberExpression",
"span": {
"start": 164,
"end": 176,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 164,
"end": 165,
"ctxt": 0
},
"value": "A",
"optional": false
},
"property": {
"type": "PrivateName",
"span": {
"start": 166,
"end": 176,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 167,
"end": 176,
"ctxt": 0
},
"value": "fieldFunc",
"optional": false
}
}
},
"arguments": [],
"typeArguments": null
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 188,
"end": 205,
"ctxt": 0
},
"expression": {
"type": "OptionalChainingExpression",
"span": {
"start": 188,
"end": 204,
"ctxt": 0
},
"questionDotToken": {
"start": 200,
"end": 201,
"ctxt": 0
},
"base": {
"type": "CallExpression",
"span": {
"start": 188,
"end": 204,
"ctxt": 0
},
"callee": {
"type": "MemberExpression",
"span": {
"start": 188,
"end": 200,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 188,
"end": 189,
"ctxt": 0
},
"value": "A",
"optional": false
},
"property": {
"type": "PrivateName",
"span": {
"start": 190,
"end": 200,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 191,
"end": 200,
"ctxt": 0
},
"value": "fieldFunc",
"optional": false
}
}
},
"arguments": [],
"typeArguments": null
}
}
},
{
"type": "VariableDeclaration",
"span": {
"start": 214,
"end": 240,
"ctxt": 0
},
"kind": "const",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 220,
"end": 239,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 220,
"end": 224,
"ctxt": 0
},
"value": "func",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "MemberExpression",
"span": {
"start": 227,
"end": 239,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 227,
"end": 228,
"ctxt": 0
},
"value": "A",
"optional": false
},
"property": {
"type": "PrivateName",
"span": {
"start": 229,
"end": 239,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 230,
"end": 239,
"ctxt": 0
},
"value": "fieldFunc",
"optional": false
}
}
},
"definite": false
}
]
},
{
"type": "ExpressionStatement",
"span": {
"start": 249,
"end": 256,
"ctxt": 0
},
"expression": {
"type": "CallExpression",
"span": {
"start": 249,
"end": 255,
"ctxt": 0
},
"callee": {
"type": "Identifier",
"span": {
"start": 249,
"end": 253,
"ctxt": 0
},
"value": "func",
"optional": false
},
"arguments": [],
"typeArguments": null
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 265,
"end": 284,
"ctxt": 0
},
"expression": {
"type": "NewExpression",
"span": {
"start": 265,
"end": 283,
"ctxt": 0
},
"callee": {
"type": "MemberExpression",
"span": {
"start": 269,
"end": 281,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 269,
"end": 270,
"ctxt": 0
},
"value": "A",
"optional": false
},
"property": {
"type": "PrivateName",
"span": {
"start": 271,
"end": 281,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 272,
"end": 281,
"ctxt": 0
},
"value": "fieldFunc",
"optional": false
}
}
},
"arguments": [],
"typeArguments": null
}
},
{
"type": "VariableDeclaration",
"span": {
"start": 294,
"end": 315,
"ctxt": 0
},
"kind": "const",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 300,
"end": 314,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 300,
"end": 303,
"ctxt": 0
},
"value": "arr",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "ArrayExpression",
"span": {
"start": 306,
"end": 314,
"ctxt": 0
},
"elements": [
{
"spread": null,
"expression": {
"type": "NumericLiteral",
"span": {
"start": 308,
"end": 309,
"ctxt": 0
},
"value": 1.0
}
},
{
"spread": null,
"expression": {
"type": "NumericLiteral",
"span": {
"start": 311,
"end": 312,
"ctxt": 0
},
"value": 2.0
}
}
]
},
"definite": false
}
]
},
{
"type": "ExpressionStatement",
"span": {
"start": 324,
"end": 352,
"ctxt": 0
},
"expression": {
"type": "CallExpression",
"span": {
"start": 324,
"end": 351,
"ctxt": 0
},
"callee": {
"type": "MemberExpression",
"span": {
"start": 324,
"end": 337,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 324,
"end": 325,
"ctxt": 0
},
"value": "A",
"optional": false
},
"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
}
},
{
"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
}
}
],
"typeArguments": null
}
},
{
"type": "VariableDeclaration",
"span": {
"start": 361,
"end": 403,
"ctxt": 0
},
"kind": "const",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 367,
"end": 402,
"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": 402,
"ctxt": 0
},
"callee": {
"type": "MemberExpression",
"span": {
"start": 375,
"end": 388,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 375,
"end": 376,
"ctxt": 0
},
"value": "A",
"optional": false
},
"property": {
"type": "PrivateName",
"span": {
"start": 377,
"end": 388,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 378,
"end": 388,
"ctxt": 0
},
"value": "fieldFunc2",
"optional": false
}
}
},
"arguments": [
{
"spread": null,
"expression": {
"type": "NumericLiteral",
"span": {
"start": 389,
"end": 390,
"ctxt": 0
},
"value": 0.0
}
},
{
"spread": {
"start": 392,
"end": 395,
"ctxt": 0
},
"expression": {
"type": "Identifier",
"span": {
"start": 395,
"end": 398,
"ctxt": 0
},
"value": "arr",
"optional": false
}
},
{
"spread": null,
"expression": {
"type": "NumericLiteral",
"span": {
"start": 400,
"end": 401,
"ctxt": 0
},
"value": 3.0
}
}
],
"typeArguments": null
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 412,
"end": 462,
"ctxt": 0
},
"kind": "const",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 418,
"end": 461,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 418,
"end": 421,
"ctxt": 0
},
"value": "str",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "TaggedTemplateExpression",
"span": {
"start": 424,
"end": 461,
"ctxt": 0
},
"tag": {
"type": "MemberExpression",
"span": {
"start": 424,
"end": 437,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 424,
"end": 425,
"ctxt": 0
},
"value": "A",
"optional": false
},
"property": {
"type": "PrivateName",
"span": {
"start": 426,
"end": 437,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 427,
"end": 437,
"ctxt": 0
},
"value": "fieldFunc2",
"optional": false
}
}
},
"typeParameters": null,
"template": {
"type": "TemplateLiteral",
"span": {
"start": 437,
"end": 461,
"ctxt": 0
},
"expressions": [
{
"type": "NumericLiteral",
"span": {
"start": 444,
"end": 445,
"ctxt": 0
},
"value": 1.0
},
{
"type": "NumericLiteral",
"span": {
"start": 454,
"end": 455,
"ctxt": 0
},
"value": 2.0
}
],
"quasis": [
{
"type": "TemplateElement",
"span": {
"start": 438,
"end": 442,
"ctxt": 0
},
"tail": false,
"cooked": {
"type": "StringLiteral",
"span": {
"start": 438,
"end": 442,
"ctxt": 0
},
"value": "head",
"hasEscape": false,
"kind": {
"type": "normal",
"containsQuote": false
}
},
"raw": {
"type": "StringLiteral",
"span": {
"start": 438,
"end": 442,
"ctxt": 0
},
"value": "head",
"hasEscape": false,
"kind": {
"type": "normal",
"containsQuote": false
}
}
},
{
"type": "TemplateElement",
"span": {
"start": 446,
"end": 452,
"ctxt": 0
},
"tail": false,
"cooked": {
"type": "StringLiteral",
"span": {
"start": 446,
"end": 452,
"ctxt": 0
},
"value": "middle",
"hasEscape": false,
"kind": {
"type": "normal",
"containsQuote": false
}
},
"raw": {
"type": "StringLiteral",
"span": {
"start": 446,
"end": 452,
"ctxt": 0
},
"value": "middle",
"hasEscape": false,
"kind": {
"type": "normal",
"containsQuote": false
}
}
},
{
"type": "TemplateElement",
"span": {
"start": 456,
"end": 460,
"ctxt": 0
},
"tail": true,
"cooked": {
"type": "StringLiteral",
"span": {
"start": 456,
"end": 460,
"ctxt": 0
},
"value": "tail",
"hasEscape": false,
"kind": {
"type": "normal",
"containsQuote": false
}
},
"raw": {
"type": "StringLiteral",
"span": {
"start": 456,
"end": 460,
"ctxt": 0
},
"value": "tail",
"hasEscape": false,
"kind": {
"type": "normal",
"containsQuote": false
}
}
}
]
}
},
"definite": false
}
]
},
{
"type": "ExpressionStatement",
"span": {
"start": 471,
"end": 516,
"ctxt": 0
},
"expression": {
"type": "TaggedTemplateExpression",
"span": {
"start": 471,
"end": 515,
"ctxt": 0
},
"tag": {
"type": "MemberExpression",
"span": {
"start": 471,
"end": 498,
"ctxt": 0
},
"object": {
"type": "CallExpression",
"span": {
"start": 471,
"end": 486,
"ctxt": 0
},
"callee": {
"type": "MemberExpression",
"span": {
"start": 471,
"end": 484,
"ctxt": 0
},
"object": {
"type": "ThisExpression",
"span": {
"start": 471,
"end": 475,
"ctxt": 0
}
},
"property": {
"type": "Identifier",
"span": {
"start": 476,
"end": 484,
"ctxt": 0
},
"value": "getClass",
"optional": false
}
},
"arguments": [],
"typeArguments": null
},
"property": {
"type": "PrivateName",
"span": {
"start": 487,
"end": 498,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 488,
"end": 498,
"ctxt": 0
},
"value": "fieldFunc2",
"optional": false
}
}
},
"typeParameters": null,
"template": {
"type": "TemplateLiteral",
"span": {
"start": 498,
"end": 515,
"ctxt": 0
},
"expressions": [
{
"type": "NumericLiteral",
"span": {
"start": 505,
"end": 506,
"ctxt": 0
},
"value": 1.0
},
{
"type": "NumericLiteral",
"span": {
"start": 512,
"end": 513,
"ctxt": 0
},
"value": 2.0
}
],
"quasis": [
{
"type": "TemplateElement",
"span": {
"start": 499,
"end": 503,
"ctxt": 0
},
"tail": false,
"cooked": {
"type": "StringLiteral",
"span": {
"start": 499,
"end": 503,
"ctxt": 0
},
"value": "test",
"hasEscape": false,
"kind": {
"type": "normal",
"containsQuote": false
}
},
"raw": {
"type": "StringLiteral",
"span": {
"start": 499,
"end": 503,
"ctxt": 0
},
"value": "test",
"hasEscape": false,
"kind": {
"type": "normal",
"containsQuote": false
}
}
},
{
"type": "TemplateElement",
"span": {
"start": 507,
"end": 510,
"ctxt": 0
},
"tail": false,
"cooked": {
"type": "StringLiteral",
"span": {
"start": 507,
"end": 510,
"ctxt": 0
},
"value": "and",
"hasEscape": false,
"kind": {
"type": "normal",
"containsQuote": false
}
},
"raw": {
"type": "StringLiteral",
"span": {
"start": 507,
"end": 510,
"ctxt": 0
},
"value": "and",
"hasEscape": false,
"kind": {
"type": "normal",
"containsQuote": false
}
}
},
{
"type": "TemplateElement",
"span": {
"start": 514,
"end": 514,
"ctxt": 0
},
"tail": true,
"cooked": {
"type": "StringLiteral",
"span": {
"start": 514,
"end": 514,
"ctxt": 0
},
"value": "",
"hasEscape": false,
"kind": {
"type": "normal",
"containsQuote": false
}
},
"raw": {
"type": "StringLiteral",
"span": {
"start": 514,
"end": 514,
"ctxt": 0
},
"value": "",
"hasEscape": false,
"kind": {
"type": "normal",
"containsQuote": 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": 527,
"end": 551,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 527,
"end": 535,
"ctxt": 0
},
"value": "getClass",
"optional": false
},
"function": {
"params": [],
"decorators": [],
"span": {
"start": 527,
"end": 551,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 538,
"end": 551,
"ctxt": 0
},
"stmts": [
{
"type": "ReturnStatement",
"span": {
"start": 540,
"end": 549,
"ctxt": 0
},
"argument": {
"type": "Identifier",
"span": {
"start": 547,
"end": 548,
"ctxt": 0
},
"value": "A",
"optional": false
}
}
]
},
"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
}