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

1284 lines
36 KiB
JSON
Raw Normal View History

{
"type": "Script",
"span": {
"start": 87,
"end": 615,
"ctxt": 0
},
"body": [
{
"type": "ClassDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 93,
"end": 94,
"ctxt": 0
},
"value": "A",
"optional": false
},
"declare": false,
"span": {
"start": 87,
"end": 499,
"ctxt": 0
},
"decorators": [],
"body": [
{
"type": "PrivateMethod",
"span": {
"start": 101,
"end": 119,
"ctxt": 0
},
"key": {
"type": "PrivateName",
"span": {
"start": 101,
"end": 105,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 102,
"end": 105,
"ctxt": 0
},
"value": "foo",
"optional": false
}
},
"function": {
"params": [
{
"type": "Parameter",
"span": {
"start": 106,
"end": 115,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 106,
"end": 115,
"ctxt": 0
},
"value": "a",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 107,
"end": 115,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 109,
"end": 115,
"ctxt": 0
},
"kind": "number"
}
}
}
}
],
"decorators": [],
"span": {
"start": 101,
"end": 119,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 117,
"end": 119,
"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": 124,
"end": 148,
"ctxt": 0
},
"key": {
"type": "PrivateName",
"span": {
"start": 130,
"end": 134,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 131,
"end": 134,
"ctxt": 0
},
"value": "bar",
"optional": false
}
},
"function": {
"params": [
{
"type": "Parameter",
"span": {
"start": 135,
"end": 144,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 135,
"end": 144,
"ctxt": 0
},
"value": "a",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 136,
"end": 144,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 138,
"end": 144,
"ctxt": 0
},
"kind": "number"
}
}
}
}
],
"decorators": [],
"span": {
"start": 124,
"end": 148,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 146,
"end": 148,
"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": 153,
"end": 201,
"ctxt": 0
},
"key": {
"type": "PrivateName",
"span": {
"start": 160,
"end": 164,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 161,
"end": 164,
"ctxt": 0
},
"value": "baz",
"optional": false
}
},
"function": {
"params": [
{
"type": "Parameter",
"span": {
"start": 165,
"end": 174,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 165,
"end": 174,
"ctxt": 0
},
"value": "a",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 166,
"end": 174,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 168,
"end": 174,
"ctxt": 0
},
"kind": "number"
}
}
}
}
],
"decorators": [],
"span": {
"start": 153,
"end": 201,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 176,
"end": 201,
"ctxt": 0
},
"stmts": [
{
"type": "ReturnStatement",
"span": {
"start": 186,
"end": 195,
"ctxt": 0
},
"argument": {
"type": "NumericLiteral",
"span": {
"start": 193,
"end": 194,
"ctxt": 0
},
"value": 3.0
}
}
]
},
"generator": true,
"async": true,
"typeParameters": null,
"returnType": null
},
"kind": "method",
"isStatic": false,
"accessibility": null,
"isAbstract": false,
"isOptional": false,
"isOverride": false
},
{
"type": "PrivateProperty",
"span": {
"start": 206,
"end": 221,
"ctxt": 0
},
"key": {
"type": "PrivateName",
"span": {
"start": 206,
"end": 212,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 207,
"end": 212,
"ctxt": 0
},
"value": "_quux",
"optional": false
}
},
"value": null,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 212,
"end": 220,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 214,
"end": 220,
"ctxt": 0
},
"kind": "number"
}
},
"isStatic": false,
"decorators": [],
"computed": false,
"accessibility": null,
"isAbstract": false,
"isOptional": false,
"isOverride": false,
"readonly": false,
"definite": false
},
{
"type": "PrivateMethod",
"span": {
"start": 226,
"end": 282,
"ctxt": 0
},
"key": {
"type": "PrivateName",
"span": {
"start": 230,
"end": 235,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 231,
"end": 235,
"ctxt": 0
},
"value": "quux",
"optional": false
}
},
"function": {
"params": [],
"decorators": [],
"span": {
"start": 226,
"end": 282,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 247,
"end": 282,
"ctxt": 0
},
"stmts": [
{
"type": "ReturnStatement",
"span": {
"start": 257,
"end": 276,
"ctxt": 0
},
"argument": {
"type": "MemberExpression",
"span": {
"start": 264,
"end": 275,
"ctxt": 0
},
"object": {
"type": "ThisExpression",
"span": {
"start": 264,
"end": 268,
"ctxt": 0
}
},
"property": {
"type": "PrivateName",
"span": {
"start": 269,
"end": 275,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 270,
"end": 275,
"ctxt": 0
},
"value": "_quux",
"optional": false
}
}
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": {
"type": "TsTypeAnnotation",
"span": {
"start": 238,
"end": 246,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 240,
"end": 246,
"ctxt": 0
},
"kind": "number"
}
}
},
"kind": "getter",
"isStatic": false,
"accessibility": null,
"isAbstract": false,
"isOptional": false,
"isOverride": false
},
{
"type": "PrivateMethod",
"span": {
"start": 287,
"end": 345,
"ctxt": 0
},
"key": {
"type": "PrivateName",
"span": {
"start": 291,
"end": 296,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 292,
"end": 296,
"ctxt": 0
},
"value": "quux",
"optional": false
}
},
"function": {
"params": [
{
"type": "Parameter",
"span": {
"start": 298,
"end": 309,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 298,
"end": 309,
"ctxt": 0
},
"value": "val",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 301,
"end": 309,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 303,
"end": 309,
"ctxt": 0
},
"kind": "number"
}
}
}
}
],
"decorators": [],
"span": {
"start": 287,
"end": 345,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 311,
"end": 345,
"ctxt": 0
},
"stmts": [
{
"type": "ExpressionStatement",
"span": {
"start": 321,
"end": 339,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 321,
"end": 338,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "MemberExpression",
"span": {
"start": 321,
"end": 332,
"ctxt": 0
},
"object": {
"type": "ThisExpression",
"span": {
"start": 321,
"end": 325,
"ctxt": 0
}
},
"property": {
"type": "PrivateName",
"span": {
"start": 326,
"end": 332,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 327,
"end": 332,
"ctxt": 0
},
"value": "_quux",
"optional": false
}
}
},
"right": {
"type": "Identifier",
"span": {
"start": 335,
"end": 338,
"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": 350,
"end": 497,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 350,
"end": 361,
"ctxt": 0
},
"value": "constructor",
"optional": false
},
"params": [],
"body": {
"type": "BlockStatement",
"span": {
"start": 365,
"end": 497,
"ctxt": 0
},
"stmts": [
{
"type": "ExpressionStatement",
"span": {
"start": 375,
"end": 389,
"ctxt": 0
},
"expression": {
"type": "CallExpression",
"span": {
"start": 375,
"end": 388,
"ctxt": 0
},
"callee": {
"type": "MemberExpression",
"span": {
"start": 375,
"end": 384,
"ctxt": 0
},
"object": {
"type": "ThisExpression",
"span": {
"start": 375,
"end": 379,
"ctxt": 0
}
},
"property": {
"type": "PrivateName",
"span": {
"start": 380,
"end": 384,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 381,
"end": 384,
"ctxt": 0
},
"value": "foo",
"optional": false
}
}
},
"arguments": [
{
"spread": null,
"expression": {
"type": "NumericLiteral",
"span": {
"start": 385,
"end": 387,
"ctxt": 0
},
"value": 30.0
}
}
],
"typeArguments": null
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 398,
"end": 412,
"ctxt": 0
},
"expression": {
"type": "CallExpression",
"span": {
"start": 398,
"end": 411,
"ctxt": 0
},
"callee": {
"type": "MemberExpression",
"span": {
"start": 398,
"end": 407,
"ctxt": 0
},
"object": {
"type": "ThisExpression",
"span": {
"start": 398,
"end": 402,
"ctxt": 0
}
},
"property": {
"type": "PrivateName",
"span": {
"start": 403,
"end": 407,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 404,
"end": 407,
"ctxt": 0
},
"value": "bar",
"optional": false
}
}
},
"arguments": [
{
"spread": null,
"expression": {
"type": "NumericLiteral",
"span": {
"start": 408,
"end": 410,
"ctxt": 0
},
"value": 30.0
}
}
],
"typeArguments": null
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 421,
"end": 435,
"ctxt": 0
},
"expression": {
"type": "CallExpression",
"span": {
"start": 421,
"end": 434,
"ctxt": 0
},
"callee": {
"type": "MemberExpression",
"span": {
"start": 421,
"end": 430,
"ctxt": 0
},
"object": {
"type": "ThisExpression",
"span": {
"start": 421,
"end": 425,
"ctxt": 0
}
},
"property": {
"type": "PrivateName",
"span": {
"start": 426,
"end": 430,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 427,
"end": 430,
"ctxt": 0
},
"value": "baz",
"optional": false
}
}
},
"arguments": [
{
"spread": null,
"expression": {
"type": "NumericLiteral",
"span": {
"start": 431,
"end": 433,
"ctxt": 0
},
"value": 30.0
}
}
],
"typeArguments": null
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 444,
"end": 472,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 444,
"end": 471,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "MemberExpression",
"span": {
"start": 444,
"end": 454,
"ctxt": 0
},
"object": {
"type": "ThisExpression",
"span": {
"start": 444,
"end": 448,
"ctxt": 0
}
},
"property": {
"type": "PrivateName",
"span": {
"start": 449,
"end": 454,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 450,
"end": 454,
"ctxt": 0
},
"value": "quux",
"optional": false
}
}
},
"right": {
"type": "BinaryExpression",
"span": {
"start": 457,
"end": 471,
"ctxt": 0
},
"operator": "+",
"left": {
"type": "MemberExpression",
"span": {
"start": 457,
"end": 467,
"ctxt": 0
},
"object": {
"type": "ThisExpression",
"span": {
"start": 457,
"end": 461,
"ctxt": 0
}
},
"property": {
"type": "PrivateName",
"span": {
"start": 462,
"end": 467,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 463,
"end": 467,
"ctxt": 0
},
"value": "quux",
"optional": false
}
}
},
"right": {
"type": "NumericLiteral",
"span": {
"start": 470,
"end": 471,
"ctxt": 0
},
"value": 1.0
}
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 481,
"end": 494,
"ctxt": 0
},
"expression": {
"type": "UpdateExpression",
"span": {
"start": 481,
"end": 493,
"ctxt": 0
},
"operator": "++",
"prefix": false,
"argument": {
"type": "MemberExpression",
"span": {
"start": 481,
"end": 491,
"ctxt": 0
},
"object": {
"type": "ThisExpression",
"span": {
"start": 481,
"end": 485,
"ctxt": 0
}
},
"property": {
"type": "PrivateName",
"span": {
"start": 486,
"end": 491,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 487,
"end": 491,
"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": 507,
"end": 508,
"ctxt": 0
},
"value": "B",
"optional": false
},
"declare": false,
"span": {
"start": 501,
"end": 615,
"ctxt": 0
},
"decorators": [],
"body": [
{
"type": "PrivateMethod",
"span": {
"start": 525,
"end": 543,
"ctxt": 0
},
"key": {
"type": "PrivateName",
"span": {
"start": 525,
"end": 529,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 526,
"end": 529,
"ctxt": 0
},
"value": "foo",
"optional": false
}
},
"function": {
"params": [
{
"type": "Parameter",
"span": {
"start": 530,
"end": 539,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 530,
"end": 539,
"ctxt": 0
},
"value": "a",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 531,
"end": 539,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 533,
"end": 539,
"ctxt": 0
},
"kind": "string"
}
}
}
}
],
"decorators": [],
"span": {
"start": 525,
"end": 543,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 541,
"end": 543,
"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": 548,
"end": 613,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 548,
"end": 559,
"ctxt": 0
},
"value": "constructor",
"optional": false
},
"params": [],
"body": {
"type": "BlockStatement",
"span": {
"start": 563,
"end": 613,
"ctxt": 0
},
"stmts": [
{
"type": "ExpressionStatement",
"span": {
"start": 573,
"end": 581,
"ctxt": 0
},
"expression": {
"type": "CallExpression",
"span": {
"start": 573,
"end": 580,
"ctxt": 0
},
"callee": {
"type": "Super",
"span": {
"start": 573,
"end": 578,
"ctxt": 0
}
},
"arguments": [],
"typeArguments": null
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 590,
"end": 607,
"ctxt": 0
},
"expression": {
"type": "CallExpression",
"span": {
"start": 590,
"end": 606,
"ctxt": 0
},
"callee": {
"type": "MemberExpression",
"span": {
"start": 590,
"end": 599,
"ctxt": 0
},
"object": {
"type": "ThisExpression",
"span": {
"start": 590,
"end": 594,
"ctxt": 0
}
},
"property": {
"type": "PrivateName",
"span": {
"start": 595,
"end": 599,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 596,
"end": 599,
"ctxt": 0
},
"value": "foo",
"optional": false
}
}
},
"arguments": [
{
"spread": null,
"expression": {
"type": "StringLiteral",
"span": {
"start": 600,
"end": 605,
"ctxt": 0
},
"value": "str",
"hasEscape": false,
"kind": {
"type": "normal",
"containsQuote": true
}
}
}
],
"typeArguments": null
}
}
]
},
"accessibility": null,
"isOptional": false
}
],
"superClass": {
"type": "Identifier",
"span": {
"start": 517,
"end": 518,
"ctxt": 0
},
"value": "A",
"optional": false
},
"isAbstract": false,
"typeParams": null,
"superTypeParams": null,
"implements": []
}
],
"interpreter": null
}