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

989 lines
21 KiB
JSON

{
"type": "Script",
"span": {
"start": 1,
"end": 414,
"ctxt": 0
},
"body": [
{
"type": "VariableDeclaration",
"span": {
"start": 1,
"end": 12,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 5,
"end": 11,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 5,
"end": 6,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "ObjectExpression",
"span": {
"start": 9,
"end": 11,
"ctxt": 0
},
"properties": []
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 13,
"end": 34,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 17,
"end": 33,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 17,
"end": 18,
"ctxt": 0
},
"value": "y",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "ObjectExpression",
"span": {
"start": 21,
"end": 33,
"ctxt": 0
},
"properties": [
{
"type": "KeyValueProperty",
"key": {
"type": "Identifier",
"span": {
"start": 22,
"end": 25,
"ctxt": 0
},
"value": "foo",
"optional": false
},
"value": {
"type": "StringLiteral",
"span": {
"start": 27,
"end": 32,
"ctxt": 0
},
"value": "bar",
"raw": "\"bar\""
}
}
]
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 35,
"end": 49,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 39,
"end": 48,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 39,
"end": 40,
"ctxt": 0
},
"value": "a",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 40,
"end": 48,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 42,
"end": 48,
"ctxt": 0
},
"kind": "object"
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "ExpressionStatement",
"span": {
"start": 50,
"end": 56,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 50,
"end": 55,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "Identifier",
"span": {
"start": 50,
"end": 51,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "Identifier",
"span": {
"start": 54,
"end": 55,
"ctxt": 0
},
"value": "a",
"optional": false
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 57,
"end": 63,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 57,
"end": 62,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "Identifier",
"span": {
"start": 57,
"end": 58,
"ctxt": 0
},
"value": "y",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "Identifier",
"span": {
"start": 61,
"end": 62,
"ctxt": 0
},
"value": "a",
"optional": false
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 80,
"end": 86,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 80,
"end": 85,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "Identifier",
"span": {
"start": 80,
"end": 81,
"ctxt": 0
},
"value": "a",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "Identifier",
"span": {
"start": 84,
"end": 85,
"ctxt": 0
},
"value": "x",
"optional": false
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 87,
"end": 93,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 87,
"end": 92,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "Identifier",
"span": {
"start": 87,
"end": 88,
"ctxt": 0
},
"value": "a",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "Identifier",
"span": {
"start": 91,
"end": 92,
"ctxt": 0
},
"value": "y",
"optional": false
}
}
},
{
"type": "VariableDeclaration",
"span": {
"start": 95,
"end": 107,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 99,
"end": 106,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 99,
"end": 100,
"ctxt": 0
},
"value": "n",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "NumericLiteral",
"span": {
"start": 103,
"end": 106,
"ctxt": 0
},
"value": 123.0,
"raw": "123"
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 108,
"end": 121,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 112,
"end": 120,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 112,
"end": 113,
"ctxt": 0
},
"value": "b",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "BooleanLiteral",
"span": {
"start": 116,
"end": 120,
"ctxt": 0
},
"value": true
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 122,
"end": 137,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 126,
"end": 136,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 126,
"end": 127,
"ctxt": 0
},
"value": "s",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "StringLiteral",
"span": {
"start": 130,
"end": 136,
"ctxt": 0
},
"value": "fooo",
"raw": "\"fooo\""
},
"definite": false
}
]
},
{
"type": "ExpressionStatement",
"span": {
"start": 139,
"end": 145,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 139,
"end": 144,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "Identifier",
"span": {
"start": 139,
"end": 140,
"ctxt": 0
},
"value": "a",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "Identifier",
"span": {
"start": 143,
"end": 144,
"ctxt": 0
},
"value": "n",
"optional": false
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 162,
"end": 168,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 162,
"end": 167,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "Identifier",
"span": {
"start": 162,
"end": 163,
"ctxt": 0
},
"value": "a",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "Identifier",
"span": {
"start": 166,
"end": 167,
"ctxt": 0
},
"value": "b",
"optional": false
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 185,
"end": 191,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 185,
"end": 190,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "Identifier",
"span": {
"start": 185,
"end": 186,
"ctxt": 0
},
"value": "a",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "Identifier",
"span": {
"start": 189,
"end": 190,
"ctxt": 0
},
"value": "s",
"optional": false
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 209,
"end": 215,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 209,
"end": 214,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "Identifier",
"span": {
"start": 209,
"end": 210,
"ctxt": 0
},
"value": "n",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "Identifier",
"span": {
"start": 213,
"end": 214,
"ctxt": 0
},
"value": "a",
"optional": false
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 232,
"end": 238,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 232,
"end": 237,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "Identifier",
"span": {
"start": 232,
"end": 233,
"ctxt": 0
},
"value": "b",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "Identifier",
"span": {
"start": 236,
"end": 237,
"ctxt": 0
},
"value": "a",
"optional": false
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 255,
"end": 261,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 255,
"end": 260,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "Identifier",
"span": {
"start": 255,
"end": 256,
"ctxt": 0
},
"value": "s",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "Identifier",
"span": {
"start": 259,
"end": 260,
"ctxt": 0
},
"value": "a",
"optional": false
}
}
},
{
"type": "VariableDeclaration",
"span": {
"start": 279,
"end": 304,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 283,
"end": 303,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 283,
"end": 289,
"ctxt": 0
},
"value": "numObj",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 289,
"end": 297,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 291,
"end": 297,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 291,
"end": 297,
"ctxt": 0
},
"value": "Number",
"optional": false
},
"typeParams": null
}
}
},
"init": {
"type": "NumericLiteral",
"span": {
"start": 300,
"end": 303,
"ctxt": 0
},
"value": 123.0,
"raw": "123"
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 305,
"end": 333,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 309,
"end": 332,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 309,
"end": 316,
"ctxt": 0
},
"value": "boolObj",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 316,
"end": 325,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 318,
"end": 325,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 318,
"end": 325,
"ctxt": 0
},
"value": "Boolean",
"optional": false
},
"typeParams": null
}
}
},
"init": {
"type": "BooleanLiteral",
"span": {
"start": 328,
"end": 332,
"ctxt": 0
},
"value": true
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 334,
"end": 364,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 338,
"end": 363,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 338,
"end": 344,
"ctxt": 0
},
"value": "strObj",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 344,
"end": 352,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 346,
"end": 352,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 346,
"end": 352,
"ctxt": 0
},
"value": "String",
"optional": false
},
"typeParams": null
}
}
},
"init": {
"type": "StringLiteral",
"span": {
"start": 355,
"end": 363,
"ctxt": 0
},
"value": "string",
"raw": "\"string\""
},
"definite": false
}
]
},
{
"type": "ExpressionStatement",
"span": {
"start": 366,
"end": 377,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 366,
"end": 376,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "Identifier",
"span": {
"start": 366,
"end": 367,
"ctxt": 0
},
"value": "a",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "Identifier",
"span": {
"start": 370,
"end": 376,
"ctxt": 0
},
"value": "numObj",
"optional": false
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 384,
"end": 396,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 384,
"end": 395,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "Identifier",
"span": {
"start": 384,
"end": 385,
"ctxt": 0
},
"value": "a",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "Identifier",
"span": {
"start": 388,
"end": 395,
"ctxt": 0
},
"value": "boolObj",
"optional": false
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 403,
"end": 414,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 403,
"end": 413,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "Identifier",
"span": {
"start": 403,
"end": 404,
"ctxt": 0
},
"value": "a",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "Identifier",
"span": {
"start": 407,
"end": 413,
"ctxt": 0
},
"value": "strObj",
"optional": false
}
}
}
],
"interpreter": null
}