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

141 lines
3.1 KiB
JSON

{
"type": "Script",
"span": {
"start": 19,
"end": 68,
"ctxt": 0
},
"body": [
{
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 28,
"end": 31,
"ctxt": 0
},
"value": "foo",
"optional": false
},
"declare": false,
"params": [
{
"type": "Parameter",
"span": {
"start": 32,
"end": 43,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 32,
"end": 43,
"ctxt": 0
},
"value": "foo",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 35,
"end": 43,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 37,
"end": 43,
"ctxt": 0
},
"kind": "string"
}
}
}
},
{
"type": "Parameter",
"span": {
"start": 45,
"end": 63,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "AssignmentPattern",
"span": {
"start": 45,
"end": 63,
"ctxt": 0
},
"left": {
"type": "Identifier",
"span": {
"start": 45,
"end": 48,
"ctxt": 0
},
"value": "bar",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "BinaryExpression",
"span": {
"start": 51,
"end": 63,
"ctxt": 0
},
"operator": "??",
"left": {
"type": "Identifier",
"span": {
"start": 51,
"end": 54,
"ctxt": 0
},
"value": "foo",
"optional": false
},
"right": {
"type": "StringLiteral",
"span": {
"start": 58,
"end": 63,
"ctxt": 0
},
"value": "bar",
"raw": "\"bar\""
}
},
"typeAnnotation": null
}
}
],
"decorators": [],
"span": {
"start": 19,
"end": 68,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 65,
"end": 68,
"ctxt": 0
},
"stmts": []
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
}
],
"interpreter": null
}