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

251 lines
7.0 KiB
JSON
Raw Normal View History

{
"type": "Script",
"span": {
"start": 115,
"end": 199,
"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": 199,
"ctxt": 0
},
"expression": {
"type": "CallExpression",
"span": {
"start": 162,
"end": 198,
"ctxt": 0
},
"callee": {
"type": "ParenthesisExpression",
"span": {
"start": 162,
"end": 196,
"ctxt": 0
},
"expression": {
"type": "ArrowFunctionExpression",
"span": {
"start": 163,
"end": 195,
"ctxt": 0
},
"params": [
{
"type": "ObjectPattern",
"span": {
"start": 164,
"end": 188,
"ctxt": 0
},
"properties": [
{
"type": "KeyValuePatternProperty",
"key": {
"type": "Computed",
"span": {
"start": 166,
"end": 178,
"ctxt": 0
},
"expression": {
"type": "BinaryExpression",
"span": {
"start": 167,
"end": 177,
"ctxt": 0
},
"operator": "??",
"left": {
"type": "CallExpression",
"span": {
"start": 167,
"end": 170,
"ctxt": 0
},
"callee": {
"type": "Identifier",
"span": {
"start": 167,
"end": 168,
"ctxt": 0
},
"value": "a",
"optional": false
},
"arguments": [],
"typeArguments": null
},
"right": {
"type": "StringLiteral",
"span": {
"start": 174,
"end": 177,
"ctxt": 0
},
"value": "d",
"hasEscape": false,
"kind": {
"type": "normal",
"containsQuote": true
}
}
}
},
"value": {
"type": "AssignmentPattern",
"span": {
"start": 180,
"end": 186,
"ctxt": 0
},
"left": {
"type": "Identifier",
"span": {
"start": 180,
"end": 181,
"ctxt": 0
},
"value": "c",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "StringLiteral",
"span": {
"start": 184,
"end": 186,
"ctxt": 0
},
"value": "",
"hasEscape": false,
"kind": {
"type": "normal",
"containsQuote": true
}
},
"typeAnnotation": null
}
}
],
"optional": false,
"typeAnnotation": null
}
],
"body": {
"type": "BlockStatement",
"span": {
"start": 193,
"end": 195,
"ctxt": 0
},
"stmts": []
},
"async": false,
"generator": false,
"typeParameters": null,
"returnType": null
}
},
"arguments": [],
"typeArguments": null
}
}
],
"interpreter": null
}