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

1505 lines
35 KiB
JSON

{
"type": "Script",
"span": {
"start": 94,
"end": 810,
"ctxt": 0
},
"body": [
{
"type": "VariableDeclaration",
"span": {
"start": 94,
"end": 136,
"ctxt": 0
},
"kind": "const",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 100,
"end": 135,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 100,
"end": 103,
"ctxt": 0
},
"value": "obj",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "ObjectExpression",
"span": {
"start": 106,
"end": 135,
"ctxt": 0
},
"properties": [
{
"type": "KeyValueProperty",
"key": {
"type": "Identifier",
"span": {
"start": 108,
"end": 113,
"ctxt": 0
},
"value": "value",
"optional": false
},
"value": {
"type": "NumericLiteral",
"span": {
"start": 115,
"end": 117,
"ctxt": 0
},
"value": 42.0,
"raw": "42"
}
},
{
"type": "KeyValueProperty",
"key": {
"type": "Identifier",
"span": {
"start": 119,
"end": 127,
"ctxt": 0
},
"value": "writable",
"optional": false
},
"value": {
"type": "BooleanLiteral",
"span": {
"start": 129,
"end": 133,
"ctxt": 0
},
"value": true
}
}
]
},
"definite": false
}
]
},
{
"type": "ExpressionStatement",
"span": {
"start": 137,
"end": 182,
"ctxt": 0
},
"expression": {
"type": "CallExpression",
"span": {
"start": 137,
"end": 181,
"ctxt": 0
},
"callee": {
"type": "MemberExpression",
"span": {
"start": 137,
"end": 158,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 137,
"end": 143,
"ctxt": 0
},
"value": "Object",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 144,
"end": 158,
"ctxt": 0
},
"value": "defineProperty",
"optional": false
}
},
"arguments": [
{
"spread": null,
"expression": {
"type": "Identifier",
"span": {
"start": 159,
"end": 166,
"ctxt": 0
},
"value": "exports",
"optional": false
}
},
{
"spread": null,
"expression": {
"type": "StringLiteral",
"span": {
"start": 168,
"end": 175,
"ctxt": 0
},
"value": "thing",
"raw": "\"thing\""
}
},
{
"spread": null,
"expression": {
"type": "Identifier",
"span": {
"start": 177,
"end": 180,
"ctxt": 0
},
"value": "obj",
"optional": false
}
}
],
"typeArguments": null
}
},
{
"type": "VariableDeclaration",
"span": {
"start": 210,
"end": 251,
"ctxt": 0
},
"kind": "let",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 214,
"end": 250,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 214,
"end": 217,
"ctxt": 0
},
"value": "str",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "ParenthesisExpression",
"span": {
"start": 241,
"end": 250,
"ctxt": 0
},
"expression": {
"type": "StringLiteral",
"span": {
"start": 242,
"end": 249,
"ctxt": 0
},
"value": "other",
"raw": "\"other\""
}
},
"definite": false
}
]
},
{
"type": "ExpressionStatement",
"span": {
"start": 252,
"end": 319,
"ctxt": 0
},
"expression": {
"type": "CallExpression",
"span": {
"start": 252,
"end": 318,
"ctxt": 0
},
"callee": {
"type": "MemberExpression",
"span": {
"start": 252,
"end": 273,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 252,
"end": 258,
"ctxt": 0
},
"value": "Object",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 259,
"end": 273,
"ctxt": 0
},
"value": "defineProperty",
"optional": false
}
},
"arguments": [
{
"spread": null,
"expression": {
"type": "Identifier",
"span": {
"start": 274,
"end": 281,
"ctxt": 0
},
"value": "exports",
"optional": false
}
},
{
"spread": null,
"expression": {
"type": "Identifier",
"span": {
"start": 283,
"end": 286,
"ctxt": 0
},
"value": "str",
"optional": false
}
},
{
"spread": null,
"expression": {
"type": "ObjectExpression",
"span": {
"start": 288,
"end": 317,
"ctxt": 0
},
"properties": [
{
"type": "KeyValueProperty",
"key": {
"type": "Identifier",
"span": {
"start": 290,
"end": 295,
"ctxt": 0
},
"value": "value",
"optional": false
},
"value": {
"type": "NumericLiteral",
"span": {
"start": 297,
"end": 299,
"ctxt": 0
},
"value": 42.0,
"raw": "42"
}
},
{
"type": "KeyValueProperty",
"key": {
"type": "Identifier",
"span": {
"start": 301,
"end": 309,
"ctxt": 0
},
"value": "writable",
"optional": false
},
"value": {
"type": "BooleanLiteral",
"span": {
"start": 311,
"end": 315,
"ctxt": 0
},
"value": true
}
}
]
}
}
],
"typeArguments": null
}
},
{
"type": "VariableDeclaration",
"span": {
"start": 321,
"end": 344,
"ctxt": 0
},
"kind": "const",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 327,
"end": 344,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 327,
"end": 335,
"ctxt": 0
},
"value": "propName",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "StringLiteral",
"span": {
"start": 338,
"end": 344,
"ctxt": 0
},
"value": "prop",
"raw": "\"prop\""
},
"definite": false
}
]
},
{
"type": "ExpressionStatement",
"span": {
"start": 345,
"end": 417,
"ctxt": 0
},
"expression": {
"type": "CallExpression",
"span": {
"start": 345,
"end": 416,
"ctxt": 0
},
"callee": {
"type": "MemberExpression",
"span": {
"start": 345,
"end": 366,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 345,
"end": 351,
"ctxt": 0
},
"value": "Object",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 352,
"end": 366,
"ctxt": 0
},
"value": "defineProperty",
"optional": false
}
},
"arguments": [
{
"spread": null,
"expression": {
"type": "Identifier",
"span": {
"start": 367,
"end": 374,
"ctxt": 0
},
"value": "exports",
"optional": false
}
},
{
"spread": null,
"expression": {
"type": "Identifier",
"span": {
"start": 376,
"end": 384,
"ctxt": 0
},
"value": "propName",
"optional": false
}
},
{
"spread": null,
"expression": {
"type": "ObjectExpression",
"span": {
"start": 386,
"end": 415,
"ctxt": 0
},
"properties": [
{
"type": "KeyValueProperty",
"key": {
"type": "Identifier",
"span": {
"start": 388,
"end": 393,
"ctxt": 0
},
"value": "value",
"optional": false
},
"value": {
"type": "NumericLiteral",
"span": {
"start": 395,
"end": 397,
"ctxt": 0
},
"value": 42.0,
"raw": "42"
}
},
{
"type": "KeyValueProperty",
"key": {
"type": "Identifier",
"span": {
"start": 399,
"end": 407,
"ctxt": 0
},
"value": "writable",
"optional": false
},
"value": {
"type": "BooleanLiteral",
"span": {
"start": 409,
"end": 413,
"ctxt": 0
},
"value": true
}
}
]
}
}
],
"typeArguments": null
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 420,
"end": 464,
"ctxt": 0
},
"expression": {
"type": "CallExpression",
"span": {
"start": 420,
"end": 463,
"ctxt": 0
},
"callee": {
"type": "MemberExpression",
"span": {
"start": 420,
"end": 441,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 420,
"end": 426,
"ctxt": 0
},
"value": "Object",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 427,
"end": 441,
"ctxt": 0
},
"value": "defineProperty",
"optional": false
}
},
"arguments": [
{
"spread": null,
"expression": {
"type": "Identifier",
"span": {
"start": 442,
"end": 449,
"ctxt": 0
},
"value": "exports",
"optional": false
}
},
{
"spread": null,
"expression": {
"type": "StringLiteral",
"span": {
"start": 451,
"end": 457,
"ctxt": 0
},
"value": "bad1",
"raw": "\"bad1\""
}
},
{
"spread": null,
"expression": {
"type": "ObjectExpression",
"span": {
"start": 459,
"end": 462,
"ctxt": 0
},
"properties": []
}
}
],
"typeArguments": null
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 465,
"end": 542,
"ctxt": 0
},
"expression": {
"type": "CallExpression",
"span": {
"start": 465,
"end": 541,
"ctxt": 0
},
"callee": {
"type": "MemberExpression",
"span": {
"start": 465,
"end": 486,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 465,
"end": 471,
"ctxt": 0
},
"value": "Object",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 472,
"end": 486,
"ctxt": 0
},
"value": "defineProperty",
"optional": false
}
},
"arguments": [
{
"spread": null,
"expression": {
"type": "Identifier",
"span": {
"start": 487,
"end": 494,
"ctxt": 0
},
"value": "exports",
"optional": false
}
},
{
"spread": null,
"expression": {
"type": "StringLiteral",
"span": {
"start": 496,
"end": 502,
"ctxt": 0
},
"value": "bad2",
"raw": "\"bad2\""
}
},
{
"spread": null,
"expression": {
"type": "ObjectExpression",
"span": {
"start": 504,
"end": 540,
"ctxt": 0
},
"properties": [
{
"type": "MethodProperty",
"key": {
"type": "Identifier",
"span": {
"start": 506,
"end": 509,
"ctxt": 0
},
"value": "get",
"optional": false
},
"params": [],
"decorators": [],
"span": {
"start": 506,
"end": 525,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 512,
"end": 525,
"ctxt": 0
},
"stmts": [
{
"type": "ReturnStatement",
"span": {
"start": 514,
"end": 523,
"ctxt": 0
},
"argument": {
"type": "NumericLiteral",
"span": {
"start": 521,
"end": 523,
"ctxt": 0
},
"value": 12.0,
"raw": "12"
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
},
{
"type": "KeyValueProperty",
"key": {
"type": "Identifier",
"span": {
"start": 527,
"end": 532,
"ctxt": 0
},
"value": "value",
"optional": false
},
"value": {
"type": "StringLiteral",
"span": {
"start": 534,
"end": 538,
"ctxt": 0
},
"value": "no",
"raw": "\"no\""
}
}
]
}
}
],
"typeArguments": null
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 543,
"end": 602,
"ctxt": 0
},
"expression": {
"type": "CallExpression",
"span": {
"start": 543,
"end": 601,
"ctxt": 0
},
"callee": {
"type": "MemberExpression",
"span": {
"start": 543,
"end": 564,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 543,
"end": 549,
"ctxt": 0
},
"value": "Object",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 550,
"end": 564,
"ctxt": 0
},
"value": "defineProperty",
"optional": false
}
},
"arguments": [
{
"spread": null,
"expression": {
"type": "Identifier",
"span": {
"start": 565,
"end": 572,
"ctxt": 0
},
"value": "exports",
"optional": false
}
},
{
"spread": null,
"expression": {
"type": "StringLiteral",
"span": {
"start": 574,
"end": 580,
"ctxt": 0
},
"value": "bad3",
"raw": "\"bad3\""
}
},
{
"spread": null,
"expression": {
"type": "ObjectExpression",
"span": {
"start": 582,
"end": 600,
"ctxt": 0
},
"properties": [
{
"type": "KeyValueProperty",
"key": {
"type": "Identifier",
"span": {
"start": 584,
"end": 592,
"ctxt": 0
},
"value": "writable",
"optional": false
},
"value": {
"type": "BooleanLiteral",
"span": {
"start": 594,
"end": 598,
"ctxt": 0
},
"value": true
}
}
]
}
}
],
"typeArguments": null
}
},
{
"type": "VariableDeclaration",
"span": {
"start": 630,
"end": 660,
"ctxt": 0
},
"kind": "const",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 636,
"end": 659,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 636,
"end": 639,
"ctxt": 0
},
"value": "mod",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "CallExpression",
"span": {
"start": 642,
"end": 659,
"ctxt": 0
},
"callee": {
"type": "Identifier",
"span": {
"start": 642,
"end": 649,
"ctxt": 0
},
"value": "require",
"optional": false
},
"arguments": [
{
"spread": null,
"expression": {
"type": "StringLiteral",
"span": {
"start": 650,
"end": 658,
"ctxt": 0
},
"value": "./mod1",
"raw": "\"./mod1\""
}
}
],
"typeArguments": null
},
"definite": false
}
]
},
{
"type": "ExpressionStatement",
"span": {
"start": 661,
"end": 671,
"ctxt": 0
},
"expression": {
"type": "MemberExpression",
"span": {
"start": 661,
"end": 670,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 661,
"end": 664,
"ctxt": 0
},
"value": "mod",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 665,
"end": 670,
"ctxt": 0
},
"value": "thing",
"optional": false
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 672,
"end": 682,
"ctxt": 0
},
"expression": {
"type": "MemberExpression",
"span": {
"start": 672,
"end": 681,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 672,
"end": 675,
"ctxt": 0
},
"value": "mod",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 676,
"end": 681,
"ctxt": 0
},
"value": "other",
"optional": false
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 683,
"end": 692,
"ctxt": 0
},
"expression": {
"type": "MemberExpression",
"span": {
"start": 683,
"end": 691,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 683,
"end": 686,
"ctxt": 0
},
"value": "mod",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 687,
"end": 691,
"ctxt": 0
},
"value": "prop",
"optional": false
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 693,
"end": 702,
"ctxt": 0
},
"expression": {
"type": "MemberExpression",
"span": {
"start": 693,
"end": 701,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 693,
"end": 696,
"ctxt": 0
},
"value": "mod",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 697,
"end": 701,
"ctxt": 0
},
"value": "bad1",
"optional": false
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 703,
"end": 712,
"ctxt": 0
},
"expression": {
"type": "MemberExpression",
"span": {
"start": 703,
"end": 711,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 703,
"end": 706,
"ctxt": 0
},
"value": "mod",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 707,
"end": 711,
"ctxt": 0
},
"value": "bad2",
"optional": false
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 713,
"end": 722,
"ctxt": 0
},
"expression": {
"type": "MemberExpression",
"span": {
"start": 713,
"end": 721,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 713,
"end": 716,
"ctxt": 0
},
"value": "mod",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 717,
"end": 721,
"ctxt": 0
},
"value": "bad3",
"optional": false
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 725,
"end": 739,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 725,
"end": 738,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "MemberExpression",
"span": {
"start": 725,
"end": 734,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 725,
"end": 728,
"ctxt": 0
},
"value": "mod",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 729,
"end": 734,
"ctxt": 0
},
"value": "thing",
"optional": false
}
},
"right": {
"type": "NumericLiteral",
"span": {
"start": 737,
"end": 738,
"ctxt": 0
},
"value": 0.0,
"raw": "0"
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 740,
"end": 754,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 740,
"end": 753,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "MemberExpression",
"span": {
"start": 740,
"end": 749,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 740,
"end": 743,
"ctxt": 0
},
"value": "mod",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 744,
"end": 749,
"ctxt": 0
},
"value": "other",
"optional": false
}
},
"right": {
"type": "NumericLiteral",
"span": {
"start": 752,
"end": 753,
"ctxt": 0
},
"value": 0.0,
"raw": "0"
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 755,
"end": 768,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 755,
"end": 767,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "MemberExpression",
"span": {
"start": 755,
"end": 763,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 755,
"end": 758,
"ctxt": 0
},
"value": "mod",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 759,
"end": 763,
"ctxt": 0
},
"value": "prop",
"optional": false
}
},
"right": {
"type": "NumericLiteral",
"span": {
"start": 766,
"end": 767,
"ctxt": 0
},
"value": 0.0,
"raw": "0"
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 769,
"end": 782,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 769,
"end": 781,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "MemberExpression",
"span": {
"start": 769,
"end": 777,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 769,
"end": 772,
"ctxt": 0
},
"value": "mod",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 773,
"end": 777,
"ctxt": 0
},
"value": "bad1",
"optional": false
}
},
"right": {
"type": "NumericLiteral",
"span": {
"start": 780,
"end": 781,
"ctxt": 0
},
"value": 0.0,
"raw": "0"
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 783,
"end": 796,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 783,
"end": 795,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "MemberExpression",
"span": {
"start": 783,
"end": 791,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 783,
"end": 786,
"ctxt": 0
},
"value": "mod",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 787,
"end": 791,
"ctxt": 0
},
"value": "bad2",
"optional": false
}
},
"right": {
"type": "NumericLiteral",
"span": {
"start": 794,
"end": 795,
"ctxt": 0
},
"value": 0.0,
"raw": "0"
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 797,
"end": 810,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 797,
"end": 809,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "MemberExpression",
"span": {
"start": 797,
"end": 805,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 797,
"end": 800,
"ctxt": 0
},
"value": "mod",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 801,
"end": 805,
"ctxt": 0
},
"value": "bad3",
"optional": false
}
},
"right": {
"type": "NumericLiteral",
"span": {
"start": 808,
"end": 809,
"ctxt": 0
},
"value": 0.0,
"raw": "0"
}
}
}
],
"interpreter": null
}