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

141 lines
3.1 KiB
JSON

{
"type": "Script",
"span": {
"start": 18,
"end": 67,
"ctxt": 0
},
"body": [
{
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 27,
"end": 30,
"ctxt": 0
},
"value": "foo",
"optional": false
},
"declare": false,
"params": [
{
"type": "Parameter",
"span": {
"start": 31,
"end": 42,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 31,
"end": 42,
"ctxt": 0
},
"value": "foo",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 34,
"end": 42,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 36,
"end": 42,
"ctxt": 0
},
"kind": "string"
}
}
}
},
{
"type": "Parameter",
"span": {
"start": 44,
"end": 62,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "AssignmentPattern",
"span": {
"start": 44,
"end": 62,
"ctxt": 0
},
"left": {
"type": "Identifier",
"span": {
"start": 44,
"end": 47,
"ctxt": 0
},
"value": "bar",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "BinaryExpression",
"span": {
"start": 50,
"end": 62,
"ctxt": 0
},
"operator": "??",
"left": {
"type": "Identifier",
"span": {
"start": 50,
"end": 53,
"ctxt": 0
},
"value": "foo",
"optional": false
},
"right": {
"type": "StringLiteral",
"span": {
"start": 57,
"end": 62,
"ctxt": 0
},
"value": "bar",
"raw": "\"bar\""
}
},
"typeAnnotation": null
}
}
],
"decorators": [],
"span": {
"start": 18,
"end": 67,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 64,
"end": 67,
"ctxt": 0
},
"stmts": []
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
}
],
"interpreter": null
}