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

1117 lines
24 KiB
JSON
Raw Normal View History

{
"type": "Script",
"span": {
"start": 0,
2022-02-04 14:17:42 +03:00
"end": 307,
"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": "VariableDeclaration",
"span": {
2022-02-04 14:17:42 +03:00
"start": 37,
"end": 52,
"ctxt": 0
},
"kind": "let",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
2022-02-04 14:17:42 +03:00
"start": 41,
"end": 51,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
2022-02-04 14:17:42 +03:00
"start": 41,
"end": 42,
"ctxt": 0
},
"value": "b",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
2022-02-04 14:17:42 +03:00
"start": 42,
"end": 51,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
2022-02-04 14:17:42 +03:00
"start": 44,
"end": 51,
"ctxt": 0
},
"kind": "boolean"
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "ExpressionStatement",
"span": {
2022-02-04 14:17:42 +03:00
"start": 53,
"end": 64,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
2022-02-04 14:17:42 +03:00
"start": 53,
"end": 63,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "Identifier",
"span": {
2022-02-04 14:17:42 +03:00
"start": 53,
"end": 54,
"ctxt": 0
},
"value": "b",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "BinaryExpression",
"span": {
2022-02-04 14:17:42 +03:00
"start": 57,
"end": 63,
"ctxt": 0
},
"operator": "==",
"left": {
"type": "Identifier",
"span": {
2022-02-04 14:17:42 +03:00
"start": 57,
"end": 58,
"ctxt": 0
},
"value": "x",
"optional": false
},
"right": {
"type": "Identifier",
"span": {
2022-02-04 14:17:42 +03:00
"start": 62,
"end": 63,
"ctxt": 0
},
"value": "y",
"optional": false
}
}
}
},
{
"type": "ExpressionStatement",
"span": {
2022-02-04 14:17:42 +03:00
"start": 65,
"end": 79,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
2022-02-04 14:17:42 +03:00
"start": 65,
"end": 79,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "Identifier",
"span": {
2022-02-04 14:17:42 +03:00
"start": 65,
"end": 66,
"ctxt": 0
},
"value": "b",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "BinaryExpression",
"span": {
2022-02-04 14:17:42 +03:00
"start": 69,
"end": 79,
"ctxt": 0
},
"operator": "==",
"left": {
"type": "StringLiteral",
"span": {
2022-02-04 14:17:42 +03:00
"start": 69,
"end": 74,
"ctxt": 0
},
"value": "foo",
"raw": "\"foo\""
},
"right": {
"type": "Identifier",
"span": {
2022-02-04 14:17:42 +03:00
"start": 78,
"end": 79,
"ctxt": 0
},
"value": "y",
"optional": false
}
}
}
},
{
"type": "ExpressionStatement",
"span": {
2022-02-04 14:17:42 +03:00
"start": 80,
"end": 95,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
2022-02-04 14:17:42 +03:00
"start": 80,
"end": 94,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "Identifier",
"span": {
2022-02-04 14:17:42 +03:00
"start": 80,
"end": 81,
"ctxt": 0
},
"value": "b",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "BinaryExpression",
"span": {
2022-02-04 14:17:42 +03:00
"start": 84,
"end": 94,
"ctxt": 0
},
"operator": "==",
"left": {
"type": "Identifier",
"span": {
2022-02-04 14:17:42 +03:00
"start": 84,
"end": 85,
"ctxt": 0
},
"value": "y",
"optional": false
},
"right": {
"type": "StringLiteral",
"span": {
2022-02-04 14:17:42 +03:00
"start": 89,
"end": 94,
"ctxt": 0
},
"value": "foo",
"raw": "\"foo\""
}
}
}
},
{
"type": "ExpressionStatement",
"span": {
2022-02-04 14:17:42 +03:00
"start": 96,
"end": 115,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
2022-02-04 14:17:42 +03:00
"start": 96,
"end": 114,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "Identifier",
"span": {
2022-02-04 14:17:42 +03:00
"start": 96,
"end": 97,
"ctxt": 0
},
"value": "b",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "BinaryExpression",
"span": {
2022-02-04 14:17:42 +03:00
"start": 100,
"end": 114,
"ctxt": 0
},
"operator": "==",
"left": {
"type": "StringLiteral",
"span": {
2022-02-04 14:17:42 +03:00
"start": 100,
"end": 105,
"ctxt": 0
},
"value": "foo",
"raw": "\"foo\""
},
"right": {
"type": "StringLiteral",
"span": {
2022-02-04 14:17:42 +03:00
"start": 109,
"end": 114,
"ctxt": 0
},
"value": "bar",
"raw": "\"bar\""
}
}
}
},
{
"type": "ExpressionStatement",
"span": {
2022-02-04 14:17:42 +03:00
"start": 116,
"end": 131,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
2022-02-04 14:17:42 +03:00
"start": 116,
"end": 130,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "Identifier",
"span": {
2022-02-04 14:17:42 +03:00
"start": 116,
"end": 117,
"ctxt": 0
},
"value": "b",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "BinaryExpression",
"span": {
2022-02-04 14:17:42 +03:00
"start": 120,
"end": 130,
"ctxt": 0
},
"operator": "==",
"left": {
"type": "StringLiteral",
"span": {
2022-02-04 14:17:42 +03:00
"start": 120,
"end": 125,
"ctxt": 0
},
"value": "bar",
"raw": "\"bar\""
},
"right": {
"type": "Identifier",
"span": {
2022-02-04 14:17:42 +03:00
"start": 129,
"end": 130,
"ctxt": 0
},
"value": "x",
"optional": false
}
}
}
},
{
"type": "ExpressionStatement",
"span": {
2022-02-04 14:17:42 +03:00
"start": 132,
"end": 147,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
2022-02-04 14:17:42 +03:00
"start": 132,
"end": 146,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "Identifier",
"span": {
2022-02-04 14:17:42 +03:00
"start": 132,
"end": 133,
"ctxt": 0
},
"value": "b",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "BinaryExpression",
"span": {
2022-02-04 14:17:42 +03:00
"start": 136,
"end": 146,
"ctxt": 0
},
"operator": "==",
"left": {
"type": "Identifier",
"span": {
2022-02-04 14:17:42 +03:00
"start": 136,
"end": 137,
"ctxt": 0
},
"value": "x",
"optional": false
},
"right": {
"type": "StringLiteral",
"span": {
2022-02-04 14:17:42 +03:00
"start": 141,
"end": 146,
"ctxt": 0
},
"value": "bar",
"raw": "\"bar\""
}
}
}
},
{
"type": "ExpressionStatement",
"span": {
2022-02-04 14:17:42 +03:00
"start": 148,
"end": 163,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
2022-02-04 14:17:42 +03:00
"start": 148,
"end": 162,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "Identifier",
"span": {
2022-02-04 14:17:42 +03:00
"start": 148,
"end": 149,
"ctxt": 0
},
"value": "b",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "BinaryExpression",
"span": {
2022-02-04 14:17:42 +03:00
"start": 152,
"end": 162,
"ctxt": 0
},
"operator": "==",
"left": {
"type": "Identifier",
"span": {
2022-02-04 14:17:42 +03:00
"start": 152,
"end": 153,
"ctxt": 0
},
"value": "y",
"optional": false
},
"right": {
"type": "StringLiteral",
"span": {
2022-02-04 14:17:42 +03:00
"start": 157,
"end": 162,
"ctxt": 0
},
"value": "bar",
"raw": "\"bar\""
}
}
}
},
{
"type": "ExpressionStatement",
"span": {
2022-02-04 14:17:42 +03:00
"start": 164,
"end": 179,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
2022-02-04 14:17:42 +03:00
"start": 164,
"end": 178,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "Identifier",
"span": {
2022-02-04 14:17:42 +03:00
"start": 164,
"end": 165,
"ctxt": 0
},
"value": "b",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "BinaryExpression",
"span": {
2022-02-04 14:17:42 +03:00
"start": 168,
"end": 178,
"ctxt": 0
},
"operator": "==",
"left": {
"type": "StringLiteral",
"span": {
2022-02-04 14:17:42 +03:00
"start": 168,
"end": 173,
"ctxt": 0
},
"value": "bar",
"raw": "\"bar\""
},
"right": {
"type": "Identifier",
"span": {
2022-02-04 14:17:42 +03:00
"start": 177,
"end": 178,
"ctxt": 0
},
"value": "y",
"optional": false
}
}
}
},
{
"type": "ExpressionStatement",
"span": {
2022-02-04 14:17:42 +03:00
"start": 181,
"end": 192,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
2022-02-04 14:17:42 +03:00
"start": 181,
"end": 191,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "Identifier",
"span": {
2022-02-04 14:17:42 +03:00
"start": 181,
"end": 182,
"ctxt": 0
},
"value": "b",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "BinaryExpression",
"span": {
2022-02-04 14:17:42 +03:00
"start": 185,
"end": 191,
"ctxt": 0
},
"operator": "!=",
"left": {
"type": "Identifier",
"span": {
2022-02-04 14:17:42 +03:00
"start": 185,
"end": 186,
"ctxt": 0
},
"value": "x",
"optional": false
},
"right": {
"type": "Identifier",
"span": {
2022-02-04 14:17:42 +03:00
"start": 190,
"end": 191,
"ctxt": 0
},
"value": "y",
"optional": false
}
}
}
},
{
"type": "ExpressionStatement",
"span": {
2022-02-04 14:17:42 +03:00
"start": 193,
"end": 207,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
2022-02-04 14:17:42 +03:00
"start": 193,
"end": 207,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "Identifier",
"span": {
2022-02-04 14:17:42 +03:00
"start": 193,
"end": 194,
"ctxt": 0
},
"value": "b",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "BinaryExpression",
"span": {
2022-02-04 14:17:42 +03:00
"start": 197,
"end": 207,
"ctxt": 0
},
"operator": "!=",
"left": {
"type": "StringLiteral",
"span": {
2022-02-04 14:17:42 +03:00
"start": 197,
"end": 202,
"ctxt": 0
},
"value": "foo",
"raw": "\"foo\""
},
"right": {
"type": "Identifier",
"span": {
2022-02-04 14:17:42 +03:00
"start": 206,
"end": 207,
"ctxt": 0
},
"value": "y",
"optional": false
}
}
}
},
{
"type": "ExpressionStatement",
"span": {
2022-02-04 14:17:42 +03:00
"start": 208,
"end": 223,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
2022-02-04 14:17:42 +03:00
"start": 208,
"end": 222,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "Identifier",
"span": {
2022-02-04 14:17:42 +03:00
"start": 208,
"end": 209,
"ctxt": 0
},
"value": "b",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "BinaryExpression",
"span": {
2022-02-04 14:17:42 +03:00
"start": 212,
"end": 222,
"ctxt": 0
},
"operator": "!=",
"left": {
"type": "Identifier",
"span": {
2022-02-04 14:17:42 +03:00
"start": 212,
"end": 213,
"ctxt": 0
},
"value": "y",
"optional": false
},
"right": {
"type": "StringLiteral",
"span": {
2022-02-04 14:17:42 +03:00
"start": 217,
"end": 222,
"ctxt": 0
},
"value": "foo",
"raw": "\"foo\""
}
}
}
},
{
"type": "ExpressionStatement",
"span": {
2022-02-04 14:17:42 +03:00
"start": 224,
"end": 243,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
2022-02-04 14:17:42 +03:00
"start": 224,
"end": 242,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "Identifier",
"span": {
2022-02-04 14:17:42 +03:00
"start": 224,
"end": 225,
"ctxt": 0
},
"value": "b",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "BinaryExpression",
"span": {
2022-02-04 14:17:42 +03:00
"start": 228,
"end": 242,
"ctxt": 0
},
"operator": "!=",
"left": {
"type": "StringLiteral",
"span": {
2022-02-04 14:17:42 +03:00
"start": 228,
"end": 233,
"ctxt": 0
},
"value": "foo",
"raw": "\"foo\""
},
"right": {
"type": "StringLiteral",
"span": {
2022-02-04 14:17:42 +03:00
"start": 237,
"end": 242,
"ctxt": 0
},
"value": "bar",
"raw": "\"bar\""
}
}
}
},
{
"type": "ExpressionStatement",
"span": {
2022-02-04 14:17:42 +03:00
"start": 244,
"end": 259,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
2022-02-04 14:17:42 +03:00
"start": 244,
"end": 258,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "Identifier",
"span": {
2022-02-04 14:17:42 +03:00
"start": 244,
"end": 245,
"ctxt": 0
},
"value": "b",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "BinaryExpression",
"span": {
2022-02-04 14:17:42 +03:00
"start": 248,
"end": 258,
"ctxt": 0
},
"operator": "!=",
"left": {
"type": "StringLiteral",
"span": {
2022-02-04 14:17:42 +03:00
"start": 248,
"end": 253,
"ctxt": 0
},
"value": "bar",
"raw": "\"bar\""
},
"right": {
"type": "Identifier",
"span": {
2022-02-04 14:17:42 +03:00
"start": 257,
"end": 258,
"ctxt": 0
},
"value": "x",
"optional": false
}
}
}
},
{
"type": "ExpressionStatement",
"span": {
2022-02-04 14:17:42 +03:00
"start": 260,
"end": 275,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
2022-02-04 14:17:42 +03:00
"start": 260,
"end": 274,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "Identifier",
"span": {
2022-02-04 14:17:42 +03:00
"start": 260,
"end": 261,
"ctxt": 0
},
"value": "b",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "BinaryExpression",
"span": {
2022-02-04 14:17:42 +03:00
"start": 264,
"end": 274,
"ctxt": 0
},
"operator": "!=",
"left": {
"type": "Identifier",
"span": {
2022-02-04 14:17:42 +03:00
"start": 264,
"end": 265,
"ctxt": 0
},
"value": "x",
"optional": false
},
"right": {
"type": "StringLiteral",
"span": {
2022-02-04 14:17:42 +03:00
"start": 269,
"end": 274,
"ctxt": 0
},
"value": "bar",
"raw": "\"bar\""
}
}
}
},
{
"type": "ExpressionStatement",
"span": {
2022-02-04 14:17:42 +03:00
"start": 276,
"end": 291,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
2022-02-04 14:17:42 +03:00
"start": 276,
"end": 290,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "Identifier",
"span": {
2022-02-04 14:17:42 +03:00
"start": 276,
"end": 277,
"ctxt": 0
},
"value": "b",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "BinaryExpression",
"span": {
2022-02-04 14:17:42 +03:00
"start": 280,
"end": 290,
"ctxt": 0
},
"operator": "!=",
"left": {
"type": "Identifier",
"span": {
2022-02-04 14:17:42 +03:00
"start": 280,
"end": 281,
"ctxt": 0
},
"value": "y",
"optional": false
},
"right": {
"type": "StringLiteral",
"span": {
2022-02-04 14:17:42 +03:00
"start": 285,
"end": 290,
"ctxt": 0
},
"value": "bar",
"raw": "\"bar\""
}
}
}
},
{
"type": "ExpressionStatement",
"span": {
2022-02-04 14:17:42 +03:00
"start": 292,
"end": 307,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
2022-02-04 14:17:42 +03:00
"start": 292,
"end": 306,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "Identifier",
"span": {
2022-02-04 14:17:42 +03:00
"start": 292,
"end": 293,
"ctxt": 0
},
"value": "b",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "BinaryExpression",
"span": {
2022-02-04 14:17:42 +03:00
"start": 296,
"end": 306,
"ctxt": 0
},
"operator": "!=",
"left": {
"type": "StringLiteral",
"span": {
2022-02-04 14:17:42 +03:00
"start": 296,
"end": 301,
"ctxt": 0
},
"value": "bar",
"raw": "\"bar\""
},
"right": {
"type": "Identifier",
"span": {
2022-02-04 14:17:42 +03:00
"start": 305,
"end": 306,
"ctxt": 0
},
"value": "y",
"optional": false
}
}
}
}
],
"interpreter": null
}