swc/crates/swc_ecma_parser/tests/tsc/privateNameFieldCallExpression.json
2022-02-04 17:08:38 +09:00

1403 lines
46 KiB
JSON

{
"type": "Script",
"span": {
"start": 20,
"end": 570,
"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": 570,
"ctxt": 0
},
"decorators": [],
"body": [
{
"type": "PrivateProperty",
"span": {
"start": 34,
"end": 75,
"ctxt": 0
},
"key": {
"type": "PrivateName",
"span": {
"start": 34,
"end": 44,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 35,
"end": 44,
"ctxt": 0
},
"value": "fieldFunc",
"optional": false
}
},
"value": {
"type": "FunctionExpression",
"identifier": null,
"params": [],
"decorators": [],
"span": {
"start": 47,
"end": 74,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 58,
"end": 74,
"ctxt": 0
},
"stmts": [
{
"type": "ExpressionStatement",
"span": {
"start": 60,
"end": 72,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 60,
"end": 71,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "MemberExpression",
"span": {
"start": 60,
"end": 66,
"ctxt": 0
},
"object": {
"type": "ThisExpression",
"span": {
"start": 60,
"end": 64,
"ctxt": 0
}
},
"property": {
"type": "Identifier",
"span": {
"start": 65,
"end": 66,
"ctxt": 0
},
"value": "x",
"optional": false
}
},
"right": {
"type": "NumericLiteral",
"span": {
"start": 69,
"end": 71,
"ctxt": 0
},
"value": 10.0
}
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
},
"typeAnnotation": null,
"isStatic": false,
"decorators": [],
"computed": false,
"accessibility": null,
"isAbstract": false,
"isOptional": false,
"isOverride": false,
"readonly": false,
"definite": false
},
{
"type": "PrivateProperty",
"span": {
"start": 80,
"end": 115,
"ctxt": 0
},
"key": {
"type": "PrivateName",
"span": {
"start": 80,
"end": 91,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 81,
"end": 91,
"ctxt": 0
},
"value": "fieldFunc2",
"optional": false
}
},
"value": {
"type": "FunctionExpression",
"identifier": null,
"params": [
{
"type": "Parameter",
"span": {
"start": 103,
"end": 104,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 103,
"end": 104,
"ctxt": 0
},
"value": "a",
"optional": false,
"typeAnnotation": null
}
},
{
"type": "Parameter",
"span": {
"start": 106,
"end": 110,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "RestElement",
"span": {
"start": 106,
"end": 110,
"ctxt": 0
},
"rest": {
"start": 106,
"end": 109,
"ctxt": 0
},
"argument": {
"type": "Identifier",
"span": {
"start": 109,
"end": 110,
"ctxt": 0
},
"value": "b",
"optional": false,
"typeAnnotation": null
},
"typeAnnotation": null
}
}
],
"decorators": [],
"span": {
"start": 94,
"end": 114,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 112,
"end": 114,
"ctxt": 0
},
"stmts": []
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
},
"typeAnnotation": null,
"isStatic": false,
"decorators": [],
"computed": false,
"accessibility": null,
"isAbstract": false,
"isOptional": false,
"isOverride": false,
"readonly": false,
"definite": false
},
{
"type": "ClassProperty",
"span": {
"start": 120,
"end": 126,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 120,
"end": 121,
"ctxt": 0
},
"value": "x",
"optional": false
},
"value": {
"type": "NumericLiteral",
"span": {
"start": 124,
"end": 125,
"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": 131,
"end": 530,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 131,
"end": 135,
"ctxt": 0
},
"value": "test",
"optional": false
},
"function": {
"params": [],
"decorators": [],
"span": {
"start": 131,
"end": 530,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 138,
"end": 530,
"ctxt": 0
},
"stmts": [
{
"type": "ExpressionStatement",
"span": {
"start": 148,
"end": 166,
"ctxt": 0
},
"expression": {
"type": "CallExpression",
"span": {
"start": 148,
"end": 165,
"ctxt": 0
},
"callee": {
"type": "MemberExpression",
"span": {
"start": 148,
"end": 163,
"ctxt": 0
},
"object": {
"type": "ThisExpression",
"span": {
"start": 148,
"end": 152,
"ctxt": 0
}
},
"property": {
"type": "PrivateName",
"span": {
"start": 153,
"end": 163,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 154,
"end": 163,
"ctxt": 0
},
"value": "fieldFunc",
"optional": false
}
}
},
"arguments": [],
"typeArguments": null
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 175,
"end": 195,
"ctxt": 0
},
"expression": {
"type": "OptionalChainingExpression",
"span": {
"start": 175,
"end": 194,
"ctxt": 0
},
"questionDotToken": {
"start": 190,
"end": 191,
"ctxt": 0
},
"expr": {
"type": "CallExpression",
"span": {
"start": 175,
"end": 194,
"ctxt": 0
},
"callee": {
"type": "MemberExpression",
"span": {
"start": 175,
"end": 190,
"ctxt": 0
},
"object": {
"type": "ThisExpression",
"span": {
"start": 175,
"end": 179,
"ctxt": 0
}
},
"property": {
"type": "PrivateName",
"span": {
"start": 180,
"end": 190,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 181,
"end": 190,
"ctxt": 0
},
"value": "fieldFunc",
"optional": false
}
}
},
"arguments": [],
"typeArguments": null
}
}
},
{
"type": "VariableDeclaration",
"span": {
"start": 204,
"end": 233,
"ctxt": 0
},
"kind": "const",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 210,
"end": 232,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 210,
"end": 214,
"ctxt": 0
},
"value": "func",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "MemberExpression",
"span": {
"start": 217,
"end": 232,
"ctxt": 0
},
"object": {
"type": "ThisExpression",
"span": {
"start": 217,
"end": 221,
"ctxt": 0
}
},
"property": {
"type": "PrivateName",
"span": {
"start": 222,
"end": 232,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 223,
"end": 232,
"ctxt": 0
},
"value": "fieldFunc",
"optional": false
}
}
},
"definite": false
}
]
},
{
"type": "ExpressionStatement",
"span": {
"start": 242,
"end": 249,
"ctxt": 0
},
"expression": {
"type": "CallExpression",
"span": {
"start": 242,
"end": 248,
"ctxt": 0
},
"callee": {
"type": "Identifier",
"span": {
"start": 242,
"end": 246,
"ctxt": 0
},
"value": "func",
"optional": false
},
"arguments": [],
"typeArguments": null
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 258,
"end": 280,
"ctxt": 0
},
"expression": {
"type": "NewExpression",
"span": {
"start": 258,
"end": 279,
"ctxt": 0
},
"callee": {
"type": "MemberExpression",
"span": {
"start": 262,
"end": 277,
"ctxt": 0
},
"object": {
"type": "ThisExpression",
"span": {
"start": 262,
"end": 266,
"ctxt": 0
}
},
"property": {
"type": "PrivateName",
"span": {
"start": 267,
"end": 277,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 268,
"end": 277,
"ctxt": 0
},
"value": "fieldFunc",
"optional": false
}
}
},
"arguments": [],
"typeArguments": null
}
},
{
"type": "VariableDeclaration",
"span": {
"start": 290,
"end": 311,
"ctxt": 0
},
"kind": "const",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 296,
"end": 310,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 296,
"end": 299,
"ctxt": 0
},
"value": "arr",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "ArrayExpression",
"span": {
"start": 302,
"end": 310,
"ctxt": 0
},
"elements": [
{
"spread": null,
"expression": {
"type": "NumericLiteral",
"span": {
"start": 304,
"end": 305,
"ctxt": 0
},
"value": 1.0
}
},
{
"spread": null,
"expression": {
"type": "NumericLiteral",
"span": {
"start": 307,
"end": 308,
"ctxt": 0
},
"value": 2.0
}
}
]
},
"definite": false
}
]
},
{
"type": "ExpressionStatement",
"span": {
"start": 320,
"end": 351,
"ctxt": 0
},
"expression": {
"type": "CallExpression",
"span": {
"start": 320,
"end": 350,
"ctxt": 0
},
"callee": {
"type": "MemberExpression",
"span": {
"start": 320,
"end": 336,
"ctxt": 0
},
"object": {
"type": "ThisExpression",
"span": {
"start": 320,
"end": 324,
"ctxt": 0
}
},
"property": {
"type": "PrivateName",
"span": {
"start": 325,
"end": 336,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 326,
"end": 336,
"ctxt": 0
},
"value": "fieldFunc2",
"optional": false
}
}
},
"arguments": [
{
"spread": null,
"expression": {
"type": "NumericLiteral",
"span": {
"start": 337,
"end": 338,
"ctxt": 0
},
"value": 0.0
}
},
{
"spread": {
"start": 340,
"end": 343,
"ctxt": 0
},
"expression": {
"type": "Identifier",
"span": {
"start": 343,
"end": 346,
"ctxt": 0
},
"value": "arr",
"optional": false
}
},
{
"spread": null,
"expression": {
"type": "NumericLiteral",
"span": {
"start": 348,
"end": 349,
"ctxt": 0
},
"value": 3.0
}
}
],
"typeArguments": null
}
},
{
"type": "VariableDeclaration",
"span": {
"start": 360,
"end": 405,
"ctxt": 0
},
"kind": "const",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 366,
"end": 404,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 366,
"end": 367,
"ctxt": 0
},
"value": "b",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "NewExpression",
"span": {
"start": 370,
"end": 404,
"ctxt": 0
},
"callee": {
"type": "MemberExpression",
"span": {
"start": 374,
"end": 390,
"ctxt": 0
},
"object": {
"type": "ThisExpression",
"span": {
"start": 374,
"end": 378,
"ctxt": 0
}
},
"property": {
"type": "PrivateName",
"span": {
"start": 379,
"end": 390,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 380,
"end": 390,
"ctxt": 0
},
"value": "fieldFunc2",
"optional": false
}
}
},
"arguments": [
{
"spread": null,
"expression": {
"type": "NumericLiteral",
"span": {
"start": 391,
"end": 392,
"ctxt": 0
},
"value": 0.0
}
},
{
"spread": {
"start": 394,
"end": 397,
"ctxt": 0
},
"expression": {
"type": "Identifier",
"span": {
"start": 397,
"end": 400,
"ctxt": 0
},
"value": "arr",
"optional": false
}
},
{
"spread": null,
"expression": {
"type": "NumericLiteral",
"span": {
"start": 402,
"end": 403,
"ctxt": 0
},
"value": 3.0
}
}
],
"typeArguments": null
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 414,
"end": 467,
"ctxt": 0
},
"kind": "const",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 420,
"end": 466,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 420,
"end": 423,
"ctxt": 0
},
"value": "str",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "TaggedTemplateExpression",
"span": {
"start": 426,
"end": 466,
"ctxt": 0
},
"tag": {
"type": "MemberExpression",
"span": {
"start": 426,
"end": 442,
"ctxt": 0
},
"object": {
"type": "ThisExpression",
"span": {
"start": 426,
"end": 430,
"ctxt": 0
}
},
"property": {
"type": "PrivateName",
"span": {
"start": 431,
"end": 442,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 432,
"end": 442,
"ctxt": 0
},
"value": "fieldFunc2",
"optional": false
}
}
},
"typeParameters": null,
"template": {
"type": "TemplateLiteral",
"span": {
"start": 442,
"end": 466,
"ctxt": 0
},
"expressions": [
{
"type": "NumericLiteral",
"span": {
"start": 449,
"end": 450,
"ctxt": 0
},
"value": 1.0
},
{
"type": "NumericLiteral",
"span": {
"start": 459,
"end": 460,
"ctxt": 0
},
"value": 2.0
}
],
"quasis": [
{
"type": "TemplateElement",
"span": {
"start": 443,
"end": 447,
"ctxt": 0
},
"tail": false,
"cooked": {
"type": "StringLiteral",
"span": {
"start": 443,
"end": 447,
"ctxt": 0
},
"value": "head",
"hasEscape": false,
"kind": {
"type": "normal",
"containsQuote": false
}
},
"raw": {
"type": "StringLiteral",
"span": {
"start": 443,
"end": 447,
"ctxt": 0
},
"value": "head",
"hasEscape": false,
"kind": {
"type": "normal",
"containsQuote": false
}
}
},
{
"type": "TemplateElement",
"span": {
"start": 451,
"end": 457,
"ctxt": 0
},
"tail": false,
"cooked": {
"type": "StringLiteral",
"span": {
"start": 451,
"end": 457,
"ctxt": 0
},
"value": "middle",
"hasEscape": false,
"kind": {
"type": "normal",
"containsQuote": false
}
},
"raw": {
"type": "StringLiteral",
"span": {
"start": 451,
"end": 457,
"ctxt": 0
},
"value": "middle",
"hasEscape": false,
"kind": {
"type": "normal",
"containsQuote": false
}
}
},
{
"type": "TemplateElement",
"span": {
"start": 461,
"end": 465,
"ctxt": 0
},
"tail": true,
"cooked": {
"type": "StringLiteral",
"span": {
"start": 461,
"end": 465,
"ctxt": 0
},
"value": "tail",
"hasEscape": false,
"kind": {
"type": "normal",
"containsQuote": false
}
},
"raw": {
"type": "StringLiteral",
"span": {
"start": 461,
"end": 465,
"ctxt": 0
},
"value": "tail",
"hasEscape": false,
"kind": {
"type": "normal",
"containsQuote": false
}
}
}
]
}
},
"definite": false
}
]
},
{
"type": "ExpressionStatement",
"span": {
"start": 476,
"end": 524,
"ctxt": 0
},
"expression": {
"type": "TaggedTemplateExpression",
"span": {
"start": 476,
"end": 523,
"ctxt": 0
},
"tag": {
"type": "MemberExpression",
"span": {
"start": 476,
"end": 506,
"ctxt": 0
},
"object": {
"type": "CallExpression",
"span": {
"start": 476,
"end": 494,
"ctxt": 0
},
"callee": {
"type": "MemberExpression",
"span": {
"start": 476,
"end": 492,
"ctxt": 0
},
"object": {
"type": "ThisExpression",
"span": {
"start": 476,
"end": 480,
"ctxt": 0
}
},
"property": {
"type": "Identifier",
"span": {
"start": 481,
"end": 492,
"ctxt": 0
},
"value": "getInstance",
"optional": false
}
},
"arguments": [],
"typeArguments": null
},
"property": {
"type": "PrivateName",
"span": {
"start": 495,
"end": 506,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 496,
"end": 506,
"ctxt": 0
},
"value": "fieldFunc2",
"optional": false
}
}
},
"typeParameters": null,
"template": {
"type": "TemplateLiteral",
"span": {
"start": 506,
"end": 523,
"ctxt": 0
},
"expressions": [
{
"type": "NumericLiteral",
"span": {
"start": 513,
"end": 514,
"ctxt": 0
},
"value": 1.0
},
{
"type": "NumericLiteral",
"span": {
"start": 520,
"end": 521,
"ctxt": 0
},
"value": 2.0
}
],
"quasis": [
{
"type": "TemplateElement",
"span": {
"start": 507,
"end": 511,
"ctxt": 0
},
"tail": false,
"cooked": {
"type": "StringLiteral",
"span": {
"start": 507,
"end": 511,
"ctxt": 0
},
"value": "test",
"hasEscape": false,
"kind": {
"type": "normal",
"containsQuote": false
}
},
"raw": {
"type": "StringLiteral",
"span": {
"start": 507,
"end": 511,
"ctxt": 0
},
"value": "test",
"hasEscape": false,
"kind": {
"type": "normal",
"containsQuote": false
}
}
},
{
"type": "TemplateElement",
"span": {
"start": 515,
"end": 518,
"ctxt": 0
},
"tail": false,
"cooked": {
"type": "StringLiteral",
"span": {
"start": 515,
"end": 518,
"ctxt": 0
},
"value": "and",
"hasEscape": false,
"kind": {
"type": "normal",
"containsQuote": false
}
},
"raw": {
"type": "StringLiteral",
"span": {
"start": 515,
"end": 518,
"ctxt": 0
},
"value": "and",
"hasEscape": false,
"kind": {
"type": "normal",
"containsQuote": false
}
}
},
{
"type": "TemplateElement",
"span": {
"start": 522,
"end": 522,
"ctxt": 0
},
"tail": true,
"cooked": {
"type": "StringLiteral",
"span": {
"start": 522,
"end": 522,
"ctxt": 0
},
"value": "",
"hasEscape": false,
"kind": {
"type": "normal",
"containsQuote": false
}
},
"raw": {
"type": "StringLiteral",
"span": {
"start": 522,
"end": 522,
"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": 535,
"end": 568,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 535,
"end": 546,
"ctxt": 0
},
"value": "getInstance",
"optional": false
},
"function": {
"params": [],
"decorators": [],
"span": {
"start": 535,
"end": 568,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 549,
"end": 568,
"ctxt": 0
},
"stmts": [
{
"type": "ReturnStatement",
"span": {
"start": 551,
"end": 566,
"ctxt": 0
},
"argument": {
"type": "NewExpression",
"span": {
"start": 558,
"end": 565,
"ctxt": 0
},
"callee": {
"type": "Identifier",
"span": {
"start": 562,
"end": 563,
"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
}