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

214 lines
5.4 KiB
JSON

{
"type": "Script",
"span": {
"start": 115,
"end": 189,
"ctxt": 0
},
"body": [
{
"type": "VariableDeclaration",
"span": {
"start": 115,
"end": 161,
"ctxt": 0
},
"kind": "const",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 121,
"end": 160,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 121,
"end": 122,
"ctxt": 0
},
"value": "a",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "ArrowFunctionExpression",
"span": {
"start": 125,
"end": 160,
"ctxt": 0
},
"params": [],
"body": {
"type": "Identifier",
"span": {
"start": 151,
"end": 160,
"ctxt": 0
},
"value": "undefined",
"optional": false
},
"async": false,
"generator": false,
"typeParameters": null,
"returnType": {
"type": "TsTypeAnnotation",
"span": {
"start": 127,
"end": 147,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsUnionType",
"span": {
"start": 129,
"end": 147,
"ctxt": 0
},
"types": [
{
"type": "TsKeywordType",
"span": {
"start": 129,
"end": 135,
"ctxt": 0
},
"kind": "string"
},
{
"type": "TsKeywordType",
"span": {
"start": 138,
"end": 147,
"ctxt": 0
},
"kind": "undefined"
}
]
}
}
},
"definite": false
}
]
},
{
"type": "ExpressionStatement",
"span": {
"start": 162,
"end": 189,
"ctxt": 0
},
"expression": {
"type": "CallExpression",
"span": {
"start": 162,
"end": 188,
"ctxt": 0
},
"callee": {
"type": "ParenthesisExpression",
"span": {
"start": 162,
"end": 186,
"ctxt": 0
},
"expression": {
"type": "ArrowFunctionExpression",
"span": {
"start": 163,
"end": 185,
"ctxt": 0
},
"params": [
{
"type": "AssignmentPattern",
"span": {
"start": 164,
"end": 178,
"ctxt": 0
},
"left": {
"type": "Identifier",
"span": {
"start": 164,
"end": 165,
"ctxt": 0
},
"value": "b",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "BinaryExpression",
"span": {
"start": 168,
"end": 178,
"ctxt": 0
},
"operator": "??",
"left": {
"type": "CallExpression",
"span": {
"start": 168,
"end": 171,
"ctxt": 0
},
"callee": {
"type": "Identifier",
"span": {
"start": 168,
"end": 169,
"ctxt": 0
},
"value": "a",
"optional": false
},
"arguments": [],
"typeArguments": null
},
"right": {
"type": "StringLiteral",
"span": {
"start": 175,
"end": 178,
"ctxt": 0
},
"value": "d",
"hasEscape": false,
"kind": {
"type": "normal",
"containsQuote": true
}
}
},
"typeAnnotation": null
}
],
"body": {
"type": "BlockStatement",
"span": {
"start": 183,
"end": 185,
"ctxt": 0
},
"stmts": []
},
"async": false,
"generator": false,
"typeParameters": null,
"returnType": null
}
},
"arguments": [],
"typeArguments": null
}
}
],
"interpreter": null
}