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

301 lines
7.1 KiB
JSON

{
"type": "Script",
"span": {
"start": 0,
"end": 152,
"ctxt": 0
},
"body": [
{
"type": "VariableDeclaration",
"span": {
"start": 0,
"end": 13,
"ctxt": 0
},
"kind": "let",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 4,
"end": 12,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 4,
"end": 5,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 5,
"end": 12,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsLiteralType",
"span": {
"start": 7,
"end": 12,
"ctxt": 0
},
"literal": {
"type": "StringLiteral",
"span": {
"start": 7,
"end": 12,
"ctxt": 0
},
"value": "foo",
"hasEscape": false,
"kind": {
"type": "normal",
"containsQuote": true
}
}
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 14,
"end": 35,
"ctxt": 0
},
"kind": "let",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 18,
"end": 34,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 18,
"end": 19,
"ctxt": 0
},
"value": "y",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 19,
"end": 34,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsUnionType",
"span": {
"start": 21,
"end": 34,
"ctxt": 0
},
"types": [
{
"type": "TsLiteralType",
"span": {
"start": 21,
"end": 26,
"ctxt": 0
},
"literal": {
"type": "StringLiteral",
"span": {
"start": 21,
"end": 26,
"ctxt": 0
},
"value": "foo",
"hasEscape": false,
"kind": {
"type": "normal",
"containsQuote": true
}
}
},
{
"type": "TsLiteralType",
"span": {
"start": 29,
"end": 34,
"ctxt": 0
},
"literal": {
"type": "StringLiteral",
"span": {
"start": 29,
"end": 34,
"ctxt": 0
},
"value": "bar",
"hasEscape": false,
"kind": {
"type": "normal",
"containsQuote": true
}
}
}
]
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "SwitchStatement",
"span": {
"start": 38,
"end": 152,
"ctxt": 0
},
"discriminant": {
"type": "Identifier",
"span": {
"start": 46,
"end": 47,
"ctxt": 0
},
"value": "x",
"optional": false
},
"cases": [
{
"type": "SwitchCase",
"span": {
"start": 55,
"end": 81,
"ctxt": 0
},
"test": {
"type": "StringLiteral",
"span": {
"start": 60,
"end": 65,
"ctxt": 0
},
"value": "foo",
"hasEscape": false,
"kind": {
"type": "normal",
"containsQuote": true
}
},
"consequent": [
{
"type": "BreakStatement",
"span": {
"start": 75,
"end": 81,
"ctxt": 0
},
"label": null
}
]
},
{
"type": "SwitchCase",
"span": {
"start": 86,
"end": 112,
"ctxt": 0
},
"test": {
"type": "StringLiteral",
"span": {
"start": 91,
"end": 96,
"ctxt": 0
},
"value": "bar",
"hasEscape": false,
"kind": {
"type": "normal",
"containsQuote": true
}
},
"consequent": [
{
"type": "BreakStatement",
"span": {
"start": 106,
"end": 112,
"ctxt": 0
},
"label": null
}
]
},
{
"type": "SwitchCase",
"span": {
"start": 117,
"end": 150,
"ctxt": 0
},
"test": {
"type": "Identifier",
"span": {
"start": 122,
"end": 123,
"ctxt": 0
},
"value": "y",
"optional": false
},
"consequent": [
{
"type": "ExpressionStatement",
"span": {
"start": 133,
"end": 135,
"ctxt": 0
},
"expression": {
"type": "Identifier",
"span": {
"start": 133,
"end": 134,
"ctxt": 0
},
"value": "y",
"optional": false
}
},
{
"type": "BreakStatement",
"span": {
"start": 144,
"end": 150,
"ctxt": 0
},
"label": null
}
]
}
]
}
],
"interpreter": null
}