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

952 lines
21 KiB
JSON

{
"type": "Script",
"span": {
"start": 18,
"end": 637,
"ctxt": 0
},
"body": [
{
"type": "VariableDeclaration",
"span": {
"start": 18,
"end": 53,
"ctxt": 0
},
"kind": "const",
"declare": true,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 32,
"end": 53,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 32,
"end": 33,
"ctxt": 0
},
"value": "a",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 33,
"end": 53,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsUnionType",
"span": {
"start": 35,
"end": 53,
"ctxt": 0
},
"types": [
{
"type": "TsKeywordType",
"span": {
"start": 35,
"end": 41,
"ctxt": 0
},
"kind": "string"
},
{
"type": "TsKeywordType",
"span": {
"start": 44,
"end": 53,
"ctxt": 0
},
"kind": "undefined"
}
]
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 54,
"end": 89,
"ctxt": 0
},
"kind": "const",
"declare": true,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 68,
"end": 89,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 68,
"end": 69,
"ctxt": 0
},
"value": "b",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 69,
"end": 89,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsUnionType",
"span": {
"start": 71,
"end": 89,
"ctxt": 0
},
"types": [
{
"type": "TsKeywordType",
"span": {
"start": 71,
"end": 77,
"ctxt": 0
},
"kind": "string"
},
{
"type": "TsKeywordType",
"span": {
"start": 80,
"end": 89,
"ctxt": 0
},
"kind": "undefined"
}
]
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 90,
"end": 125,
"ctxt": 0
},
"kind": "const",
"declare": true,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 104,
"end": 125,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 104,
"end": 105,
"ctxt": 0
},
"value": "c",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 105,
"end": 125,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsUnionType",
"span": {
"start": 107,
"end": 125,
"ctxt": 0
},
"types": [
{
"type": "TsKeywordType",
"span": {
"start": 107,
"end": 113,
"ctxt": 0
},
"kind": "string"
},
{
"type": "TsKeywordType",
"span": {
"start": 116,
"end": 125,
"ctxt": 0
},
"kind": "undefined"
}
]
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "ExpressionStatement",
"span": {
"start": 155,
"end": 167,
"ctxt": 0
},
"expression": {
"type": "BinaryExpression",
"span": {
"start": 155,
"end": 166,
"ctxt": 0
},
"operator": "||",
"left": {
"type": "BinaryExpression",
"span": {
"start": 155,
"end": 161,
"ctxt": 0
},
"operator": "??",
"left": {
"type": "Identifier",
"span": {
"start": 155,
"end": 156,
"ctxt": 0
},
"value": "a",
"optional": false
},
"right": {
"type": "Identifier",
"span": {
"start": 160,
"end": 161,
"ctxt": 0
},
"value": "b",
"optional": false
}
},
"right": {
"type": "Identifier",
"span": {
"start": 165,
"end": 166,
"ctxt": 0
},
"value": "c",
"optional": false
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 197,
"end": 209,
"ctxt": 0
},
"expression": {
"type": "BinaryExpression",
"span": {
"start": 197,
"end": 208,
"ctxt": 0
},
"operator": "??",
"left": {
"type": "BinaryExpression",
"span": {
"start": 197,
"end": 203,
"ctxt": 0
},
"operator": "||",
"left": {
"type": "Identifier",
"span": {
"start": 197,
"end": 198,
"ctxt": 0
},
"value": "a",
"optional": false
},
"right": {
"type": "Identifier",
"span": {
"start": 202,
"end": 203,
"ctxt": 0
},
"value": "b",
"optional": false
}
},
"right": {
"type": "Identifier",
"span": {
"start": 207,
"end": 208,
"ctxt": 0
},
"value": "c",
"optional": false
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 239,
"end": 251,
"ctxt": 0
},
"expression": {
"type": "BinaryExpression",
"span": {
"start": 239,
"end": 250,
"ctxt": 0
},
"operator": "??",
"left": {
"type": "Identifier",
"span": {
"start": 239,
"end": 240,
"ctxt": 0
},
"value": "a",
"optional": false
},
"right": {
"type": "BinaryExpression",
"span": {
"start": 244,
"end": 250,
"ctxt": 0
},
"operator": "&&",
"left": {
"type": "Identifier",
"span": {
"start": 244,
"end": 245,
"ctxt": 0
},
"value": "b",
"optional": false
},
"right": {
"type": "Identifier",
"span": {
"start": 249,
"end": 250,
"ctxt": 0
},
"value": "c",
"optional": false
}
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 281,
"end": 293,
"ctxt": 0
},
"expression": {
"type": "BinaryExpression",
"span": {
"start": 281,
"end": 292,
"ctxt": 0
},
"operator": "??",
"left": {
"type": "BinaryExpression",
"span": {
"start": 281,
"end": 287,
"ctxt": 0
},
"operator": "&&",
"left": {
"type": "Identifier",
"span": {
"start": 281,
"end": 282,
"ctxt": 0
},
"value": "a",
"optional": false
},
"right": {
"type": "Identifier",
"span": {
"start": 286,
"end": 287,
"ctxt": 0
},
"value": "b",
"optional": false
}
},
"right": {
"type": "Identifier",
"span": {
"start": 291,
"end": 292,
"ctxt": 0
},
"value": "c",
"optional": false
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 322,
"end": 336,
"ctxt": 0
},
"expression": {
"type": "BinaryExpression",
"span": {
"start": 322,
"end": 335,
"ctxt": 0
},
"operator": "??",
"left": {
"type": "Identifier",
"span": {
"start": 322,
"end": 323,
"ctxt": 0
},
"value": "a",
"optional": false
},
"right": {
"type": "ParenthesisExpression",
"span": {
"start": 327,
"end": 335,
"ctxt": 0
},
"expression": {
"type": "BinaryExpression",
"span": {
"start": 328,
"end": 334,
"ctxt": 0
},
"operator": "||",
"left": {
"type": "Identifier",
"span": {
"start": 328,
"end": 329,
"ctxt": 0
},
"value": "b",
"optional": false
},
"right": {
"type": "Identifier",
"span": {
"start": 333,
"end": 334,
"ctxt": 0
},
"value": "c",
"optional": false
}
}
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 365,
"end": 379,
"ctxt": 0
},
"expression": {
"type": "BinaryExpression",
"span": {
"start": 365,
"end": 378,
"ctxt": 0
},
"operator": "||",
"left": {
"type": "ParenthesisExpression",
"span": {
"start": 365,
"end": 373,
"ctxt": 0
},
"expression": {
"type": "BinaryExpression",
"span": {
"start": 366,
"end": 372,
"ctxt": 0
},
"operator": "??",
"left": {
"type": "Identifier",
"span": {
"start": 366,
"end": 367,
"ctxt": 0
},
"value": "a",
"optional": false
},
"right": {
"type": "Identifier",
"span": {
"start": 371,
"end": 372,
"ctxt": 0
},
"value": "b",
"optional": false
}
}
},
"right": {
"type": "Identifier",
"span": {
"start": 377,
"end": 378,
"ctxt": 0
},
"value": "c",
"optional": false
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 408,
"end": 422,
"ctxt": 0
},
"expression": {
"type": "BinaryExpression",
"span": {
"start": 408,
"end": 421,
"ctxt": 0
},
"operator": "??",
"left": {
"type": "ParenthesisExpression",
"span": {
"start": 408,
"end": 416,
"ctxt": 0
},
"expression": {
"type": "BinaryExpression",
"span": {
"start": 409,
"end": 415,
"ctxt": 0
},
"operator": "||",
"left": {
"type": "Identifier",
"span": {
"start": 409,
"end": 410,
"ctxt": 0
},
"value": "a",
"optional": false
},
"right": {
"type": "Identifier",
"span": {
"start": 414,
"end": 415,
"ctxt": 0
},
"value": "b",
"optional": false
}
}
},
"right": {
"type": "Identifier",
"span": {
"start": 420,
"end": 421,
"ctxt": 0
},
"value": "c",
"optional": false
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 451,
"end": 465,
"ctxt": 0
},
"expression": {
"type": "BinaryExpression",
"span": {
"start": 451,
"end": 464,
"ctxt": 0
},
"operator": "||",
"left": {
"type": "Identifier",
"span": {
"start": 451,
"end": 452,
"ctxt": 0
},
"value": "a",
"optional": false
},
"right": {
"type": "ParenthesisExpression",
"span": {
"start": 456,
"end": 464,
"ctxt": 0
},
"expression": {
"type": "BinaryExpression",
"span": {
"start": 457,
"end": 463,
"ctxt": 0
},
"operator": "??",
"left": {
"type": "Identifier",
"span": {
"start": 457,
"end": 458,
"ctxt": 0
},
"value": "b",
"optional": false
},
"right": {
"type": "Identifier",
"span": {
"start": 462,
"end": 463,
"ctxt": 0
},
"value": "c",
"optional": false
}
}
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 494,
"end": 508,
"ctxt": 0
},
"expression": {
"type": "BinaryExpression",
"span": {
"start": 494,
"end": 507,
"ctxt": 0
},
"operator": "??",
"left": {
"type": "Identifier",
"span": {
"start": 494,
"end": 495,
"ctxt": 0
},
"value": "a",
"optional": false
},
"right": {
"type": "ParenthesisExpression",
"span": {
"start": 499,
"end": 507,
"ctxt": 0
},
"expression": {
"type": "BinaryExpression",
"span": {
"start": 500,
"end": 506,
"ctxt": 0
},
"operator": "&&",
"left": {
"type": "Identifier",
"span": {
"start": 500,
"end": 501,
"ctxt": 0
},
"value": "b",
"optional": false
},
"right": {
"type": "Identifier",
"span": {
"start": 505,
"end": 506,
"ctxt": 0
},
"value": "c",
"optional": false
}
}
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 537,
"end": 551,
"ctxt": 0
},
"expression": {
"type": "BinaryExpression",
"span": {
"start": 537,
"end": 550,
"ctxt": 0
},
"operator": "&&",
"left": {
"type": "ParenthesisExpression",
"span": {
"start": 537,
"end": 545,
"ctxt": 0
},
"expression": {
"type": "BinaryExpression",
"span": {
"start": 538,
"end": 544,
"ctxt": 0
},
"operator": "??",
"left": {
"type": "Identifier",
"span": {
"start": 538,
"end": 539,
"ctxt": 0
},
"value": "a",
"optional": false
},
"right": {
"type": "Identifier",
"span": {
"start": 543,
"end": 544,
"ctxt": 0
},
"value": "b",
"optional": false
}
}
},
"right": {
"type": "Identifier",
"span": {
"start": 549,
"end": 550,
"ctxt": 0
},
"value": "c",
"optional": false
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 580,
"end": 594,
"ctxt": 0
},
"expression": {
"type": "BinaryExpression",
"span": {
"start": 580,
"end": 593,
"ctxt": 0
},
"operator": "??",
"left": {
"type": "ParenthesisExpression",
"span": {
"start": 580,
"end": 588,
"ctxt": 0
},
"expression": {
"type": "BinaryExpression",
"span": {
"start": 581,
"end": 587,
"ctxt": 0
},
"operator": "&&",
"left": {
"type": "Identifier",
"span": {
"start": 581,
"end": 582,
"ctxt": 0
},
"value": "a",
"optional": false
},
"right": {
"type": "Identifier",
"span": {
"start": 586,
"end": 587,
"ctxt": 0
},
"value": "b",
"optional": false
}
}
},
"right": {
"type": "Identifier",
"span": {
"start": 592,
"end": 593,
"ctxt": 0
},
"value": "c",
"optional": false
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 623,
"end": 637,
"ctxt": 0
},
"expression": {
"type": "BinaryExpression",
"span": {
"start": 623,
"end": 636,
"ctxt": 0
},
"operator": "&&",
"left": {
"type": "Identifier",
"span": {
"start": 623,
"end": 624,
"ctxt": 0
},
"value": "a",
"optional": false
},
"right": {
"type": "ParenthesisExpression",
"span": {
"start": 628,
"end": 636,
"ctxt": 0
},
"expression": {
"type": "BinaryExpression",
"span": {
"start": 629,
"end": 635,
"ctxt": 0
},
"operator": "??",
"left": {
"type": "Identifier",
"span": {
"start": 629,
"end": 630,
"ctxt": 0
},
"value": "b",
"optional": false
},
"right": {
"type": "Identifier",
"span": {
"start": 634,
"end": 635,
"ctxt": 0
},
"value": "c",
"optional": false
}
}
}
}
}
],
"interpreter": null
}