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

524 lines
14 KiB
JSON

{
"type": "Script",
"span": {
"start": 132,
"end": 271,
"ctxt": 0
},
"body": [
{
"type": "VariableDeclaration",
"span": {
"start": 132,
"end": 185,
"ctxt": 0
},
"kind": "const",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 138,
"end": 184,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 138,
"end": 139,
"ctxt": 0
},
"value": "a",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "ArrowFunctionExpression",
"span": {
"start": 142,
"end": 184,
"ctxt": 0
},
"params": [],
"body": {
"type": "Identifier",
"span": {
"start": 175,
"end": 184,
"ctxt": 0
},
"value": "undefined",
"optional": false
},
"async": false,
"generator": false,
"typeParameters": null,
"returnType": {
"type": "TsTypeAnnotation",
"span": {
"start": 144,
"end": 171,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsUnionType",
"span": {
"start": 146,
"end": 171,
"ctxt": 0
},
"types": [
{
"type": "TsTypeLiteral",
"span": {
"start": 146,
"end": 159,
"ctxt": 0
},
"members": [
{
"type": "TsPropertySignature",
"span": {
"start": 148,
"end": 157,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 148,
"end": 149,
"ctxt": 0
},
"value": "d",
"optional": false
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 149,
"end": 157,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 151,
"end": 157,
"ctxt": 0
},
"kind": "string"
}
},
"typeParams": null
}
]
},
{
"type": "TsKeywordType",
"span": {
"start": 162,
"end": 171,
"ctxt": 0
},
"kind": "undefined"
}
]
}
}
},
"definite": false
}
]
},
{
"type": "ExpressionStatement",
"span": {
"start": 186,
"end": 217,
"ctxt": 0
},
"expression": {
"type": "CallExpression",
"span": {
"start": 186,
"end": 216,
"ctxt": 0
},
"callee": {
"type": "ParenthesisExpression",
"span": {
"start": 186,
"end": 214,
"ctxt": 0
},
"expression": {
"type": "ArrowFunctionExpression",
"span": {
"start": 187,
"end": 213,
"ctxt": 0
},
"params": [
{
"type": "AssignmentPattern",
"span": {
"start": 188,
"end": 198,
"ctxt": 0
},
"left": {
"type": "Identifier",
"span": {
"start": 188,
"end": 189,
"ctxt": 0
},
"value": "b",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "OptionalChainingExpression",
"span": {
"start": 192,
"end": 198,
"ctxt": 0
},
"questionDotToken": {
"start": 195,
"end": 196,
"ctxt": 0
},
"base": {
"type": "MemberExpression",
"span": {
"start": 192,
"end": 198,
"ctxt": 0
},
"object": {
"type": "CallExpression",
"span": {
"start": 192,
"end": 195,
"ctxt": 0
},
"callee": {
"type": "Identifier",
"span": {
"start": 192,
"end": 193,
"ctxt": 0
},
"value": "a",
"optional": false
},
"arguments": [],
"typeArguments": null
},
"property": {
"type": "Identifier",
"span": {
"start": 197,
"end": 198,
"ctxt": 0
},
"value": "d",
"optional": false
}
}
},
"typeAnnotation": null
}
],
"body": {
"type": "BlockStatement",
"span": {
"start": 203,
"end": 213,
"ctxt": 0
},
"stmts": [
{
"type": "VariableDeclaration",
"span": {
"start": 205,
"end": 211,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 209,
"end": 210,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 209,
"end": 210,
"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": 219,
"end": 232,
"ctxt": 0
},
"kind": "const",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 225,
"end": 231,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 225,
"end": 226,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "StringLiteral",
"span": {
"start": 229,
"end": 231,
"ctxt": 0
},
"value": "",
"raw": "\"\""
},
"definite": false
}
]
},
{
"type": "ExpressionStatement",
"span": {
"start": 233,
"end": 271,
"ctxt": 0
},
"expression": {
"type": "CallExpression",
"span": {
"start": 233,
"end": 270,
"ctxt": 0
},
"callee": {
"type": "ParenthesisExpression",
"span": {
"start": 233,
"end": 268,
"ctxt": 0
},
"expression": {
"type": "ArrowFunctionExpression",
"span": {
"start": 234,
"end": 267,
"ctxt": 0
},
"params": [
{
"type": "AssignmentPattern",
"span": {
"start": 235,
"end": 245,
"ctxt": 0
},
"left": {
"type": "Identifier",
"span": {
"start": 235,
"end": 236,
"ctxt": 0
},
"value": "b",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "OptionalChainingExpression",
"span": {
"start": 239,
"end": 245,
"ctxt": 0
},
"questionDotToken": {
"start": 242,
"end": 243,
"ctxt": 0
},
"base": {
"type": "MemberExpression",
"span": {
"start": 239,
"end": 245,
"ctxt": 0
},
"object": {
"type": "CallExpression",
"span": {
"start": 239,
"end": 242,
"ctxt": 0
},
"callee": {
"type": "Identifier",
"span": {
"start": 239,
"end": 240,
"ctxt": 0
},
"value": "a",
"optional": false
},
"arguments": [],
"typeArguments": null
},
"property": {
"type": "Identifier",
"span": {
"start": 244,
"end": 245,
"ctxt": 0
},
"value": "d",
"optional": false
}
}
},
"typeAnnotation": null
},
{
"type": "AssignmentPattern",
"span": {
"start": 247,
"end": 252,
"ctxt": 0
},
"left": {
"type": "Identifier",
"span": {
"start": 247,
"end": 248,
"ctxt": 0
},
"value": "d",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "Identifier",
"span": {
"start": 251,
"end": 252,
"ctxt": 0
},
"value": "x",
"optional": false
},
"typeAnnotation": null
}
],
"body": {
"type": "BlockStatement",
"span": {
"start": 257,
"end": 267,
"ctxt": 0
},
"stmts": [
{
"type": "VariableDeclaration",
"span": {
"start": 259,
"end": 265,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 263,
"end": 264,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 263,
"end": 264,
"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
}