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

1297 lines
36 KiB
JSON

{
"type": "Script",
"span": {
"start": 105,
"end": 661,
"ctxt": 0
},
"body": [
{
"type": "ClassDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 111,
"end": 112,
"ctxt": 0
},
"value": "A",
"optional": false
},
"declare": false,
"span": {
"start": 105,
"end": 541,
"ctxt": 0
},
"decorators": [],
"body": [
{
"type": "PrivateMethod",
"span": {
"start": 119,
"end": 144,
"ctxt": 0
},
"key": {
"type": "PrivateName",
"span": {
"start": 126,
"end": 130,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 127,
"end": 130,
"ctxt": 0
},
"value": "foo",
"optional": false
}
},
"function": {
"params": [
{
"type": "Parameter",
"span": {
"start": 131,
"end": 140,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 131,
"end": 140,
"ctxt": 0
},
"value": "a",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 132,
"end": 140,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 134,
"end": 140,
"ctxt": 0
},
"kind": "number"
}
}
}
}
],
"decorators": [],
"span": {
"start": 119,
"end": 144,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 142,
"end": 144,
"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": 149,
"end": 180,
"ctxt": 0
},
"key": {
"type": "PrivateName",
"span": {
"start": 162,
"end": 166,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 163,
"end": 166,
"ctxt": 0
},
"value": "bar",
"optional": false
}
},
"function": {
"params": [
{
"type": "Parameter",
"span": {
"start": 167,
"end": 176,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 167,
"end": 176,
"ctxt": 0
},
"value": "a",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 168,
"end": 176,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 170,
"end": 176,
"ctxt": 0
},
"kind": "number"
}
}
}
}
],
"decorators": [],
"span": {
"start": 149,
"end": 180,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 178,
"end": 180,
"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": 185,
"end": 240,
"ctxt": 0
},
"key": {
"type": "PrivateName",
"span": {
"start": 199,
"end": 203,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 200,
"end": 203,
"ctxt": 0
},
"value": "baz",
"optional": false
}
},
"function": {
"params": [
{
"type": "Parameter",
"span": {
"start": 204,
"end": 213,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 204,
"end": 213,
"ctxt": 0
},
"value": "a",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 205,
"end": 213,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 207,
"end": 213,
"ctxt": 0
},
"kind": "number"
}
}
}
}
],
"decorators": [],
"span": {
"start": 185,
"end": 240,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 215,
"end": 240,
"ctxt": 0
},
"stmts": [
{
"type": "ReturnStatement",
"span": {
"start": 225,
"end": 234,
"ctxt": 0
},
"argument": {
"type": "NumericLiteral",
"span": {
"start": 232,
"end": 233,
"ctxt": 0
},
"value": 3.0,
"raw": "3"
}
}
]
},
"generator": true,
"async": true,
"typeParameters": null,
"returnType": null
},
"kind": "method",
"isStatic": true,
"accessibility": null,
"isAbstract": false,
"isOptional": false,
"isOverride": false
},
{
"type": "PrivateProperty",
"span": {
"start": 245,
"end": 267,
"ctxt": 0
},
"key": {
"type": "PrivateName",
"span": {
"start": 252,
"end": 258,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 253,
"end": 258,
"ctxt": 0
},
"value": "_quux",
"optional": false
}
},
"value": null,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 258,
"end": 266,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 260,
"end": 266,
"ctxt": 0
},
"kind": "number"
}
},
"isStatic": true,
"decorators": [],
"accessibility": null,
"isOptional": false,
"isOverride": false,
"readonly": false,
"definite": false
},
{
"type": "PrivateMethod",
"span": {
"start": 272,
"end": 335,
"ctxt": 0
},
"key": {
"type": "PrivateName",
"span": {
"start": 283,
"end": 288,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 284,
"end": 288,
"ctxt": 0
},
"value": "quux",
"optional": false
}
},
"function": {
"params": [],
"decorators": [],
"span": {
"start": 272,
"end": 335,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 300,
"end": 335,
"ctxt": 0
},
"stmts": [
{
"type": "ReturnStatement",
"span": {
"start": 310,
"end": 329,
"ctxt": 0
},
"argument": {
"type": "MemberExpression",
"span": {
"start": 317,
"end": 328,
"ctxt": 0
},
"object": {
"type": "ThisExpression",
"span": {
"start": 317,
"end": 321,
"ctxt": 0
}
},
"property": {
"type": "PrivateName",
"span": {
"start": 322,
"end": 328,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 323,
"end": 328,
"ctxt": 0
},
"value": "_quux",
"optional": false
}
}
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": {
"type": "TsTypeAnnotation",
"span": {
"start": 291,
"end": 299,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 293,
"end": 299,
"ctxt": 0
},
"kind": "number"
}
}
},
"kind": "getter",
"isStatic": true,
"accessibility": null,
"isAbstract": false,
"isOptional": false,
"isOverride": false
},
{
"type": "PrivateMethod",
"span": {
"start": 340,
"end": 405,
"ctxt": 0
},
"key": {
"type": "PrivateName",
"span": {
"start": 351,
"end": 356,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 352,
"end": 356,
"ctxt": 0
},
"value": "quux",
"optional": false
}
},
"function": {
"params": [
{
"type": "Parameter",
"span": {
"start": 358,
"end": 369,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 358,
"end": 369,
"ctxt": 0
},
"value": "val",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 361,
"end": 369,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 363,
"end": 369,
"ctxt": 0
},
"kind": "number"
}
}
}
}
],
"decorators": [],
"span": {
"start": 340,
"end": 405,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 371,
"end": 405,
"ctxt": 0
},
"stmts": [
{
"type": "ExpressionStatement",
"span": {
"start": 381,
"end": 399,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 381,
"end": 398,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "MemberExpression",
"span": {
"start": 381,
"end": 392,
"ctxt": 0
},
"object": {
"type": "ThisExpression",
"span": {
"start": 381,
"end": 385,
"ctxt": 0
}
},
"property": {
"type": "PrivateName",
"span": {
"start": 386,
"end": 392,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 387,
"end": 392,
"ctxt": 0
},
"value": "_quux",
"optional": false
}
}
},
"right": {
"type": "Identifier",
"span": {
"start": 395,
"end": 398,
"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": 410,
"end": 539,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 410,
"end": 421,
"ctxt": 0
},
"value": "constructor",
"optional": false
},
"params": [],
"body": {
"type": "BlockStatement",
"span": {
"start": 425,
"end": 539,
"ctxt": 0
},
"stmts": [
{
"type": "ExpressionStatement",
"span": {
"start": 435,
"end": 446,
"ctxt": 0
},
"expression": {
"type": "CallExpression",
"span": {
"start": 435,
"end": 445,
"ctxt": 0
},
"callee": {
"type": "MemberExpression",
"span": {
"start": 435,
"end": 441,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 435,
"end": 436,
"ctxt": 0
},
"value": "A",
"optional": false
},
"property": {
"type": "PrivateName",
"span": {
"start": 437,
"end": 441,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 438,
"end": 441,
"ctxt": 0
},
"value": "foo",
"optional": false
}
}
},
"arguments": [
{
"spread": null,
"expression": {
"type": "NumericLiteral",
"span": {
"start": 442,
"end": 444,
"ctxt": 0
},
"value": 30.0,
"raw": "30"
}
}
],
"typeArguments": null
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 455,
"end": 466,
"ctxt": 0
},
"expression": {
"type": "CallExpression",
"span": {
"start": 455,
"end": 465,
"ctxt": 0
},
"callee": {
"type": "MemberExpression",
"span": {
"start": 455,
"end": 461,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 455,
"end": 456,
"ctxt": 0
},
"value": "A",
"optional": false
},
"property": {
"type": "PrivateName",
"span": {
"start": 457,
"end": 461,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 458,
"end": 461,
"ctxt": 0
},
"value": "bar",
"optional": false
}
}
},
"arguments": [
{
"spread": null,
"expression": {
"type": "NumericLiteral",
"span": {
"start": 462,
"end": 464,
"ctxt": 0
},
"value": 30.0,
"raw": "30"
}
}
],
"typeArguments": null
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 475,
"end": 486,
"ctxt": 0
},
"expression": {
"type": "CallExpression",
"span": {
"start": 475,
"end": 485,
"ctxt": 0
},
"callee": {
"type": "MemberExpression",
"span": {
"start": 475,
"end": 481,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 475,
"end": 476,
"ctxt": 0
},
"value": "A",
"optional": false
},
"property": {
"type": "PrivateName",
"span": {
"start": 477,
"end": 481,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 478,
"end": 481,
"ctxt": 0
},
"value": "bar",
"optional": false
}
}
},
"arguments": [
{
"spread": null,
"expression": {
"type": "NumericLiteral",
"span": {
"start": 482,
"end": 484,
"ctxt": 0
},
"value": 30.0,
"raw": "30"
}
}
],
"typeArguments": null
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 495,
"end": 517,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 495,
"end": 516,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "MemberExpression",
"span": {
"start": 495,
"end": 502,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 495,
"end": 496,
"ctxt": 0
},
"value": "A",
"optional": false
},
"property": {
"type": "PrivateName",
"span": {
"start": 497,
"end": 502,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 498,
"end": 502,
"ctxt": 0
},
"value": "quux",
"optional": false
}
}
},
"right": {
"type": "BinaryExpression",
"span": {
"start": 505,
"end": 516,
"ctxt": 0
},
"operator": "+",
"left": {
"type": "MemberExpression",
"span": {
"start": 505,
"end": 512,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 505,
"end": 506,
"ctxt": 0
},
"value": "A",
"optional": false
},
"property": {
"type": "PrivateName",
"span": {
"start": 507,
"end": 512,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 508,
"end": 512,
"ctxt": 0
},
"value": "quux",
"optional": false
}
}
},
"right": {
"type": "NumericLiteral",
"span": {
"start": 515,
"end": 516,
"ctxt": 0
},
"value": 1.0,
"raw": "1"
}
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 526,
"end": 536,
"ctxt": 0
},
"expression": {
"type": "UpdateExpression",
"span": {
"start": 526,
"end": 535,
"ctxt": 0
},
"operator": "++",
"prefix": false,
"argument": {
"type": "MemberExpression",
"span": {
"start": 526,
"end": 533,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 526,
"end": 527,
"ctxt": 0
},
"value": "A",
"optional": false
},
"property": {
"type": "PrivateName",
"span": {
"start": 528,
"end": 533,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 529,
"end": 533,
"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": 549,
"end": 550,
"ctxt": 0
},
"value": "B",
"optional": false
},
"declare": false,
"span": {
"start": 543,
"end": 661,
"ctxt": 0
},
"decorators": [],
"body": [
{
"type": "PrivateMethod",
"span": {
"start": 567,
"end": 592,
"ctxt": 0
},
"key": {
"type": "PrivateName",
"span": {
"start": 574,
"end": 578,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 575,
"end": 578,
"ctxt": 0
},
"value": "foo",
"optional": false
}
},
"function": {
"params": [
{
"type": "Parameter",
"span": {
"start": 579,
"end": 588,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 579,
"end": 588,
"ctxt": 0
},
"value": "a",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 580,
"end": 588,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 582,
"end": 588,
"ctxt": 0
},
"kind": "string"
}
}
}
}
],
"decorators": [],
"span": {
"start": 567,
"end": 592,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 590,
"end": 592,
"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": 597,
"end": 659,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 597,
"end": 608,
"ctxt": 0
},
"value": "constructor",
"optional": false
},
"params": [],
"body": {
"type": "BlockStatement",
"span": {
"start": 612,
"end": 659,
"ctxt": 0
},
"stmts": [
{
"type": "ExpressionStatement",
"span": {
"start": 622,
"end": 630,
"ctxt": 0
},
"expression": {
"type": "CallExpression",
"span": {
"start": 622,
"end": 629,
"ctxt": 0
},
"callee": {
"type": "Super",
"span": {
"start": 622,
"end": 627,
"ctxt": 0
}
},
"arguments": [],
"typeArguments": null
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 639,
"end": 653,
"ctxt": 0
},
"expression": {
"type": "CallExpression",
"span": {
"start": 639,
"end": 652,
"ctxt": 0
},
"callee": {
"type": "MemberExpression",
"span": {
"start": 639,
"end": 645,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 639,
"end": 640,
"ctxt": 0
},
"value": "B",
"optional": false
},
"property": {
"type": "PrivateName",
"span": {
"start": 641,
"end": 645,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 642,
"end": 645,
"ctxt": 0
},
"value": "foo",
"optional": false
}
}
},
"arguments": [
{
"spread": null,
"expression": {
"type": "StringLiteral",
"span": {
"start": 646,
"end": 651,
"ctxt": 0
},
"value": "str",
"raw": "\"str\""
}
}
],
"typeArguments": null
}
}
]
},
"accessibility": null,
"isOptional": false
}
],
"superClass": {
"type": "Identifier",
"span": {
"start": 559,
"end": 560,
"ctxt": 0
},
"value": "A",
"optional": false
},
"isAbstract": false,
"typeParams": null,
"superTypeParams": null,
"implements": []
}
],
"interpreter": null
}