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

1321 lines
32 KiB
JSON

{
"type": "Script",
"span": {
"start": 18,
"end": 623,
"ctxt": 0
},
"body": [
{
"type": "VariableDeclaration",
"span": {
"start": 18,
"end": 64,
"ctxt": 0
},
"kind": "const",
"declare": true,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 32,
"end": 64,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 32,
"end": 34,
"ctxt": 0
},
"value": "a1",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 34,
"end": 64,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsUnionType",
"span": {
"start": 36,
"end": 64,
"ctxt": 0
},
"types": [
{
"type": "TsLiteralType",
"span": {
"start": 36,
"end": 45,
"ctxt": 0
},
"literal": {
"type": "StringLiteral",
"span": {
"start": 36,
"end": 45,
"ctxt": 0
},
"value": "literal",
"hasEscape": false,
"kind": {
"type": "normal",
"containsQuote": true
}
}
},
{
"type": "TsKeywordType",
"span": {
"start": 48,
"end": 57,
"ctxt": 0
},
"kind": "undefined"
},
{
"type": "TsKeywordType",
"span": {
"start": 60,
"end": 64,
"ctxt": 0
},
"kind": "null"
}
]
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 65,
"end": 104,
"ctxt": 0
},
"kind": "const",
"declare": true,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 79,
"end": 104,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 79,
"end": 81,
"ctxt": 0
},
"value": "a2",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 81,
"end": 104,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsUnionType",
"span": {
"start": 83,
"end": 104,
"ctxt": 0
},
"types": [
{
"type": "TsLiteralType",
"span": {
"start": 83,
"end": 85,
"ctxt": 0
},
"literal": {
"type": "StringLiteral",
"span": {
"start": 83,
"end": 85,
"ctxt": 0
},
"value": "",
"hasEscape": false,
"kind": {
"type": "normal",
"containsQuote": true
}
}
},
{
"type": "TsKeywordType",
"span": {
"start": 88,
"end": 97,
"ctxt": 0
},
"kind": "undefined"
},
{
"type": "TsKeywordType",
"span": {
"start": 100,
"end": 104,
"ctxt": 0
},
"kind": "null"
}
]
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 105,
"end": 143,
"ctxt": 0
},
"kind": "const",
"declare": true,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 119,
"end": 143,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 119,
"end": 121,
"ctxt": 0
},
"value": "a3",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 121,
"end": 143,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsUnionType",
"span": {
"start": 123,
"end": 143,
"ctxt": 0
},
"types": [
{
"type": "TsLiteralType",
"span": {
"start": 123,
"end": 124,
"ctxt": 0
},
"literal": {
"type": "NumericLiteral",
"span": {
"start": 123,
"end": 124,
"ctxt": 0
},
"value": 1.0
}
},
{
"type": "TsKeywordType",
"span": {
"start": 127,
"end": 136,
"ctxt": 0
},
"kind": "undefined"
},
{
"type": "TsKeywordType",
"span": {
"start": 139,
"end": 143,
"ctxt": 0
},
"kind": "null"
}
]
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 144,
"end": 182,
"ctxt": 0
},
"kind": "const",
"declare": true,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 158,
"end": 182,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 158,
"end": 160,
"ctxt": 0
},
"value": "a4",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 160,
"end": 182,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsUnionType",
"span": {
"start": 162,
"end": 182,
"ctxt": 0
},
"types": [
{
"type": "TsLiteralType",
"span": {
"start": 162,
"end": 163,
"ctxt": 0
},
"literal": {
"type": "NumericLiteral",
"span": {
"start": 162,
"end": 163,
"ctxt": 0
},
"value": 0.0
}
},
{
"type": "TsKeywordType",
"span": {
"start": 166,
"end": 175,
"ctxt": 0
},
"kind": "undefined"
},
{
"type": "TsKeywordType",
"span": {
"start": 178,
"end": 182,
"ctxt": 0
},
"kind": "null"
}
]
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 183,
"end": 224,
"ctxt": 0
},
"kind": "const",
"declare": true,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 197,
"end": 224,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 197,
"end": 199,
"ctxt": 0
},
"value": "a5",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 199,
"end": 224,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsUnionType",
"span": {
"start": 201,
"end": 224,
"ctxt": 0
},
"types": [
{
"type": "TsLiteralType",
"span": {
"start": 201,
"end": 205,
"ctxt": 0
},
"literal": {
"type": "BooleanLiteral",
"span": {
"start": 201,
"end": 205,
"ctxt": 0
},
"value": true
}
},
{
"type": "TsKeywordType",
"span": {
"start": 208,
"end": 217,
"ctxt": 0
},
"kind": "undefined"
},
{
"type": "TsKeywordType",
"span": {
"start": 220,
"end": 224,
"ctxt": 0
},
"kind": "null"
}
]
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 225,
"end": 267,
"ctxt": 0
},
"kind": "const",
"declare": true,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 239,
"end": 267,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 239,
"end": 241,
"ctxt": 0
},
"value": "a6",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 241,
"end": 267,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsUnionType",
"span": {
"start": 243,
"end": 267,
"ctxt": 0
},
"types": [
{
"type": "TsLiteralType",
"span": {
"start": 243,
"end": 248,
"ctxt": 0
},
"literal": {
"type": "BooleanLiteral",
"span": {
"start": 243,
"end": 248,
"ctxt": 0
},
"value": false
}
},
{
"type": "TsKeywordType",
"span": {
"start": 251,
"end": 260,
"ctxt": 0
},
"kind": "undefined"
},
{
"type": "TsKeywordType",
"span": {
"start": 263,
"end": 267,
"ctxt": 0
},
"kind": "null"
}
]
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 268,
"end": 300,
"ctxt": 0
},
"kind": "const",
"declare": true,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 282,
"end": 300,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 282,
"end": 284,
"ctxt": 0
},
"value": "a7",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 284,
"end": 300,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsUnionType",
"span": {
"start": 286,
"end": 300,
"ctxt": 0
},
"types": [
{
"type": "TsKeywordType",
"span": {
"start": 286,
"end": 293,
"ctxt": 0
},
"kind": "unknown"
},
{
"type": "TsKeywordType",
"span": {
"start": 296,
"end": 300,
"ctxt": 0
},
"kind": "null"
}
]
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 301,
"end": 331,
"ctxt": 0
},
"kind": "const",
"declare": true,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 315,
"end": 331,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 315,
"end": 317,
"ctxt": 0
},
"value": "a8",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 317,
"end": 331,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsUnionType",
"span": {
"start": 319,
"end": 331,
"ctxt": 0
},
"types": [
{
"type": "TsKeywordType",
"span": {
"start": 319,
"end": 324,
"ctxt": 0
},
"kind": "never"
},
{
"type": "TsKeywordType",
"span": {
"start": 327,
"end": 331,
"ctxt": 0
},
"kind": "null"
}
]
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 332,
"end": 360,
"ctxt": 0
},
"kind": "const",
"declare": true,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 346,
"end": 360,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 346,
"end": 348,
"ctxt": 0
},
"value": "a9",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 348,
"end": 360,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsUnionType",
"span": {
"start": 350,
"end": 360,
"ctxt": 0
},
"types": [
{
"type": "TsKeywordType",
"span": {
"start": 350,
"end": 353,
"ctxt": 0
},
"kind": "any"
},
{
"type": "TsKeywordType",
"span": {
"start": 356,
"end": 360,
"ctxt": 0
},
"kind": "null"
}
]
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 363,
"end": 391,
"ctxt": 0
},
"kind": "const",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 369,
"end": 391,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 369,
"end": 372,
"ctxt": 0
},
"value": "aa1",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "BinaryExpression",
"span": {
"start": 375,
"end": 391,
"ctxt": 0
},
"operator": "??",
"left": {
"type": "Identifier",
"span": {
"start": 375,
"end": 377,
"ctxt": 0
},
"value": "a1",
"optional": false
},
"right": {
"type": "StringLiteral",
"span": {
"start": 381,
"end": 391,
"ctxt": 0
},
"value": "whatever",
"hasEscape": false,
"kind": {
"type": "normal",
"containsQuote": true
}
}
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 392,
"end": 420,
"ctxt": 0
},
"kind": "const",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 398,
"end": 420,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 398,
"end": 401,
"ctxt": 0
},
"value": "aa2",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "BinaryExpression",
"span": {
"start": 404,
"end": 420,
"ctxt": 0
},
"operator": "??",
"left": {
"type": "Identifier",
"span": {
"start": 404,
"end": 406,
"ctxt": 0
},
"value": "a2",
"optional": false
},
"right": {
"type": "StringLiteral",
"span": {
"start": 410,
"end": 420,
"ctxt": 0
},
"value": "whatever",
"hasEscape": false,
"kind": {
"type": "normal",
"containsQuote": true
}
}
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 421,
"end": 449,
"ctxt": 0
},
"kind": "const",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 427,
"end": 449,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 427,
"end": 430,
"ctxt": 0
},
"value": "aa3",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "BinaryExpression",
"span": {
"start": 433,
"end": 449,
"ctxt": 0
},
"operator": "??",
"left": {
"type": "Identifier",
"span": {
"start": 433,
"end": 435,
"ctxt": 0
},
"value": "a3",
"optional": false
},
"right": {
"type": "StringLiteral",
"span": {
"start": 439,
"end": 449,
"ctxt": 0
},
"value": "whatever",
"hasEscape": false,
"kind": {
"type": "normal",
"containsQuote": true
}
}
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 450,
"end": 478,
"ctxt": 0
},
"kind": "const",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 456,
"end": 478,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 456,
"end": 459,
"ctxt": 0
},
"value": "aa4",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "BinaryExpression",
"span": {
"start": 462,
"end": 478,
"ctxt": 0
},
"operator": "??",
"left": {
"type": "Identifier",
"span": {
"start": 462,
"end": 464,
"ctxt": 0
},
"value": "a4",
"optional": false
},
"right": {
"type": "StringLiteral",
"span": {
"start": 468,
"end": 478,
"ctxt": 0
},
"value": "whatever",
"hasEscape": false,
"kind": {
"type": "normal",
"containsQuote": true
}
}
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 479,
"end": 507,
"ctxt": 0
},
"kind": "const",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 485,
"end": 507,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 485,
"end": 488,
"ctxt": 0
},
"value": "aa5",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "BinaryExpression",
"span": {
"start": 491,
"end": 507,
"ctxt": 0
},
"operator": "??",
"left": {
"type": "Identifier",
"span": {
"start": 491,
"end": 493,
"ctxt": 0
},
"value": "a5",
"optional": false
},
"right": {
"type": "StringLiteral",
"span": {
"start": 497,
"end": 507,
"ctxt": 0
},
"value": "whatever",
"hasEscape": false,
"kind": {
"type": "normal",
"containsQuote": true
}
}
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 508,
"end": 536,
"ctxt": 0
},
"kind": "const",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 514,
"end": 536,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 514,
"end": 517,
"ctxt": 0
},
"value": "aa6",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "BinaryExpression",
"span": {
"start": 520,
"end": 536,
"ctxt": 0
},
"operator": "??",
"left": {
"type": "Identifier",
"span": {
"start": 520,
"end": 522,
"ctxt": 0
},
"value": "a6",
"optional": false
},
"right": {
"type": "StringLiteral",
"span": {
"start": 526,
"end": 536,
"ctxt": 0
},
"value": "whatever",
"hasEscape": false,
"kind": {
"type": "normal",
"containsQuote": true
}
}
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 537,
"end": 565,
"ctxt": 0
},
"kind": "const",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 543,
"end": 565,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 543,
"end": 546,
"ctxt": 0
},
"value": "aa7",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "BinaryExpression",
"span": {
"start": 549,
"end": 565,
"ctxt": 0
},
"operator": "??",
"left": {
"type": "Identifier",
"span": {
"start": 549,
"end": 551,
"ctxt": 0
},
"value": "a7",
"optional": false
},
"right": {
"type": "StringLiteral",
"span": {
"start": 555,
"end": 565,
"ctxt": 0
},
"value": "whatever",
"hasEscape": false,
"kind": {
"type": "normal",
"containsQuote": true
}
}
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 566,
"end": 594,
"ctxt": 0
},
"kind": "const",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 572,
"end": 594,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 572,
"end": 575,
"ctxt": 0
},
"value": "aa8",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "BinaryExpression",
"span": {
"start": 578,
"end": 594,
"ctxt": 0
},
"operator": "??",
"left": {
"type": "Identifier",
"span": {
"start": 578,
"end": 580,
"ctxt": 0
},
"value": "a8",
"optional": false
},
"right": {
"type": "StringLiteral",
"span": {
"start": 584,
"end": 594,
"ctxt": 0
},
"value": "whatever",
"hasEscape": false,
"kind": {
"type": "normal",
"containsQuote": true
}
}
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 595,
"end": 623,
"ctxt": 0
},
"kind": "const",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 601,
"end": 623,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 601,
"end": 604,
"ctxt": 0
},
"value": "aa9",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "BinaryExpression",
"span": {
"start": 607,
"end": 623,
"ctxt": 0
},
"operator": "??",
"left": {
"type": "Identifier",
"span": {
"start": 607,
"end": 609,
"ctxt": 0
},
"value": "a9",
"optional": false
},
"right": {
"type": "StringLiteral",
"span": {
"start": 613,
"end": 623,
"ctxt": 0
},
"value": "whatever",
"hasEscape": false,
"kind": {
"type": "normal",
"containsQuote": true
}
}
},
"definite": false
}
]
}
],
"interpreter": null
}