swc/crates/swc_ecma_parser/tests/tsc/optionalChainingInParameterInitializer.2.json

524 lines
14 KiB
JSON

{
"type": "Script",
"span": {
"start": 133,
"end": 272,
"ctxt": 0
},
"body": [
{
"type": "VariableDeclaration",
"span": {
"start": 133,
"end": 186,
"ctxt": 0
},
"kind": "const",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 139,
"end": 185,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 139,
"end": 140,
"ctxt": 0
},
"value": "a",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "ArrowFunctionExpression",
"span": {
"start": 143,
"end": 185,
"ctxt": 0
},
"params": [],
"body": {
"type": "Identifier",
"span": {
"start": 176,
"end": 185,
"ctxt": 0
},
"value": "undefined",
"optional": false
},
"async": false,
"generator": false,
"typeParameters": null,
"returnType": {
"type": "TsTypeAnnotation",
"span": {
"start": 145,
"end": 172,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsUnionType",
"span": {
"start": 147,
"end": 172,
"ctxt": 0
},
"types": [
{
"type": "TsTypeLiteral",
"span": {
"start": 147,
"end": 160,
"ctxt": 0
},
"members": [
{
"type": "TsPropertySignature",
"span": {
"start": 149,
"end": 158,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 149,
"end": 150,
"ctxt": 0
},
"value": "d",
"optional": false
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 150,
"end": 158,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 152,
"end": 158,
"ctxt": 0
},
"kind": "string"
}
},
"typeParams": null
}
]
},
{
"type": "TsKeywordType",
"span": {
"start": 163,
"end": 172,
"ctxt": 0
},
"kind": "undefined"
}
]
}
}
},
"definite": false
}
]
},
{
"type": "ExpressionStatement",
"span": {
"start": 187,
"end": 218,
"ctxt": 0
},
"expression": {
"type": "CallExpression",
"span": {
"start": 187,
"end": 217,
"ctxt": 0
},
"callee": {
"type": "ParenthesisExpression",
"span": {
"start": 187,
"end": 215,
"ctxt": 0
},
"expression": {
"type": "ArrowFunctionExpression",
"span": {
"start": 188,
"end": 214,
"ctxt": 0
},
"params": [
{
"type": "AssignmentPattern",
"span": {
"start": 189,
"end": 199,
"ctxt": 0
},
"left": {
"type": "Identifier",
"span": {
"start": 189,
"end": 190,
"ctxt": 0
},
"value": "b",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "OptionalChainingExpression",
"span": {
"start": 193,
"end": 199,
"ctxt": 0
},
"questionDotToken": {
"start": 196,
"end": 197,
"ctxt": 0
},
"base": {
"type": "MemberExpression",
"span": {
"start": 193,
"end": 199,
"ctxt": 0
},
"object": {
"type": "CallExpression",
"span": {
"start": 193,
"end": 196,
"ctxt": 0
},
"callee": {
"type": "Identifier",
"span": {
"start": 193,
"end": 194,
"ctxt": 0
},
"value": "a",
"optional": false
},
"arguments": [],
"typeArguments": null
},
"property": {
"type": "Identifier",
"span": {
"start": 198,
"end": 199,
"ctxt": 0
},
"value": "d",
"optional": false
}
}
},
"typeAnnotation": null
}
],
"body": {
"type": "BlockStatement",
"span": {
"start": 204,
"end": 214,
"ctxt": 0
},
"stmts": [
{
"type": "VariableDeclaration",
"span": {
"start": 206,
"end": 212,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 210,
"end": 211,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 210,
"end": 211,
"ctxt": 0
},
"value": "a",
"optional": false,
"typeAnnotation": null
},
"init": null,
"definite": false
}
]
}
]
},
"async": false,
"generator": false,
"typeParameters": null,
"returnType": null
}
},
"arguments": [],
"typeArguments": null
}
},
{
"type": "VariableDeclaration",
"span": {
"start": 220,
"end": 233,
"ctxt": 0
},
"kind": "const",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 226,
"end": 232,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 226,
"end": 227,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "StringLiteral",
"span": {
"start": 230,
"end": 232,
"ctxt": 0
},
"value": "",
"raw": "\"\""
},
"definite": false
}
]
},
{
"type": "ExpressionStatement",
"span": {
"start": 234,
"end": 272,
"ctxt": 0
},
"expression": {
"type": "CallExpression",
"span": {
"start": 234,
"end": 271,
"ctxt": 0
},
"callee": {
"type": "ParenthesisExpression",
"span": {
"start": 234,
"end": 269,
"ctxt": 0
},
"expression": {
"type": "ArrowFunctionExpression",
"span": {
"start": 235,
"end": 268,
"ctxt": 0
},
"params": [
{
"type": "AssignmentPattern",
"span": {
"start": 236,
"end": 246,
"ctxt": 0
},
"left": {
"type": "Identifier",
"span": {
"start": 236,
"end": 237,
"ctxt": 0
},
"value": "b",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "OptionalChainingExpression",
"span": {
"start": 240,
"end": 246,
"ctxt": 0
},
"questionDotToken": {
"start": 243,
"end": 244,
"ctxt": 0
},
"base": {
"type": "MemberExpression",
"span": {
"start": 240,
"end": 246,
"ctxt": 0
},
"object": {
"type": "CallExpression",
"span": {
"start": 240,
"end": 243,
"ctxt": 0
},
"callee": {
"type": "Identifier",
"span": {
"start": 240,
"end": 241,
"ctxt": 0
},
"value": "a",
"optional": false
},
"arguments": [],
"typeArguments": null
},
"property": {
"type": "Identifier",
"span": {
"start": 245,
"end": 246,
"ctxt": 0
},
"value": "d",
"optional": false
}
}
},
"typeAnnotation": null
},
{
"type": "AssignmentPattern",
"span": {
"start": 248,
"end": 253,
"ctxt": 0
},
"left": {
"type": "Identifier",
"span": {
"start": 248,
"end": 249,
"ctxt": 0
},
"value": "d",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "Identifier",
"span": {
"start": 252,
"end": 253,
"ctxt": 0
},
"value": "x",
"optional": false
},
"typeAnnotation": null
}
],
"body": {
"type": "BlockStatement",
"span": {
"start": 258,
"end": 268,
"ctxt": 0
},
"stmts": [
{
"type": "VariableDeclaration",
"span": {
"start": 260,
"end": 266,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 264,
"end": 265,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 264,
"end": 265,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": null
},
"init": null,
"definite": false
}
]
}
]
},
"async": false,
"generator": false,
"typeParameters": null,
"returnType": null
}
},
"arguments": [],
"typeArguments": null
}
}
],
"interpreter": null
}