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

281 lines
6.5 KiB
JSON

{
"type": "Script",
"span": {
"start": 1,
"end": 153,
"ctxt": 0
},
"body": [
{
"type": "VariableDeclaration",
"span": {
"start": 1,
"end": 14,
"ctxt": 0
},
"kind": "let",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 5,
"end": 13,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 5,
"end": 6,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 6,
"end": 13,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsLiteralType",
"span": {
"start": 8,
"end": 13,
"ctxt": 0
},
"literal": {
"type": "StringLiteral",
"span": {
"start": 8,
"end": 13,
"ctxt": 0
},
"value": "foo",
"raw": "\"foo\""
}
}
}
},
"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",
"raw": "\"foo\""
}
},
{
"type": "TsLiteralType",
"span": {
"start": 30,
"end": 35,
"ctxt": 0
},
"literal": {
"type": "StringLiteral",
"span": {
"start": 30,
"end": 35,
"ctxt": 0
},
"value": "bar",
"raw": "\"bar\""
}
}
]
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "SwitchStatement",
"span": {
"start": 39,
"end": 153,
"ctxt": 0
},
"discriminant": {
"type": "Identifier",
"span": {
"start": 47,
"end": 48,
"ctxt": 0
},
"value": "x",
"optional": false
},
"cases": [
{
"type": "SwitchCase",
"span": {
"start": 56,
"end": 82,
"ctxt": 0
},
"test": {
"type": "StringLiteral",
"span": {
"start": 61,
"end": 66,
"ctxt": 0
},
"value": "foo",
"raw": "\"foo\""
},
"consequent": [
{
"type": "BreakStatement",
"span": {
"start": 76,
"end": 82,
"ctxt": 0
},
"label": null
}
]
},
{
"type": "SwitchCase",
"span": {
"start": 87,
"end": 113,
"ctxt": 0
},
"test": {
"type": "StringLiteral",
"span": {
"start": 92,
"end": 97,
"ctxt": 0
},
"value": "bar",
"raw": "\"bar\""
},
"consequent": [
{
"type": "BreakStatement",
"span": {
"start": 107,
"end": 113,
"ctxt": 0
},
"label": null
}
]
},
{
"type": "SwitchCase",
"span": {
"start": 118,
"end": 151,
"ctxt": 0
},
"test": {
"type": "Identifier",
"span": {
"start": 123,
"end": 124,
"ctxt": 0
},
"value": "y",
"optional": false
},
"consequent": [
{
"type": "ExpressionStatement",
"span": {
"start": 134,
"end": 136,
"ctxt": 0
},
"expression": {
"type": "Identifier",
"span": {
"start": 134,
"end": 135,
"ctxt": 0
},
"value": "y",
"optional": false
}
},
{
"type": "BreakStatement",
"span": {
"start": 145,
"end": 151,
"ctxt": 0
},
"label": null
}
]
}
]
}
],
"interpreter": null
}