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

1527 lines
35 KiB
JSON

{
"type": "Script",
"span": {
"start": 93,
"end": 809,
"ctxt": 0
},
"body": [
{
"type": "VariableDeclaration",
"span": {
"start": 93,
"end": 135,
"ctxt": 0
},
"kind": "const",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 99,
"end": 134,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 99,
"end": 102,
"ctxt": 0
},
"value": "obj",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "ObjectExpression",
"span": {
"start": 105,
"end": 134,
"ctxt": 0
},
"properties": [
{
"type": "KeyValueProperty",
"key": {
"type": "Identifier",
"span": {
"start": 107,
"end": 112,
"ctxt": 0
},
"value": "value",
"optional": false
},
"value": {
"type": "NumericLiteral",
"span": {
"start": 114,
"end": 116,
"ctxt": 0
},
"value": 42.0
}
},
{
"type": "KeyValueProperty",
"key": {
"type": "Identifier",
"span": {
"start": 118,
"end": 126,
"ctxt": 0
},
"value": "writable",
"optional": false
},
"value": {
"type": "BooleanLiteral",
"span": {
"start": 128,
"end": 132,
"ctxt": 0
},
"value": true
}
}
]
},
"definite": false
}
]
},
{
"type": "ExpressionStatement",
"span": {
"start": 136,
"end": 181,
"ctxt": 0
},
"expression": {
"type": "CallExpression",
"span": {
"start": 136,
"end": 180,
"ctxt": 0
},
"callee": {
"type": "MemberExpression",
"span": {
"start": 136,
"end": 157,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 136,
"end": 142,
"ctxt": 0
},
"value": "Object",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 143,
"end": 157,
"ctxt": 0
},
"value": "defineProperty",
"optional": false
}
},
"arguments": [
{
"spread": null,
"expression": {
"type": "Identifier",
"span": {
"start": 158,
"end": 165,
"ctxt": 0
},
"value": "exports",
"optional": false
}
},
{
"spread": null,
"expression": {
"type": "StringLiteral",
"span": {
"start": 167,
"end": 174,
"ctxt": 0
},
"value": "thing",
"hasEscape": false,
"kind": {
"type": "normal",
"containsQuote": true
}
}
},
{
"spread": null,
"expression": {
"type": "Identifier",
"span": {
"start": 176,
"end": 179,
"ctxt": 0
},
"value": "obj",
"optional": false
}
}
],
"typeArguments": null
}
},
{
"type": "VariableDeclaration",
"span": {
"start": 209,
"end": 250,
"ctxt": 0
},
"kind": "let",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 213,
"end": 249,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 213,
"end": 216,
"ctxt": 0
},
"value": "str",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "ParenthesisExpression",
"span": {
"start": 240,
"end": 249,
"ctxt": 0
},
"expression": {
"type": "StringLiteral",
"span": {
"start": 241,
"end": 248,
"ctxt": 0
},
"value": "other",
"hasEscape": false,
"kind": {
"type": "normal",
"containsQuote": true
}
}
},
"definite": false
}
]
},
{
"type": "ExpressionStatement",
"span": {
"start": 251,
"end": 318,
"ctxt": 0
},
"expression": {
"type": "CallExpression",
"span": {
"start": 251,
"end": 317,
"ctxt": 0
},
"callee": {
"type": "MemberExpression",
"span": {
"start": 251,
"end": 272,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 251,
"end": 257,
"ctxt": 0
},
"value": "Object",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 258,
"end": 272,
"ctxt": 0
},
"value": "defineProperty",
"optional": false
}
},
"arguments": [
{
"spread": null,
"expression": {
"type": "Identifier",
"span": {
"start": 273,
"end": 280,
"ctxt": 0
},
"value": "exports",
"optional": false
}
},
{
"spread": null,
"expression": {
"type": "Identifier",
"span": {
"start": 282,
"end": 285,
"ctxt": 0
},
"value": "str",
"optional": false
}
},
{
"spread": null,
"expression": {
"type": "ObjectExpression",
"span": {
"start": 287,
"end": 316,
"ctxt": 0
},
"properties": [
{
"type": "KeyValueProperty",
"key": {
"type": "Identifier",
"span": {
"start": 289,
"end": 294,
"ctxt": 0
},
"value": "value",
"optional": false
},
"value": {
"type": "NumericLiteral",
"span": {
"start": 296,
"end": 298,
"ctxt": 0
},
"value": 42.0
}
},
{
"type": "KeyValueProperty",
"key": {
"type": "Identifier",
"span": {
"start": 300,
"end": 308,
"ctxt": 0
},
"value": "writable",
"optional": false
},
"value": {
"type": "BooleanLiteral",
"span": {
"start": 310,
"end": 314,
"ctxt": 0
},
"value": true
}
}
]
}
}
],
"typeArguments": null
}
},
{
"type": "VariableDeclaration",
"span": {
"start": 320,
"end": 343,
"ctxt": 0
},
"kind": "const",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 326,
"end": 343,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 326,
"end": 334,
"ctxt": 0
},
"value": "propName",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "StringLiteral",
"span": {
"start": 337,
"end": 343,
"ctxt": 0
},
"value": "prop",
"hasEscape": false,
"kind": {
"type": "normal",
"containsQuote": true
}
},
"definite": false
}
]
},
{
"type": "ExpressionStatement",
"span": {
"start": 344,
"end": 416,
"ctxt": 0
},
"expression": {
"type": "CallExpression",
"span": {
"start": 344,
"end": 415,
"ctxt": 0
},
"callee": {
"type": "MemberExpression",
"span": {
"start": 344,
"end": 365,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 344,
"end": 350,
"ctxt": 0
},
"value": "Object",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 351,
"end": 365,
"ctxt": 0
},
"value": "defineProperty",
"optional": false
}
},
"arguments": [
{
"spread": null,
"expression": {
"type": "Identifier",
"span": {
"start": 366,
"end": 373,
"ctxt": 0
},
"value": "exports",
"optional": false
}
},
{
"spread": null,
"expression": {
"type": "Identifier",
"span": {
"start": 375,
"end": 383,
"ctxt": 0
},
"value": "propName",
"optional": false
}
},
{
"spread": null,
"expression": {
"type": "ObjectExpression",
"span": {
"start": 385,
"end": 414,
"ctxt": 0
},
"properties": [
{
"type": "KeyValueProperty",
"key": {
"type": "Identifier",
"span": {
"start": 387,
"end": 392,
"ctxt": 0
},
"value": "value",
"optional": false
},
"value": {
"type": "NumericLiteral",
"span": {
"start": 394,
"end": 396,
"ctxt": 0
},
"value": 42.0
}
},
{
"type": "KeyValueProperty",
"key": {
"type": "Identifier",
"span": {
"start": 398,
"end": 406,
"ctxt": 0
},
"value": "writable",
"optional": false
},
"value": {
"type": "BooleanLiteral",
"span": {
"start": 408,
"end": 412,
"ctxt": 0
},
"value": true
}
}
]
}
}
],
"typeArguments": null
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 419,
"end": 463,
"ctxt": 0
},
"expression": {
"type": "CallExpression",
"span": {
"start": 419,
"end": 462,
"ctxt": 0
},
"callee": {
"type": "MemberExpression",
"span": {
"start": 419,
"end": 440,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 419,
"end": 425,
"ctxt": 0
},
"value": "Object",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 426,
"end": 440,
"ctxt": 0
},
"value": "defineProperty",
"optional": false
}
},
"arguments": [
{
"spread": null,
"expression": {
"type": "Identifier",
"span": {
"start": 441,
"end": 448,
"ctxt": 0
},
"value": "exports",
"optional": false
}
},
{
"spread": null,
"expression": {
"type": "StringLiteral",
"span": {
"start": 450,
"end": 456,
"ctxt": 0
},
"value": "bad1",
"hasEscape": false,
"kind": {
"type": "normal",
"containsQuote": true
}
}
},
{
"spread": null,
"expression": {
"type": "ObjectExpression",
"span": {
"start": 458,
"end": 461,
"ctxt": 0
},
"properties": []
}
}
],
"typeArguments": null
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 464,
"end": 541,
"ctxt": 0
},
"expression": {
"type": "CallExpression",
"span": {
"start": 464,
"end": 540,
"ctxt": 0
},
"callee": {
"type": "MemberExpression",
"span": {
"start": 464,
"end": 485,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 464,
"end": 470,
"ctxt": 0
},
"value": "Object",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 471,
"end": 485,
"ctxt": 0
},
"value": "defineProperty",
"optional": false
}
},
"arguments": [
{
"spread": null,
"expression": {
"type": "Identifier",
"span": {
"start": 486,
"end": 493,
"ctxt": 0
},
"value": "exports",
"optional": false
}
},
{
"spread": null,
"expression": {
"type": "StringLiteral",
"span": {
"start": 495,
"end": 501,
"ctxt": 0
},
"value": "bad2",
"hasEscape": false,
"kind": {
"type": "normal",
"containsQuote": true
}
}
},
{
"spread": null,
"expression": {
"type": "ObjectExpression",
"span": {
"start": 503,
"end": 539,
"ctxt": 0
},
"properties": [
{
"type": "MethodProperty",
"key": {
"type": "Identifier",
"span": {
"start": 505,
"end": 508,
"ctxt": 0
},
"value": "get",
"optional": false
},
"params": [],
"decorators": [],
"span": {
"start": 505,
"end": 524,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 511,
"end": 524,
"ctxt": 0
},
"stmts": [
{
"type": "ReturnStatement",
"span": {
"start": 513,
"end": 522,
"ctxt": 0
},
"argument": {
"type": "NumericLiteral",
"span": {
"start": 520,
"end": 522,
"ctxt": 0
},
"value": 12.0
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
},
{
"type": "KeyValueProperty",
"key": {
"type": "Identifier",
"span": {
"start": 526,
"end": 531,
"ctxt": 0
},
"value": "value",
"optional": false
},
"value": {
"type": "StringLiteral",
"span": {
"start": 533,
"end": 537,
"ctxt": 0
},
"value": "no",
"hasEscape": false,
"kind": {
"type": "normal",
"containsQuote": true
}
}
}
]
}
}
],
"typeArguments": null
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 542,
"end": 601,
"ctxt": 0
},
"expression": {
"type": "CallExpression",
"span": {
"start": 542,
"end": 600,
"ctxt": 0
},
"callee": {
"type": "MemberExpression",
"span": {
"start": 542,
"end": 563,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 542,
"end": 548,
"ctxt": 0
},
"value": "Object",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 549,
"end": 563,
"ctxt": 0
},
"value": "defineProperty",
"optional": false
}
},
"arguments": [
{
"spread": null,
"expression": {
"type": "Identifier",
"span": {
"start": 564,
"end": 571,
"ctxt": 0
},
"value": "exports",
"optional": false
}
},
{
"spread": null,
"expression": {
"type": "StringLiteral",
"span": {
"start": 573,
"end": 579,
"ctxt": 0
},
"value": "bad3",
"hasEscape": false,
"kind": {
"type": "normal",
"containsQuote": true
}
}
},
{
"spread": null,
"expression": {
"type": "ObjectExpression",
"span": {
"start": 581,
"end": 599,
"ctxt": 0
},
"properties": [
{
"type": "KeyValueProperty",
"key": {
"type": "Identifier",
"span": {
"start": 583,
"end": 591,
"ctxt": 0
},
"value": "writable",
"optional": false
},
"value": {
"type": "BooleanLiteral",
"span": {
"start": 593,
"end": 597,
"ctxt": 0
},
"value": true
}
}
]
}
}
],
"typeArguments": null
}
},
{
"type": "VariableDeclaration",
"span": {
"start": 629,
"end": 659,
"ctxt": 0
},
"kind": "const",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 635,
"end": 658,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 635,
"end": 638,
"ctxt": 0
},
"value": "mod",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "CallExpression",
"span": {
"start": 641,
"end": 658,
"ctxt": 0
},
"callee": {
"type": "Identifier",
"span": {
"start": 641,
"end": 648,
"ctxt": 0
},
"value": "require",
"optional": false
},
"arguments": [
{
"spread": null,
"expression": {
"type": "StringLiteral",
"span": {
"start": 649,
"end": 657,
"ctxt": 0
},
"value": "./mod1",
"hasEscape": false,
"kind": {
"type": "normal",
"containsQuote": true
}
}
}
],
"typeArguments": null
},
"definite": false
}
]
},
{
"type": "ExpressionStatement",
"span": {
"start": 660,
"end": 670,
"ctxt": 0
},
"expression": {
"type": "MemberExpression",
"span": {
"start": 660,
"end": 669,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 660,
"end": 663,
"ctxt": 0
},
"value": "mod",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 664,
"end": 669,
"ctxt": 0
},
"value": "thing",
"optional": false
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 671,
"end": 681,
"ctxt": 0
},
"expression": {
"type": "MemberExpression",
"span": {
"start": 671,
"end": 680,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 671,
"end": 674,
"ctxt": 0
},
"value": "mod",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 675,
"end": 680,
"ctxt": 0
},
"value": "other",
"optional": false
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 682,
"end": 691,
"ctxt": 0
},
"expression": {
"type": "MemberExpression",
"span": {
"start": 682,
"end": 690,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 682,
"end": 685,
"ctxt": 0
},
"value": "mod",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 686,
"end": 690,
"ctxt": 0
},
"value": "prop",
"optional": false
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 692,
"end": 701,
"ctxt": 0
},
"expression": {
"type": "MemberExpression",
"span": {
"start": 692,
"end": 700,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 692,
"end": 695,
"ctxt": 0
},
"value": "mod",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 696,
"end": 700,
"ctxt": 0
},
"value": "bad1",
"optional": false
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 702,
"end": 711,
"ctxt": 0
},
"expression": {
"type": "MemberExpression",
"span": {
"start": 702,
"end": 710,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 702,
"end": 705,
"ctxt": 0
},
"value": "mod",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 706,
"end": 710,
"ctxt": 0
},
"value": "bad2",
"optional": false
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 712,
"end": 721,
"ctxt": 0
},
"expression": {
"type": "MemberExpression",
"span": {
"start": 712,
"end": 720,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 712,
"end": 715,
"ctxt": 0
},
"value": "mod",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 716,
"end": 720,
"ctxt": 0
},
"value": "bad3",
"optional": false
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 724,
"end": 738,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 724,
"end": 737,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "MemberExpression",
"span": {
"start": 724,
"end": 733,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 724,
"end": 727,
"ctxt": 0
},
"value": "mod",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 728,
"end": 733,
"ctxt": 0
},
"value": "thing",
"optional": false
}
},
"right": {
"type": "NumericLiteral",
"span": {
"start": 736,
"end": 737,
"ctxt": 0
},
"value": 0.0
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 739,
"end": 753,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 739,
"end": 752,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "MemberExpression",
"span": {
"start": 739,
"end": 748,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 739,
"end": 742,
"ctxt": 0
},
"value": "mod",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 743,
"end": 748,
"ctxt": 0
},
"value": "other",
"optional": false
}
},
"right": {
"type": "NumericLiteral",
"span": {
"start": 751,
"end": 752,
"ctxt": 0
},
"value": 0.0
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 754,
"end": 767,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 754,
"end": 766,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "MemberExpression",
"span": {
"start": 754,
"end": 762,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 754,
"end": 757,
"ctxt": 0
},
"value": "mod",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 758,
"end": 762,
"ctxt": 0
},
"value": "prop",
"optional": false
}
},
"right": {
"type": "NumericLiteral",
"span": {
"start": 765,
"end": 766,
"ctxt": 0
},
"value": 0.0
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 768,
"end": 781,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 768,
"end": 780,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "MemberExpression",
"span": {
"start": 768,
"end": 776,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 768,
"end": 771,
"ctxt": 0
},
"value": "mod",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 772,
"end": 776,
"ctxt": 0
},
"value": "bad1",
"optional": false
}
},
"right": {
"type": "NumericLiteral",
"span": {
"start": 779,
"end": 780,
"ctxt": 0
},
"value": 0.0
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 782,
"end": 795,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 782,
"end": 794,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "MemberExpression",
"span": {
"start": 782,
"end": 790,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 782,
"end": 785,
"ctxt": 0
},
"value": "mod",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 786,
"end": 790,
"ctxt": 0
},
"value": "bad2",
"optional": false
}
},
"right": {
"type": "NumericLiteral",
"span": {
"start": 793,
"end": 794,
"ctxt": 0
},
"value": 0.0
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 796,
"end": 809,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 796,
"end": 808,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "MemberExpression",
"span": {
"start": 796,
"end": 804,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 796,
"end": 799,
"ctxt": 0
},
"value": "mod",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 800,
"end": 804,
"ctxt": 0
},
"value": "bad3",
"optional": false
}
},
"right": {
"type": "NumericLiteral",
"span": {
"start": 807,
"end": 808,
"ctxt": 0
},
"value": 0.0
}
}
}
],
"interpreter": null
}