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

682 lines
18 KiB
JSON

{
"type": "Script",
"span": {
"start": 19,
"end": 329,
"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": 271,
"end": 329,
"ctxt": 0
},
"kind": "const",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 277,
"end": 329,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 277,
"end": 280,
"ctxt": 0
},
"value": "aa1",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "BinaryExpression",
"span": {
"start": 283,
"end": 329,
"ctxt": 0
},
"operator": "??",
"left": {
"type": "BinaryExpression",
"span": {
"start": 283,
"end": 315,
"ctxt": 0
},
"operator": "??",
"left": {
"type": "BinaryExpression",
"span": {
"start": 283,
"end": 309,
"ctxt": 0
},
"operator": "??",
"left": {
"type": "BinaryExpression",
"span": {
"start": 283,
"end": 303,
"ctxt": 0
},
"operator": "??",
"left": {
"type": "BinaryExpression",
"span": {
"start": 283,
"end": 297,
"ctxt": 0
},
"operator": "??",
"left": {
"type": "BinaryExpression",
"span": {
"start": 283,
"end": 291,
"ctxt": 0
},
"operator": "??",
"left": {
"type": "Identifier",
"span": {
"start": 283,
"end": 285,
"ctxt": 0
},
"value": "a1",
"optional": false
},
"right": {
"type": "Identifier",
"span": {
"start": 289,
"end": 291,
"ctxt": 0
},
"value": "a2",
"optional": false
}
},
"right": {
"type": "Identifier",
"span": {
"start": 295,
"end": 297,
"ctxt": 0
},
"value": "a3",
"optional": false
}
},
"right": {
"type": "Identifier",
"span": {
"start": 301,
"end": 303,
"ctxt": 0
},
"value": "a4",
"optional": false
}
},
"right": {
"type": "Identifier",
"span": {
"start": 307,
"end": 309,
"ctxt": 0
},
"value": "a5",
"optional": false
}
},
"right": {
"type": "Identifier",
"span": {
"start": 313,
"end": 315,
"ctxt": 0
},
"value": "a6",
"optional": false
}
},
"right": {
"type": "StringLiteral",
"span": {
"start": 319,
"end": 329,
"ctxt": 0
},
"value": "whatever",
"raw": "'whatever'"
}
},
"definite": false
}
]
}
],
"interpreter": null
}