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

661 lines
15 KiB
JSON

{
"type": "Script",
"span": {
"start": 1,
"end": 180,
"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": "VariableDeclaration",
"span": {
"start": 38,
"end": 53,
"ctxt": 0
},
"kind": "let",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 42,
"end": 52,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 42,
"end": 43,
"ctxt": 0
},
"value": "b",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 43,
"end": 52,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 45,
"end": 52,
"ctxt": 0
},
"kind": "boolean"
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "ExpressionStatement",
"span": {
"start": 54,
"end": 65,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 54,
"end": 64,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "Identifier",
"span": {
"start": 54,
"end": 55,
"ctxt": 0
},
"value": "b",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "BinaryExpression",
"span": {
"start": 58,
"end": 64,
"ctxt": 0
},
"operator": "==",
"left": {
"type": "Identifier",
"span": {
"start": 58,
"end": 59,
"ctxt": 0
},
"value": "x",
"optional": false
},
"right": {
"type": "Identifier",
"span": {
"start": 63,
"end": 64,
"ctxt": 0
},
"value": "y",
"optional": false
}
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 66,
"end": 80,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 66,
"end": 80,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "Identifier",
"span": {
"start": 66,
"end": 67,
"ctxt": 0
},
"value": "b",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "BinaryExpression",
"span": {
"start": 70,
"end": 80,
"ctxt": 0
},
"operator": "==",
"left": {
"type": "StringLiteral",
"span": {
"start": 70,
"end": 75,
"ctxt": 0
},
"value": "foo",
"raw": "\"foo\""
},
"right": {
"type": "Identifier",
"span": {
"start": 79,
"end": 80,
"ctxt": 0
},
"value": "y",
"optional": false
}
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 81,
"end": 96,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 81,
"end": 95,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "Identifier",
"span": {
"start": 81,
"end": 82,
"ctxt": 0
},
"value": "b",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "BinaryExpression",
"span": {
"start": 85,
"end": 95,
"ctxt": 0
},
"operator": "==",
"left": {
"type": "Identifier",
"span": {
"start": 85,
"end": 86,
"ctxt": 0
},
"value": "y",
"optional": false
},
"right": {
"type": "StringLiteral",
"span": {
"start": 90,
"end": 95,
"ctxt": 0
},
"value": "foo",
"raw": "\"foo\""
}
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 97,
"end": 116,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 97,
"end": 115,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "Identifier",
"span": {
"start": 97,
"end": 98,
"ctxt": 0
},
"value": "b",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "BinaryExpression",
"span": {
"start": 101,
"end": 115,
"ctxt": 0
},
"operator": "==",
"left": {
"type": "StringLiteral",
"span": {
"start": 101,
"end": 106,
"ctxt": 0
},
"value": "foo",
"raw": "\"foo\""
},
"right": {
"type": "StringLiteral",
"span": {
"start": 110,
"end": 115,
"ctxt": 0
},
"value": "bar",
"raw": "\"bar\""
}
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 118,
"end": 129,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 118,
"end": 128,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "Identifier",
"span": {
"start": 118,
"end": 119,
"ctxt": 0
},
"value": "b",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "BinaryExpression",
"span": {
"start": 122,
"end": 128,
"ctxt": 0
},
"operator": "!=",
"left": {
"type": "Identifier",
"span": {
"start": 122,
"end": 123,
"ctxt": 0
},
"value": "x",
"optional": false
},
"right": {
"type": "Identifier",
"span": {
"start": 127,
"end": 128,
"ctxt": 0
},
"value": "y",
"optional": false
}
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 130,
"end": 144,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 130,
"end": 144,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "Identifier",
"span": {
"start": 130,
"end": 131,
"ctxt": 0
},
"value": "b",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "BinaryExpression",
"span": {
"start": 134,
"end": 144,
"ctxt": 0
},
"operator": "!=",
"left": {
"type": "StringLiteral",
"span": {
"start": 134,
"end": 139,
"ctxt": 0
},
"value": "foo",
"raw": "\"foo\""
},
"right": {
"type": "Identifier",
"span": {
"start": 143,
"end": 144,
"ctxt": 0
},
"value": "y",
"optional": false
}
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 145,
"end": 160,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 145,
"end": 159,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "Identifier",
"span": {
"start": 145,
"end": 146,
"ctxt": 0
},
"value": "b",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "BinaryExpression",
"span": {
"start": 149,
"end": 159,
"ctxt": 0
},
"operator": "!=",
"left": {
"type": "Identifier",
"span": {
"start": 149,
"end": 150,
"ctxt": 0
},
"value": "y",
"optional": false
},
"right": {
"type": "StringLiteral",
"span": {
"start": 154,
"end": 159,
"ctxt": 0
},
"value": "foo",
"raw": "\"foo\""
}
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 161,
"end": 180,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 161,
"end": 179,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "Identifier",
"span": {
"start": 161,
"end": 162,
"ctxt": 0
},
"value": "b",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "BinaryExpression",
"span": {
"start": 165,
"end": 179,
"ctxt": 0
},
"operator": "!=",
"left": {
"type": "StringLiteral",
"span": {
"start": 165,
"end": 170,
"ctxt": 0
},
"value": "foo",
"raw": "\"foo\""
},
"right": {
"type": "StringLiteral",
"span": {
"start": 174,
"end": 179,
"ctxt": 0
},
"value": "bar",
"raw": "\"bar\""
}
}
}
}
],
"interpreter": null
}