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

952 lines
21 KiB
JSON
Raw Normal View History

{
"type": "Script",
"span": {
"start": 19,
"end": 638,
"ctxt": 0
},
"body": [
{
"type": "VariableDeclaration",
"span": {
"start": 19,
"end": 54,
"ctxt": 0
},
"kind": "const",
"declare": true,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 33,
"end": 54,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 33,
"end": 34,
"ctxt": 0
},
"value": "a",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 34,
"end": 54,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsUnionType",
"span": {
"start": 36,
"end": 54,
"ctxt": 0
},
"types": [
{
"type": "TsKeywordType",
"span": {
"start": 36,
"end": 42,
"ctxt": 0
},
"kind": "string"
},
{
"type": "TsKeywordType",
"span": {
"start": 45,
"end": 54,
"ctxt": 0
},
"kind": "undefined"
}
]
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 55,
"end": 90,
"ctxt": 0
},
"kind": "const",
"declare": true,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 69,
"end": 90,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 69,
"end": 70,
"ctxt": 0
},
"value": "b",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 70,
"end": 90,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsUnionType",
"span": {
"start": 72,
"end": 90,
"ctxt": 0
},
"types": [
{
"type": "TsKeywordType",
"span": {
"start": 72,
"end": 78,
"ctxt": 0
},
"kind": "string"
},
{
"type": "TsKeywordType",
"span": {
"start": 81,
"end": 90,
"ctxt": 0
},
"kind": "undefined"
}
]
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 91,
"end": 126,
"ctxt": 0
},
"kind": "const",
"declare": true,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 105,
"end": 126,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 105,
"end": 106,
"ctxt": 0
},
"value": "c",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 106,
"end": 126,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsUnionType",
"span": {
"start": 108,
"end": 126,
"ctxt": 0
},
"types": [
{
"type": "TsKeywordType",
"span": {
"start": 108,
"end": 114,
"ctxt": 0
},
"kind": "string"
},
{
"type": "TsKeywordType",
"span": {
"start": 117,
"end": 126,
"ctxt": 0
},
"kind": "undefined"
}
]
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "ExpressionStatement",
"span": {
"start": 156,
"end": 168,
"ctxt": 0
},
"expression": {
"type": "BinaryExpression",
"span": {
"start": 156,
"end": 167,
"ctxt": 0
},
"operator": "||",
"left": {
"type": "BinaryExpression",
"span": {
"start": 156,
"end": 162,
"ctxt": 0
},
"operator": "??",
"left": {
"type": "Identifier",
"span": {
"start": 156,
"end": 157,
"ctxt": 0
},
"value": "a",
"optional": false
},
"right": {
"type": "Identifier",
"span": {
"start": 161,
"end": 162,
"ctxt": 0
},
"value": "b",
"optional": false
}
},
"right": {
"type": "Identifier",
"span": {
"start": 166,
"end": 167,
"ctxt": 0
},
"value": "c",
"optional": false
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 198,
"end": 210,
"ctxt": 0
},
"expression": {
"type": "BinaryExpression",
"span": {
"start": 198,
"end": 209,
"ctxt": 0
},
"operator": "??",
"left": {
"type": "BinaryExpression",
"span": {
"start": 198,
"end": 204,
"ctxt": 0
},
"operator": "||",
"left": {
"type": "Identifier",
"span": {
"start": 198,
"end": 199,
"ctxt": 0
},
"value": "a",
"optional": false
},
"right": {
"type": "Identifier",
"span": {
"start": 203,
"end": 204,
"ctxt": 0
},
"value": "b",
"optional": false
}
},
"right": {
"type": "Identifier",
"span": {
"start": 208,
"end": 209,
"ctxt": 0
},
"value": "c",
"optional": false
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 240,
"end": 252,
"ctxt": 0
},
"expression": {
"type": "BinaryExpression",
"span": {
"start": 240,
"end": 251,
"ctxt": 0
},
"operator": "??",
"left": {
"type": "Identifier",
"span": {
"start": 240,
"end": 241,
"ctxt": 0
},
"value": "a",
"optional": false
},
"right": {
"type": "BinaryExpression",
"span": {
"start": 245,
"end": 251,
"ctxt": 0
},
"operator": "&&",
"left": {
"type": "Identifier",
"span": {
"start": 245,
"end": 246,
"ctxt": 0
},
"value": "b",
"optional": false
},
"right": {
"type": "Identifier",
"span": {
"start": 250,
"end": 251,
"ctxt": 0
},
"value": "c",
"optional": false
}
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 282,
"end": 294,
"ctxt": 0
},
"expression": {
"type": "BinaryExpression",
"span": {
"start": 282,
"end": 293,
"ctxt": 0
},
"operator": "??",
"left": {
"type": "BinaryExpression",
"span": {
"start": 282,
"end": 288,
"ctxt": 0
},
"operator": "&&",
"left": {
"type": "Identifier",
"span": {
"start": 282,
"end": 283,
"ctxt": 0
},
"value": "a",
"optional": false
},
"right": {
"type": "Identifier",
"span": {
"start": 287,
"end": 288,
"ctxt": 0
},
"value": "b",
"optional": false
}
},
"right": {
"type": "Identifier",
"span": {
"start": 292,
"end": 293,
"ctxt": 0
},
"value": "c",
"optional": false
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 323,
"end": 337,
"ctxt": 0
},
"expression": {
"type": "BinaryExpression",
"span": {
"start": 323,
"end": 336,
"ctxt": 0
},
"operator": "??",
"left": {
"type": "Identifier",
"span": {
"start": 323,
"end": 324,
"ctxt": 0
},
"value": "a",
"optional": false
},
"right": {
"type": "ParenthesisExpression",
"span": {
"start": 328,
"end": 336,
"ctxt": 0
},
"expression": {
"type": "BinaryExpression",
"span": {
"start": 329,
"end": 335,
"ctxt": 0
},
"operator": "||",
"left": {
"type": "Identifier",
"span": {
"start": 329,
"end": 330,
"ctxt": 0
},
"value": "b",
"optional": false
},
"right": {
"type": "Identifier",
"span": {
"start": 334,
"end": 335,
"ctxt": 0
},
"value": "c",
"optional": false
}
}
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 366,
"end": 380,
"ctxt": 0
},
"expression": {
"type": "BinaryExpression",
"span": {
"start": 366,
"end": 379,
"ctxt": 0
},
"operator": "||",
"left": {
"type": "ParenthesisExpression",
"span": {
"start": 366,
"end": 374,
"ctxt": 0
},
"expression": {
"type": "BinaryExpression",
"span": {
"start": 367,
"end": 373,
"ctxt": 0
},
"operator": "??",
"left": {
"type": "Identifier",
"span": {
"start": 367,
"end": 368,
"ctxt": 0
},
"value": "a",
"optional": false
},
"right": {
"type": "Identifier",
"span": {
"start": 372,
"end": 373,
"ctxt": 0
},
"value": "b",
"optional": false
}
}
},
"right": {
"type": "Identifier",
"span": {
"start": 378,
"end": 379,
"ctxt": 0
},
"value": "c",
"optional": false
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 409,
"end": 423,
"ctxt": 0
},
"expression": {
"type": "BinaryExpression",
"span": {
"start": 409,
"end": 422,
"ctxt": 0
},
"operator": "??",
"left": {
"type": "ParenthesisExpression",
"span": {
"start": 409,
"end": 417,
"ctxt": 0
},
"expression": {
"type": "BinaryExpression",
"span": {
"start": 410,
"end": 416,
"ctxt": 0
},
"operator": "||",
"left": {
"type": "Identifier",
"span": {
"start": 410,
"end": 411,
"ctxt": 0
},
"value": "a",
"optional": false
},
"right": {
"type": "Identifier",
"span": {
"start": 415,
"end": 416,
"ctxt": 0
},
"value": "b",
"optional": false
}
}
},
"right": {
"type": "Identifier",
"span": {
"start": 421,
"end": 422,
"ctxt": 0
},
"value": "c",
"optional": false
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 452,
"end": 466,
"ctxt": 0
},
"expression": {
"type": "BinaryExpression",
"span": {
"start": 452,
"end": 465,
"ctxt": 0
},
"operator": "||",
"left": {
"type": "Identifier",
"span": {
"start": 452,
"end": 453,
"ctxt": 0
},
"value": "a",
"optional": false
},
"right": {
"type": "ParenthesisExpression",
"span": {
"start": 457,
"end": 465,
"ctxt": 0
},
"expression": {
"type": "BinaryExpression",
"span": {
"start": 458,
"end": 464,
"ctxt": 0
},
"operator": "??",
"left": {
"type": "Identifier",
"span": {
"start": 458,
"end": 459,
"ctxt": 0
},
"value": "b",
"optional": false
},
"right": {
"type": "Identifier",
"span": {
"start": 463,
"end": 464,
"ctxt": 0
},
"value": "c",
"optional": false
}
}
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 495,
"end": 509,
"ctxt": 0
},
"expression": {
"type": "BinaryExpression",
"span": {
"start": 495,
"end": 508,
"ctxt": 0
},
"operator": "??",
"left": {
"type": "Identifier",
"span": {
"start": 495,
"end": 496,
"ctxt": 0
},
"value": "a",
"optional": false
},
"right": {
"type": "ParenthesisExpression",
"span": {
"start": 500,
"end": 508,
"ctxt": 0
},
"expression": {
"type": "BinaryExpression",
"span": {
"start": 501,
"end": 507,
"ctxt": 0
},
"operator": "&&",
"left": {
"type": "Identifier",
"span": {
"start": 501,
"end": 502,
"ctxt": 0
},
"value": "b",
"optional": false
},
"right": {
"type": "Identifier",
"span": {
"start": 506,
"end": 507,
"ctxt": 0
},
"value": "c",
"optional": false
}
}
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 538,
"end": 552,
"ctxt": 0
},
"expression": {
"type": "BinaryExpression",
"span": {
"start": 538,
"end": 551,
"ctxt": 0
},
"operator": "&&",
"left": {
"type": "ParenthesisExpression",
"span": {
"start": 538,
"end": 546,
"ctxt": 0
},
"expression": {
"type": "BinaryExpression",
"span": {
"start": 539,
"end": 545,
"ctxt": 0
},
"operator": "??",
"left": {
"type": "Identifier",
"span": {
"start": 539,
"end": 540,
"ctxt": 0
},
"value": "a",
"optional": false
},
"right": {
"type": "Identifier",
"span": {
"start": 544,
"end": 545,
"ctxt": 0
},
"value": "b",
"optional": false
}
}
},
"right": {
"type": "Identifier",
"span": {
"start": 550,
"end": 551,
"ctxt": 0
},
"value": "c",
"optional": false
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 581,
"end": 595,
"ctxt": 0
},
"expression": {
"type": "BinaryExpression",
"span": {
"start": 581,
"end": 594,
"ctxt": 0
},
"operator": "??",
"left": {
"type": "ParenthesisExpression",
"span": {
"start": 581,
"end": 589,
"ctxt": 0
},
"expression": {
"type": "BinaryExpression",
"span": {
"start": 582,
"end": 588,
"ctxt": 0
},
"operator": "&&",
"left": {
"type": "Identifier",
"span": {
"start": 582,
"end": 583,
"ctxt": 0
},
"value": "a",
"optional": false
},
"right": {
"type": "Identifier",
"span": {
"start": 587,
"end": 588,
"ctxt": 0
},
"value": "b",
"optional": false
}
}
},
"right": {
"type": "Identifier",
"span": {
"start": 593,
"end": 594,
"ctxt": 0
},
"value": "c",
"optional": false
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 624,
"end": 638,
"ctxt": 0
},
"expression": {
"type": "BinaryExpression",
"span": {
"start": 624,
"end": 637,
"ctxt": 0
},
"operator": "&&",
"left": {
"type": "Identifier",
"span": {
"start": 624,
"end": 625,
"ctxt": 0
},
"value": "a",
"optional": false
},
"right": {
"type": "ParenthesisExpression",
"span": {
"start": 629,
"end": 637,
"ctxt": 0
},
"expression": {
"type": "BinaryExpression",
"span": {
"start": 630,
"end": 636,
"ctxt": 0
},
"operator": "??",
"left": {
"type": "Identifier",
"span": {
"start": 630,
"end": 631,
"ctxt": 0
},
"value": "b",
"optional": false
},
"right": {
"type": "Identifier",
"span": {
"start": 635,
"end": 636,
"ctxt": 0
},
"value": "c",
"optional": false
}
}
}
}
}
],
"interpreter": null
}