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

1296 lines
36 KiB
JSON

{
"type": "Script",
"span": {
"start": 104,
"end": 660,
"ctxt": 0
},
"body": [
{
"type": "ClassDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 110,
"end": 111,
"ctxt": 0
},
"value": "A",
"optional": false
},
"declare": false,
"span": {
"start": 104,
"end": 540,
"ctxt": 0
},
"decorators": [],
"body": [
{
"type": "PrivateMethod",
"span": {
"start": 118,
"end": 143,
"ctxt": 0
},
"key": {
"type": "PrivateName",
"span": {
"start": 125,
"end": 129,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 126,
"end": 129,
"ctxt": 0
},
"value": "foo",
"optional": false
}
},
"function": {
"params": [
{
"type": "Parameter",
"span": {
"start": 130,
"end": 139,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 130,
"end": 139,
"ctxt": 0
},
"value": "a",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 131,
"end": 139,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 133,
"end": 139,
"ctxt": 0
},
"kind": "number"
}
}
}
}
],
"decorators": [],
"span": {
"start": 118,
"end": 143,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 141,
"end": 143,
"ctxt": 0
},
"stmts": []
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
},
"kind": "method",
"isStatic": true,
"accessibility": null,
"isAbstract": false,
"isOptional": false,
"isOverride": false
},
{
"type": "PrivateMethod",
"span": {
"start": 148,
"end": 179,
"ctxt": 0
},
"key": {
"type": "PrivateName",
"span": {
"start": 161,
"end": 165,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 162,
"end": 165,
"ctxt": 0
},
"value": "bar",
"optional": false
}
},
"function": {
"params": [
{
"type": "Parameter",
"span": {
"start": 166,
"end": 175,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 166,
"end": 175,
"ctxt": 0
},
"value": "a",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 167,
"end": 175,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 169,
"end": 175,
"ctxt": 0
},
"kind": "number"
}
}
}
}
],
"decorators": [],
"span": {
"start": 148,
"end": 179,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 177,
"end": 179,
"ctxt": 0
},
"stmts": []
},
"generator": false,
"async": true,
"typeParameters": null,
"returnType": null
},
"kind": "method",
"isStatic": true,
"accessibility": null,
"isAbstract": false,
"isOptional": false,
"isOverride": false
},
{
"type": "PrivateMethod",
"span": {
"start": 184,
"end": 239,
"ctxt": 0
},
"key": {
"type": "PrivateName",
"span": {
"start": 198,
"end": 202,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 199,
"end": 202,
"ctxt": 0
},
"value": "baz",
"optional": false
}
},
"function": {
"params": [
{
"type": "Parameter",
"span": {
"start": 203,
"end": 212,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 203,
"end": 212,
"ctxt": 0
},
"value": "a",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 204,
"end": 212,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 206,
"end": 212,
"ctxt": 0
},
"kind": "number"
}
}
}
}
],
"decorators": [],
"span": {
"start": 184,
"end": 239,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 214,
"end": 239,
"ctxt": 0
},
"stmts": [
{
"type": "ReturnStatement",
"span": {
"start": 224,
"end": 233,
"ctxt": 0
},
"argument": {
"type": "NumericLiteral",
"span": {
"start": 231,
"end": 232,
"ctxt": 0
},
"value": 3.0
}
}
]
},
"generator": true,
"async": true,
"typeParameters": null,
"returnType": null
},
"kind": "method",
"isStatic": true,
"accessibility": null,
"isAbstract": false,
"isOptional": false,
"isOverride": false
},
{
"type": "PrivateProperty",
"span": {
"start": 244,
"end": 266,
"ctxt": 0
},
"key": {
"type": "PrivateName",
"span": {
"start": 251,
"end": 257,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 252,
"end": 257,
"ctxt": 0
},
"value": "_quux",
"optional": false
}
},
"value": null,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 257,
"end": 265,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 259,
"end": 265,
"ctxt": 0
},
"kind": "number"
}
},
"isStatic": true,
"decorators": [],
"accessibility": null,
"isOptional": false,
"isOverride": false,
"readonly": false,
"definite": false
},
{
"type": "PrivateMethod",
"span": {
"start": 271,
"end": 334,
"ctxt": 0
},
"key": {
"type": "PrivateName",
"span": {
"start": 282,
"end": 287,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 283,
"end": 287,
"ctxt": 0
},
"value": "quux",
"optional": false
}
},
"function": {
"params": [],
"decorators": [],
"span": {
"start": 271,
"end": 334,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 299,
"end": 334,
"ctxt": 0
},
"stmts": [
{
"type": "ReturnStatement",
"span": {
"start": 309,
"end": 328,
"ctxt": 0
},
"argument": {
"type": "MemberExpression",
"span": {
"start": 316,
"end": 327,
"ctxt": 0
},
"object": {
"type": "ThisExpression",
"span": {
"start": 316,
"end": 320,
"ctxt": 0
}
},
"property": {
"type": "PrivateName",
"span": {
"start": 321,
"end": 327,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 322,
"end": 327,
"ctxt": 0
},
"value": "_quux",
"optional": false
}
}
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": {
"type": "TsTypeAnnotation",
"span": {
"start": 290,
"end": 298,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 292,
"end": 298,
"ctxt": 0
},
"kind": "number"
}
}
},
"kind": "getter",
"isStatic": true,
"accessibility": null,
"isAbstract": false,
"isOptional": false,
"isOverride": false
},
{
"type": "PrivateMethod",
"span": {
"start": 339,
"end": 404,
"ctxt": 0
},
"key": {
"type": "PrivateName",
"span": {
"start": 350,
"end": 355,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 351,
"end": 355,
"ctxt": 0
},
"value": "quux",
"optional": false
}
},
"function": {
"params": [
{
"type": "Parameter",
"span": {
"start": 357,
"end": 368,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 357,
"end": 368,
"ctxt": 0
},
"value": "val",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 360,
"end": 368,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 362,
"end": 368,
"ctxt": 0
},
"kind": "number"
}
}
}
}
],
"decorators": [],
"span": {
"start": 339,
"end": 404,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 370,
"end": 404,
"ctxt": 0
},
"stmts": [
{
"type": "ExpressionStatement",
"span": {
"start": 380,
"end": 398,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 380,
"end": 397,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "MemberExpression",
"span": {
"start": 380,
"end": 391,
"ctxt": 0
},
"object": {
"type": "ThisExpression",
"span": {
"start": 380,
"end": 384,
"ctxt": 0
}
},
"property": {
"type": "PrivateName",
"span": {
"start": 385,
"end": 391,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 386,
"end": 391,
"ctxt": 0
},
"value": "_quux",
"optional": false
}
}
},
"right": {
"type": "Identifier",
"span": {
"start": 394,
"end": 397,
"ctxt": 0
},
"value": "val",
"optional": false
}
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
},
"kind": "setter",
"isStatic": true,
"accessibility": null,
"isAbstract": false,
"isOptional": false,
"isOverride": false
},
{
"type": "Constructor",
"span": {
"start": 409,
"end": 538,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 409,
"end": 420,
"ctxt": 0
},
"value": "constructor",
"optional": false
},
"params": [],
"body": {
"type": "BlockStatement",
"span": {
"start": 424,
"end": 538,
"ctxt": 0
},
"stmts": [
{
"type": "ExpressionStatement",
"span": {
"start": 434,
"end": 445,
"ctxt": 0
},
"expression": {
"type": "CallExpression",
"span": {
"start": 434,
"end": 444,
"ctxt": 0
},
"callee": {
"type": "MemberExpression",
"span": {
"start": 434,
"end": 440,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 434,
"end": 435,
"ctxt": 0
},
"value": "A",
"optional": false
},
"property": {
"type": "PrivateName",
"span": {
"start": 436,
"end": 440,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 437,
"end": 440,
"ctxt": 0
},
"value": "foo",
"optional": false
}
}
},
"arguments": [
{
"spread": null,
"expression": {
"type": "NumericLiteral",
"span": {
"start": 441,
"end": 443,
"ctxt": 0
},
"value": 30.0
}
}
],
"typeArguments": null
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 454,
"end": 465,
"ctxt": 0
},
"expression": {
"type": "CallExpression",
"span": {
"start": 454,
"end": 464,
"ctxt": 0
},
"callee": {
"type": "MemberExpression",
"span": {
"start": 454,
"end": 460,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 454,
"end": 455,
"ctxt": 0
},
"value": "A",
"optional": false
},
"property": {
"type": "PrivateName",
"span": {
"start": 456,
"end": 460,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 457,
"end": 460,
"ctxt": 0
},
"value": "bar",
"optional": false
}
}
},
"arguments": [
{
"spread": null,
"expression": {
"type": "NumericLiteral",
"span": {
"start": 461,
"end": 463,
"ctxt": 0
},
"value": 30.0
}
}
],
"typeArguments": null
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 474,
"end": 485,
"ctxt": 0
},
"expression": {
"type": "CallExpression",
"span": {
"start": 474,
"end": 484,
"ctxt": 0
},
"callee": {
"type": "MemberExpression",
"span": {
"start": 474,
"end": 480,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 474,
"end": 475,
"ctxt": 0
},
"value": "A",
"optional": false
},
"property": {
"type": "PrivateName",
"span": {
"start": 476,
"end": 480,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 477,
"end": 480,
"ctxt": 0
},
"value": "bar",
"optional": false
}
}
},
"arguments": [
{
"spread": null,
"expression": {
"type": "NumericLiteral",
"span": {
"start": 481,
"end": 483,
"ctxt": 0
},
"value": 30.0
}
}
],
"typeArguments": null
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 494,
"end": 516,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 494,
"end": 515,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "MemberExpression",
"span": {
"start": 494,
"end": 501,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 494,
"end": 495,
"ctxt": 0
},
"value": "A",
"optional": false
},
"property": {
"type": "PrivateName",
"span": {
"start": 496,
"end": 501,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 497,
"end": 501,
"ctxt": 0
},
"value": "quux",
"optional": false
}
}
},
"right": {
"type": "BinaryExpression",
"span": {
"start": 504,
"end": 515,
"ctxt": 0
},
"operator": "+",
"left": {
"type": "MemberExpression",
"span": {
"start": 504,
"end": 511,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 504,
"end": 505,
"ctxt": 0
},
"value": "A",
"optional": false
},
"property": {
"type": "PrivateName",
"span": {
"start": 506,
"end": 511,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 507,
"end": 511,
"ctxt": 0
},
"value": "quux",
"optional": false
}
}
},
"right": {
"type": "NumericLiteral",
"span": {
"start": 514,
"end": 515,
"ctxt": 0
},
"value": 1.0
}
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 525,
"end": 535,
"ctxt": 0
},
"expression": {
"type": "UpdateExpression",
"span": {
"start": 525,
"end": 534,
"ctxt": 0
},
"operator": "++",
"prefix": false,
"argument": {
"type": "MemberExpression",
"span": {
"start": 525,
"end": 532,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 525,
"end": 526,
"ctxt": 0
},
"value": "A",
"optional": false
},
"property": {
"type": "PrivateName",
"span": {
"start": 527,
"end": 532,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 528,
"end": 532,
"ctxt": 0
},
"value": "quux",
"optional": false
}
}
}
}
}
]
},
"accessibility": null,
"isOptional": false
}
],
"superClass": null,
"isAbstract": false,
"typeParams": null,
"superTypeParams": null,
"implements": []
},
{
"type": "ClassDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 548,
"end": 549,
"ctxt": 0
},
"value": "B",
"optional": false
},
"declare": false,
"span": {
"start": 542,
"end": 660,
"ctxt": 0
},
"decorators": [],
"body": [
{
"type": "PrivateMethod",
"span": {
"start": 566,
"end": 591,
"ctxt": 0
},
"key": {
"type": "PrivateName",
"span": {
"start": 573,
"end": 577,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 574,
"end": 577,
"ctxt": 0
},
"value": "foo",
"optional": false
}
},
"function": {
"params": [
{
"type": "Parameter",
"span": {
"start": 578,
"end": 587,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 578,
"end": 587,
"ctxt": 0
},
"value": "a",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 579,
"end": 587,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 581,
"end": 587,
"ctxt": 0
},
"kind": "string"
}
}
}
}
],
"decorators": [],
"span": {
"start": 566,
"end": 591,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 589,
"end": 591,
"ctxt": 0
},
"stmts": []
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
},
"kind": "method",
"isStatic": true,
"accessibility": null,
"isAbstract": false,
"isOptional": false,
"isOverride": false
},
{
"type": "Constructor",
"span": {
"start": 596,
"end": 658,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 596,
"end": 607,
"ctxt": 0
},
"value": "constructor",
"optional": false
},
"params": [],
"body": {
"type": "BlockStatement",
"span": {
"start": 611,
"end": 658,
"ctxt": 0
},
"stmts": [
{
"type": "ExpressionStatement",
"span": {
"start": 621,
"end": 629,
"ctxt": 0
},
"expression": {
"type": "CallExpression",
"span": {
"start": 621,
"end": 628,
"ctxt": 0
},
"callee": {
"type": "Super",
"span": {
"start": 621,
"end": 626,
"ctxt": 0
}
},
"arguments": [],
"typeArguments": null
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 638,
"end": 652,
"ctxt": 0
},
"expression": {
"type": "CallExpression",
"span": {
"start": 638,
"end": 651,
"ctxt": 0
},
"callee": {
"type": "MemberExpression",
"span": {
"start": 638,
"end": 644,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 638,
"end": 639,
"ctxt": 0
},
"value": "B",
"optional": false
},
"property": {
"type": "PrivateName",
"span": {
"start": 640,
"end": 644,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 641,
"end": 644,
"ctxt": 0
},
"value": "foo",
"optional": false
}
}
},
"arguments": [
{
"spread": null,
"expression": {
"type": "StringLiteral",
"span": {
"start": 645,
"end": 650,
"ctxt": 0
},
"value": "str",
"hasEscape": false,
"kind": {
"type": "normal",
"containsQuote": true
}
}
}
],
"typeArguments": null
}
}
]
},
"accessibility": null,
"isOptional": false
}
],
"superClass": {
"type": "Identifier",
"span": {
"start": 558,
"end": 559,
"ctxt": 0
},
"value": "A",
"optional": false
},
"isAbstract": false,
"typeParams": null,
"superTypeParams": null,
"implements": []
}
],
"interpreter": null
}