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

1629 lines
55 KiB
JSON

{
"type": "Script",
"span": {
"start": 71,
"end": 677,
"ctxt": 0
},
"body": [
{
"type": "ClassDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 77,
"end": 78,
"ctxt": 0
},
"value": "A",
"optional": false
},
"declare": false,
"span": {
"start": 71,
"end": 677,
"ctxt": 0
},
"decorators": [],
"body": [
{
"type": "PrivateProperty",
"span": {
"start": 85,
"end": 103,
"ctxt": 0
},
"key": {
"type": "PrivateName",
"span": {
"start": 92,
"end": 98,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 93,
"end": 98,
"ctxt": 0
},
"value": "field",
"optional": false
}
},
"value": {
"type": "NumericLiteral",
"span": {
"start": 101,
"end": 102,
"ctxt": 0
},
"value": 1.0
},
"typeAnnotation": null,
"isStatic": true,
"decorators": [],
"accessibility": null,
"isOptional": false,
"isOverride": false,
"readonly": false,
"definite": false
},
{
"type": "ClassProperty",
"span": {
"start": 108,
"end": 123,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 108,
"end": 118,
"ctxt": 0
},
"value": "otherClass",
"optional": false
},
"value": {
"type": "Identifier",
"span": {
"start": 121,
"end": 122,
"ctxt": 0
},
"value": "A",
"optional": false
},
"typeAnnotation": null,
"isStatic": false,
"decorators": [],
"accessibility": null,
"isAbstract": false,
"isOptional": false,
"isOverride": false,
"readonly": false,
"declare": false,
"definite": false
},
{
"type": "ClassMethod",
"span": {
"start": 128,
"end": 180,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 128,
"end": 138,
"ctxt": 0
},
"value": "testObject",
"optional": false
},
"function": {
"params": [],
"decorators": [],
"span": {
"start": 128,
"end": 180,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 141,
"end": 180,
"ctxt": 0
},
"stmts": [
{
"type": "ReturnStatement",
"span": {
"start": 151,
"end": 174,
"ctxt": 0
},
"argument": {
"type": "ObjectExpression",
"span": {
"start": 158,
"end": 173,
"ctxt": 0
},
"properties": [
{
"type": "KeyValueProperty",
"key": {
"type": "Identifier",
"span": {
"start": 160,
"end": 161,
"ctxt": 0
},
"value": "x",
"optional": false
},
"value": {
"type": "NumericLiteral",
"span": {
"start": 163,
"end": 165,
"ctxt": 0
},
"value": 10.0
}
},
{
"type": "KeyValueProperty",
"key": {
"type": "Identifier",
"span": {
"start": 167,
"end": 168,
"ctxt": 0
},
"value": "y",
"optional": false
},
"value": {
"type": "NumericLiteral",
"span": {
"start": 170,
"end": 171,
"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": 185,
"end": 229,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 185,
"end": 194,
"ctxt": 0
},
"value": "testArray",
"optional": false
},
"function": {
"params": [],
"decorators": [],
"span": {
"start": 185,
"end": 229,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 197,
"end": 229,
"ctxt": 0
},
"stmts": [
{
"type": "ReturnStatement",
"span": {
"start": 207,
"end": 223,
"ctxt": 0
},
"argument": {
"type": "ArrayExpression",
"span": {
"start": 214,
"end": 222,
"ctxt": 0
},
"elements": [
{
"spread": null,
"expression": {
"type": "NumericLiteral",
"span": {
"start": 215,
"end": 217,
"ctxt": 0
},
"value": 10.0
}
},
{
"spread": null,
"expression": {
"type": "NumericLiteral",
"span": {
"start": 219,
"end": 221,
"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": 234,
"end": 610,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 234,
"end": 245,
"ctxt": 0
},
"value": "constructor",
"optional": false
},
"params": [],
"body": {
"type": "BlockStatement",
"span": {
"start": 248,
"end": 610,
"ctxt": 0
},
"stmts": [
{
"type": "VariableDeclaration",
"span": {
"start": 258,
"end": 272,
"ctxt": 0
},
"kind": "let",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 262,
"end": 271,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 262,
"end": 263,
"ctxt": 0
},
"value": "y",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 263,
"end": 271,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 265,
"end": 271,
"ctxt": 0
},
"kind": "number"
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "ExpressionStatement",
"span": {
"start": 281,
"end": 322,
"ctxt": 0
},
"expression": {
"type": "ParenthesisExpression",
"span": {
"start": 281,
"end": 321,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 282,
"end": 320,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "ObjectPattern",
"span": {
"start": 282,
"end": 300,
"ctxt": 0
},
"properties": [
{
"type": "KeyValuePatternProperty",
"key": {
"type": "Identifier",
"span": {
"start": 284,
"end": 285,
"ctxt": 0
},
"value": "x",
"optional": false
},
"value": {
"type": "MemberExpression",
"span": {
"start": 287,
"end": 295,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 287,
"end": 288,
"ctxt": 0
},
"value": "A",
"optional": false
},
"property": {
"type": "PrivateName",
"span": {
"start": 289,
"end": 295,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 290,
"end": 295,
"ctxt": 0
},
"value": "field",
"optional": false
}
}
}
},
{
"type": "AssignmentPatternProperty",
"span": {
"start": 297,
"end": 298,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 297,
"end": 298,
"ctxt": 0
},
"value": "y",
"optional": false
},
"value": null
}
],
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "CallExpression",
"span": {
"start": 303,
"end": 320,
"ctxt": 0
},
"callee": {
"type": "MemberExpression",
"span": {
"start": 303,
"end": 318,
"ctxt": 0
},
"object": {
"type": "ThisExpression",
"span": {
"start": 303,
"end": 307,
"ctxt": 0
}
},
"property": {
"type": "Identifier",
"span": {
"start": 308,
"end": 318,
"ctxt": 0
},
"value": "testObject",
"optional": false
}
},
"arguments": [],
"typeArguments": null
}
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 331,
"end": 366,
"ctxt": 0
},
"expression": {
"type": "ParenthesisExpression",
"span": {
"start": 331,
"end": 365,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 332,
"end": 364,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "ArrayPattern",
"span": {
"start": 332,
"end": 345,
"ctxt": 0
},
"elements": [
{
"type": "MemberExpression",
"span": {
"start": 333,
"end": 341,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 333,
"end": 334,
"ctxt": 0
},
"value": "A",
"optional": false
},
"property": {
"type": "PrivateName",
"span": {
"start": 335,
"end": 341,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 336,
"end": 341,
"ctxt": 0
},
"value": "field",
"optional": false
}
}
},
{
"type": "Identifier",
"span": {
"start": 343,
"end": 344,
"ctxt": 0
},
"value": "y",
"optional": false,
"typeAnnotation": null
}
],
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "CallExpression",
"span": {
"start": 348,
"end": 364,
"ctxt": 0
},
"callee": {
"type": "MemberExpression",
"span": {
"start": 348,
"end": 362,
"ctxt": 0
},
"object": {
"type": "ThisExpression",
"span": {
"start": 348,
"end": 352,
"ctxt": 0
}
},
"property": {
"type": "Identifier",
"span": {
"start": 353,
"end": 362,
"ctxt": 0
},
"value": "testArray",
"optional": false
}
},
"arguments": [],
"typeArguments": null
}
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 375,
"end": 427,
"ctxt": 0
},
"expression": {
"type": "ParenthesisExpression",
"span": {
"start": 375,
"end": 426,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 376,
"end": 425,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "ObjectPattern",
"span": {
"start": 376,
"end": 406,
"ctxt": 0
},
"properties": [
{
"type": "KeyValuePatternProperty",
"key": {
"type": "Identifier",
"span": {
"start": 378,
"end": 379,
"ctxt": 0
},
"value": "a",
"optional": false
},
"value": {
"type": "MemberExpression",
"span": {
"start": 381,
"end": 389,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 381,
"end": 382,
"ctxt": 0
},
"value": "A",
"optional": false
},
"property": {
"type": "PrivateName",
"span": {
"start": 383,
"end": 389,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 384,
"end": 389,
"ctxt": 0
},
"value": "field",
"optional": false
}
}
}
},
{
"type": "KeyValuePatternProperty",
"key": {
"type": "Identifier",
"span": {
"start": 391,
"end": 392,
"ctxt": 0
},
"value": "b",
"optional": false
},
"value": {
"type": "ArrayPattern",
"span": {
"start": 394,
"end": 404,
"ctxt": 0
},
"elements": [
{
"type": "MemberExpression",
"span": {
"start": 395,
"end": 403,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 395,
"end": 396,
"ctxt": 0
},
"value": "A",
"optional": false
},
"property": {
"type": "PrivateName",
"span": {
"start": 397,
"end": 403,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 398,
"end": 403,
"ctxt": 0
},
"value": "field",
"optional": false
}
}
}
],
"optional": false,
"typeAnnotation": null
}
}
],
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "ObjectExpression",
"span": {
"start": 409,
"end": 425,
"ctxt": 0
},
"properties": [
{
"type": "KeyValueProperty",
"key": {
"type": "Identifier",
"span": {
"start": 411,
"end": 412,
"ctxt": 0
},
"value": "a",
"optional": false
},
"value": {
"type": "NumericLiteral",
"span": {
"start": 414,
"end": 415,
"ctxt": 0
},
"value": 1.0
}
},
{
"type": "KeyValueProperty",
"key": {
"type": "Identifier",
"span": {
"start": 417,
"end": 418,
"ctxt": 0
},
"value": "b",
"optional": false
},
"value": {
"type": "ArrayExpression",
"span": {
"start": 420,
"end": 423,
"ctxt": 0
},
"elements": [
{
"spread": null,
"expression": {
"type": "NumericLiteral",
"span": {
"start": 421,
"end": 422,
"ctxt": 0
},
"value": 2.0
}
}
]
}
}
]
}
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 436,
"end": 470,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 436,
"end": 469,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "ArrayPattern",
"span": {
"start": 436,
"end": 458,
"ctxt": 0
},
"elements": [
{
"type": "MemberExpression",
"span": {
"start": 437,
"end": 445,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 437,
"end": 438,
"ctxt": 0
},
"value": "A",
"optional": false
},
"property": {
"type": "PrivateName",
"span": {
"start": 439,
"end": 445,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 440,
"end": 445,
"ctxt": 0
},
"value": "field",
"optional": false
}
}
},
{
"type": "ArrayPattern",
"span": {
"start": 447,
"end": 457,
"ctxt": 0
},
"elements": [
{
"type": "MemberExpression",
"span": {
"start": 448,
"end": 456,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 448,
"end": 449,
"ctxt": 0
},
"value": "A",
"optional": false
},
"property": {
"type": "PrivateName",
"span": {
"start": 450,
"end": 456,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 451,
"end": 456,
"ctxt": 0
},
"value": "field",
"optional": false
}
}
}
],
"optional": false,
"typeAnnotation": null
}
],
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "ArrayExpression",
"span": {
"start": 461,
"end": 469,
"ctxt": 0
},
"elements": [
{
"spread": null,
"expression": {
"type": "NumericLiteral",
"span": {
"start": 462,
"end": 463,
"ctxt": 0
},
"value": 1.0
}
},
{
"spread": null,
"expression": {
"type": "ArrayExpression",
"span": {
"start": 465,
"end": 468,
"ctxt": 0
},
"elements": [
{
"spread": null,
"expression": {
"type": "NumericLiteral",
"span": {
"start": 466,
"end": 467,
"ctxt": 0
},
"value": 2.0
}
}
]
}
}
]
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 479,
"end": 532,
"ctxt": 0
},
"expression": {
"type": "ParenthesisExpression",
"span": {
"start": 479,
"end": 531,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 480,
"end": 530,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "ObjectPattern",
"span": {
"start": 480,
"end": 518,
"ctxt": 0
},
"properties": [
{
"type": "KeyValuePatternProperty",
"key": {
"type": "Identifier",
"span": {
"start": 482,
"end": 483,
"ctxt": 0
},
"value": "a",
"optional": false
},
"value": {
"type": "AssignmentPattern",
"span": {
"start": 485,
"end": 497,
"ctxt": 0
},
"left": {
"type": "MemberExpression",
"span": {
"start": 485,
"end": 493,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 485,
"end": 486,
"ctxt": 0
},
"value": "A",
"optional": false
},
"property": {
"type": "PrivateName",
"span": {
"start": 487,
"end": 493,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 488,
"end": 493,
"ctxt": 0
},
"value": "field",
"optional": false
}
}
},
"right": {
"type": "NumericLiteral",
"span": {
"start": 496,
"end": 497,
"ctxt": 0
},
"value": 1.0
},
"typeAnnotation": null
}
},
{
"type": "KeyValuePatternProperty",
"key": {
"type": "Identifier",
"span": {
"start": 499,
"end": 500,
"ctxt": 0
},
"value": "b",
"optional": false
},
"value": {
"type": "ArrayPattern",
"span": {
"start": 502,
"end": 516,
"ctxt": 0
},
"elements": [
{
"type": "AssignmentPattern",
"span": {
"start": 503,
"end": 515,
"ctxt": 0
},
"left": {
"type": "MemberExpression",
"span": {
"start": 503,
"end": 511,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 503,
"end": 504,
"ctxt": 0
},
"value": "A",
"optional": false
},
"property": {
"type": "PrivateName",
"span": {
"start": 505,
"end": 511,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 506,
"end": 511,
"ctxt": 0
},
"value": "field",
"optional": false
}
}
},
"right": {
"type": "NumericLiteral",
"span": {
"start": 514,
"end": 515,
"ctxt": 0
},
"value": 1.0
},
"typeAnnotation": null
}
],
"optional": false,
"typeAnnotation": null
}
}
],
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "ObjectExpression",
"span": {
"start": 521,
"end": 530,
"ctxt": 0
},
"properties": [
{
"type": "KeyValueProperty",
"key": {
"type": "Identifier",
"span": {
"start": 523,
"end": 524,
"ctxt": 0
},
"value": "b",
"optional": false
},
"value": {
"type": "ArrayExpression",
"span": {
"start": 526,
"end": 528,
"ctxt": 0
},
"elements": []
}
}
]
}
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 541,
"end": 561,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 541,
"end": 560,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "ArrayPattern",
"span": {
"start": 541,
"end": 555,
"ctxt": 0
},
"elements": [
{
"type": "AssignmentPattern",
"span": {
"start": 542,
"end": 554,
"ctxt": 0
},
"left": {
"type": "MemberExpression",
"span": {
"start": 542,
"end": 550,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 542,
"end": 543,
"ctxt": 0
},
"value": "A",
"optional": false
},
"property": {
"type": "PrivateName",
"span": {
"start": 544,
"end": 550,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 545,
"end": 550,
"ctxt": 0
},
"value": "field",
"optional": false
}
}
},
"right": {
"type": "NumericLiteral",
"span": {
"start": 553,
"end": 554,
"ctxt": 0
},
"value": 2.0
},
"typeAnnotation": null
}
],
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "ArrayExpression",
"span": {
"start": 558,
"end": 560,
"ctxt": 0
},
"elements": []
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 570,
"end": 604,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 570,
"end": 603,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "ArrayPattern",
"span": {
"start": 570,
"end": 598,
"ctxt": 0
},
"elements": [
{
"type": "AssignmentPattern",
"span": {
"start": 571,
"end": 597,
"ctxt": 0
},
"left": {
"type": "MemberExpression",
"span": {
"start": 571,
"end": 593,
"ctxt": 0
},
"object": {
"type": "MemberExpression",
"span": {
"start": 571,
"end": 586,
"ctxt": 0
},
"object": {
"type": "ThisExpression",
"span": {
"start": 571,
"end": 575,
"ctxt": 0
}
},
"property": {
"type": "Identifier",
"span": {
"start": 576,
"end": 586,
"ctxt": 0
},
"value": "otherClass",
"optional": false
}
},
"property": {
"type": "PrivateName",
"span": {
"start": 587,
"end": 593,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 588,
"end": 593,
"ctxt": 0
},
"value": "field",
"optional": false
}
}
},
"right": {
"type": "NumericLiteral",
"span": {
"start": 596,
"end": 597,
"ctxt": 0
},
"value": 2.0
},
"typeAnnotation": null
}
],
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "ArrayExpression",
"span": {
"start": 601,
"end": 603,
"ctxt": 0
},
"elements": []
}
}
}
]
},
"accessibility": null,
"isOptional": false
},
{
"type": "ClassMethod",
"span": {
"start": 615,
"end": 675,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 622,
"end": 626,
"ctxt": 0
},
"value": "test",
"optional": false
},
"function": {
"params": [
{
"type": "Parameter",
"span": {
"start": 627,
"end": 639,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 627,
"end": 639,
"ctxt": 0
},
"value": "_a",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 629,
"end": 639,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeQuery",
"span": {
"start": 631,
"end": 639,
"ctxt": 0
},
"exprName": {
"type": "Identifier",
"span": {
"start": 638,
"end": 639,
"ctxt": 0
},
"value": "A",
"optional": false
},
"typeArguments": null
}
}
}
}
],
"decorators": [],
"span": {
"start": 615,
"end": 675,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 641,
"end": 675,
"ctxt": 0
},
"stmts": [
{
"type": "ExpressionStatement",
"span": {
"start": 651,
"end": 669,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 651,
"end": 668,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "ArrayPattern",
"span": {
"start": 651,
"end": 662,
"ctxt": 0
},
"elements": [
{
"type": "MemberExpression",
"span": {
"start": 652,
"end": 661,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 652,
"end": 654,
"ctxt": 0
},
"value": "_a",
"optional": false
},
"property": {
"type": "PrivateName",
"span": {
"start": 655,
"end": 661,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 656,
"end": 661,
"ctxt": 0
},
"value": "field",
"optional": false
}
}
}
],
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "ArrayExpression",
"span": {
"start": 665,
"end": 668,
"ctxt": 0
},
"elements": [
{
"spread": null,
"expression": {
"type": "NumericLiteral",
"span": {
"start": 666,
"end": 667,
"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
}