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

522 lines
15 KiB
JSON
Raw Normal View History

{
"type": "Script",
"span": {
"start": 133,
"end": 293,
"ctxt": 0
},
"body": [
{
"type": "VariableDeclaration",
"span": {
"start": 133,
"end": 179,
"ctxt": 0
},
"kind": "const",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 139,
"end": 178,
"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": 178,
"ctxt": 0
},
"params": [],
"body": {
"type": "Identifier",
"span": {
"start": 169,
"end": 178,
"ctxt": 0
},
"value": "undefined",
"optional": false
},
"async": false,
"generator": false,
"typeParameters": null,
"returnType": {
"type": "TsTypeAnnotation",
"span": {
"start": 145,
"end": 165,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsUnionType",
"span": {
"start": 147,
"end": 165,
"ctxt": 0
},
"types": [
{
"type": "TsKeywordType",
"span": {
"start": 147,
"end": 153,
"ctxt": 0
},
"kind": "string"
},
{
"type": "TsKeywordType",
"span": {
"start": 156,
"end": 165,
"ctxt": 0
},
"kind": "undefined"
}
]
}
}
},
"definite": false
}
]
},
{
"type": "ExpressionStatement",
"span": {
"start": 180,
"end": 225,
"ctxt": 0
},
"expression": {
"type": "CallExpression",
"span": {
"start": 180,
"end": 224,
"ctxt": 0
},
"callee": {
"type": "ParenthesisExpression",
"span": {
"start": 180,
"end": 222,
"ctxt": 0
},
"expression": {
"type": "ArrowFunctionExpression",
"span": {
"start": 181,
"end": 221,
"ctxt": 0
},
"params": [
{
"type": "ObjectPattern",
"span": {
"start": 182,
"end": 206,
"ctxt": 0
},
"properties": [
{
"type": "KeyValuePatternProperty",
"key": {
"type": "Computed",
"span": {
"start": 184,
"end": 196,
"ctxt": 0
},
"expression": {
"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",
"raw": "\"d\""
}
}
},
"value": {
"type": "AssignmentPattern",
"span": {
"start": 198,
"end": 204,
"ctxt": 0
},
"left": {
"type": "Identifier",
"span": {
"start": 198,
"end": 199,
"ctxt": 0
},
"value": "c",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "StringLiteral",
"span": {
"start": 202,
"end": 204,
"ctxt": 0
},
"value": "",
"raw": "\"\""
},
"typeAnnotation": null
}
}
],
"optional": false,
"typeAnnotation": null
}
],
"body": {
"type": "BlockStatement",
"span": {
"start": 211,
"end": 221,
"ctxt": 0
},
"stmts": [
{
"type": "VariableDeclaration",
"span": {
"start": 213,
"end": 219,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 217,
"end": 218,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 217,
"end": 218,
"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": 227,
"end": 240,
"ctxt": 0
},
"kind": "const",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 233,
"end": 239,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 233,
"end": 234,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "StringLiteral",
"span": {
"start": 237,
"end": 239,
"ctxt": 0
},
"value": "",
"raw": "\"\""
},
"definite": false
}
]
},
{
"type": "ExpressionStatement",
"span": {
"start": 241,
"end": 293,
"ctxt": 0
},
"expression": {
"type": "CallExpression",
"span": {
"start": 241,
"end": 292,
"ctxt": 0
},
"callee": {
"type": "ParenthesisExpression",
"span": {
"start": 241,
"end": 290,
"ctxt": 0
},
"expression": {
"type": "ArrowFunctionExpression",
"span": {
"start": 242,
"end": 289,
"ctxt": 0
},
"params": [
{
"type": "ObjectPattern",
"span": {
"start": 243,
"end": 274,
"ctxt": 0
},
"properties": [
{
"type": "KeyValuePatternProperty",
"key": {
"type": "Computed",
"span": {
"start": 245,
"end": 257,
"ctxt": 0
},
"expression": {
"type": "BinaryExpression",
"span": {
"start": 246,
"end": 256,
"ctxt": 0
},
"operator": "??",
"left": {
"type": "CallExpression",
"span": {
"start": 246,
"end": 249,
"ctxt": 0
},
"callee": {
"type": "Identifier",
"span": {
"start": 246,
"end": 247,
"ctxt": 0
},
"value": "a",
"optional": false
},
"arguments": [],
"typeArguments": null
},
"right": {
"type": "StringLiteral",
"span": {
"start": 253,
"end": 256,
"ctxt": 0
},
"value": "d",
"raw": "\"d\""
}
}
},
"value": {
"type": "AssignmentPattern",
"span": {
"start": 259,
"end": 265,
"ctxt": 0
},
"left": {
"type": "Identifier",
"span": {
"start": 259,
"end": 260,
"ctxt": 0
},
"value": "c",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "StringLiteral",
"span": {
"start": 263,
"end": 265,
"ctxt": 0
},
"value": "",
"raw": "\"\""
},
"typeAnnotation": null
}
},
{
"type": "AssignmentPatternProperty",
"span": {
"start": 267,
"end": 272,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 267,
"end": 268,
"ctxt": 0
},
"value": "d",
"optional": false
},
"value": {
"type": "Identifier",
"span": {
"start": 271,
"end": 272,
"ctxt": 0
},
"value": "x",
"optional": false
}
}
],
"optional": false,
"typeAnnotation": null
}
],
"body": {
"type": "BlockStatement",
"span": {
"start": 279,
"end": 289,
"ctxt": 0
},
"stmts": [
{
"type": "VariableDeclaration",
"span": {
"start": 281,
"end": 287,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 285,
"end": 286,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 285,
"end": 286,
"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
}