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

281 lines
6.5 KiB
JSON
Raw Normal View History

{
"type": "Script",
"span": {
"start": 0,
2022-02-04 14:17:42 +03:00
"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",
"raw": "\"foo\""
}
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
2022-02-04 14:17:42 +03:00
"start": 14,
"end": 35,
"ctxt": 0
},
"kind": "let",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
2022-02-04 14:17:42 +03:00
"start": 18,
"end": 34,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
2022-02-04 14:17:42 +03:00
"start": 18,
"end": 19,
"ctxt": 0
},
"value": "y",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
2022-02-04 14:17:42 +03:00
"start": 19,
"end": 34,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsUnionType",
"span": {
2022-02-04 14:17:42 +03:00
"start": 21,
"end": 34,
"ctxt": 0
},
"types": [
{
"type": "TsLiteralType",
"span": {
2022-02-04 14:17:42 +03:00
"start": 21,
"end": 26,
"ctxt": 0
},
"literal": {
"type": "StringLiteral",
"span": {
2022-02-04 14:17:42 +03:00
"start": 21,
"end": 26,
"ctxt": 0
},
"value": "foo",
"raw": "\"foo\""
}
},
{
"type": "TsLiteralType",
"span": {
2022-02-04 14:17:42 +03:00
"start": 29,
"end": 34,
"ctxt": 0
},
"literal": {
"type": "StringLiteral",
"span": {
2022-02-04 14:17:42 +03:00
"start": 29,
"end": 34,
"ctxt": 0
},
"value": "bar",
"raw": "\"bar\""
}
}
]
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "SwitchStatement",
"span": {
2022-02-04 14:17:42 +03:00
"start": 38,
"end": 152,
"ctxt": 0
},
"discriminant": {
"type": "Identifier",
"span": {
2022-02-04 14:17:42 +03:00
"start": 46,
"end": 47,
"ctxt": 0
},
"value": "x",
"optional": false
},
"cases": [
{
"type": "SwitchCase",
"span": {
2022-02-04 14:17:42 +03:00
"start": 55,
"end": 81,
"ctxt": 0
},
"test": {
"type": "StringLiteral",
"span": {
2022-02-04 14:17:42 +03:00
"start": 60,
"end": 65,
"ctxt": 0
},
"value": "foo",
"raw": "\"foo\""
},
"consequent": [
{
"type": "BreakStatement",
"span": {
2022-02-04 14:17:42 +03:00
"start": 75,
"end": 81,
"ctxt": 0
},
"label": null
}
]
},
{
"type": "SwitchCase",
"span": {
2022-02-04 14:17:42 +03:00
"start": 86,
"end": 112,
"ctxt": 0
},
"test": {
"type": "StringLiteral",
"span": {
2022-02-04 14:17:42 +03:00
"start": 91,
"end": 96,
"ctxt": 0
},
"value": "bar",
"raw": "\"bar\""
},
"consequent": [
{
"type": "BreakStatement",
"span": {
2022-02-04 14:17:42 +03:00
"start": 106,
"end": 112,
"ctxt": 0
},
"label": null
}
]
},
{
"type": "SwitchCase",
"span": {
2022-02-04 14:17:42 +03:00
"start": 117,
"end": 150,
"ctxt": 0
},
"test": {
"type": "Identifier",
"span": {
2022-02-04 14:17:42 +03:00
"start": 122,
"end": 123,
"ctxt": 0
},
"value": "y",
"optional": false
},
"consequent": [
{
"type": "ExpressionStatement",
"span": {
2022-02-04 14:17:42 +03:00
"start": 133,
"end": 135,
"ctxt": 0
},
"expression": {
"type": "Identifier",
"span": {
2022-02-04 14:17:42 +03:00
"start": 133,
"end": 134,
"ctxt": 0
},
"value": "y",
"optional": false
}
},
{
"type": "BreakStatement",
"span": {
2022-02-04 14:17:42 +03:00
"start": 144,
"end": 150,
"ctxt": 0
},
"label": null
}
]
}
]
}
],
"interpreter": null
}