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

352 lines
9.9 KiB
JSON

{
"type": "Script",
"span": {
"start": 0,
"end": 63,
"ctxt": 0
},
"body": [
{
"type": "VariableDeclaration",
"span": {
"start": 0,
"end": 63,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 4,
"end": 62,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 4,
"end": 5,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "ConditionalExpression",
"span": {
"start": 8,
"end": 62,
"ctxt": 0
},
"test": {
"type": "TemplateLiteral",
"span": {
"start": 8,
"end": 24,
"ctxt": 0
},
"expressions": [
{
"type": "StringLiteral",
"span": {
"start": 15,
"end": 18,
"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": 20,
"end": 23,
"ctxt": 0
},
"tail": true,
"cooked": {
"type": "StringLiteral",
"span": {
"start": 20,
"end": 23,
"ctxt": 0
},
"value": "def",
"hasEscape": false,
"kind": {
"type": "normal",
"containsQuote": false
}
},
"raw": {
"type": "StringLiteral",
"span": {
"start": 20,
"end": 23,
"ctxt": 0
},
"value": "def",
"hasEscape": false,
"kind": {
"type": "normal",
"containsQuote": false
}
}
}
]
},
"consequent": {
"type": "TemplateLiteral",
"span": {
"start": 27,
"end": 43,
"ctxt": 0
},
"expressions": [
{
"type": "StringLiteral",
"span": {
"start": 34,
"end": 37,
"ctxt": 0
},
"value": " ",
"hasEscape": false,
"kind": {
"type": "normal",
"containsQuote": true
}
}
],
"quasis": [
{
"type": "TemplateElement",
"span": {
"start": 28,
"end": 31,
"ctxt": 0
},
"tail": false,
"cooked": {
"type": "StringLiteral",
"span": {
"start": 28,
"end": 31,
"ctxt": 0
},
"value": "abc",
"hasEscape": false,
"kind": {
"type": "normal",
"containsQuote": false
}
},
"raw": {
"type": "StringLiteral",
"span": {
"start": 28,
"end": 31,
"ctxt": 0
},
"value": "abc",
"hasEscape": false,
"kind": {
"type": "normal",
"containsQuote": false
}
}
},
{
"type": "TemplateElement",
"span": {
"start": 39,
"end": 42,
"ctxt": 0
},
"tail": true,
"cooked": {
"type": "StringLiteral",
"span": {
"start": 39,
"end": 42,
"ctxt": 0
},
"value": "def",
"hasEscape": false,
"kind": {
"type": "normal",
"containsQuote": false
}
},
"raw": {
"type": "StringLiteral",
"span": {
"start": 39,
"end": 42,
"ctxt": 0
},
"value": "def",
"hasEscape": false,
"kind": {
"type": "normal",
"containsQuote": false
}
}
}
]
},
"alternate": {
"type": "TemplateLiteral",
"span": {
"start": 46,
"end": 62,
"ctxt": 0
},
"expressions": [
{
"type": "StringLiteral",
"span": {
"start": 53,
"end": 56,
"ctxt": 0
},
"value": " ",
"hasEscape": false,
"kind": {
"type": "normal",
"containsQuote": true
}
}
],
"quasis": [
{
"type": "TemplateElement",
"span": {
"start": 47,
"end": 50,
"ctxt": 0
},
"tail": false,
"cooked": {
"type": "StringLiteral",
"span": {
"start": 47,
"end": 50,
"ctxt": 0
},
"value": "abc",
"hasEscape": false,
"kind": {
"type": "normal",
"containsQuote": false
}
},
"raw": {
"type": "StringLiteral",
"span": {
"start": 47,
"end": 50,
"ctxt": 0
},
"value": "abc",
"hasEscape": false,
"kind": {
"type": "normal",
"containsQuote": false
}
}
},
{
"type": "TemplateElement",
"span": {
"start": 58,
"end": 61,
"ctxt": 0
},
"tail": true,
"cooked": {
"type": "StringLiteral",
"span": {
"start": 58,
"end": 61,
"ctxt": 0
},
"value": "def",
"hasEscape": false,
"kind": {
"type": "normal",
"containsQuote": false
}
},
"raw": {
"type": "StringLiteral",
"span": {
"start": 58,
"end": 61,
"ctxt": 0
},
"value": "def",
"hasEscape": false,
"kind": {
"type": "normal",
"containsQuote": false
}
}
}
]
}
},
"definite": false
}
]
}
],
"interpreter": null
}