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

692 lines
18 KiB
JSON

{
"type": "Script",
"span": {
"start": 18,
"end": 328,
"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": 270,
"end": 328,
"ctxt": 0
},
"kind": "const",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 276,
"end": 328,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 276,
"end": 279,
"ctxt": 0
},
"value": "aa1",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "BinaryExpression",
"span": {
"start": 282,
"end": 328,
"ctxt": 0
},
"operator": "??",
"left": {
"type": "BinaryExpression",
"span": {
"start": 282,
"end": 314,
"ctxt": 0
},
"operator": "??",
"left": {
"type": "BinaryExpression",
"span": {
"start": 282,
"end": 308,
"ctxt": 0
},
"operator": "??",
"left": {
"type": "BinaryExpression",
"span": {
"start": 282,
"end": 302,
"ctxt": 0
},
"operator": "??",
"left": {
"type": "BinaryExpression",
"span": {
"start": 282,
"end": 296,
"ctxt": 0
},
"operator": "??",
"left": {
"type": "BinaryExpression",
"span": {
"start": 282,
"end": 290,
"ctxt": 0
},
"operator": "??",
"left": {
"type": "Identifier",
"span": {
"start": 282,
"end": 284,
"ctxt": 0
},
"value": "a1",
"optional": false
},
"right": {
"type": "Identifier",
"span": {
"start": 288,
"end": 290,
"ctxt": 0
},
"value": "a2",
"optional": false
}
},
"right": {
"type": "Identifier",
"span": {
"start": 294,
"end": 296,
"ctxt": 0
},
"value": "a3",
"optional": false
}
},
"right": {
"type": "Identifier",
"span": {
"start": 300,
"end": 302,
"ctxt": 0
},
"value": "a4",
"optional": false
}
},
"right": {
"type": "Identifier",
"span": {
"start": 306,
"end": 308,
"ctxt": 0
},
"value": "a5",
"optional": false
}
},
"right": {
"type": "Identifier",
"span": {
"start": 312,
"end": 314,
"ctxt": 0
},
"value": "a6",
"optional": false
}
},
"right": {
"type": "StringLiteral",
"span": {
"start": 318,
"end": 328,
"ctxt": 0
},
"value": "whatever",
"hasEscape": false,
"kind": {
"type": "normal",
"containsQuote": true
}
}
},
"definite": false
}
]
}
],
"interpreter": null
}