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

297 lines
8.7 KiB
JSON

{
"type": "Script",
"span": {
"start": 115,
"end": 202,
"ctxt": 0
},
"body": [
{
"type": "VariableDeclaration",
"span": {
"start": 115,
"end": 168,
"ctxt": 0
},
"kind": "const",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 121,
"end": 167,
"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": 167,
"ctxt": 0
},
"params": [],
"body": {
"type": "Identifier",
"span": {
"start": 158,
"end": 167,
"ctxt": 0
},
"value": "undefined",
"optional": false
},
"async": false,
"generator": false,
"typeParameters": null,
"returnType": {
"type": "TsTypeAnnotation",
"span": {
"start": 127,
"end": 154,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsUnionType",
"span": {
"start": 129,
"end": 154,
"ctxt": 0
},
"types": [
{
"type": "TsTypeLiteral",
"span": {
"start": 129,
"end": 142,
"ctxt": 0
},
"members": [
{
"type": "TsPropertySignature",
"span": {
"start": 131,
"end": 140,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 131,
"end": 132,
"ctxt": 0
},
"value": "d",
"optional": false
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 132,
"end": 140,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 134,
"end": 140,
"ctxt": 0
},
"kind": "string"
}
},
"typeParams": null
}
]
},
{
"type": "TsKeywordType",
"span": {
"start": 145,
"end": 154,
"ctxt": 0
},
"kind": "undefined"
}
]
}
}
},
"definite": false
}
]
},
{
"type": "ExpressionStatement",
"span": {
"start": 169,
"end": 202,
"ctxt": 0
},
"expression": {
"type": "CallExpression",
"span": {
"start": 169,
"end": 201,
"ctxt": 0
},
"callee": {
"type": "ParenthesisExpression",
"span": {
"start": 169,
"end": 199,
"ctxt": 0
},
"expression": {
"type": "ArrowFunctionExpression",
"span": {
"start": 170,
"end": 198,
"ctxt": 0
},
"params": [
{
"type": "ObjectPattern",
"span": {
"start": 171,
"end": 191,
"ctxt": 0
},
"properties": [
{
"type": "KeyValuePatternProperty",
"key": {
"type": "Computed",
"span": {
"start": 173,
"end": 181,
"ctxt": 0
},
"expression": {
"type": "OptionalChainingExpression",
"span": {
"start": 174,
"end": 180,
"ctxt": 0
},
"questionDotToken": {
"start": 177,
"end": 178,
"ctxt": 0
},
"base": {
"type": "MemberExpression",
"span": {
"start": 174,
"end": 180,
"ctxt": 0
},
"object": {
"type": "CallExpression",
"span": {
"start": 174,
"end": 177,
"ctxt": 0
},
"callee": {
"type": "Identifier",
"span": {
"start": 174,
"end": 175,
"ctxt": 0
},
"value": "a",
"optional": false
},
"arguments": [],
"typeArguments": null
},
"property": {
"type": "Identifier",
"span": {
"start": 179,
"end": 180,
"ctxt": 0
},
"value": "d",
"optional": false
}
}
}
},
"value": {
"type": "AssignmentPattern",
"span": {
"start": 183,
"end": 189,
"ctxt": 0
},
"left": {
"type": "Identifier",
"span": {
"start": 183,
"end": 184,
"ctxt": 0
},
"value": "c",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "StringLiteral",
"span": {
"start": 187,
"end": 189,
"ctxt": 0
},
"value": "",
"raw": "\"\""
},
"typeAnnotation": null
}
}
],
"optional": false,
"typeAnnotation": null
}
],
"body": {
"type": "BlockStatement",
"span": {
"start": 196,
"end": 198,
"ctxt": 0
},
"stmts": []
},
"async": false,
"generator": false,
"typeParameters": null,
"returnType": null
}
},
"arguments": [],
"typeArguments": null
}
}
],
"interpreter": null
}