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

1165 lines
26 KiB
JSON

{
"type": "Script",
"span": {
"start": 1,
"end": 498,
"ctxt": 0
},
"body": [
{
"type": "VariableDeclaration",
"span": {
"start": 1,
"end": 11,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 5,
"end": 10,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 5,
"end": 10,
"ctxt": 0
},
"value": "value",
"optional": false,
"typeAnnotation": null
},
"init": null,
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 52,
"end": 67,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 56,
"end": 66,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 56,
"end": 58,
"ctxt": 0
},
"value": "x1",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 58,
"end": 66,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 60,
"end": 66,
"ctxt": 0
},
"kind": "number"
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "ExpressionStatement",
"span": {
"start": 68,
"end": 80,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 68,
"end": 79,
"ctxt": 0
},
"operator": "*=",
"left": {
"type": "Identifier",
"span": {
"start": 68,
"end": 70,
"ctxt": 0
},
"value": "x1",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "Identifier",
"span": {
"start": 74,
"end": 79,
"ctxt": 0
},
"value": "value",
"optional": false
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 81,
"end": 93,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 81,
"end": 92,
"ctxt": 0
},
"operator": "+=",
"left": {
"type": "Identifier",
"span": {
"start": 81,
"end": 83,
"ctxt": 0
},
"value": "x1",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "Identifier",
"span": {
"start": 87,
"end": 92,
"ctxt": 0
},
"value": "value",
"optional": false
}
}
},
{
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 104,
"end": 107,
"ctxt": 0
},
"value": "fn1",
"optional": false
},
"declare": false,
"params": [
{
"type": "Parameter",
"span": {
"start": 108,
"end": 118,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 108,
"end": 118,
"ctxt": 0
},
"value": "x2",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 110,
"end": 118,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 112,
"end": 118,
"ctxt": 0
},
"kind": "number"
}
}
}
}
],
"decorators": [],
"span": {
"start": 95,
"end": 157,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 120,
"end": 157,
"ctxt": 0
},
"stmts": [
{
"type": "ExpressionStatement",
"span": {
"start": 126,
"end": 138,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 126,
"end": 137,
"ctxt": 0
},
"operator": "*=",
"left": {
"type": "Identifier",
"span": {
"start": 126,
"end": 128,
"ctxt": 0
},
"value": "x2",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "Identifier",
"span": {
"start": 132,
"end": 137,
"ctxt": 0
},
"value": "value",
"optional": false
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 143,
"end": 155,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 143,
"end": 154,
"ctxt": 0
},
"operator": "+=",
"left": {
"type": "Identifier",
"span": {
"start": 143,
"end": 145,
"ctxt": 0
},
"value": "x2",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "Identifier",
"span": {
"start": 149,
"end": 154,
"ctxt": 0
},
"value": "value",
"optional": false
}
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
},
{
"type": "VariableDeclaration",
"span": {
"start": 180,
"end": 202,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 184,
"end": 201,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 184,
"end": 186,
"ctxt": 0
},
"value": "x3",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 186,
"end": 201,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeLiteral",
"span": {
"start": 188,
"end": 201,
"ctxt": 0
},
"members": [
{
"type": "TsPropertySignature",
"span": {
"start": 190,
"end": 199,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 190,
"end": 191,
"ctxt": 0
},
"value": "a",
"optional": false
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 191,
"end": 199,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 193,
"end": 199,
"ctxt": 0
},
"kind": "number"
}
},
"typeParams": null
}
]
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "ExpressionStatement",
"span": {
"start": 203,
"end": 217,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 203,
"end": 216,
"ctxt": 0
},
"operator": "*=",
"left": {
"type": "MemberExpression",
"span": {
"start": 203,
"end": 207,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 203,
"end": 205,
"ctxt": 0
},
"value": "x3",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 206,
"end": 207,
"ctxt": 0
},
"value": "a",
"optional": false
}
},
"right": {
"type": "Identifier",
"span": {
"start": 211,
"end": 216,
"ctxt": 0
},
"value": "value",
"optional": false
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 218,
"end": 232,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 218,
"end": 231,
"ctxt": 0
},
"operator": "+=",
"left": {
"type": "MemberExpression",
"span": {
"start": 218,
"end": 222,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 218,
"end": 220,
"ctxt": 0
},
"value": "x3",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 221,
"end": 222,
"ctxt": 0
},
"value": "a",
"optional": false
}
},
"right": {
"type": "Identifier",
"span": {
"start": 226,
"end": 231,
"ctxt": 0
},
"value": "value",
"optional": false
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 234,
"end": 251,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 234,
"end": 250,
"ctxt": 0
},
"operator": "*=",
"left": {
"type": "MemberExpression",
"span": {
"start": 234,
"end": 241,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 234,
"end": 236,
"ctxt": 0
},
"value": "x3",
"optional": false
},
"property": {
"type": "Computed",
"span": {
"start": 236,
"end": 241,
"ctxt": 0
},
"expression": {
"type": "StringLiteral",
"span": {
"start": 237,
"end": 240,
"ctxt": 0
},
"value": "a",
"raw": "'a'"
}
}
},
"right": {
"type": "Identifier",
"span": {
"start": 245,
"end": 250,
"ctxt": 0
},
"value": "value",
"optional": false
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 252,
"end": 269,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 252,
"end": 268,
"ctxt": 0
},
"operator": "+=",
"left": {
"type": "MemberExpression",
"span": {
"start": 252,
"end": 259,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 252,
"end": 254,
"ctxt": 0
},
"value": "x3",
"optional": false
},
"property": {
"type": "Computed",
"span": {
"start": 254,
"end": 259,
"ctxt": 0
},
"expression": {
"type": "StringLiteral",
"span": {
"start": 255,
"end": 258,
"ctxt": 0
},
"value": "a",
"raw": "'a'"
}
}
},
"right": {
"type": "Identifier",
"span": {
"start": 263,
"end": 268,
"ctxt": 0
},
"value": "value",
"optional": false
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 325,
"end": 339,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 325,
"end": 338,
"ctxt": 0
},
"operator": "*=",
"left": {
"type": "ParenthesisExpression",
"span": {
"start": 325,
"end": 329,
"ctxt": 0
},
"expression": {
"type": "Identifier",
"span": {
"start": 326,
"end": 328,
"ctxt": 0
},
"value": "x1",
"optional": false
}
},
"right": {
"type": "Identifier",
"span": {
"start": 333,
"end": 338,
"ctxt": 0
},
"value": "value",
"optional": false
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 340,
"end": 354,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 340,
"end": 353,
"ctxt": 0
},
"operator": "+=",
"left": {
"type": "ParenthesisExpression",
"span": {
"start": 340,
"end": 344,
"ctxt": 0
},
"expression": {
"type": "Identifier",
"span": {
"start": 341,
"end": 343,
"ctxt": 0
},
"value": "x1",
"optional": false
}
},
"right": {
"type": "Identifier",
"span": {
"start": 348,
"end": 353,
"ctxt": 0
},
"value": "value",
"optional": false
}
}
},
{
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 365,
"end": 368,
"ctxt": 0
},
"value": "fn2",
"optional": false
},
"declare": false,
"params": [
{
"type": "Parameter",
"span": {
"start": 369,
"end": 379,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 369,
"end": 379,
"ctxt": 0
},
"value": "x4",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 371,
"end": 379,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 373,
"end": 379,
"ctxt": 0
},
"kind": "number"
}
}
}
}
],
"decorators": [],
"span": {
"start": 356,
"end": 422,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 381,
"end": 422,
"ctxt": 0
},
"stmts": [
{
"type": "ExpressionStatement",
"span": {
"start": 387,
"end": 401,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 387,
"end": 400,
"ctxt": 0
},
"operator": "*=",
"left": {
"type": "ParenthesisExpression",
"span": {
"start": 387,
"end": 391,
"ctxt": 0
},
"expression": {
"type": "Identifier",
"span": {
"start": 388,
"end": 390,
"ctxt": 0
},
"value": "x4",
"optional": false
}
},
"right": {
"type": "Identifier",
"span": {
"start": 395,
"end": 400,
"ctxt": 0
},
"value": "value",
"optional": false
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 406,
"end": 420,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 406,
"end": 419,
"ctxt": 0
},
"operator": "+=",
"left": {
"type": "ParenthesisExpression",
"span": {
"start": 406,
"end": 410,
"ctxt": 0
},
"expression": {
"type": "Identifier",
"span": {
"start": 407,
"end": 409,
"ctxt": 0
},
"value": "x4",
"optional": false
}
},
"right": {
"type": "Identifier",
"span": {
"start": 414,
"end": 419,
"ctxt": 0
},
"value": "value",
"optional": false
}
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
},
{
"type": "ExpressionStatement",
"span": {
"start": 424,
"end": 440,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 424,
"end": 439,
"ctxt": 0
},
"operator": "*=",
"left": {
"type": "ParenthesisExpression",
"span": {
"start": 424,
"end": 430,
"ctxt": 0
},
"expression": {
"type": "MemberExpression",
"span": {
"start": 425,
"end": 429,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 425,
"end": 427,
"ctxt": 0
},
"value": "x3",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 428,
"end": 429,
"ctxt": 0
},
"value": "a",
"optional": false
}
}
},
"right": {
"type": "Identifier",
"span": {
"start": 434,
"end": 439,
"ctxt": 0
},
"value": "value",
"optional": false
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 441,
"end": 457,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 441,
"end": 456,
"ctxt": 0
},
"operator": "+=",
"left": {
"type": "ParenthesisExpression",
"span": {
"start": 441,
"end": 447,
"ctxt": 0
},
"expression": {
"type": "MemberExpression",
"span": {
"start": 442,
"end": 446,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 442,
"end": 444,
"ctxt": 0
},
"value": "x3",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 445,
"end": 446,
"ctxt": 0
},
"value": "a",
"optional": false
}
}
},
"right": {
"type": "Identifier",
"span": {
"start": 451,
"end": 456,
"ctxt": 0
},
"value": "value",
"optional": false
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 459,
"end": 478,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 459,
"end": 477,
"ctxt": 0
},
"operator": "*=",
"left": {
"type": "ParenthesisExpression",
"span": {
"start": 459,
"end": 468,
"ctxt": 0
},
"expression": {
"type": "MemberExpression",
"span": {
"start": 460,
"end": 467,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 460,
"end": 462,
"ctxt": 0
},
"value": "x3",
"optional": false
},
"property": {
"type": "Computed",
"span": {
"start": 462,
"end": 467,
"ctxt": 0
},
"expression": {
"type": "StringLiteral",
"span": {
"start": 463,
"end": 466,
"ctxt": 0
},
"value": "a",
"raw": "'a'"
}
}
}
},
"right": {
"type": "Identifier",
"span": {
"start": 472,
"end": 477,
"ctxt": 0
},
"value": "value",
"optional": false
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 479,
"end": 498,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 479,
"end": 497,
"ctxt": 0
},
"operator": "+=",
"left": {
"type": "ParenthesisExpression",
"span": {
"start": 479,
"end": 488,
"ctxt": 0
},
"expression": {
"type": "MemberExpression",
"span": {
"start": 480,
"end": 487,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 480,
"end": 482,
"ctxt": 0
},
"value": "x3",
"optional": false
},
"property": {
"type": "Computed",
"span": {
"start": 482,
"end": 487,
"ctxt": 0
},
"expression": {
"type": "StringLiteral",
"span": {
"start": 483,
"end": 486,
"ctxt": 0
},
"value": "a",
"raw": "'a'"
}
}
}
},
"right": {
"type": "Identifier",
"span": {
"start": 492,
"end": 497,
"ctxt": 0
},
"value": "value",
"optional": false
}
}
}
],
"interpreter": null
}