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

432 lines
13 KiB
JSON
Raw Normal View History

{
"type": "Script",
"span": {
"start": 19,
"end": 163,
"ctxt": 0
},
"body": [
{
"type": "VariableDeclaration",
"span": {
"start": 19,
"end": 63,
"ctxt": 0
},
"kind": "let",
"declare": true,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 31,
"end": 62,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 31,
"end": 32,
"ctxt": 0
},
"value": "f",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 32,
"end": 62,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsUnionType",
"span": {
"start": 34,
"end": 62,
"ctxt": 0
},
"types": [
{
"type": "TsKeywordType",
"span": {
"start": 34,
"end": 38,
"ctxt": 0
},
"kind": "null"
},
{
"type": "TsParenthesizedType",
"span": {
"start": 41,
"end": 62,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsFunctionType",
"span": {
"start": 42,
"end": 61,
"ctxt": 0
},
"params": [
{
"type": "Identifier",
"span": {
"start": 43,
"end": 52,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 44,
"end": 52,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 46,
"end": 52,
"ctxt": 0
},
"kind": "string"
}
}
}
],
"typeParams": null,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 54,
"end": 61,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 57,
"end": 61,
"ctxt": 0
},
"kind": "void"
}
}
}
}
]
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 65,
"end": 113,
"ctxt": 0
},
"kind": "let",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 69,
"end": 113,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 69,
"end": 70,
"ctxt": 0
},
"value": "g",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "BinaryExpression",
"span": {
"start": 73,
"end": 113,
"ctxt": 0
},
"operator": "||",
"left": {
"type": "Identifier",
"span": {
"start": 73,
"end": 74,
"ctxt": 0
},
"value": "f",
"optional": false
},
"right": {
"type": "ParenthesisExpression",
"span": {
"start": 78,
"end": 113,
"ctxt": 0
},
"expression": {
"type": "ArrowFunctionExpression",
"span": {
"start": 79,
"end": 112,
"ctxt": 0
},
"params": [
{
"type": "Identifier",
"span": {
"start": 79,
"end": 82,
"ctxt": 0
},
"value": "abc",
"optional": false,
"typeAnnotation": null
}
],
"body": {
"type": "BlockStatement",
"span": {
"start": 86,
"end": 112,
"ctxt": 0
},
"stmts": [
{
"type": "ExpressionStatement",
"span": {
"start": 88,
"end": 110,
"ctxt": 0
},
"expression": {
"type": "UnaryExpression",
"span": {
"start": 88,
"end": 110,
"ctxt": 0
},
"operator": "void",
"argument": {
"type": "CallExpression",
"span": {
"start": 93,
"end": 110,
"ctxt": 0
},
"callee": {
"type": "MemberExpression",
"span": {
"start": 93,
"end": 108,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 93,
"end": 96,
"ctxt": 0
},
"value": "abc",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 97,
"end": 108,
"ctxt": 0
},
"value": "toLowerCase",
"optional": false
}
},
"arguments": [],
"typeArguments": null
}
}
}
]
},
"async": false,
"generator": false,
"typeParameters": null,
"returnType": null
}
}
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 114,
"end": 163,
"ctxt": 0
},
"kind": "let",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 118,
"end": 163,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 118,
"end": 120,
"ctxt": 0
},
"value": "gg",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "BinaryExpression",
"span": {
"start": 123,
"end": 163,
"ctxt": 0
},
"operator": "??",
"left": {
"type": "Identifier",
"span": {
"start": 123,
"end": 124,
"ctxt": 0
},
"value": "f",
"optional": false
},
"right": {
"type": "ParenthesisExpression",
"span": {
"start": 128,
"end": 163,
"ctxt": 0
},
"expression": {
"type": "ArrowFunctionExpression",
"span": {
"start": 129,
"end": 162,
"ctxt": 0
},
"params": [
{
"type": "Identifier",
"span": {
"start": 129,
"end": 132,
"ctxt": 0
},
"value": "abc",
"optional": false,
"typeAnnotation": null
}
],
"body": {
"type": "BlockStatement",
"span": {
"start": 136,
"end": 162,
"ctxt": 0
},
"stmts": [
{
"type": "ExpressionStatement",
"span": {
"start": 138,
"end": 160,
"ctxt": 0
},
"expression": {
"type": "UnaryExpression",
"span": {
"start": 138,
"end": 160,
"ctxt": 0
},
"operator": "void",
"argument": {
"type": "CallExpression",
"span": {
"start": 143,
"end": 160,
"ctxt": 0
},
"callee": {
"type": "MemberExpression",
"span": {
"start": 143,
"end": 158,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 143,
"end": 146,
"ctxt": 0
},
"value": "abc",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 147,
"end": 158,
"ctxt": 0
},
"value": "toLowerCase",
"optional": false
}
},
"arguments": [],
"typeArguments": null
}
}
}
]
},
"async": false,
"generator": false,
"typeParameters": null,
"returnType": null
}
}
},
"definite": false
}
]
}
],
"interpreter": null
}