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

763 lines
17 KiB
JSON

{
"type": "Script",
"span": {
"start": 1,
"end": 360,
"ctxt": 0
},
"body": [
{
"type": "VariableDeclaration",
"span": {
"start": 1,
"end": 16,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 5,
"end": 15,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 5,
"end": 10,
"ctxt": 0
},
"value": "value",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 10,
"end": 15,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 12,
"end": 15,
"ctxt": 0
},
"kind": "any"
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 57,
"end": 72,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 61,
"end": 71,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 61,
"end": 63,
"ctxt": 0
},
"value": "x1",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 63,
"end": 71,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 65,
"end": 71,
"ctxt": 0
},
"kind": "number"
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "ExpressionStatement",
"span": {
"start": 73,
"end": 84,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 73,
"end": 83,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "Identifier",
"span": {
"start": 73,
"end": 75,
"ctxt": 0
},
"value": "x1",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "Identifier",
"span": {
"start": 78,
"end": 83,
"ctxt": 0
},
"value": "value",
"optional": false
}
}
},
{
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 95,
"end": 98,
"ctxt": 0
},
"value": "fn1",
"optional": false
},
"declare": false,
"params": [
{
"type": "Parameter",
"span": {
"start": 99,
"end": 109,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 99,
"end": 109,
"ctxt": 0
},
"value": "x2",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 101,
"end": 109,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 103,
"end": 109,
"ctxt": 0
},
"kind": "number"
}
}
}
}
],
"decorators": [],
"span": {
"start": 86,
"end": 130,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 111,
"end": 130,
"ctxt": 0
},
"stmts": [
{
"type": "ExpressionStatement",
"span": {
"start": 117,
"end": 128,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 117,
"end": 127,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "Identifier",
"span": {
"start": 117,
"end": 119,
"ctxt": 0
},
"value": "x2",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "Identifier",
"span": {
"start": 122,
"end": 127,
"ctxt": 0
},
"value": "value",
"optional": false
}
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
},
{
"type": "VariableDeclaration",
"span": {
"start": 153,
"end": 176,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 157,
"end": 175,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 157,
"end": 159,
"ctxt": 0
},
"value": "x3",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 159,
"end": 175,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeLiteral",
"span": {
"start": 161,
"end": 175,
"ctxt": 0
},
"members": [
{
"type": "TsPropertySignature",
"span": {
"start": 163,
"end": 172,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 163,
"end": 164,
"ctxt": 0
},
"value": "a",
"optional": false
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 164,
"end": 172,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 166,
"end": 172,
"ctxt": 0
},
"kind": "string"
}
},
"typeParams": null
}
]
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "ExpressionStatement",
"span": {
"start": 177,
"end": 190,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 177,
"end": 189,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "MemberExpression",
"span": {
"start": 177,
"end": 181,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 177,
"end": 179,
"ctxt": 0
},
"value": "x3",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 180,
"end": 181,
"ctxt": 0
},
"value": "a",
"optional": false
}
},
"right": {
"type": "Identifier",
"span": {
"start": 184,
"end": 189,
"ctxt": 0
},
"value": "value",
"optional": false
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 191,
"end": 207,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 191,
"end": 206,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "MemberExpression",
"span": {
"start": 191,
"end": 198,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 191,
"end": 193,
"ctxt": 0
},
"value": "x3",
"optional": false
},
"property": {
"type": "Computed",
"span": {
"start": 193,
"end": 198,
"ctxt": 0
},
"expression": {
"type": "StringLiteral",
"span": {
"start": 194,
"end": 197,
"ctxt": 0
},
"value": "a",
"raw": "'a'"
}
}
},
"right": {
"type": "Identifier",
"span": {
"start": 201,
"end": 206,
"ctxt": 0
},
"value": "value",
"optional": false
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 263,
"end": 276,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 263,
"end": 275,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "ParenthesisExpression",
"span": {
"start": 263,
"end": 267,
"ctxt": 0
},
"expression": {
"type": "Identifier",
"span": {
"start": 264,
"end": 266,
"ctxt": 0
},
"value": "x1",
"optional": false
}
},
"right": {
"type": "Identifier",
"span": {
"start": 270,
"end": 275,
"ctxt": 0
},
"value": "value",
"optional": false
}
}
},
{
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 287,
"end": 290,
"ctxt": 0
},
"value": "fn2",
"optional": false
},
"declare": false,
"params": [
{
"type": "Parameter",
"span": {
"start": 291,
"end": 301,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 291,
"end": 301,
"ctxt": 0
},
"value": "x4",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 293,
"end": 301,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 295,
"end": 301,
"ctxt": 0
},
"kind": "number"
}
}
}
}
],
"decorators": [],
"span": {
"start": 278,
"end": 324,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 303,
"end": 324,
"ctxt": 0
},
"stmts": [
{
"type": "ExpressionStatement",
"span": {
"start": 309,
"end": 322,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 309,
"end": 321,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "ParenthesisExpression",
"span": {
"start": 309,
"end": 313,
"ctxt": 0
},
"expression": {
"type": "Identifier",
"span": {
"start": 310,
"end": 312,
"ctxt": 0
},
"value": "x4",
"optional": false
}
},
"right": {
"type": "Identifier",
"span": {
"start": 316,
"end": 321,
"ctxt": 0
},
"value": "value",
"optional": false
}
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
},
{
"type": "ExpressionStatement",
"span": {
"start": 326,
"end": 341,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 326,
"end": 340,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "ParenthesisExpression",
"span": {
"start": 326,
"end": 332,
"ctxt": 0
},
"expression": {
"type": "MemberExpression",
"span": {
"start": 327,
"end": 331,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 327,
"end": 329,
"ctxt": 0
},
"value": "x3",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 330,
"end": 331,
"ctxt": 0
},
"value": "a",
"optional": false
}
}
},
"right": {
"type": "Identifier",
"span": {
"start": 335,
"end": 340,
"ctxt": 0
},
"value": "value",
"optional": false
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 342,
"end": 360,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 342,
"end": 359,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "ParenthesisExpression",
"span": {
"start": 342,
"end": 351,
"ctxt": 0
},
"expression": {
"type": "MemberExpression",
"span": {
"start": 343,
"end": 350,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 343,
"end": 345,
"ctxt": 0
},
"value": "x3",
"optional": false
},
"property": {
"type": "Computed",
"span": {
"start": 345,
"end": 350,
"ctxt": 0
},
"expression": {
"type": "StringLiteral",
"span": {
"start": 346,
"end": 349,
"ctxt": 0
},
"value": "a",
"raw": "'a'"
}
}
}
},
"right": {
"type": "Identifier",
"span": {
"start": 354,
"end": 359,
"ctxt": 0
},
"value": "value",
"optional": false
}
}
}
],
"interpreter": null
}