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

1074 lines
26 KiB
JSON

{
"type": "Script",
"span": {
"start": 61,
"end": 439,
"ctxt": 0
},
"body": [
{
"type": "VariableDeclaration",
"span": {
"start": 61,
"end": 94,
"ctxt": 0
},
"kind": "let",
"declare": true,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 73,
"end": 94,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 73,
"end": 74,
"ctxt": 0
},
"value": "a",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 74,
"end": 94,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsUnionType",
"span": {
"start": 76,
"end": 94,
"ctxt": 0
},
"types": [
{
"type": "TsKeywordType",
"span": {
"start": 76,
"end": 82,
"ctxt": 0
},
"kind": "string"
},
{
"type": "TsKeywordType",
"span": {
"start": 85,
"end": 94,
"ctxt": 0
},
"kind": "undefined"
}
]
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 95,
"end": 128,
"ctxt": 0
},
"kind": "let",
"declare": true,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 107,
"end": 128,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 107,
"end": 108,
"ctxt": 0
},
"value": "b",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 108,
"end": 128,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsUnionType",
"span": {
"start": 110,
"end": 128,
"ctxt": 0
},
"types": [
{
"type": "TsKeywordType",
"span": {
"start": 110,
"end": 116,
"ctxt": 0
},
"kind": "string"
},
{
"type": "TsKeywordType",
"span": {
"start": 119,
"end": 128,
"ctxt": 0
},
"kind": "undefined"
}
]
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 129,
"end": 162,
"ctxt": 0
},
"kind": "let",
"declare": true,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 141,
"end": 162,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 141,
"end": 142,
"ctxt": 0
},
"value": "c",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 142,
"end": 162,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsUnionType",
"span": {
"start": 144,
"end": 162,
"ctxt": 0
},
"types": [
{
"type": "TsKeywordType",
"span": {
"start": 144,
"end": 150,
"ctxt": 0
},
"kind": "string"
},
{
"type": "TsKeywordType",
"span": {
"start": 153,
"end": 162,
"ctxt": 0
},
"kind": "undefined"
}
]
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 164,
"end": 197,
"ctxt": 0
},
"kind": "let",
"declare": true,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 176,
"end": 197,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 176,
"end": 177,
"ctxt": 0
},
"value": "d",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 177,
"end": 197,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsUnionType",
"span": {
"start": 179,
"end": 197,
"ctxt": 0
},
"types": [
{
"type": "TsKeywordType",
"span": {
"start": 179,
"end": 185,
"ctxt": 0
},
"kind": "number"
},
{
"type": "TsKeywordType",
"span": {
"start": 188,
"end": 197,
"ctxt": 0
},
"kind": "undefined"
}
]
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 198,
"end": 231,
"ctxt": 0
},
"kind": "let",
"declare": true,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 210,
"end": 231,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 210,
"end": 211,
"ctxt": 0
},
"value": "e",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 211,
"end": 231,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsUnionType",
"span": {
"start": 213,
"end": 231,
"ctxt": 0
},
"types": [
{
"type": "TsKeywordType",
"span": {
"start": 213,
"end": 219,
"ctxt": 0
},
"kind": "number"
},
{
"type": "TsKeywordType",
"span": {
"start": 222,
"end": 231,
"ctxt": 0
},
"kind": "undefined"
}
]
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 232,
"end": 265,
"ctxt": 0
},
"kind": "let",
"declare": true,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 244,
"end": 265,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 244,
"end": 245,
"ctxt": 0
},
"value": "f",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 245,
"end": 265,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsUnionType",
"span": {
"start": 247,
"end": 265,
"ctxt": 0
},
"types": [
{
"type": "TsKeywordType",
"span": {
"start": 247,
"end": 253,
"ctxt": 0
},
"kind": "number"
},
{
"type": "TsKeywordType",
"span": {
"start": 256,
"end": 265,
"ctxt": 0
},
"kind": "undefined"
}
]
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 267,
"end": 292,
"ctxt": 0
},
"kind": "let",
"declare": true,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 279,
"end": 292,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 279,
"end": 280,
"ctxt": 0
},
"value": "g",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 280,
"end": 292,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsUnionType",
"span": {
"start": 282,
"end": 292,
"ctxt": 0
},
"types": [
{
"type": "TsLiteralType",
"span": {
"start": 282,
"end": 283,
"ctxt": 0
},
"literal": {
"type": "NumericLiteral",
"span": {
"start": 282,
"end": 283,
"ctxt": 0
},
"value": 0.0,
"raw": "0"
}
},
{
"type": "TsLiteralType",
"span": {
"start": 286,
"end": 287,
"ctxt": 0
},
"literal": {
"type": "NumericLiteral",
"span": {
"start": 286,
"end": 287,
"ctxt": 0
},
"value": 1.0,
"raw": "1"
}
},
{
"type": "TsLiteralType",
"span": {
"start": 290,
"end": 292,
"ctxt": 0
},
"literal": {
"type": "NumericLiteral",
"span": {
"start": 290,
"end": 292,
"ctxt": 0
},
"value": 42.0,
"raw": "42"
}
}
]
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 293,
"end": 318,
"ctxt": 0
},
"kind": "let",
"declare": true,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 305,
"end": 318,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 305,
"end": 306,
"ctxt": 0
},
"value": "h",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 306,
"end": 318,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsUnionType",
"span": {
"start": 308,
"end": 318,
"ctxt": 0
},
"types": [
{
"type": "TsLiteralType",
"span": {
"start": 308,
"end": 309,
"ctxt": 0
},
"literal": {
"type": "NumericLiteral",
"span": {
"start": 308,
"end": 309,
"ctxt": 0
},
"value": 0.0,
"raw": "0"
}
},
{
"type": "TsLiteralType",
"span": {
"start": 312,
"end": 313,
"ctxt": 0
},
"literal": {
"type": "NumericLiteral",
"span": {
"start": 312,
"end": 313,
"ctxt": 0
},
"value": 1.0,
"raw": "1"
}
},
{
"type": "TsLiteralType",
"span": {
"start": 316,
"end": 318,
"ctxt": 0
},
"literal": {
"type": "NumericLiteral",
"span": {
"start": 316,
"end": 318,
"ctxt": 0
},
"value": 42.0,
"raw": "42"
}
}
]
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 319,
"end": 344,
"ctxt": 0
},
"kind": "let",
"declare": true,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 331,
"end": 344,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 331,
"end": 332,
"ctxt": 0
},
"value": "i",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 332,
"end": 344,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsUnionType",
"span": {
"start": 334,
"end": 344,
"ctxt": 0
},
"types": [
{
"type": "TsLiteralType",
"span": {
"start": 334,
"end": 335,
"ctxt": 0
},
"literal": {
"type": "NumericLiteral",
"span": {
"start": 334,
"end": 335,
"ctxt": 0
},
"value": 0.0,
"raw": "0"
}
},
{
"type": "TsLiteralType",
"span": {
"start": 338,
"end": 339,
"ctxt": 0
},
"literal": {
"type": "NumericLiteral",
"span": {
"start": 338,
"end": 339,
"ctxt": 0
},
"value": 1.0,
"raw": "1"
}
},
{
"type": "TsLiteralType",
"span": {
"start": 342,
"end": 344,
"ctxt": 0
},
"literal": {
"type": "NumericLiteral",
"span": {
"start": 342,
"end": 344,
"ctxt": 0
},
"value": 42.0,
"raw": "42"
}
}
]
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "ExpressionStatement",
"span": {
"start": 347,
"end": 358,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 347,
"end": 358,
"ctxt": 0
},
"operator": "&&=",
"left": {
"type": "Identifier",
"span": {
"start": 347,
"end": 348,
"ctxt": 0
},
"value": "a",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "StringLiteral",
"span": {
"start": 353,
"end": 358,
"ctxt": 0
},
"value": "foo",
"raw": "\"foo\""
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 359,
"end": 370,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 359,
"end": 370,
"ctxt": 0
},
"operator": "||=",
"left": {
"type": "Identifier",
"span": {
"start": 359,
"end": 360,
"ctxt": 0
},
"value": "b",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "StringLiteral",
"span": {
"start": 365,
"end": 370,
"ctxt": 0
},
"value": "foo",
"raw": "\"foo\""
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 371,
"end": 382,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 371,
"end": 382,
"ctxt": 0
},
"operator": "??=",
"left": {
"type": "Identifier",
"span": {
"start": 371,
"end": 372,
"ctxt": 0
},
"value": "c",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "StringLiteral",
"span": {
"start": 377,
"end": 382,
"ctxt": 0
},
"value": "foo",
"raw": "\"foo\""
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 385,
"end": 393,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 385,
"end": 393,
"ctxt": 0
},
"operator": "&&=",
"left": {
"type": "Identifier",
"span": {
"start": 385,
"end": 386,
"ctxt": 0
},
"value": "d",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "NumericLiteral",
"span": {
"start": 391,
"end": 393,
"ctxt": 0
},
"value": 42.0,
"raw": "42"
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 394,
"end": 402,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 394,
"end": 402,
"ctxt": 0
},
"operator": "||=",
"left": {
"type": "Identifier",
"span": {
"start": 394,
"end": 395,
"ctxt": 0
},
"value": "e",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "NumericLiteral",
"span": {
"start": 400,
"end": 402,
"ctxt": 0
},
"value": 42.0,
"raw": "42"
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 403,
"end": 411,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 403,
"end": 411,
"ctxt": 0
},
"operator": "??=",
"left": {
"type": "Identifier",
"span": {
"start": 403,
"end": 404,
"ctxt": 0
},
"value": "f",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "NumericLiteral",
"span": {
"start": 409,
"end": 411,
"ctxt": 0
},
"value": 42.0,
"raw": "42"
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 413,
"end": 421,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 413,
"end": 421,
"ctxt": 0
},
"operator": "&&=",
"left": {
"type": "Identifier",
"span": {
"start": 413,
"end": 414,
"ctxt": 0
},
"value": "g",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "NumericLiteral",
"span": {
"start": 419,
"end": 421,
"ctxt": 0
},
"value": 42.0,
"raw": "42"
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 422,
"end": 430,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 422,
"end": 430,
"ctxt": 0
},
"operator": "||=",
"left": {
"type": "Identifier",
"span": {
"start": 422,
"end": 423,
"ctxt": 0
},
"value": "h",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "NumericLiteral",
"span": {
"start": 428,
"end": 430,
"ctxt": 0
},
"value": 42.0,
"raw": "42"
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 431,
"end": 439,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 431,
"end": 439,
"ctxt": 0
},
"operator": "??=",
"left": {
"type": "Identifier",
"span": {
"start": 431,
"end": 432,
"ctxt": 0
},
"value": "i",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "NumericLiteral",
"span": {
"start": 437,
"end": 439,
"ctxt": 0
},
"value": 42.0,
"raw": "42"
}
}
}
],
"interpreter": null
}