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

1259 lines
40 KiB
JSON

{
"type": "Script",
"span": {
"start": 21,
"end": 554,
"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": 554,
"ctxt": 0
},
"decorators": [],
"body": [
{
"type": "PrivateProperty",
"span": {
"start": 35,
"end": 84,
"ctxt": 0
},
"key": {
"type": "PrivateName",
"span": {
"start": 42,
"end": 52,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 43,
"end": 52,
"ctxt": 0
},
"value": "fieldFunc",
"optional": false
}
},
"value": {
"type": "FunctionExpression",
"identifier": null,
"params": [],
"decorators": [],
"span": {
"start": 55,
"end": 83,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 67,
"end": 83,
"ctxt": 0
},
"stmts": [
{
"type": "ExpressionStatement",
"span": {
"start": 69,
"end": 81,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 69,
"end": 80,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "MemberExpression",
"span": {
"start": 69,
"end": 75,
"ctxt": 0
},
"object": {
"type": "ThisExpression",
"span": {
"start": 69,
"end": 73,
"ctxt": 0
}
},
"property": {
"type": "Identifier",
"span": {
"start": 74,
"end": 75,
"ctxt": 0
},
"value": "x",
"optional": false
}
},
"right": {
"type": "NumericLiteral",
"span": {
"start": 78,
"end": 80,
"ctxt": 0
},
"value": 10.0,
"raw": "10"
}
}
}
]
},
"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": 89,
"end": 132,
"ctxt": 0
},
"key": {
"type": "PrivateName",
"span": {
"start": 96,
"end": 107,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 97,
"end": 107,
"ctxt": 0
},
"value": "fieldFunc2",
"optional": false
}
},
"value": {
"type": "FunctionExpression",
"identifier": null,
"params": [
{
"type": "Parameter",
"span": {
"start": 120,
"end": 121,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 120,
"end": 121,
"ctxt": 0
},
"value": "a",
"optional": false,
"typeAnnotation": null
}
},
{
"type": "Parameter",
"span": {
"start": 123,
"end": 127,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "RestElement",
"span": {
"start": 123,
"end": 127,
"ctxt": 0
},
"rest": {
"start": 123,
"end": 126,
"ctxt": 0
},
"argument": {
"type": "Identifier",
"span": {
"start": 126,
"end": 127,
"ctxt": 0
},
"value": "b",
"optional": false,
"typeAnnotation": null
},
"typeAnnotation": null
}
}
],
"decorators": [],
"span": {
"start": 110,
"end": 131,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 129,
"end": 131,
"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": 137,
"end": 143,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 137,
"end": 138,
"ctxt": 0
},
"value": "x",
"optional": false
},
"value": {
"type": "NumericLiteral",
"span": {
"start": 141,
"end": 142,
"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": 148,
"end": 523,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 148,
"end": 152,
"ctxt": 0
},
"value": "test",
"optional": false
},
"function": {
"params": [],
"decorators": [],
"span": {
"start": 148,
"end": 523,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 155,
"end": 523,
"ctxt": 0
},
"stmts": [
{
"type": "ExpressionStatement",
"span": {
"start": 165,
"end": 180,
"ctxt": 0
},
"expression": {
"type": "CallExpression",
"span": {
"start": 165,
"end": 179,
"ctxt": 0
},
"callee": {
"type": "MemberExpression",
"span": {
"start": 165,
"end": 177,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 165,
"end": 166,
"ctxt": 0
},
"value": "A",
"optional": false
},
"property": {
"type": "PrivateName",
"span": {
"start": 167,
"end": 177,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 168,
"end": 177,
"ctxt": 0
},
"value": "fieldFunc",
"optional": false
}
}
},
"arguments": [],
"typeArguments": null
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 189,
"end": 206,
"ctxt": 0
},
"expression": {
"type": "OptionalChainingExpression",
"span": {
"start": 189,
"end": 205,
"ctxt": 0
},
"questionDotToken": {
"start": 201,
"end": 202,
"ctxt": 0
},
"base": {
"type": "CallExpression",
"span": {
"start": 189,
"end": 205,
"ctxt": 0
},
"callee": {
"type": "MemberExpression",
"span": {
"start": 189,
"end": 201,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 189,
"end": 190,
"ctxt": 0
},
"value": "A",
"optional": false
},
"property": {
"type": "PrivateName",
"span": {
"start": 191,
"end": 201,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 192,
"end": 201,
"ctxt": 0
},
"value": "fieldFunc",
"optional": false
}
}
},
"arguments": [],
"typeArguments": null
}
}
},
{
"type": "VariableDeclaration",
"span": {
"start": 215,
"end": 241,
"ctxt": 0
},
"kind": "const",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 221,
"end": 240,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 221,
"end": 225,
"ctxt": 0
},
"value": "func",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "MemberExpression",
"span": {
"start": 228,
"end": 240,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 228,
"end": 229,
"ctxt": 0
},
"value": "A",
"optional": false
},
"property": {
"type": "PrivateName",
"span": {
"start": 230,
"end": 240,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 231,
"end": 240,
"ctxt": 0
},
"value": "fieldFunc",
"optional": false
}
}
},
"definite": false
}
]
},
{
"type": "ExpressionStatement",
"span": {
"start": 250,
"end": 257,
"ctxt": 0
},
"expression": {
"type": "CallExpression",
"span": {
"start": 250,
"end": 256,
"ctxt": 0
},
"callee": {
"type": "Identifier",
"span": {
"start": 250,
"end": 254,
"ctxt": 0
},
"value": "func",
"optional": false
},
"arguments": [],
"typeArguments": null
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 266,
"end": 285,
"ctxt": 0
},
"expression": {
"type": "NewExpression",
"span": {
"start": 266,
"end": 284,
"ctxt": 0
},
"callee": {
"type": "MemberExpression",
"span": {
"start": 270,
"end": 282,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 270,
"end": 271,
"ctxt": 0
},
"value": "A",
"optional": false
},
"property": {
"type": "PrivateName",
"span": {
"start": 272,
"end": 282,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 273,
"end": 282,
"ctxt": 0
},
"value": "fieldFunc",
"optional": false
}
}
},
"arguments": [],
"typeArguments": null
}
},
{
"type": "VariableDeclaration",
"span": {
"start": 295,
"end": 316,
"ctxt": 0
},
"kind": "const",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 301,
"end": 315,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 301,
"end": 304,
"ctxt": 0
},
"value": "arr",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "ArrayExpression",
"span": {
"start": 307,
"end": 315,
"ctxt": 0
},
"elements": [
{
"spread": null,
"expression": {
"type": "NumericLiteral",
"span": {
"start": 309,
"end": 310,
"ctxt": 0
},
"value": 1.0,
"raw": "1"
}
},
{
"spread": null,
"expression": {
"type": "NumericLiteral",
"span": {
"start": 312,
"end": 313,
"ctxt": 0
},
"value": 2.0,
"raw": "2"
}
}
]
},
"definite": false
}
]
},
{
"type": "ExpressionStatement",
"span": {
"start": 325,
"end": 353,
"ctxt": 0
},
"expression": {
"type": "CallExpression",
"span": {
"start": 325,
"end": 352,
"ctxt": 0
},
"callee": {
"type": "MemberExpression",
"span": {
"start": 325,
"end": 338,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 325,
"end": 326,
"ctxt": 0
},
"value": "A",
"optional": false
},
"property": {
"type": "PrivateName",
"span": {
"start": 327,
"end": 338,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 328,
"end": 338,
"ctxt": 0
},
"value": "fieldFunc2",
"optional": false
}
}
},
"arguments": [
{
"spread": null,
"expression": {
"type": "NumericLiteral",
"span": {
"start": 339,
"end": 340,
"ctxt": 0
},
"value": 0.0,
"raw": "0"
}
},
{
"spread": {
"start": 342,
"end": 345,
"ctxt": 0
},
"expression": {
"type": "Identifier",
"span": {
"start": 345,
"end": 348,
"ctxt": 0
},
"value": "arr",
"optional": false
}
},
{
"spread": null,
"expression": {
"type": "NumericLiteral",
"span": {
"start": 350,
"end": 351,
"ctxt": 0
},
"value": 3.0,
"raw": "3"
}
}
],
"typeArguments": null
}
},
{
"type": "VariableDeclaration",
"span": {
"start": 362,
"end": 404,
"ctxt": 0
},
"kind": "const",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 368,
"end": 403,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 368,
"end": 369,
"ctxt": 0
},
"value": "b",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "NewExpression",
"span": {
"start": 372,
"end": 403,
"ctxt": 0
},
"callee": {
"type": "MemberExpression",
"span": {
"start": 376,
"end": 389,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 376,
"end": 377,
"ctxt": 0
},
"value": "A",
"optional": false
},
"property": {
"type": "PrivateName",
"span": {
"start": 378,
"end": 389,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 379,
"end": 389,
"ctxt": 0
},
"value": "fieldFunc2",
"optional": false
}
}
},
"arguments": [
{
"spread": null,
"expression": {
"type": "NumericLiteral",
"span": {
"start": 390,
"end": 391,
"ctxt": 0
},
"value": 0.0,
"raw": "0"
}
},
{
"spread": {
"start": 393,
"end": 396,
"ctxt": 0
},
"expression": {
"type": "Identifier",
"span": {
"start": 396,
"end": 399,
"ctxt": 0
},
"value": "arr",
"optional": false
}
},
{
"spread": null,
"expression": {
"type": "NumericLiteral",
"span": {
"start": 401,
"end": 402,
"ctxt": 0
},
"value": 3.0,
"raw": "3"
}
}
],
"typeArguments": null
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 413,
"end": 463,
"ctxt": 0
},
"kind": "const",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 419,
"end": 462,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 419,
"end": 422,
"ctxt": 0
},
"value": "str",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "TaggedTemplateExpression",
"span": {
"start": 425,
"end": 462,
"ctxt": 0
},
"tag": {
"type": "MemberExpression",
"span": {
"start": 425,
"end": 438,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 425,
"end": 426,
"ctxt": 0
},
"value": "A",
"optional": false
},
"property": {
"type": "PrivateName",
"span": {
"start": 427,
"end": 438,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 428,
"end": 438,
"ctxt": 0
},
"value": "fieldFunc2",
"optional": false
}
}
},
"typeParameters": null,
"template": {
"type": "TemplateLiteral",
"span": {
"start": 438,
"end": 462,
"ctxt": 0
},
"expressions": [
{
"type": "NumericLiteral",
"span": {
"start": 445,
"end": 446,
"ctxt": 0
},
"value": 1.0,
"raw": "1"
},
{
"type": "NumericLiteral",
"span": {
"start": 455,
"end": 456,
"ctxt": 0
},
"value": 2.0,
"raw": "2"
}
],
"quasis": [
{
"type": "TemplateElement",
"span": {
"start": 439,
"end": 443,
"ctxt": 0
},
"tail": false,
"cooked": "head",
"raw": "head"
},
{
"type": "TemplateElement",
"span": {
"start": 447,
"end": 453,
"ctxt": 0
},
"tail": false,
"cooked": "middle",
"raw": "middle"
},
{
"type": "TemplateElement",
"span": {
"start": 457,
"end": 461,
"ctxt": 0
},
"tail": true,
"cooked": "tail",
"raw": "tail"
}
]
}
},
"definite": false
}
]
},
{
"type": "ExpressionStatement",
"span": {
"start": 472,
"end": 517,
"ctxt": 0
},
"expression": {
"type": "TaggedTemplateExpression",
"span": {
"start": 472,
"end": 516,
"ctxt": 0
},
"tag": {
"type": "MemberExpression",
"span": {
"start": 472,
"end": 499,
"ctxt": 0
},
"object": {
"type": "CallExpression",
"span": {
"start": 472,
"end": 487,
"ctxt": 0
},
"callee": {
"type": "MemberExpression",
"span": {
"start": 472,
"end": 485,
"ctxt": 0
},
"object": {
"type": "ThisExpression",
"span": {
"start": 472,
"end": 476,
"ctxt": 0
}
},
"property": {
"type": "Identifier",
"span": {
"start": 477,
"end": 485,
"ctxt": 0
},
"value": "getClass",
"optional": false
}
},
"arguments": [],
"typeArguments": null
},
"property": {
"type": "PrivateName",
"span": {
"start": 488,
"end": 499,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 489,
"end": 499,
"ctxt": 0
},
"value": "fieldFunc2",
"optional": false
}
}
},
"typeParameters": null,
"template": {
"type": "TemplateLiteral",
"span": {
"start": 499,
"end": 516,
"ctxt": 0
},
"expressions": [
{
"type": "NumericLiteral",
"span": {
"start": 506,
"end": 507,
"ctxt": 0
},
"value": 1.0,
"raw": "1"
},
{
"type": "NumericLiteral",
"span": {
"start": 513,
"end": 514,
"ctxt": 0
},
"value": 2.0,
"raw": "2"
}
],
"quasis": [
{
"type": "TemplateElement",
"span": {
"start": 500,
"end": 504,
"ctxt": 0
},
"tail": false,
"cooked": "test",
"raw": "test"
},
{
"type": "TemplateElement",
"span": {
"start": 508,
"end": 511,
"ctxt": 0
},
"tail": false,
"cooked": "and",
"raw": "and"
},
{
"type": "TemplateElement",
"span": {
"start": 515,
"end": 515,
"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": 528,
"end": 552,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 528,
"end": 536,
"ctxt": 0
},
"value": "getClass",
"optional": false
},
"function": {
"params": [],
"decorators": [],
"span": {
"start": 528,
"end": 552,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 539,
"end": 552,
"ctxt": 0
},
"stmts": [
{
"type": "ReturnStatement",
"span": {
"start": 541,
"end": 550,
"ctxt": 0
},
"argument": {
"type": "Identifier",
"span": {
"start": 548,
"end": 549,
"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
}