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

1623 lines
55 KiB
JSON

{
"type": "Script",
"span": {
"start": 36,
"end": 663,
"ctxt": 0
},
"body": [
{
"type": "ClassDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 42,
"end": 43,
"ctxt": 0
},
"value": "A",
"optional": false
},
"declare": false,
"span": {
"start": 36,
"end": 663,
"ctxt": 0
},
"decorators": [],
"body": [
{
"type": "PrivateProperty",
"span": {
"start": 50,
"end": 61,
"ctxt": 0
},
"key": {
"type": "PrivateName",
"span": {
"start": 50,
"end": 56,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 51,
"end": 56,
"ctxt": 0
},
"value": "field",
"optional": false
}
},
"value": {
"type": "NumericLiteral",
"span": {
"start": 59,
"end": 60,
"ctxt": 0
},
"value": 1.0
},
"typeAnnotation": null,
"isStatic": false,
"decorators": [],
"computed": false,
"accessibility": null,
"isAbstract": false,
"isOptional": false,
"isOverride": false,
"readonly": false,
"definite": false
},
{
"type": "ClassProperty",
"span": {
"start": 66,
"end": 88,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 66,
"end": 77,
"ctxt": 0
},
"value": "otherObject",
"optional": false
},
"value": {
"type": "NewExpression",
"span": {
"start": 80,
"end": 87,
"ctxt": 0
},
"callee": {
"type": "Identifier",
"span": {
"start": 84,
"end": 85,
"ctxt": 0
},
"value": "A",
"optional": false
},
"arguments": [],
"typeArguments": null
},
"typeAnnotation": null,
"isStatic": false,
"decorators": [],
"accessibility": null,
"isAbstract": false,
"isOptional": false,
"isOverride": false,
"readonly": false,
"declare": false,
"definite": false
},
{
"type": "ClassMethod",
"span": {
"start": 93,
"end": 145,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 93,
"end": 103,
"ctxt": 0
},
"value": "testObject",
"optional": false
},
"function": {
"params": [],
"decorators": [],
"span": {
"start": 93,
"end": 145,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 106,
"end": 145,
"ctxt": 0
},
"stmts": [
{
"type": "ReturnStatement",
"span": {
"start": 116,
"end": 139,
"ctxt": 0
},
"argument": {
"type": "ObjectExpression",
"span": {
"start": 123,
"end": 138,
"ctxt": 0
},
"properties": [
{
"type": "KeyValueProperty",
"key": {
"type": "Identifier",
"span": {
"start": 125,
"end": 126,
"ctxt": 0
},
"value": "x",
"optional": false
},
"value": {
"type": "NumericLiteral",
"span": {
"start": 128,
"end": 130,
"ctxt": 0
},
"value": 10.0
}
},
{
"type": "KeyValueProperty",
"key": {
"type": "Identifier",
"span": {
"start": 132,
"end": 133,
"ctxt": 0
},
"value": "y",
"optional": false
},
"value": {
"type": "NumericLiteral",
"span": {
"start": 135,
"end": 136,
"ctxt": 0
},
"value": 6.0
}
}
]
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
},
"kind": "method",
"isStatic": false,
"accessibility": null,
"isAbstract": false,
"isOptional": false,
"isOverride": false
},
{
"type": "ClassMethod",
"span": {
"start": 150,
"end": 194,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 150,
"end": 159,
"ctxt": 0
},
"value": "testArray",
"optional": false
},
"function": {
"params": [],
"decorators": [],
"span": {
"start": 150,
"end": 194,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 162,
"end": 194,
"ctxt": 0
},
"stmts": [
{
"type": "ReturnStatement",
"span": {
"start": 172,
"end": 188,
"ctxt": 0
},
"argument": {
"type": "ArrayExpression",
"span": {
"start": 179,
"end": 187,
"ctxt": 0
},
"elements": [
{
"spread": null,
"expression": {
"type": "NumericLiteral",
"span": {
"start": 180,
"end": 182,
"ctxt": 0
},
"value": 10.0
}
},
{
"spread": null,
"expression": {
"type": "NumericLiteral",
"span": {
"start": 184,
"end": 186,
"ctxt": 0
},
"value": 11.0
}
}
]
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
},
"kind": "method",
"isStatic": false,
"accessibility": null,
"isAbstract": false,
"isOptional": false,
"isOverride": false
},
{
"type": "Constructor",
"span": {
"start": 199,
"end": 603,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 199,
"end": 210,
"ctxt": 0
},
"value": "constructor",
"optional": false
},
"params": [],
"body": {
"type": "BlockStatement",
"span": {
"start": 213,
"end": 603,
"ctxt": 0
},
"stmts": [
{
"type": "VariableDeclaration",
"span": {
"start": 223,
"end": 237,
"ctxt": 0
},
"kind": "let",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 227,
"end": 236,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 227,
"end": 228,
"ctxt": 0
},
"value": "y",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 228,
"end": 236,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 230,
"end": 236,
"ctxt": 0
},
"kind": "number"
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "ExpressionStatement",
"span": {
"start": 246,
"end": 290,
"ctxt": 0
},
"expression": {
"type": "ParenthesisExpression",
"span": {
"start": 246,
"end": 289,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 247,
"end": 288,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "ObjectPattern",
"span": {
"start": 247,
"end": 268,
"ctxt": 0
},
"properties": [
{
"type": "KeyValuePatternProperty",
"key": {
"type": "Identifier",
"span": {
"start": 249,
"end": 250,
"ctxt": 0
},
"value": "x",
"optional": false
},
"value": {
"type": "MemberExpression",
"span": {
"start": 252,
"end": 263,
"ctxt": 0
},
"object": {
"type": "ThisExpression",
"span": {
"start": 252,
"end": 256,
"ctxt": 0
}
},
"property": {
"type": "PrivateName",
"span": {
"start": 257,
"end": 263,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 258,
"end": 263,
"ctxt": 0
},
"value": "field",
"optional": false
}
}
}
},
{
"type": "AssignmentPatternProperty",
"span": {
"start": 265,
"end": 266,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 265,
"end": 266,
"ctxt": 0
},
"value": "y",
"optional": false
},
"value": null
}
],
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "CallExpression",
"span": {
"start": 271,
"end": 288,
"ctxt": 0
},
"callee": {
"type": "MemberExpression",
"span": {
"start": 271,
"end": 286,
"ctxt": 0
},
"object": {
"type": "ThisExpression",
"span": {
"start": 271,
"end": 275,
"ctxt": 0
}
},
"property": {
"type": "Identifier",
"span": {
"start": 276,
"end": 286,
"ctxt": 0
},
"value": "testObject",
"optional": false
}
},
"arguments": [],
"typeArguments": null
}
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 299,
"end": 337,
"ctxt": 0
},
"expression": {
"type": "ParenthesisExpression",
"span": {
"start": 299,
"end": 336,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 300,
"end": 335,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "ArrayPattern",
"span": {
"start": 300,
"end": 316,
"ctxt": 0
},
"elements": [
{
"type": "MemberExpression",
"span": {
"start": 301,
"end": 312,
"ctxt": 0
},
"object": {
"type": "ThisExpression",
"span": {
"start": 301,
"end": 305,
"ctxt": 0
}
},
"property": {
"type": "PrivateName",
"span": {
"start": 306,
"end": 312,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 307,
"end": 312,
"ctxt": 0
},
"value": "field",
"optional": false
}
}
},
{
"type": "Identifier",
"span": {
"start": 314,
"end": 315,
"ctxt": 0
},
"value": "y",
"optional": false,
"typeAnnotation": null
}
],
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "CallExpression",
"span": {
"start": 319,
"end": 335,
"ctxt": 0
},
"callee": {
"type": "MemberExpression",
"span": {
"start": 319,
"end": 333,
"ctxt": 0
},
"object": {
"type": "ThisExpression",
"span": {
"start": 319,
"end": 323,
"ctxt": 0
}
},
"property": {
"type": "Identifier",
"span": {
"start": 324,
"end": 333,
"ctxt": 0
},
"value": "testArray",
"optional": false
}
},
"arguments": [],
"typeArguments": null
}
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 346,
"end": 404,
"ctxt": 0
},
"expression": {
"type": "ParenthesisExpression",
"span": {
"start": 346,
"end": 403,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 347,
"end": 402,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "ObjectPattern",
"span": {
"start": 347,
"end": 383,
"ctxt": 0
},
"properties": [
{
"type": "KeyValuePatternProperty",
"key": {
"type": "Identifier",
"span": {
"start": 349,
"end": 350,
"ctxt": 0
},
"value": "a",
"optional": false
},
"value": {
"type": "MemberExpression",
"span": {
"start": 352,
"end": 363,
"ctxt": 0
},
"object": {
"type": "ThisExpression",
"span": {
"start": 352,
"end": 356,
"ctxt": 0
}
},
"property": {
"type": "PrivateName",
"span": {
"start": 357,
"end": 363,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 358,
"end": 363,
"ctxt": 0
},
"value": "field",
"optional": false
}
}
}
},
{
"type": "KeyValuePatternProperty",
"key": {
"type": "Identifier",
"span": {
"start": 365,
"end": 366,
"ctxt": 0
},
"value": "b",
"optional": false
},
"value": {
"type": "ArrayPattern",
"span": {
"start": 368,
"end": 381,
"ctxt": 0
},
"elements": [
{
"type": "MemberExpression",
"span": {
"start": 369,
"end": 380,
"ctxt": 0
},
"object": {
"type": "ThisExpression",
"span": {
"start": 369,
"end": 373,
"ctxt": 0
}
},
"property": {
"type": "PrivateName",
"span": {
"start": 374,
"end": 380,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 375,
"end": 380,
"ctxt": 0
},
"value": "field",
"optional": false
}
}
}
],
"optional": false,
"typeAnnotation": null
}
}
],
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "ObjectExpression",
"span": {
"start": 386,
"end": 402,
"ctxt": 0
},
"properties": [
{
"type": "KeyValueProperty",
"key": {
"type": "Identifier",
"span": {
"start": 388,
"end": 389,
"ctxt": 0
},
"value": "a",
"optional": false
},
"value": {
"type": "NumericLiteral",
"span": {
"start": 391,
"end": 392,
"ctxt": 0
},
"value": 1.0
}
},
{
"type": "KeyValueProperty",
"key": {
"type": "Identifier",
"span": {
"start": 394,
"end": 395,
"ctxt": 0
},
"value": "b",
"optional": false
},
"value": {
"type": "ArrayExpression",
"span": {
"start": 397,
"end": 400,
"ctxt": 0
},
"elements": [
{
"spread": null,
"expression": {
"type": "NumericLiteral",
"span": {
"start": 398,
"end": 399,
"ctxt": 0
},
"value": 2.0
}
}
]
}
}
]
}
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 413,
"end": 453,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 413,
"end": 452,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "ArrayPattern",
"span": {
"start": 413,
"end": 441,
"ctxt": 0
},
"elements": [
{
"type": "MemberExpression",
"span": {
"start": 414,
"end": 425,
"ctxt": 0
},
"object": {
"type": "ThisExpression",
"span": {
"start": 414,
"end": 418,
"ctxt": 0
}
},
"property": {
"type": "PrivateName",
"span": {
"start": 419,
"end": 425,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 420,
"end": 425,
"ctxt": 0
},
"value": "field",
"optional": false
}
}
},
{
"type": "ArrayPattern",
"span": {
"start": 427,
"end": 440,
"ctxt": 0
},
"elements": [
{
"type": "MemberExpression",
"span": {
"start": 428,
"end": 439,
"ctxt": 0
},
"object": {
"type": "ThisExpression",
"span": {
"start": 428,
"end": 432,
"ctxt": 0
}
},
"property": {
"type": "PrivateName",
"span": {
"start": 433,
"end": 439,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 434,
"end": 439,
"ctxt": 0
},
"value": "field",
"optional": false
}
}
}
],
"optional": false,
"typeAnnotation": null
}
],
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "ArrayExpression",
"span": {
"start": 444,
"end": 452,
"ctxt": 0
},
"elements": [
{
"spread": null,
"expression": {
"type": "NumericLiteral",
"span": {
"start": 445,
"end": 446,
"ctxt": 0
},
"value": 1.0
}
},
{
"spread": null,
"expression": {
"type": "ArrayExpression",
"span": {
"start": 448,
"end": 451,
"ctxt": 0
},
"elements": [
{
"spread": null,
"expression": {
"type": "NumericLiteral",
"span": {
"start": 449,
"end": 450,
"ctxt": 0
},
"value": 2.0
}
}
]
}
}
]
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 462,
"end": 521,
"ctxt": 0
},
"expression": {
"type": "ParenthesisExpression",
"span": {
"start": 462,
"end": 520,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 463,
"end": 519,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "ObjectPattern",
"span": {
"start": 463,
"end": 507,
"ctxt": 0
},
"properties": [
{
"type": "KeyValuePatternProperty",
"key": {
"type": "Identifier",
"span": {
"start": 465,
"end": 466,
"ctxt": 0
},
"value": "a",
"optional": false
},
"value": {
"type": "AssignmentPattern",
"span": {
"start": 468,
"end": 483,
"ctxt": 0
},
"left": {
"type": "MemberExpression",
"span": {
"start": 468,
"end": 479,
"ctxt": 0
},
"object": {
"type": "ThisExpression",
"span": {
"start": 468,
"end": 472,
"ctxt": 0
}
},
"property": {
"type": "PrivateName",
"span": {
"start": 473,
"end": 479,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 474,
"end": 479,
"ctxt": 0
},
"value": "field",
"optional": false
}
}
},
"right": {
"type": "NumericLiteral",
"span": {
"start": 482,
"end": 483,
"ctxt": 0
},
"value": 1.0
},
"typeAnnotation": null
}
},
{
"type": "KeyValuePatternProperty",
"key": {
"type": "Identifier",
"span": {
"start": 485,
"end": 486,
"ctxt": 0
},
"value": "b",
"optional": false
},
"value": {
"type": "ArrayPattern",
"span": {
"start": 488,
"end": 505,
"ctxt": 0
},
"elements": [
{
"type": "AssignmentPattern",
"span": {
"start": 489,
"end": 504,
"ctxt": 0
},
"left": {
"type": "MemberExpression",
"span": {
"start": 489,
"end": 500,
"ctxt": 0
},
"object": {
"type": "ThisExpression",
"span": {
"start": 489,
"end": 493,
"ctxt": 0
}
},
"property": {
"type": "PrivateName",
"span": {
"start": 494,
"end": 500,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 495,
"end": 500,
"ctxt": 0
},
"value": "field",
"optional": false
}
}
},
"right": {
"type": "NumericLiteral",
"span": {
"start": 503,
"end": 504,
"ctxt": 0
},
"value": 1.0
},
"typeAnnotation": null
}
],
"optional": false,
"typeAnnotation": null
}
}
],
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "ObjectExpression",
"span": {
"start": 510,
"end": 519,
"ctxt": 0
},
"properties": [
{
"type": "KeyValueProperty",
"key": {
"type": "Identifier",
"span": {
"start": 512,
"end": 513,
"ctxt": 0
},
"value": "b",
"optional": false
},
"value": {
"type": "ArrayExpression",
"span": {
"start": 515,
"end": 517,
"ctxt": 0
},
"elements": []
}
}
]
}
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 530,
"end": 553,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 530,
"end": 552,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "ArrayPattern",
"span": {
"start": 530,
"end": 547,
"ctxt": 0
},
"elements": [
{
"type": "AssignmentPattern",
"span": {
"start": 531,
"end": 546,
"ctxt": 0
},
"left": {
"type": "MemberExpression",
"span": {
"start": 531,
"end": 542,
"ctxt": 0
},
"object": {
"type": "ThisExpression",
"span": {
"start": 531,
"end": 535,
"ctxt": 0
}
},
"property": {
"type": "PrivateName",
"span": {
"start": 536,
"end": 542,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 537,
"end": 542,
"ctxt": 0
},
"value": "field",
"optional": false
}
}
},
"right": {
"type": "NumericLiteral",
"span": {
"start": 545,
"end": 546,
"ctxt": 0
},
"value": 2.0
},
"typeAnnotation": null
}
],
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "ArrayExpression",
"span": {
"start": 550,
"end": 552,
"ctxt": 0
},
"elements": []
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 562,
"end": 597,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 562,
"end": 596,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "ArrayPattern",
"span": {
"start": 562,
"end": 591,
"ctxt": 0
},
"elements": [
{
"type": "AssignmentPattern",
"span": {
"start": 563,
"end": 590,
"ctxt": 0
},
"left": {
"type": "MemberExpression",
"span": {
"start": 563,
"end": 586,
"ctxt": 0
},
"object": {
"type": "MemberExpression",
"span": {
"start": 563,
"end": 579,
"ctxt": 0
},
"object": {
"type": "ThisExpression",
"span": {
"start": 563,
"end": 567,
"ctxt": 0
}
},
"property": {
"type": "Identifier",
"span": {
"start": 568,
"end": 579,
"ctxt": 0
},
"value": "otherObject",
"optional": false
}
},
"property": {
"type": "PrivateName",
"span": {
"start": 580,
"end": 586,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 581,
"end": 586,
"ctxt": 0
},
"value": "field",
"optional": false
}
}
},
"right": {
"type": "NumericLiteral",
"span": {
"start": 589,
"end": 590,
"ctxt": 0
},
"value": 2.0
},
"typeAnnotation": null
}
],
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "ArrayExpression",
"span": {
"start": 594,
"end": 596,
"ctxt": 0
},
"elements": []
}
}
}
]
},
"accessibility": null,
"isOptional": false
},
{
"type": "ClassMethod",
"span": {
"start": 608,
"end": 661,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 615,
"end": 619,
"ctxt": 0
},
"value": "test",
"optional": false
},
"function": {
"params": [
{
"type": "Parameter",
"span": {
"start": 620,
"end": 625,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 620,
"end": 625,
"ctxt": 0
},
"value": "_a",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 622,
"end": 625,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 624,
"end": 625,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 624,
"end": 625,
"ctxt": 0
},
"value": "A",
"optional": false
},
"typeParams": null
}
}
}
}
],
"decorators": [],
"span": {
"start": 608,
"end": 661,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 627,
"end": 661,
"ctxt": 0
},
"stmts": [
{
"type": "ExpressionStatement",
"span": {
"start": 637,
"end": 655,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 637,
"end": 654,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "ArrayPattern",
"span": {
"start": 637,
"end": 648,
"ctxt": 0
},
"elements": [
{
"type": "MemberExpression",
"span": {
"start": 638,
"end": 647,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 638,
"end": 640,
"ctxt": 0
},
"value": "_a",
"optional": false
},
"property": {
"type": "PrivateName",
"span": {
"start": 641,
"end": 647,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 642,
"end": 647,
"ctxt": 0
},
"value": "field",
"optional": false
}
}
}
],
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "ArrayExpression",
"span": {
"start": 651,
"end": 654,
"ctxt": 0
},
"elements": [
{
"spread": null,
"expression": {
"type": "NumericLiteral",
"span": {
"start": 652,
"end": 653,
"ctxt": 0
},
"value": 2.0
}
}
]
}
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
},
"kind": "method",
"isStatic": true,
"accessibility": null,
"isAbstract": false,
"isOptional": false,
"isOverride": false
}
],
"superClass": null,
"isAbstract": false,
"typeParams": null,
"superTypeParams": null,
"implements": []
}
],
"interpreter": null
}