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

1279 lines
31 KiB
JSON

{
"type": "Script",
"span": {
"start": 19,
"end": 624,
"ctxt": 0
},
"body": [
{
"type": "VariableDeclaration",
"span": {
"start": 19,
"end": 65,
"ctxt": 0
},
"kind": "const",
"declare": true,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 33,
"end": 65,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 33,
"end": 35,
"ctxt": 0
},
"value": "a1",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 35,
"end": 65,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsUnionType",
"span": {
"start": 37,
"end": 65,
"ctxt": 0
},
"types": [
{
"type": "TsLiteralType",
"span": {
"start": 37,
"end": 46,
"ctxt": 0
},
"literal": {
"type": "StringLiteral",
"span": {
"start": 37,
"end": 46,
"ctxt": 0
},
"value": "literal",
"raw": "'literal'"
}
},
{
"type": "TsKeywordType",
"span": {
"start": 49,
"end": 58,
"ctxt": 0
},
"kind": "undefined"
},
{
"type": "TsKeywordType",
"span": {
"start": 61,
"end": 65,
"ctxt": 0
},
"kind": "null"
}
]
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 66,
"end": 105,
"ctxt": 0
},
"kind": "const",
"declare": true,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 80,
"end": 105,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 80,
"end": 82,
"ctxt": 0
},
"value": "a2",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 82,
"end": 105,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsUnionType",
"span": {
"start": 84,
"end": 105,
"ctxt": 0
},
"types": [
{
"type": "TsLiteralType",
"span": {
"start": 84,
"end": 86,
"ctxt": 0
},
"literal": {
"type": "StringLiteral",
"span": {
"start": 84,
"end": 86,
"ctxt": 0
},
"value": "",
"raw": "''"
}
},
{
"type": "TsKeywordType",
"span": {
"start": 89,
"end": 98,
"ctxt": 0
},
"kind": "undefined"
},
{
"type": "TsKeywordType",
"span": {
"start": 101,
"end": 105,
"ctxt": 0
},
"kind": "null"
}
]
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 106,
"end": 144,
"ctxt": 0
},
"kind": "const",
"declare": true,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 120,
"end": 144,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 120,
"end": 122,
"ctxt": 0
},
"value": "a3",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 122,
"end": 144,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsUnionType",
"span": {
"start": 124,
"end": 144,
"ctxt": 0
},
"types": [
{
"type": "TsLiteralType",
"span": {
"start": 124,
"end": 125,
"ctxt": 0
},
"literal": {
"type": "NumericLiteral",
"span": {
"start": 124,
"end": 125,
"ctxt": 0
},
"value": 1.0,
"raw": "1"
}
},
{
"type": "TsKeywordType",
"span": {
"start": 128,
"end": 137,
"ctxt": 0
},
"kind": "undefined"
},
{
"type": "TsKeywordType",
"span": {
"start": 140,
"end": 144,
"ctxt": 0
},
"kind": "null"
}
]
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 145,
"end": 183,
"ctxt": 0
},
"kind": "const",
"declare": true,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 159,
"end": 183,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 159,
"end": 161,
"ctxt": 0
},
"value": "a4",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 161,
"end": 183,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsUnionType",
"span": {
"start": 163,
"end": 183,
"ctxt": 0
},
"types": [
{
"type": "TsLiteralType",
"span": {
"start": 163,
"end": 164,
"ctxt": 0
},
"literal": {
"type": "NumericLiteral",
"span": {
"start": 163,
"end": 164,
"ctxt": 0
},
"value": 0.0,
"raw": "0"
}
},
{
"type": "TsKeywordType",
"span": {
"start": 167,
"end": 176,
"ctxt": 0
},
"kind": "undefined"
},
{
"type": "TsKeywordType",
"span": {
"start": 179,
"end": 183,
"ctxt": 0
},
"kind": "null"
}
]
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 184,
"end": 225,
"ctxt": 0
},
"kind": "const",
"declare": true,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 198,
"end": 225,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 198,
"end": 200,
"ctxt": 0
},
"value": "a5",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 200,
"end": 225,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsUnionType",
"span": {
"start": 202,
"end": 225,
"ctxt": 0
},
"types": [
{
"type": "TsLiteralType",
"span": {
"start": 202,
"end": 206,
"ctxt": 0
},
"literal": {
"type": "BooleanLiteral",
"span": {
"start": 202,
"end": 206,
"ctxt": 0
},
"value": true
}
},
{
"type": "TsKeywordType",
"span": {
"start": 209,
"end": 218,
"ctxt": 0
},
"kind": "undefined"
},
{
"type": "TsKeywordType",
"span": {
"start": 221,
"end": 225,
"ctxt": 0
},
"kind": "null"
}
]
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 226,
"end": 268,
"ctxt": 0
},
"kind": "const",
"declare": true,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 240,
"end": 268,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 240,
"end": 242,
"ctxt": 0
},
"value": "a6",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 242,
"end": 268,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsUnionType",
"span": {
"start": 244,
"end": 268,
"ctxt": 0
},
"types": [
{
"type": "TsLiteralType",
"span": {
"start": 244,
"end": 249,
"ctxt": 0
},
"literal": {
"type": "BooleanLiteral",
"span": {
"start": 244,
"end": 249,
"ctxt": 0
},
"value": false
}
},
{
"type": "TsKeywordType",
"span": {
"start": 252,
"end": 261,
"ctxt": 0
},
"kind": "undefined"
},
{
"type": "TsKeywordType",
"span": {
"start": 264,
"end": 268,
"ctxt": 0
},
"kind": "null"
}
]
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 269,
"end": 301,
"ctxt": 0
},
"kind": "const",
"declare": true,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 283,
"end": 301,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 283,
"end": 285,
"ctxt": 0
},
"value": "a7",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 285,
"end": 301,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsUnionType",
"span": {
"start": 287,
"end": 301,
"ctxt": 0
},
"types": [
{
"type": "TsKeywordType",
"span": {
"start": 287,
"end": 294,
"ctxt": 0
},
"kind": "unknown"
},
{
"type": "TsKeywordType",
"span": {
"start": 297,
"end": 301,
"ctxt": 0
},
"kind": "null"
}
]
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 302,
"end": 332,
"ctxt": 0
},
"kind": "const",
"declare": true,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 316,
"end": 332,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 316,
"end": 318,
"ctxt": 0
},
"value": "a8",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 318,
"end": 332,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsUnionType",
"span": {
"start": 320,
"end": 332,
"ctxt": 0
},
"types": [
{
"type": "TsKeywordType",
"span": {
"start": 320,
"end": 325,
"ctxt": 0
},
"kind": "never"
},
{
"type": "TsKeywordType",
"span": {
"start": 328,
"end": 332,
"ctxt": 0
},
"kind": "null"
}
]
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 333,
"end": 361,
"ctxt": 0
},
"kind": "const",
"declare": true,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 347,
"end": 361,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 347,
"end": 349,
"ctxt": 0
},
"value": "a9",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 349,
"end": 361,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsUnionType",
"span": {
"start": 351,
"end": 361,
"ctxt": 0
},
"types": [
{
"type": "TsKeywordType",
"span": {
"start": 351,
"end": 354,
"ctxt": 0
},
"kind": "any"
},
{
"type": "TsKeywordType",
"span": {
"start": 357,
"end": 361,
"ctxt": 0
},
"kind": "null"
}
]
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 364,
"end": 392,
"ctxt": 0
},
"kind": "const",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 370,
"end": 392,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 370,
"end": 373,
"ctxt": 0
},
"value": "aa1",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "BinaryExpression",
"span": {
"start": 376,
"end": 392,
"ctxt": 0
},
"operator": "??",
"left": {
"type": "Identifier",
"span": {
"start": 376,
"end": 378,
"ctxt": 0
},
"value": "a1",
"optional": false
},
"right": {
"type": "StringLiteral",
"span": {
"start": 382,
"end": 392,
"ctxt": 0
},
"value": "whatever",
"raw": "'whatever'"
}
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 393,
"end": 421,
"ctxt": 0
},
"kind": "const",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 399,
"end": 421,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 399,
"end": 402,
"ctxt": 0
},
"value": "aa2",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "BinaryExpression",
"span": {
"start": 405,
"end": 421,
"ctxt": 0
},
"operator": "??",
"left": {
"type": "Identifier",
"span": {
"start": 405,
"end": 407,
"ctxt": 0
},
"value": "a2",
"optional": false
},
"right": {
"type": "StringLiteral",
"span": {
"start": 411,
"end": 421,
"ctxt": 0
},
"value": "whatever",
"raw": "'whatever'"
}
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 422,
"end": 450,
"ctxt": 0
},
"kind": "const",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 428,
"end": 450,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 428,
"end": 431,
"ctxt": 0
},
"value": "aa3",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "BinaryExpression",
"span": {
"start": 434,
"end": 450,
"ctxt": 0
},
"operator": "??",
"left": {
"type": "Identifier",
"span": {
"start": 434,
"end": 436,
"ctxt": 0
},
"value": "a3",
"optional": false
},
"right": {
"type": "StringLiteral",
"span": {
"start": 440,
"end": 450,
"ctxt": 0
},
"value": "whatever",
"raw": "'whatever'"
}
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 451,
"end": 479,
"ctxt": 0
},
"kind": "const",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 457,
"end": 479,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 457,
"end": 460,
"ctxt": 0
},
"value": "aa4",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "BinaryExpression",
"span": {
"start": 463,
"end": 479,
"ctxt": 0
},
"operator": "??",
"left": {
"type": "Identifier",
"span": {
"start": 463,
"end": 465,
"ctxt": 0
},
"value": "a4",
"optional": false
},
"right": {
"type": "StringLiteral",
"span": {
"start": 469,
"end": 479,
"ctxt": 0
},
"value": "whatever",
"raw": "'whatever'"
}
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 480,
"end": 508,
"ctxt": 0
},
"kind": "const",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 486,
"end": 508,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 486,
"end": 489,
"ctxt": 0
},
"value": "aa5",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "BinaryExpression",
"span": {
"start": 492,
"end": 508,
"ctxt": 0
},
"operator": "??",
"left": {
"type": "Identifier",
"span": {
"start": 492,
"end": 494,
"ctxt": 0
},
"value": "a5",
"optional": false
},
"right": {
"type": "StringLiteral",
"span": {
"start": 498,
"end": 508,
"ctxt": 0
},
"value": "whatever",
"raw": "'whatever'"
}
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 509,
"end": 537,
"ctxt": 0
},
"kind": "const",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 515,
"end": 537,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 515,
"end": 518,
"ctxt": 0
},
"value": "aa6",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "BinaryExpression",
"span": {
"start": 521,
"end": 537,
"ctxt": 0
},
"operator": "??",
"left": {
"type": "Identifier",
"span": {
"start": 521,
"end": 523,
"ctxt": 0
},
"value": "a6",
"optional": false
},
"right": {
"type": "StringLiteral",
"span": {
"start": 527,
"end": 537,
"ctxt": 0
},
"value": "whatever",
"raw": "'whatever'"
}
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 538,
"end": 566,
"ctxt": 0
},
"kind": "const",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 544,
"end": 566,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 544,
"end": 547,
"ctxt": 0
},
"value": "aa7",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "BinaryExpression",
"span": {
"start": 550,
"end": 566,
"ctxt": 0
},
"operator": "??",
"left": {
"type": "Identifier",
"span": {
"start": 550,
"end": 552,
"ctxt": 0
},
"value": "a7",
"optional": false
},
"right": {
"type": "StringLiteral",
"span": {
"start": 556,
"end": 566,
"ctxt": 0
},
"value": "whatever",
"raw": "'whatever'"
}
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 567,
"end": 595,
"ctxt": 0
},
"kind": "const",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 573,
"end": 595,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 573,
"end": 576,
"ctxt": 0
},
"value": "aa8",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "BinaryExpression",
"span": {
"start": 579,
"end": 595,
"ctxt": 0
},
"operator": "??",
"left": {
"type": "Identifier",
"span": {
"start": 579,
"end": 581,
"ctxt": 0
},
"value": "a8",
"optional": false
},
"right": {
"type": "StringLiteral",
"span": {
"start": 585,
"end": 595,
"ctxt": 0
},
"value": "whatever",
"raw": "'whatever'"
}
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 596,
"end": 624,
"ctxt": 0
},
"kind": "const",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 602,
"end": 624,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 602,
"end": 605,
"ctxt": 0
},
"value": "aa9",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "BinaryExpression",
"span": {
"start": 608,
"end": 624,
"ctxt": 0
},
"operator": "??",
"left": {
"type": "Identifier",
"span": {
"start": 608,
"end": 610,
"ctxt": 0
},
"value": "a9",
"optional": false
},
"right": {
"type": "StringLiteral",
"span": {
"start": 614,
"end": 624,
"ctxt": 0
},
"value": "whatever",
"raw": "'whatever'"
}
},
"definite": false
}
]
}
],
"interpreter": null
}