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

432 lines
13 KiB
JSON

{
"type": "Script",
"span": {
"start": 18,
"end": 162,
"ctxt": 0
},
"body": [
{
"type": "VariableDeclaration",
"span": {
"start": 18,
"end": 62,
"ctxt": 0
},
"kind": "let",
"declare": true,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 30,
"end": 61,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 30,
"end": 31,
"ctxt": 0
},
"value": "f",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 31,
"end": 61,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsUnionType",
"span": {
"start": 33,
"end": 61,
"ctxt": 0
},
"types": [
{
"type": "TsKeywordType",
"span": {
"start": 33,
"end": 37,
"ctxt": 0
},
"kind": "null"
},
{
"type": "TsParenthesizedType",
"span": {
"start": 40,
"end": 61,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsFunctionType",
"span": {
"start": 41,
"end": 60,
"ctxt": 0
},
"params": [
{
"type": "Identifier",
"span": {
"start": 42,
"end": 51,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 43,
"end": 51,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 45,
"end": 51,
"ctxt": 0
},
"kind": "string"
}
}
}
],
"typeParams": null,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 53,
"end": 60,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 56,
"end": 60,
"ctxt": 0
},
"kind": "void"
}
}
}
}
]
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 64,
"end": 112,
"ctxt": 0
},
"kind": "let",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 68,
"end": 112,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 68,
"end": 69,
"ctxt": 0
},
"value": "g",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "BinaryExpression",
"span": {
"start": 72,
"end": 112,
"ctxt": 0
},
"operator": "||",
"left": {
"type": "Identifier",
"span": {
"start": 72,
"end": 73,
"ctxt": 0
},
"value": "f",
"optional": false
},
"right": {
"type": "ParenthesisExpression",
"span": {
"start": 77,
"end": 112,
"ctxt": 0
},
"expression": {
"type": "ArrowFunctionExpression",
"span": {
"start": 78,
"end": 111,
"ctxt": 0
},
"params": [
{
"type": "Identifier",
"span": {
"start": 78,
"end": 81,
"ctxt": 0
},
"value": "abc",
"optional": false,
"typeAnnotation": null
}
],
"body": {
"type": "BlockStatement",
"span": {
"start": 85,
"end": 111,
"ctxt": 0
},
"stmts": [
{
"type": "ExpressionStatement",
"span": {
"start": 87,
"end": 109,
"ctxt": 0
},
"expression": {
"type": "UnaryExpression",
"span": {
"start": 87,
"end": 109,
"ctxt": 0
},
"operator": "void",
"argument": {
"type": "CallExpression",
"span": {
"start": 92,
"end": 109,
"ctxt": 0
},
"callee": {
"type": "MemberExpression",
"span": {
"start": 92,
"end": 107,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 92,
"end": 95,
"ctxt": 0
},
"value": "abc",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 96,
"end": 107,
"ctxt": 0
},
"value": "toLowerCase",
"optional": false
}
},
"arguments": [],
"typeArguments": null
}
}
}
]
},
"async": false,
"generator": false,
"typeParameters": null,
"returnType": null
}
}
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 113,
"end": 162,
"ctxt": 0
},
"kind": "let",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 117,
"end": 162,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 117,
"end": 119,
"ctxt": 0
},
"value": "gg",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "BinaryExpression",
"span": {
"start": 122,
"end": 162,
"ctxt": 0
},
"operator": "??",
"left": {
"type": "Identifier",
"span": {
"start": 122,
"end": 123,
"ctxt": 0
},
"value": "f",
"optional": false
},
"right": {
"type": "ParenthesisExpression",
"span": {
"start": 127,
"end": 162,
"ctxt": 0
},
"expression": {
"type": "ArrowFunctionExpression",
"span": {
"start": 128,
"end": 161,
"ctxt": 0
},
"params": [
{
"type": "Identifier",
"span": {
"start": 128,
"end": 131,
"ctxt": 0
},
"value": "abc",
"optional": false,
"typeAnnotation": null
}
],
"body": {
"type": "BlockStatement",
"span": {
"start": 135,
"end": 161,
"ctxt": 0
},
"stmts": [
{
"type": "ExpressionStatement",
"span": {
"start": 137,
"end": 159,
"ctxt": 0
},
"expression": {
"type": "UnaryExpression",
"span": {
"start": 137,
"end": 159,
"ctxt": 0
},
"operator": "void",
"argument": {
"type": "CallExpression",
"span": {
"start": 142,
"end": 159,
"ctxt": 0
},
"callee": {
"type": "MemberExpression",
"span": {
"start": 142,
"end": 157,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 142,
"end": 145,
"ctxt": 0
},
"value": "abc",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 146,
"end": 157,
"ctxt": 0
},
"value": "toLowerCase",
"optional": false
}
},
"arguments": [],
"typeArguments": null
}
}
}
]
},
"async": false,
"generator": false,
"typeParameters": null,
"returnType": null
}
}
},
"definite": false
}
]
}
],
"interpreter": null
}