swc/crates/swc_ecma_parser/tests/tsc/nullishCoalescingOperator4.json
2022-03-22 07:54:08 +00:00

276 lines
6.8 KiB
JSON

{
"type": "Script",
"span": {
"start": 18,
"end": 140,
"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",
"raw": "'literal'"
}
},
{
"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": 99,
"ctxt": 0
},
"kind": "const",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 71,
"end": 99,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 71,
"end": 74,
"ctxt": 0
},
"value": "aa1",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "BinaryExpression",
"span": {
"start": 77,
"end": 99,
"ctxt": 0
},
"operator": "??",
"left": {
"type": "Identifier",
"span": {
"start": 77,
"end": 79,
"ctxt": 0
},
"value": "a1",
"optional": false
},
"right": {
"type": "CallExpression",
"span": {
"start": 83,
"end": 99,
"ctxt": 0
},
"callee": {
"type": "MemberExpression",
"span": {
"start": 83,
"end": 97,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 83,
"end": 85,
"ctxt": 0
},
"value": "a1",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 86,
"end": 97,
"ctxt": 0
},
"value": "toLowerCase",
"optional": false
}
},
"arguments": [],
"typeArguments": null
}
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 100,
"end": 140,
"ctxt": 0
},
"kind": "const",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 106,
"end": 140,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 106,
"end": 109,
"ctxt": 0
},
"value": "aa2",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "BinaryExpression",
"span": {
"start": 112,
"end": 140,
"ctxt": 0
},
"operator": "||",
"left": {
"type": "Identifier",
"span": {
"start": 112,
"end": 114,
"ctxt": 0
},
"value": "a1",
"optional": false
},
"right": {
"type": "CallExpression",
"span": {
"start": 118,
"end": 140,
"ctxt": 0
},
"callee": {
"type": "MemberExpression",
"span": {
"start": 118,
"end": 138,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 118,
"end": 120,
"ctxt": 0
},
"value": "a1",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 121,
"end": 138,
"ctxt": 0
},
"value": "toLocaleUpperCase",
"optional": false
}
},
"arguments": [],
"typeArguments": null
}
},
"definite": false
}
]
}
],
"interpreter": null
}