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

470 lines
12 KiB
JSON

{
"type": "Script",
"span": {
"start": 132,
"end": 272,
"ctxt": 0
},
"body": [
{
"type": "VariableDeclaration",
"span": {
"start": 132,
"end": 178,
"ctxt": 0
},
"kind": "const",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 138,
"end": 177,
"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": 177,
"ctxt": 0
},
"params": [],
"body": {
"type": "Identifier",
"span": {
"start": 168,
"end": 177,
"ctxt": 0
},
"value": "undefined",
"optional": false
},
"async": false,
"generator": false,
"typeParameters": null,
"returnType": {
"type": "TsTypeAnnotation",
"span": {
"start": 144,
"end": 164,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsUnionType",
"span": {
"start": 146,
"end": 164,
"ctxt": 0
},
"types": [
{
"type": "TsKeywordType",
"span": {
"start": 146,
"end": 152,
"ctxt": 0
},
"kind": "string"
},
{
"type": "TsKeywordType",
"span": {
"start": 155,
"end": 164,
"ctxt": 0
},
"kind": "undefined"
}
]
}
}
},
"definite": false
}
]
},
{
"type": "ExpressionStatement",
"span": {
"start": 179,
"end": 214,
"ctxt": 0
},
"expression": {
"type": "CallExpression",
"span": {
"start": 179,
"end": 213,
"ctxt": 0
},
"callee": {
"type": "ParenthesisExpression",
"span": {
"start": 179,
"end": 211,
"ctxt": 0
},
"expression": {
"type": "ArrowFunctionExpression",
"span": {
"start": 180,
"end": 210,
"ctxt": 0
},
"params": [
{
"type": "AssignmentPattern",
"span": {
"start": 181,
"end": 195,
"ctxt": 0
},
"left": {
"type": "Identifier",
"span": {
"start": 181,
"end": 182,
"ctxt": 0
},
"value": "b",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "BinaryExpression",
"span": {
"start": 185,
"end": 195,
"ctxt": 0
},
"operator": "??",
"left": {
"type": "CallExpression",
"span": {
"start": 185,
"end": 188,
"ctxt": 0
},
"callee": {
"type": "Identifier",
"span": {
"start": 185,
"end": 186,
"ctxt": 0
},
"value": "a",
"optional": false
},
"arguments": [],
"typeArguments": null
},
"right": {
"type": "StringLiteral",
"span": {
"start": 192,
"end": 195,
"ctxt": 0
},
"value": "d",
"hasEscape": false,
"kind": {
"type": "normal",
"containsQuote": true
}
}
},
"typeAnnotation": null
}
],
"body": {
"type": "BlockStatement",
"span": {
"start": 200,
"end": 210,
"ctxt": 0
},
"stmts": [
{
"type": "VariableDeclaration",
"span": {
"start": 202,
"end": 208,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 206,
"end": 207,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 206,
"end": 207,
"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": 216,
"end": 229,
"ctxt": 0
},
"kind": "const",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 222,
"end": 228,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 222,
"end": 223,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "StringLiteral",
"span": {
"start": 226,
"end": 228,
"ctxt": 0
},
"value": "",
"hasEscape": false,
"kind": {
"type": "normal",
"containsQuote": true
}
},
"definite": false
}
]
},
{
"type": "ExpressionStatement",
"span": {
"start": 230,
"end": 272,
"ctxt": 0
},
"expression": {
"type": "CallExpression",
"span": {
"start": 230,
"end": 271,
"ctxt": 0
},
"callee": {
"type": "ParenthesisExpression",
"span": {
"start": 230,
"end": 269,
"ctxt": 0
},
"expression": {
"type": "ArrowFunctionExpression",
"span": {
"start": 231,
"end": 268,
"ctxt": 0
},
"params": [
{
"type": "AssignmentPattern",
"span": {
"start": 232,
"end": 246,
"ctxt": 0
},
"left": {
"type": "Identifier",
"span": {
"start": 232,
"end": 233,
"ctxt": 0
},
"value": "b",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "BinaryExpression",
"span": {
"start": 236,
"end": 246,
"ctxt": 0
},
"operator": "??",
"left": {
"type": "CallExpression",
"span": {
"start": 236,
"end": 239,
"ctxt": 0
},
"callee": {
"type": "Identifier",
"span": {
"start": 236,
"end": 237,
"ctxt": 0
},
"value": "a",
"optional": false
},
"arguments": [],
"typeArguments": null
},
"right": {
"type": "StringLiteral",
"span": {
"start": 243,
"end": 246,
"ctxt": 0
},
"value": "d",
"hasEscape": false,
"kind": {
"type": "normal",
"containsQuote": true
}
}
},
"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
}