swc/crates/swc_ecma_parser/tests/tsc/stringLiteralsWithSwitchStatements01.json
2022-02-04 17:08:38 +09:00

301 lines
7.1 KiB
JSON

{
"type": "Script",
"span": {
"start": 0,
"end": 163,
"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": 15,
"end": 36,
"ctxt": 0
},
"kind": "let",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 19,
"end": 35,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 19,
"end": 20,
"ctxt": 0
},
"value": "y",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 20,
"end": 35,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsUnionType",
"span": {
"start": 22,
"end": 35,
"ctxt": 0
},
"types": [
{
"type": "TsLiteralType",
"span": {
"start": 22,
"end": 27,
"ctxt": 0
},
"literal": {
"type": "StringLiteral",
"span": {
"start": 22,
"end": 27,
"ctxt": 0
},
"value": "foo",
"hasEscape": false,
"kind": {
"type": "normal",
"containsQuote": true
}
}
},
{
"type": "TsLiteralType",
"span": {
"start": 30,
"end": 35,
"ctxt": 0
},
"literal": {
"type": "StringLiteral",
"span": {
"start": 30,
"end": 35,
"ctxt": 0
},
"value": "bar",
"hasEscape": false,
"kind": {
"type": "normal",
"containsQuote": true
}
}
}
]
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "SwitchStatement",
"span": {
"start": 41,
"end": 163,
"ctxt": 0
},
"discriminant": {
"type": "Identifier",
"span": {
"start": 49,
"end": 50,
"ctxt": 0
},
"value": "x",
"optional": false
},
"cases": [
{
"type": "SwitchCase",
"span": {
"start": 59,
"end": 86,
"ctxt": 0
},
"test": {
"type": "StringLiteral",
"span": {
"start": 64,
"end": 69,
"ctxt": 0
},
"value": "foo",
"hasEscape": false,
"kind": {
"type": "normal",
"containsQuote": true
}
},
"consequent": [
{
"type": "BreakStatement",
"span": {
"start": 80,
"end": 86,
"ctxt": 0
},
"label": null
}
]
},
{
"type": "SwitchCase",
"span": {
"start": 92,
"end": 119,
"ctxt": 0
},
"test": {
"type": "StringLiteral",
"span": {
"start": 97,
"end": 102,
"ctxt": 0
},
"value": "bar",
"hasEscape": false,
"kind": {
"type": "normal",
"containsQuote": true
}
},
"consequent": [
{
"type": "BreakStatement",
"span": {
"start": 113,
"end": 119,
"ctxt": 0
},
"label": null
}
]
},
{
"type": "SwitchCase",
"span": {
"start": 125,
"end": 160,
"ctxt": 0
},
"test": {
"type": "Identifier",
"span": {
"start": 130,
"end": 131,
"ctxt": 0
},
"value": "y",
"optional": false
},
"consequent": [
{
"type": "ExpressionStatement",
"span": {
"start": 142,
"end": 144,
"ctxt": 0
},
"expression": {
"type": "Identifier",
"span": {
"start": 142,
"end": 143,
"ctxt": 0
},
"value": "y",
"optional": false
}
},
{
"type": "BreakStatement",
"span": {
"start": 154,
"end": 160,
"ctxt": 0
},
"label": null
}
]
}
]
}
],
"interpreter": null
}