swc/crates/swc_ecma_parser/tests/tsc/stringLiteralsWithEqualityChecks02.json
2022-03-22 07:54:08 +00:00

1117 lines
24 KiB
JSON

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