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

297 lines
8.7 KiB
JSON
Raw Normal View History

{
"type": "Script",
"span": {
"start": 116,
"end": 203,
"ctxt": 0
},
"body": [
{
"type": "VariableDeclaration",
"span": {
"start": 116,
"end": 169,
"ctxt": 0
},
"kind": "const",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 122,
"end": 168,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 122,
"end": 123,
"ctxt": 0
},
"value": "a",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "ArrowFunctionExpression",
"span": {
"start": 126,
"end": 168,
"ctxt": 0
},
"params": [],
"body": {
"type": "Identifier",
"span": {
"start": 159,
"end": 168,
"ctxt": 0
},
"value": "undefined",
"optional": false
},
"async": false,
"generator": false,
"typeParameters": null,
"returnType": {
"type": "TsTypeAnnotation",
"span": {
"start": 128,
"end": 155,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsUnionType",
"span": {
"start": 130,
"end": 155,
"ctxt": 0
},
"types": [
{
"type": "TsTypeLiteral",
"span": {
"start": 130,
"end": 143,
"ctxt": 0
},
"members": [
{
"type": "TsPropertySignature",
"span": {
"start": 132,
"end": 141,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 132,
"end": 133,
"ctxt": 0
},
"value": "d",
"optional": false
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 133,
"end": 141,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 135,
"end": 141,
"ctxt": 0
},
"kind": "string"
}
},
"typeParams": null
}
]
},
{
"type": "TsKeywordType",
"span": {
"start": 146,
"end": 155,
"ctxt": 0
},
"kind": "undefined"
}
]
}
}
},
"definite": false
}
]
},
{
"type": "ExpressionStatement",
"span": {
"start": 170,
"end": 203,
"ctxt": 0
},
"expression": {
"type": "CallExpression",
"span": {
"start": 170,
"end": 202,
"ctxt": 0
},
"callee": {
"type": "ParenthesisExpression",
"span": {
"start": 170,
"end": 200,
"ctxt": 0
},
"expression": {
"type": "ArrowFunctionExpression",
"span": {
"start": 171,
"end": 199,
"ctxt": 0
},
"params": [
{
"type": "ObjectPattern",
"span": {
"start": 172,
"end": 192,
"ctxt": 0
},
"properties": [
{
"type": "KeyValuePatternProperty",
"key": {
"type": "Computed",
"span": {
"start": 174,
"end": 182,
"ctxt": 0
},
"expression": {
"type": "OptionalChainingExpression",
"span": {
"start": 175,
"end": 181,
"ctxt": 0
},
"questionDotToken": {
"start": 178,
"end": 179,
"ctxt": 0
},
"base": {
"type": "MemberExpression",
"span": {
"start": 175,
"end": 181,
"ctxt": 0
},
"object": {
"type": "CallExpression",
"span": {
"start": 175,
"end": 178,
"ctxt": 0
},
"callee": {
"type": "Identifier",
"span": {
"start": 175,
"end": 176,
"ctxt": 0
},
"value": "a",
"optional": false
},
"arguments": [],
"typeArguments": null
},
"property": {
"type": "Identifier",
"span": {
"start": 180,
"end": 181,
"ctxt": 0
},
"value": "d",
"optional": false
}
}
}
},
"value": {
"type": "AssignmentPattern",
"span": {
"start": 184,
"end": 190,
"ctxt": 0
},
"left": {
"type": "Identifier",
"span": {
"start": 184,
"end": 185,
"ctxt": 0
},
"value": "c",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "StringLiteral",
"span": {
"start": 188,
"end": 190,
"ctxt": 0
},
"value": "",
"raw": "\"\""
},
"typeAnnotation": null
}
}
],
"optional": false,
"typeAnnotation": null
}
],
"body": {
"type": "BlockStatement",
"span": {
"start": 197,
"end": 199,
"ctxt": 0
},
"stmts": []
},
"async": false,
"generator": false,
"typeParameters": null,
"returnType": null
}
},
"arguments": [],
"typeArguments": null
}
}
],
"interpreter": null
}