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

170 lines
4.3 KiB
JSON

{
"type": "Script",
"span": {
"start": 0,
"end": 40,
"ctxt": 0
},
"body": [
{
"type": "VariableDeclaration",
"span": {
"start": 0,
"end": 40,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 4,
"end": 39,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 4,
"end": 5,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "TemplateLiteral",
"span": {
"start": 8,
"end": 39,
"ctxt": 0
},
"expressions": [
{
"type": "ConditionalExpression",
"span": {
"start": 15,
"end": 33,
"ctxt": 0
},
"test": {
"type": "BooleanLiteral",
"span": {
"start": 15,
"end": 19,
"ctxt": 0
},
"value": true
},
"consequent": {
"type": "BooleanLiteral",
"span": {
"start": 22,
"end": 27,
"ctxt": 0
},
"value": false
},
"alternate": {
"type": "StringLiteral",
"span": {
"start": 30,
"end": 33,
"ctxt": 0
},
"value": " ",
"hasEscape": false,
"kind": {
"type": "normal",
"containsQuote": true
}
}
}
],
"quasis": [
{
"type": "TemplateElement",
"span": {
"start": 9,
"end": 12,
"ctxt": 0
},
"tail": false,
"cooked": {
"type": "StringLiteral",
"span": {
"start": 9,
"end": 12,
"ctxt": 0
},
"value": "abc",
"hasEscape": false,
"kind": {
"type": "normal",
"containsQuote": false
}
},
"raw": {
"type": "StringLiteral",
"span": {
"start": 9,
"end": 12,
"ctxt": 0
},
"value": "abc",
"hasEscape": false,
"kind": {
"type": "normal",
"containsQuote": false
}
}
},
{
"type": "TemplateElement",
"span": {
"start": 35,
"end": 38,
"ctxt": 0
},
"tail": true,
"cooked": {
"type": "StringLiteral",
"span": {
"start": 35,
"end": 38,
"ctxt": 0
},
"value": "def",
"hasEscape": false,
"kind": {
"type": "normal",
"containsQuote": false
}
},
"raw": {
"type": "StringLiteral",
"span": {
"start": 35,
"end": 38,
"ctxt": 0
},
"value": "def",
"hasEscape": false,
"kind": {
"type": "normal",
"containsQuote": false
}
}
}
]
},
"definite": false
}
]
}
],
"interpreter": null
}