swc/crates/swc_ecma_parser/tests/tsc/nullishCoalescingOperator12.json

252 lines
6.1 KiB
JSON

{
"type": "Script",
"span": {
"start": 38,
"end": 114,
"ctxt": 0
},
"body": [
{
"type": "VariableDeclaration",
"span": {
"start": 38,
"end": 78,
"ctxt": 0
},
"kind": "const",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 44,
"end": 77,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 44,
"end": 47,
"ctxt": 0
},
"value": "obj",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 47,
"end": 63,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeLiteral",
"span": {
"start": 49,
"end": 63,
"ctxt": 0
},
"members": [
{
"type": "TsPropertySignature",
"span": {
"start": 51,
"end": 61,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 51,
"end": 54,
"ctxt": 0
},
"value": "arr",
"optional": false
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 54,
"end": 61,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsArrayType",
"span": {
"start": 56,
"end": 61,
"ctxt": 0
},
"elemType": {
"type": "TsKeywordType",
"span": {
"start": 56,
"end": 59,
"ctxt": 0
},
"kind": "any"
}
}
},
"typeParams": null
}
]
}
}
},
"init": {
"type": "ObjectExpression",
"span": {
"start": 66,
"end": 77,
"ctxt": 0
},
"properties": [
{
"type": "KeyValueProperty",
"key": {
"type": "Identifier",
"span": {
"start": 68,
"end": 71,
"ctxt": 0
},
"value": "arr",
"optional": false
},
"value": {
"type": "ArrayExpression",
"span": {
"start": 73,
"end": 75,
"ctxt": 0
},
"elements": []
}
}
]
},
"definite": false
}
]
},
{
"type": "ForOfStatement",
"span": {
"start": 79,
"end": 114,
"ctxt": 0
},
"await": null,
"left": {
"type": "VariableDeclaration",
"span": {
"start": 84,
"end": 91,
"ctxt": 0
},
"kind": "const",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 90,
"end": 91,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 90,
"end": 91,
"ctxt": 0
},
"value": "i",
"optional": false,
"typeAnnotation": null
},
"init": null,
"definite": false
}
]
},
"right": {
"type": "BinaryExpression",
"span": {
"start": 95,
"end": 109,
"ctxt": 0
},
"operator": "??",
"left": {
"type": "OptionalChainingExpression",
"span": {
"start": 95,
"end": 103,
"ctxt": 0
},
"questionDotToken": {
"start": 98,
"end": 99,
"ctxt": 0
},
"base": {
"type": "MemberExpression",
"span": {
"start": 95,
"end": 103,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 95,
"end": 98,
"ctxt": 0
},
"value": "obj",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 100,
"end": 103,
"ctxt": 0
},
"value": "arr",
"optional": false
}
}
},
"right": {
"type": "ArrayExpression",
"span": {
"start": 107,
"end": 109,
"ctxt": 0
},
"elements": []
}
},
"body": {
"type": "BlockStatement",
"span": {
"start": 111,
"end": 114,
"ctxt": 0
},
"stmts": []
}
}
],
"interpreter": null
}