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

276 lines
6.8 KiB
JSON

{
"type": "Script",
"span": {
"start": 19,
"end": 141,
"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": 100,
"ctxt": 0
},
"kind": "const",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 72,
"end": 100,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 72,
"end": 75,
"ctxt": 0
},
"value": "aa1",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "BinaryExpression",
"span": {
"start": 78,
"end": 100,
"ctxt": 0
},
"operator": "??",
"left": {
"type": "Identifier",
"span": {
"start": 78,
"end": 80,
"ctxt": 0
},
"value": "a1",
"optional": false
},
"right": {
"type": "CallExpression",
"span": {
"start": 84,
"end": 100,
"ctxt": 0
},
"callee": {
"type": "MemberExpression",
"span": {
"start": 84,
"end": 98,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 84,
"end": 86,
"ctxt": 0
},
"value": "a1",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 87,
"end": 98,
"ctxt": 0
},
"value": "toLowerCase",
"optional": false
}
},
"arguments": [],
"typeArguments": null
}
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 101,
"end": 141,
"ctxt": 0
},
"kind": "const",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 107,
"end": 141,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 107,
"end": 110,
"ctxt": 0
},
"value": "aa2",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "BinaryExpression",
"span": {
"start": 113,
"end": 141,
"ctxt": 0
},
"operator": "||",
"left": {
"type": "Identifier",
"span": {
"start": 113,
"end": 115,
"ctxt": 0
},
"value": "a1",
"optional": false
},
"right": {
"type": "CallExpression",
"span": {
"start": 119,
"end": 141,
"ctxt": 0
},
"callee": {
"type": "MemberExpression",
"span": {
"start": 119,
"end": 139,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 119,
"end": 121,
"ctxt": 0
},
"value": "a1",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 122,
"end": 139,
"ctxt": 0
},
"value": "toLocaleUpperCase",
"optional": false
}
},
"arguments": [],
"typeArguments": null
}
},
"definite": false
}
]
}
],
"interpreter": null
}