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

771 lines
18 KiB
JSON

{
"type": "Script",
"span": {
"start": 0,
"end": 359,
"ctxt": 0
},
"body": [
{
"type": "VariableDeclaration",
"span": {
"start": 0,
"end": 15,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 4,
"end": 14,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 4,
"end": 9,
"ctxt": 0
},
"value": "value",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 9,
"end": 14,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 11,
"end": 14,
"ctxt": 0
},
"kind": "any"
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 56,
"end": 71,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 60,
"end": 70,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 60,
"end": 62,
"ctxt": 0
},
"value": "x1",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 62,
"end": 70,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 64,
"end": 70,
"ctxt": 0
},
"kind": "number"
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "ExpressionStatement",
"span": {
"start": 72,
"end": 83,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 72,
"end": 82,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "Identifier",
"span": {
"start": 72,
"end": 74,
"ctxt": 0
},
"value": "x1",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "Identifier",
"span": {
"start": 77,
"end": 82,
"ctxt": 0
},
"value": "value",
"optional": false
}
}
},
{
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 94,
"end": 97,
"ctxt": 0
},
"value": "fn1",
"optional": false
},
"declare": false,
"params": [
{
"type": "Parameter",
"span": {
"start": 98,
"end": 108,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 98,
"end": 108,
"ctxt": 0
},
"value": "x2",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 100,
"end": 108,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 102,
"end": 108,
"ctxt": 0
},
"kind": "number"
}
}
}
}
],
"decorators": [],
"span": {
"start": 85,
"end": 129,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 110,
"end": 129,
"ctxt": 0
},
"stmts": [
{
"type": "ExpressionStatement",
"span": {
"start": 116,
"end": 127,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 116,
"end": 126,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "Identifier",
"span": {
"start": 116,
"end": 118,
"ctxt": 0
},
"value": "x2",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "Identifier",
"span": {
"start": 121,
"end": 126,
"ctxt": 0
},
"value": "value",
"optional": false
}
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
},
{
"type": "VariableDeclaration",
"span": {
"start": 152,
"end": 175,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 156,
"end": 174,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 156,
"end": 158,
"ctxt": 0
},
"value": "x3",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 158,
"end": 174,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeLiteral",
"span": {
"start": 160,
"end": 174,
"ctxt": 0
},
"members": [
{
"type": "TsPropertySignature",
"span": {
"start": 162,
"end": 171,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 162,
"end": 163,
"ctxt": 0
},
"value": "a",
"optional": false
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 163,
"end": 171,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 165,
"end": 171,
"ctxt": 0
},
"kind": "string"
}
},
"typeParams": null
}
]
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "ExpressionStatement",
"span": {
"start": 176,
"end": 189,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 176,
"end": 188,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "MemberExpression",
"span": {
"start": 176,
"end": 180,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 176,
"end": 178,
"ctxt": 0
},
"value": "x3",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 179,
"end": 180,
"ctxt": 0
},
"value": "a",
"optional": false
}
},
"right": {
"type": "Identifier",
"span": {
"start": 183,
"end": 188,
"ctxt": 0
},
"value": "value",
"optional": false
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 190,
"end": 206,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 190,
"end": 205,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "MemberExpression",
"span": {
"start": 190,
"end": 197,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 190,
"end": 192,
"ctxt": 0
},
"value": "x3",
"optional": false
},
"property": {
"type": "Computed",
"span": {
"start": 192,
"end": 197,
"ctxt": 0
},
"expression": {
"type": "StringLiteral",
"span": {
"start": 193,
"end": 196,
"ctxt": 0
},
"value": "a",
"hasEscape": false,
"kind": {
"type": "normal",
"containsQuote": true
}
}
}
},
"right": {
"type": "Identifier",
"span": {
"start": 200,
"end": 205,
"ctxt": 0
},
"value": "value",
"optional": false
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 262,
"end": 275,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 262,
"end": 274,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "ParenthesisExpression",
"span": {
"start": 262,
"end": 266,
"ctxt": 0
},
"expression": {
"type": "Identifier",
"span": {
"start": 263,
"end": 265,
"ctxt": 0
},
"value": "x1",
"optional": false
}
},
"right": {
"type": "Identifier",
"span": {
"start": 269,
"end": 274,
"ctxt": 0
},
"value": "value",
"optional": false
}
}
},
{
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 286,
"end": 289,
"ctxt": 0
},
"value": "fn2",
"optional": false
},
"declare": false,
"params": [
{
"type": "Parameter",
"span": {
"start": 290,
"end": 300,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 290,
"end": 300,
"ctxt": 0
},
"value": "x4",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 292,
"end": 300,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 294,
"end": 300,
"ctxt": 0
},
"kind": "number"
}
}
}
}
],
"decorators": [],
"span": {
"start": 277,
"end": 323,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 302,
"end": 323,
"ctxt": 0
},
"stmts": [
{
"type": "ExpressionStatement",
"span": {
"start": 308,
"end": 321,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 308,
"end": 320,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "ParenthesisExpression",
"span": {
"start": 308,
"end": 312,
"ctxt": 0
},
"expression": {
"type": "Identifier",
"span": {
"start": 309,
"end": 311,
"ctxt": 0
},
"value": "x4",
"optional": false
}
},
"right": {
"type": "Identifier",
"span": {
"start": 315,
"end": 320,
"ctxt": 0
},
"value": "value",
"optional": false
}
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
},
{
"type": "ExpressionStatement",
"span": {
"start": 325,
"end": 340,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 325,
"end": 339,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "ParenthesisExpression",
"span": {
"start": 325,
"end": 331,
"ctxt": 0
},
"expression": {
"type": "MemberExpression",
"span": {
"start": 326,
"end": 330,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 326,
"end": 328,
"ctxt": 0
},
"value": "x3",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 329,
"end": 330,
"ctxt": 0
},
"value": "a",
"optional": false
}
}
},
"right": {
"type": "Identifier",
"span": {
"start": 334,
"end": 339,
"ctxt": 0
},
"value": "value",
"optional": false
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 341,
"end": 359,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 341,
"end": 358,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "ParenthesisExpression",
"span": {
"start": 341,
"end": 350,
"ctxt": 0
},
"expression": {
"type": "MemberExpression",
"span": {
"start": 342,
"end": 349,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 342,
"end": 344,
"ctxt": 0
},
"value": "x3",
"optional": false
},
"property": {
"type": "Computed",
"span": {
"start": 344,
"end": 349,
"ctxt": 0
},
"expression": {
"type": "StringLiteral",
"span": {
"start": 345,
"end": 348,
"ctxt": 0
},
"value": "a",
"hasEscape": false,
"kind": {
"type": "normal",
"containsQuote": true
}
}
}
}
},
"right": {
"type": "Identifier",
"span": {
"start": 353,
"end": 358,
"ctxt": 0
},
"value": "value",
"optional": false
}
}
}
],
"interpreter": null
}