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

699 lines
20 KiB
JSON

{
"type": "Script",
"span": {
"start": 18,
"end": 264,
"ctxt": 0
},
"body": [
{
"type": "VariableDeclaration",
"span": {
"start": 18,
"end": 86,
"ctxt": 0
},
"kind": "const",
"declare": true,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 32,
"end": 85,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 32,
"end": 33,
"ctxt": 0
},
"value": "a",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 33,
"end": 85,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeLiteral",
"span": {
"start": 35,
"end": 85,
"ctxt": 0
},
"members": [
{
"type": "TsPropertySignature",
"span": {
"start": 37,
"end": 59,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 37,
"end": 38,
"ctxt": 0
},
"value": "p",
"optional": false
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 38,
"end": 58,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsUnionType",
"span": {
"start": 40,
"end": 58,
"ctxt": 0
},
"types": [
{
"type": "TsKeywordType",
"span": {
"start": 40,
"end": 46,
"ctxt": 0
},
"kind": "string"
},
{
"type": "TsKeywordType",
"span": {
"start": 49,
"end": 58,
"ctxt": 0
},
"kind": "undefined"
}
]
}
},
"typeParams": null
},
{
"type": "TsMethodSignature",
"span": {
"start": 60,
"end": 83,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 60,
"end": 61,
"ctxt": 0
},
"value": "m",
"optional": false
},
"computed": false,
"optional": false,
"params": [],
"typeAnn": {
"type": "TsTypeAnnotation",
"span": {
"start": 63,
"end": 83,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsUnionType",
"span": {
"start": 65,
"end": 83,
"ctxt": 0
},
"types": [
{
"type": "TsKeywordType",
"span": {
"start": 65,
"end": 71,
"ctxt": 0
},
"kind": "string"
},
{
"type": "TsKeywordType",
"span": {
"start": 74,
"end": 83,
"ctxt": 0
},
"kind": "undefined"
}
]
}
},
"typeParams": null
}
]
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 87,
"end": 155,
"ctxt": 0
},
"kind": "const",
"declare": true,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 101,
"end": 154,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 101,
"end": 102,
"ctxt": 0
},
"value": "b",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 102,
"end": 154,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeLiteral",
"span": {
"start": 104,
"end": 154,
"ctxt": 0
},
"members": [
{
"type": "TsPropertySignature",
"span": {
"start": 106,
"end": 128,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 106,
"end": 107,
"ctxt": 0
},
"value": "p",
"optional": false
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 107,
"end": 127,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsUnionType",
"span": {
"start": 109,
"end": 127,
"ctxt": 0
},
"types": [
{
"type": "TsKeywordType",
"span": {
"start": 109,
"end": 115,
"ctxt": 0
},
"kind": "string"
},
{
"type": "TsKeywordType",
"span": {
"start": 118,
"end": 127,
"ctxt": 0
},
"kind": "undefined"
}
]
}
},
"typeParams": null
},
{
"type": "TsMethodSignature",
"span": {
"start": 129,
"end": 152,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 129,
"end": 130,
"ctxt": 0
},
"value": "m",
"optional": false
},
"computed": false,
"optional": false,
"params": [],
"typeAnn": {
"type": "TsTypeAnnotation",
"span": {
"start": 132,
"end": 152,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsUnionType",
"span": {
"start": 134,
"end": 152,
"ctxt": 0
},
"types": [
{
"type": "TsKeywordType",
"span": {
"start": 134,
"end": 140,
"ctxt": 0
},
"kind": "string"
},
{
"type": "TsKeywordType",
"span": {
"start": 143,
"end": 152,
"ctxt": 0
},
"kind": "undefined"
}
]
}
},
"typeParams": null
}
]
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 157,
"end": 185,
"ctxt": 0
},
"kind": "const",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 163,
"end": 184,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 163,
"end": 165,
"ctxt": 0
},
"value": "n1",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "BinaryExpression",
"span": {
"start": 168,
"end": 184,
"ctxt": 0
},
"operator": "??",
"left": {
"type": "MemberExpression",
"span": {
"start": 168,
"end": 171,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 168,
"end": 169,
"ctxt": 0
},
"value": "a",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 170,
"end": 171,
"ctxt": 0
},
"value": "p",
"optional": false
}
},
"right": {
"type": "StringLiteral",
"span": {
"start": 175,
"end": 184,
"ctxt": 0
},
"value": "default",
"raw": "\"default\""
}
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 186,
"end": 216,
"ctxt": 0
},
"kind": "const",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 192,
"end": 215,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 192,
"end": 194,
"ctxt": 0
},
"value": "n2",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "BinaryExpression",
"span": {
"start": 197,
"end": 215,
"ctxt": 0
},
"operator": "??",
"left": {
"type": "CallExpression",
"span": {
"start": 197,
"end": 202,
"ctxt": 0
},
"callee": {
"type": "MemberExpression",
"span": {
"start": 197,
"end": 200,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 197,
"end": 198,
"ctxt": 0
},
"value": "a",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 199,
"end": 200,
"ctxt": 0
},
"value": "m",
"optional": false
}
},
"arguments": [],
"typeArguments": null
},
"right": {
"type": "StringLiteral",
"span": {
"start": 206,
"end": 215,
"ctxt": 0
},
"value": "default",
"raw": "\"default\""
}
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 217,
"end": 263,
"ctxt": 0
},
"kind": "const",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 223,
"end": 262,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 223,
"end": 225,
"ctxt": 0
},
"value": "n3",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "BinaryExpression",
"span": {
"start": 228,
"end": 262,
"ctxt": 0
},
"operator": "??",
"left": {
"type": "BinaryExpression",
"span": {
"start": 228,
"end": 249,
"ctxt": 0
},
"operator": "??",
"left": {
"type": "BinaryExpression",
"span": {
"start": 228,
"end": 240,
"ctxt": 0
},
"operator": "??",
"left": {
"type": "CallExpression",
"span": {
"start": 228,
"end": 233,
"ctxt": 0
},
"callee": {
"type": "MemberExpression",
"span": {
"start": 228,
"end": 231,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 228,
"end": 229,
"ctxt": 0
},
"value": "a",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 230,
"end": 231,
"ctxt": 0
},
"value": "m",
"optional": false
}
},
"arguments": [],
"typeArguments": null
},
"right": {
"type": "MemberExpression",
"span": {
"start": 237,
"end": 240,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 237,
"end": 238,
"ctxt": 0
},
"value": "b",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 239,
"end": 240,
"ctxt": 0
},
"value": "p",
"optional": false
}
}
},
"right": {
"type": "CallExpression",
"span": {
"start": 244,
"end": 249,
"ctxt": 0
},
"callee": {
"type": "MemberExpression",
"span": {
"start": 244,
"end": 247,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 244,
"end": 245,
"ctxt": 0
},
"value": "b",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 246,
"end": 247,
"ctxt": 0
},
"value": "m",
"optional": false
}
},
"arguments": [],
"typeArguments": null
}
},
"right": {
"type": "StringLiteral",
"span": {
"start": 253,
"end": 262,
"ctxt": 0
},
"value": "default",
"raw": "\"default\""
}
},
"definite": false
}
]
},
{
"type": "EmptyStatement",
"span": {
"start": 263,
"end": 264,
"ctxt": 0
}
}
],
"interpreter": null
}