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

1181 lines
27 KiB
JSON

{
"type": "Script",
"span": {
"start": 0,
"end": 497,
"ctxt": 0
},
"body": [
{
"type": "VariableDeclaration",
"span": {
"start": 0,
"end": 10,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 4,
"end": 9,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 4,
"end": 9,
"ctxt": 0
},
"value": "value",
"optional": false,
"typeAnnotation": null
},
"init": null,
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 51,
"end": 66,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 55,
"end": 65,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 55,
"end": 57,
"ctxt": 0
},
"value": "x1",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 57,
"end": 65,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 59,
"end": 65,
"ctxt": 0
},
"kind": "number"
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "ExpressionStatement",
"span": {
"start": 67,
"end": 79,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 67,
"end": 78,
"ctxt": 0
},
"operator": "*=",
"left": {
"type": "Identifier",
"span": {
"start": 67,
"end": 69,
"ctxt": 0
},
"value": "x1",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "Identifier",
"span": {
"start": 73,
"end": 78,
"ctxt": 0
},
"value": "value",
"optional": false
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 80,
"end": 92,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 80,
"end": 91,
"ctxt": 0
},
"operator": "+=",
"left": {
"type": "Identifier",
"span": {
"start": 80,
"end": 82,
"ctxt": 0
},
"value": "x1",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "Identifier",
"span": {
"start": 86,
"end": 91,
"ctxt": 0
},
"value": "value",
"optional": false
}
}
},
{
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 103,
"end": 106,
"ctxt": 0
},
"value": "fn1",
"optional": false
},
"declare": false,
"params": [
{
"type": "Parameter",
"span": {
"start": 107,
"end": 117,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 107,
"end": 117,
"ctxt": 0
},
"value": "x2",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 109,
"end": 117,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 111,
"end": 117,
"ctxt": 0
},
"kind": "number"
}
}
}
}
],
"decorators": [],
"span": {
"start": 94,
"end": 156,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 119,
"end": 156,
"ctxt": 0
},
"stmts": [
{
"type": "ExpressionStatement",
"span": {
"start": 125,
"end": 137,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 125,
"end": 136,
"ctxt": 0
},
"operator": "*=",
"left": {
"type": "Identifier",
"span": {
"start": 125,
"end": 127,
"ctxt": 0
},
"value": "x2",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "Identifier",
"span": {
"start": 131,
"end": 136,
"ctxt": 0
},
"value": "value",
"optional": false
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 142,
"end": 154,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 142,
"end": 153,
"ctxt": 0
},
"operator": "+=",
"left": {
"type": "Identifier",
"span": {
"start": 142,
"end": 144,
"ctxt": 0
},
"value": "x2",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "Identifier",
"span": {
"start": 148,
"end": 153,
"ctxt": 0
},
"value": "value",
"optional": false
}
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
},
{
"type": "VariableDeclaration",
"span": {
"start": 179,
"end": 201,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 183,
"end": 200,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 183,
"end": 185,
"ctxt": 0
},
"value": "x3",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 185,
"end": 200,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeLiteral",
"span": {
"start": 187,
"end": 200,
"ctxt": 0
},
"members": [
{
"type": "TsPropertySignature",
"span": {
"start": 189,
"end": 198,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 189,
"end": 190,
"ctxt": 0
},
"value": "a",
"optional": false
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 190,
"end": 198,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 192,
"end": 198,
"ctxt": 0
},
"kind": "number"
}
},
"typeParams": null
}
]
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "ExpressionStatement",
"span": {
"start": 202,
"end": 216,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 202,
"end": 215,
"ctxt": 0
},
"operator": "*=",
"left": {
"type": "MemberExpression",
"span": {
"start": 202,
"end": 206,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 202,
"end": 204,
"ctxt": 0
},
"value": "x3",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 205,
"end": 206,
"ctxt": 0
},
"value": "a",
"optional": false
}
},
"right": {
"type": "Identifier",
"span": {
"start": 210,
"end": 215,
"ctxt": 0
},
"value": "value",
"optional": false
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 217,
"end": 231,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 217,
"end": 230,
"ctxt": 0
},
"operator": "+=",
"left": {
"type": "MemberExpression",
"span": {
"start": 217,
"end": 221,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 217,
"end": 219,
"ctxt": 0
},
"value": "x3",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 220,
"end": 221,
"ctxt": 0
},
"value": "a",
"optional": false
}
},
"right": {
"type": "Identifier",
"span": {
"start": 225,
"end": 230,
"ctxt": 0
},
"value": "value",
"optional": false
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 233,
"end": 250,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 233,
"end": 249,
"ctxt": 0
},
"operator": "*=",
"left": {
"type": "MemberExpression",
"span": {
"start": 233,
"end": 240,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 233,
"end": 235,
"ctxt": 0
},
"value": "x3",
"optional": false
},
"property": {
"type": "Computed",
"span": {
"start": 235,
"end": 240,
"ctxt": 0
},
"expression": {
"type": "StringLiteral",
"span": {
"start": 236,
"end": 239,
"ctxt": 0
},
"value": "a",
"hasEscape": false,
"kind": {
"type": "normal",
"containsQuote": true
}
}
}
},
"right": {
"type": "Identifier",
"span": {
"start": 244,
"end": 249,
"ctxt": 0
},
"value": "value",
"optional": false
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 251,
"end": 268,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 251,
"end": 267,
"ctxt": 0
},
"operator": "+=",
"left": {
"type": "MemberExpression",
"span": {
"start": 251,
"end": 258,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 251,
"end": 253,
"ctxt": 0
},
"value": "x3",
"optional": false
},
"property": {
"type": "Computed",
"span": {
"start": 253,
"end": 258,
"ctxt": 0
},
"expression": {
"type": "StringLiteral",
"span": {
"start": 254,
"end": 257,
"ctxt": 0
},
"value": "a",
"hasEscape": false,
"kind": {
"type": "normal",
"containsQuote": true
}
}
}
},
"right": {
"type": "Identifier",
"span": {
"start": 262,
"end": 267,
"ctxt": 0
},
"value": "value",
"optional": false
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 324,
"end": 338,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 324,
"end": 337,
"ctxt": 0
},
"operator": "*=",
"left": {
"type": "ParenthesisExpression",
"span": {
"start": 324,
"end": 328,
"ctxt": 0
},
"expression": {
"type": "Identifier",
"span": {
"start": 325,
"end": 327,
"ctxt": 0
},
"value": "x1",
"optional": false
}
},
"right": {
"type": "Identifier",
"span": {
"start": 332,
"end": 337,
"ctxt": 0
},
"value": "value",
"optional": false
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 339,
"end": 353,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 339,
"end": 352,
"ctxt": 0
},
"operator": "+=",
"left": {
"type": "ParenthesisExpression",
"span": {
"start": 339,
"end": 343,
"ctxt": 0
},
"expression": {
"type": "Identifier",
"span": {
"start": 340,
"end": 342,
"ctxt": 0
},
"value": "x1",
"optional": false
}
},
"right": {
"type": "Identifier",
"span": {
"start": 347,
"end": 352,
"ctxt": 0
},
"value": "value",
"optional": false
}
}
},
{
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 364,
"end": 367,
"ctxt": 0
},
"value": "fn2",
"optional": false
},
"declare": false,
"params": [
{
"type": "Parameter",
"span": {
"start": 368,
"end": 378,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 368,
"end": 378,
"ctxt": 0
},
"value": "x4",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 370,
"end": 378,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 372,
"end": 378,
"ctxt": 0
},
"kind": "number"
}
}
}
}
],
"decorators": [],
"span": {
"start": 355,
"end": 421,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 380,
"end": 421,
"ctxt": 0
},
"stmts": [
{
"type": "ExpressionStatement",
"span": {
"start": 386,
"end": 400,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 386,
"end": 399,
"ctxt": 0
},
"operator": "*=",
"left": {
"type": "ParenthesisExpression",
"span": {
"start": 386,
"end": 390,
"ctxt": 0
},
"expression": {
"type": "Identifier",
"span": {
"start": 387,
"end": 389,
"ctxt": 0
},
"value": "x4",
"optional": false
}
},
"right": {
"type": "Identifier",
"span": {
"start": 394,
"end": 399,
"ctxt": 0
},
"value": "value",
"optional": false
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 405,
"end": 419,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 405,
"end": 418,
"ctxt": 0
},
"operator": "+=",
"left": {
"type": "ParenthesisExpression",
"span": {
"start": 405,
"end": 409,
"ctxt": 0
},
"expression": {
"type": "Identifier",
"span": {
"start": 406,
"end": 408,
"ctxt": 0
},
"value": "x4",
"optional": false
}
},
"right": {
"type": "Identifier",
"span": {
"start": 413,
"end": 418,
"ctxt": 0
},
"value": "value",
"optional": false
}
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
},
{
"type": "ExpressionStatement",
"span": {
"start": 423,
"end": 439,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 423,
"end": 438,
"ctxt": 0
},
"operator": "*=",
"left": {
"type": "ParenthesisExpression",
"span": {
"start": 423,
"end": 429,
"ctxt": 0
},
"expression": {
"type": "MemberExpression",
"span": {
"start": 424,
"end": 428,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 424,
"end": 426,
"ctxt": 0
},
"value": "x3",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 427,
"end": 428,
"ctxt": 0
},
"value": "a",
"optional": false
}
}
},
"right": {
"type": "Identifier",
"span": {
"start": 433,
"end": 438,
"ctxt": 0
},
"value": "value",
"optional": false
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 440,
"end": 456,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 440,
"end": 455,
"ctxt": 0
},
"operator": "+=",
"left": {
"type": "ParenthesisExpression",
"span": {
"start": 440,
"end": 446,
"ctxt": 0
},
"expression": {
"type": "MemberExpression",
"span": {
"start": 441,
"end": 445,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 441,
"end": 443,
"ctxt": 0
},
"value": "x3",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 444,
"end": 445,
"ctxt": 0
},
"value": "a",
"optional": false
}
}
},
"right": {
"type": "Identifier",
"span": {
"start": 450,
"end": 455,
"ctxt": 0
},
"value": "value",
"optional": false
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 458,
"end": 477,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 458,
"end": 476,
"ctxt": 0
},
"operator": "*=",
"left": {
"type": "ParenthesisExpression",
"span": {
"start": 458,
"end": 467,
"ctxt": 0
},
"expression": {
"type": "MemberExpression",
"span": {
"start": 459,
"end": 466,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 459,
"end": 461,
"ctxt": 0
},
"value": "x3",
"optional": false
},
"property": {
"type": "Computed",
"span": {
"start": 461,
"end": 466,
"ctxt": 0
},
"expression": {
"type": "StringLiteral",
"span": {
"start": 462,
"end": 465,
"ctxt": 0
},
"value": "a",
"hasEscape": false,
"kind": {
"type": "normal",
"containsQuote": true
}
}
}
}
},
"right": {
"type": "Identifier",
"span": {
"start": 471,
"end": 476,
"ctxt": 0
},
"value": "value",
"optional": false
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 478,
"end": 497,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 478,
"end": 496,
"ctxt": 0
},
"operator": "+=",
"left": {
"type": "ParenthesisExpression",
"span": {
"start": 478,
"end": 487,
"ctxt": 0
},
"expression": {
"type": "MemberExpression",
"span": {
"start": 479,
"end": 486,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 479,
"end": 481,
"ctxt": 0
},
"value": "x3",
"optional": false
},
"property": {
"type": "Computed",
"span": {
"start": 481,
"end": 486,
"ctxt": 0
},
"expression": {
"type": "StringLiteral",
"span": {
"start": 482,
"end": 485,
"ctxt": 0
},
"value": "a",
"hasEscape": false,
"kind": {
"type": "normal",
"containsQuote": true
}
}
}
}
},
"right": {
"type": "Identifier",
"span": {
"start": 491,
"end": 496,
"ctxt": 0
},
"value": "value",
"optional": false
}
}
}
],
"interpreter": null
}