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

1283 lines
36 KiB
JSON

{
"type": "Script",
"span": {
"start": 88,
"end": 616,
"ctxt": 0
},
"body": [
{
"type": "ClassDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 94,
"end": 95,
"ctxt": 0
},
"value": "A",
"optional": false
},
"declare": false,
"span": {
"start": 88,
"end": 500,
"ctxt": 0
},
"decorators": [],
"body": [
{
"type": "PrivateMethod",
"span": {
"start": 102,
"end": 120,
"ctxt": 0
},
"key": {
"type": "PrivateName",
"span": {
"start": 102,
"end": 106,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 103,
"end": 106,
"ctxt": 0
},
"value": "foo",
"optional": false
}
},
"function": {
"params": [
{
"type": "Parameter",
"span": {
"start": 107,
"end": 116,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 107,
"end": 116,
"ctxt": 0
},
"value": "a",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 108,
"end": 116,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 110,
"end": 116,
"ctxt": 0
},
"kind": "number"
}
}
}
}
],
"decorators": [],
"span": {
"start": 102,
"end": 120,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 118,
"end": 120,
"ctxt": 0
},
"stmts": []
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
},
"kind": "method",
"isStatic": false,
"accessibility": null,
"isAbstract": false,
"isOptional": false,
"isOverride": false
},
{
"type": "PrivateMethod",
"span": {
"start": 125,
"end": 149,
"ctxt": 0
},
"key": {
"type": "PrivateName",
"span": {
"start": 131,
"end": 135,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 132,
"end": 135,
"ctxt": 0
},
"value": "bar",
"optional": false
}
},
"function": {
"params": [
{
"type": "Parameter",
"span": {
"start": 136,
"end": 145,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 136,
"end": 145,
"ctxt": 0
},
"value": "a",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 137,
"end": 145,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 139,
"end": 145,
"ctxt": 0
},
"kind": "number"
}
}
}
}
],
"decorators": [],
"span": {
"start": 125,
"end": 149,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 147,
"end": 149,
"ctxt": 0
},
"stmts": []
},
"generator": false,
"async": true,
"typeParameters": null,
"returnType": null
},
"kind": "method",
"isStatic": false,
"accessibility": null,
"isAbstract": false,
"isOptional": false,
"isOverride": false
},
{
"type": "PrivateMethod",
"span": {
"start": 154,
"end": 202,
"ctxt": 0
},
"key": {
"type": "PrivateName",
"span": {
"start": 161,
"end": 165,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 162,
"end": 165,
"ctxt": 0
},
"value": "baz",
"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": 154,
"end": 202,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 177,
"end": 202,
"ctxt": 0
},
"stmts": [
{
"type": "ReturnStatement",
"span": {
"start": 187,
"end": 196,
"ctxt": 0
},
"argument": {
"type": "NumericLiteral",
"span": {
"start": 194,
"end": 195,
"ctxt": 0
},
"value": 3.0,
"raw": "3"
}
}
]
},
"generator": true,
"async": true,
"typeParameters": null,
"returnType": null
},
"kind": "method",
"isStatic": false,
"accessibility": null,
"isAbstract": false,
"isOptional": false,
"isOverride": false
},
{
"type": "PrivateProperty",
"span": {
"start": 207,
"end": 222,
"ctxt": 0
},
"key": {
"type": "PrivateName",
"span": {
"start": 207,
"end": 213,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 208,
"end": 213,
"ctxt": 0
},
"value": "_quux",
"optional": false
}
},
"value": null,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 213,
"end": 221,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 215,
"end": 221,
"ctxt": 0
},
"kind": "number"
}
},
"isStatic": false,
"decorators": [],
"accessibility": null,
"isOptional": false,
"isOverride": false,
"readonly": false,
"definite": false
},
{
"type": "PrivateMethod",
"span": {
"start": 227,
"end": 283,
"ctxt": 0
},
"key": {
"type": "PrivateName",
"span": {
"start": 231,
"end": 236,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 232,
"end": 236,
"ctxt": 0
},
"value": "quux",
"optional": false
}
},
"function": {
"params": [],
"decorators": [],
"span": {
"start": 227,
"end": 283,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 248,
"end": 283,
"ctxt": 0
},
"stmts": [
{
"type": "ReturnStatement",
"span": {
"start": 258,
"end": 277,
"ctxt": 0
},
"argument": {
"type": "MemberExpression",
"span": {
"start": 265,
"end": 276,
"ctxt": 0
},
"object": {
"type": "ThisExpression",
"span": {
"start": 265,
"end": 269,
"ctxt": 0
}
},
"property": {
"type": "PrivateName",
"span": {
"start": 270,
"end": 276,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 271,
"end": 276,
"ctxt": 0
},
"value": "_quux",
"optional": false
}
}
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": {
"type": "TsTypeAnnotation",
"span": {
"start": 239,
"end": 247,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 241,
"end": 247,
"ctxt": 0
},
"kind": "number"
}
}
},
"kind": "getter",
"isStatic": false,
"accessibility": null,
"isAbstract": false,
"isOptional": false,
"isOverride": false
},
{
"type": "PrivateMethod",
"span": {
"start": 288,
"end": 346,
"ctxt": 0
},
"key": {
"type": "PrivateName",
"span": {
"start": 292,
"end": 297,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 293,
"end": 297,
"ctxt": 0
},
"value": "quux",
"optional": false
}
},
"function": {
"params": [
{
"type": "Parameter",
"span": {
"start": 299,
"end": 310,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 299,
"end": 310,
"ctxt": 0
},
"value": "val",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 302,
"end": 310,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 304,
"end": 310,
"ctxt": 0
},
"kind": "number"
}
}
}
}
],
"decorators": [],
"span": {
"start": 288,
"end": 346,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 312,
"end": 346,
"ctxt": 0
},
"stmts": [
{
"type": "ExpressionStatement",
"span": {
"start": 322,
"end": 340,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 322,
"end": 339,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "MemberExpression",
"span": {
"start": 322,
"end": 333,
"ctxt": 0
},
"object": {
"type": "ThisExpression",
"span": {
"start": 322,
"end": 326,
"ctxt": 0
}
},
"property": {
"type": "PrivateName",
"span": {
"start": 327,
"end": 333,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 328,
"end": 333,
"ctxt": 0
},
"value": "_quux",
"optional": false
}
}
},
"right": {
"type": "Identifier",
"span": {
"start": 336,
"end": 339,
"ctxt": 0
},
"value": "val",
"optional": false
}
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
},
"kind": "setter",
"isStatic": false,
"accessibility": null,
"isAbstract": false,
"isOptional": false,
"isOverride": false
},
{
"type": "Constructor",
"span": {
"start": 351,
"end": 498,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 351,
"end": 362,
"ctxt": 0
},
"value": "constructor",
"optional": false
},
"params": [],
"body": {
"type": "BlockStatement",
"span": {
"start": 366,
"end": 498,
"ctxt": 0
},
"stmts": [
{
"type": "ExpressionStatement",
"span": {
"start": 376,
"end": 390,
"ctxt": 0
},
"expression": {
"type": "CallExpression",
"span": {
"start": 376,
"end": 389,
"ctxt": 0
},
"callee": {
"type": "MemberExpression",
"span": {
"start": 376,
"end": 385,
"ctxt": 0
},
"object": {
"type": "ThisExpression",
"span": {
"start": 376,
"end": 380,
"ctxt": 0
}
},
"property": {
"type": "PrivateName",
"span": {
"start": 381,
"end": 385,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 382,
"end": 385,
"ctxt": 0
},
"value": "foo",
"optional": false
}
}
},
"arguments": [
{
"spread": null,
"expression": {
"type": "NumericLiteral",
"span": {
"start": 386,
"end": 388,
"ctxt": 0
},
"value": 30.0,
"raw": "30"
}
}
],
"typeArguments": null
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 399,
"end": 413,
"ctxt": 0
},
"expression": {
"type": "CallExpression",
"span": {
"start": 399,
"end": 412,
"ctxt": 0
},
"callee": {
"type": "MemberExpression",
"span": {
"start": 399,
"end": 408,
"ctxt": 0
},
"object": {
"type": "ThisExpression",
"span": {
"start": 399,
"end": 403,
"ctxt": 0
}
},
"property": {
"type": "PrivateName",
"span": {
"start": 404,
"end": 408,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 405,
"end": 408,
"ctxt": 0
},
"value": "bar",
"optional": false
}
}
},
"arguments": [
{
"spread": null,
"expression": {
"type": "NumericLiteral",
"span": {
"start": 409,
"end": 411,
"ctxt": 0
},
"value": 30.0,
"raw": "30"
}
}
],
"typeArguments": null
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 422,
"end": 436,
"ctxt": 0
},
"expression": {
"type": "CallExpression",
"span": {
"start": 422,
"end": 435,
"ctxt": 0
},
"callee": {
"type": "MemberExpression",
"span": {
"start": 422,
"end": 431,
"ctxt": 0
},
"object": {
"type": "ThisExpression",
"span": {
"start": 422,
"end": 426,
"ctxt": 0
}
},
"property": {
"type": "PrivateName",
"span": {
"start": 427,
"end": 431,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 428,
"end": 431,
"ctxt": 0
},
"value": "baz",
"optional": false
}
}
},
"arguments": [
{
"spread": null,
"expression": {
"type": "NumericLiteral",
"span": {
"start": 432,
"end": 434,
"ctxt": 0
},
"value": 30.0,
"raw": "30"
}
}
],
"typeArguments": null
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 445,
"end": 473,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 445,
"end": 472,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "MemberExpression",
"span": {
"start": 445,
"end": 455,
"ctxt": 0
},
"object": {
"type": "ThisExpression",
"span": {
"start": 445,
"end": 449,
"ctxt": 0
}
},
"property": {
"type": "PrivateName",
"span": {
"start": 450,
"end": 455,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 451,
"end": 455,
"ctxt": 0
},
"value": "quux",
"optional": false
}
}
},
"right": {
"type": "BinaryExpression",
"span": {
"start": 458,
"end": 472,
"ctxt": 0
},
"operator": "+",
"left": {
"type": "MemberExpression",
"span": {
"start": 458,
"end": 468,
"ctxt": 0
},
"object": {
"type": "ThisExpression",
"span": {
"start": 458,
"end": 462,
"ctxt": 0
}
},
"property": {
"type": "PrivateName",
"span": {
"start": 463,
"end": 468,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 464,
"end": 468,
"ctxt": 0
},
"value": "quux",
"optional": false
}
}
},
"right": {
"type": "NumericLiteral",
"span": {
"start": 471,
"end": 472,
"ctxt": 0
},
"value": 1.0,
"raw": "1"
}
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 482,
"end": 495,
"ctxt": 0
},
"expression": {
"type": "UpdateExpression",
"span": {
"start": 482,
"end": 494,
"ctxt": 0
},
"operator": "++",
"prefix": false,
"argument": {
"type": "MemberExpression",
"span": {
"start": 482,
"end": 492,
"ctxt": 0
},
"object": {
"type": "ThisExpression",
"span": {
"start": 482,
"end": 486,
"ctxt": 0
}
},
"property": {
"type": "PrivateName",
"span": {
"start": 487,
"end": 492,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 488,
"end": 492,
"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": 508,
"end": 509,
"ctxt": 0
},
"value": "B",
"optional": false
},
"declare": false,
"span": {
"start": 502,
"end": 616,
"ctxt": 0
},
"decorators": [],
"body": [
{
"type": "PrivateMethod",
"span": {
"start": 526,
"end": 544,
"ctxt": 0
},
"key": {
"type": "PrivateName",
"span": {
"start": 526,
"end": 530,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 527,
"end": 530,
"ctxt": 0
},
"value": "foo",
"optional": false
}
},
"function": {
"params": [
{
"type": "Parameter",
"span": {
"start": 531,
"end": 540,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 531,
"end": 540,
"ctxt": 0
},
"value": "a",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 532,
"end": 540,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 534,
"end": 540,
"ctxt": 0
},
"kind": "string"
}
}
}
}
],
"decorators": [],
"span": {
"start": 526,
"end": 544,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 542,
"end": 544,
"ctxt": 0
},
"stmts": []
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
},
"kind": "method",
"isStatic": false,
"accessibility": null,
"isAbstract": false,
"isOptional": false,
"isOverride": false
},
{
"type": "Constructor",
"span": {
"start": 549,
"end": 614,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 549,
"end": 560,
"ctxt": 0
},
"value": "constructor",
"optional": false
},
"params": [],
"body": {
"type": "BlockStatement",
"span": {
"start": 564,
"end": 614,
"ctxt": 0
},
"stmts": [
{
"type": "ExpressionStatement",
"span": {
"start": 574,
"end": 582,
"ctxt": 0
},
"expression": {
"type": "CallExpression",
"span": {
"start": 574,
"end": 581,
"ctxt": 0
},
"callee": {
"type": "Super",
"span": {
"start": 574,
"end": 579,
"ctxt": 0
}
},
"arguments": [],
"typeArguments": null
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 591,
"end": 608,
"ctxt": 0
},
"expression": {
"type": "CallExpression",
"span": {
"start": 591,
"end": 607,
"ctxt": 0
},
"callee": {
"type": "MemberExpression",
"span": {
"start": 591,
"end": 600,
"ctxt": 0
},
"object": {
"type": "ThisExpression",
"span": {
"start": 591,
"end": 595,
"ctxt": 0
}
},
"property": {
"type": "PrivateName",
"span": {
"start": 596,
"end": 600,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 597,
"end": 600,
"ctxt": 0
},
"value": "foo",
"optional": false
}
}
},
"arguments": [
{
"spread": null,
"expression": {
"type": "StringLiteral",
"span": {
"start": 601,
"end": 606,
"ctxt": 0
},
"value": "str",
"raw": "\"str\""
}
}
],
"typeArguments": null
}
}
]
},
"accessibility": null,
"isOptional": false
}
],
"superClass": {
"type": "Identifier",
"span": {
"start": 518,
"end": 519,
"ctxt": 0
},
"value": "A",
"optional": false
},
"isAbstract": false,
"typeParams": null,
"superTypeParams": null,
"implements": []
}
],
"interpreter": null
}