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

1117 lines
24 KiB
JSON
Raw Normal View History

{
"type": "Script",
"span": {
"start": 0,
2022-02-04 14:17:42 +03:00
"end": 323,
"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": 65,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
2022-02-04 14:17:42 +03:00
"start": 53,
"end": 64,
"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": 64,
"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": 63,
"end": 64,
"ctxt": 0
},
"value": "y",
"optional": false
}
}
}
},
{
"type": "ExpressionStatement",
"span": {
2022-02-04 14:17:42 +03:00
"start": 66,
"end": 81,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
2022-02-04 14:17:42 +03:00
"start": 66,
"end": 81,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "Identifier",
"span": {
2022-02-04 14:17:42 +03:00
"start": 66,
"end": 67,
"ctxt": 0
},
"value": "b",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "BinaryExpression",
"span": {
2022-02-04 14:17:42 +03:00
"start": 70,
"end": 81,
"ctxt": 0
},
"operator": "===",
"left": {
"type": "StringLiteral",
"span": {
2022-02-04 14:17:42 +03:00
"start": 70,
"end": 75,
"ctxt": 0
},
"value": "foo",
"raw": "\"foo\""
},
"right": {
"type": "Identifier",
"span": {
2022-02-04 14:17:42 +03:00
"start": 80,
"end": 81,
"ctxt": 0
},
"value": "y",
"optional": false
}
}
}
},
{
"type": "ExpressionStatement",
"span": {
2022-02-04 14:17:42 +03:00
"start": 82,
"end": 98,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
2022-02-04 14:17:42 +03:00
"start": 82,
"end": 97,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "Identifier",
"span": {
2022-02-04 14:17:42 +03:00
"start": 82,
"end": 83,
"ctxt": 0
},
"value": "b",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "BinaryExpression",
"span": {
2022-02-04 14:17:42 +03:00
"start": 86,
"end": 97,
"ctxt": 0
},
"operator": "===",
"left": {
"type": "Identifier",
"span": {
2022-02-04 14:17:42 +03:00
"start": 86,
"end": 87,
"ctxt": 0
},
"value": "y",
"optional": false
},
"right": {
"type": "StringLiteral",
"span": {
2022-02-04 14:17:42 +03:00
"start": 92,
"end": 97,
"ctxt": 0
},
"value": "foo",
"raw": "\"foo\""
}
}
}
},
{
"type": "ExpressionStatement",
"span": {
2022-02-04 14:17:42 +03:00
"start": 99,
"end": 119,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
2022-02-04 14:17:42 +03:00
"start": 99,
"end": 118,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "Identifier",
"span": {
2022-02-04 14:17:42 +03:00
"start": 99,
"end": 100,
"ctxt": 0
},
"value": "b",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "BinaryExpression",
"span": {
2022-02-04 14:17:42 +03:00
"start": 103,
"end": 118,
"ctxt": 0
},
"operator": "===",
"left": {
"type": "StringLiteral",
"span": {
2022-02-04 14:17:42 +03:00
"start": 103,
"end": 108,
"ctxt": 0
},
"value": "foo",
"raw": "\"foo\""
},
"right": {
"type": "StringLiteral",
"span": {
2022-02-04 14:17:42 +03:00
"start": 113,
"end": 118,
"ctxt": 0
},
"value": "bar",
"raw": "\"bar\""
}
}
}
},
{
"type": "ExpressionStatement",
"span": {
2022-02-04 14:17:42 +03:00
"start": 120,
"end": 136,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
2022-02-04 14:17:42 +03:00
"start": 120,
"end": 135,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "Identifier",
"span": {
2022-02-04 14:17:42 +03:00
"start": 120,
"end": 121,
"ctxt": 0
},
"value": "b",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "BinaryExpression",
"span": {
2022-02-04 14:17:42 +03:00
"start": 124,
"end": 135,
"ctxt": 0
},
"operator": "===",
"left": {
"type": "StringLiteral",
"span": {
2022-02-04 14:17:42 +03:00
"start": 124,
"end": 129,
"ctxt": 0
},
"value": "bar",
"raw": "\"bar\""
},
"right": {
"type": "Identifier",
"span": {
2022-02-04 14:17:42 +03:00
"start": 134,
"end": 135,
"ctxt": 0
},
"value": "x",
"optional": false
}
}
}
},
{
"type": "ExpressionStatement",
"span": {
2022-02-04 14:17:42 +03:00
"start": 137,
"end": 153,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
2022-02-04 14:17:42 +03:00
"start": 137,
"end": 152,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "Identifier",
"span": {
2022-02-04 14:17:42 +03:00
"start": 137,
"end": 138,
"ctxt": 0
},
"value": "b",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "BinaryExpression",
"span": {
2022-02-04 14:17:42 +03:00
"start": 141,
"end": 152,
"ctxt": 0
},
"operator": "===",
"left": {
"type": "Identifier",
"span": {
2022-02-04 14:17:42 +03:00
"start": 141,
"end": 142,
"ctxt": 0
},
"value": "x",
"optional": false
},
"right": {
"type": "StringLiteral",
"span": {
2022-02-04 14:17:42 +03:00
"start": 147,
"end": 152,
"ctxt": 0
},
"value": "bar",
"raw": "\"bar\""
}
}
}
},
{
"type": "ExpressionStatement",
"span": {
2022-02-04 14:17:42 +03:00
"start": 154,
"end": 170,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
2022-02-04 14:17:42 +03:00
"start": 154,
"end": 169,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "Identifier",
"span": {
2022-02-04 14:17:42 +03:00
"start": 154,
"end": 155,
"ctxt": 0
},
"value": "b",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "BinaryExpression",
"span": {
2022-02-04 14:17:42 +03:00
"start": 158,
"end": 169,
"ctxt": 0
},
"operator": "===",
"left": {
"type": "Identifier",
"span": {
2022-02-04 14:17:42 +03:00
"start": 158,
"end": 159,
"ctxt": 0
},
"value": "y",
"optional": false
},
"right": {
"type": "StringLiteral",
"span": {
2022-02-04 14:17:42 +03:00
"start": 164,
"end": 169,
"ctxt": 0
},
"value": "bar",
"raw": "\"bar\""
}
}
}
},
{
"type": "ExpressionStatement",
"span": {
2022-02-04 14:17:42 +03:00
"start": 171,
"end": 187,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
2022-02-04 14:17:42 +03:00
"start": 171,
"end": 186,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "Identifier",
"span": {
2022-02-04 14:17:42 +03:00
"start": 171,
"end": 172,
"ctxt": 0
},
"value": "b",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "BinaryExpression",
"span": {
2022-02-04 14:17:42 +03:00
"start": 175,
"end": 186,
"ctxt": 0
},
"operator": "===",
"left": {
"type": "StringLiteral",
"span": {
2022-02-04 14:17:42 +03:00
"start": 175,
"end": 180,
"ctxt": 0
},
"value": "bar",
"raw": "\"bar\""
},
"right": {
"type": "Identifier",
"span": {
2022-02-04 14:17:42 +03:00
"start": 185,
"end": 186,
"ctxt": 0
},
"value": "y",
"optional": false
}
}
}
},
{
"type": "ExpressionStatement",
"span": {
2022-02-04 14:17:42 +03:00
"start": 189,
"end": 201,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
2022-02-04 14:17:42 +03:00
"start": 189,
"end": 200,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "Identifier",
"span": {
2022-02-04 14:17:42 +03:00
"start": 189,
"end": 190,
"ctxt": 0
},
"value": "b",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "BinaryExpression",
"span": {
2022-02-04 14:17:42 +03:00
"start": 193,
"end": 200,
"ctxt": 0
},
"operator": "!==",
"left": {
"type": "Identifier",
"span": {
2022-02-04 14:17:42 +03:00
"start": 193,
"end": 194,
"ctxt": 0
},
"value": "x",
"optional": false
},
"right": {
"type": "Identifier",
"span": {
2022-02-04 14:17:42 +03:00
"start": 199,
"end": 200,
"ctxt": 0
},
"value": "y",
"optional": false
}
}
}
},
{
"type": "ExpressionStatement",
"span": {
2022-02-04 14:17:42 +03:00
"start": 202,
"end": 217,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
2022-02-04 14:17:42 +03:00
"start": 202,
"end": 217,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "Identifier",
"span": {
2022-02-04 14:17:42 +03:00
"start": 202,
"end": 203,
"ctxt": 0
},
"value": "b",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "BinaryExpression",
"span": {
2022-02-04 14:17:42 +03:00
"start": 206,
"end": 217,
"ctxt": 0
},
"operator": "!==",
"left": {
"type": "StringLiteral",
"span": {
2022-02-04 14:17:42 +03:00
"start": 206,
"end": 211,
"ctxt": 0
},
"value": "foo",
"raw": "\"foo\""
},
"right": {
"type": "Identifier",
"span": {
2022-02-04 14:17:42 +03:00
"start": 216,
"end": 217,
"ctxt": 0
},
"value": "y",
"optional": false
}
}
}
},
{
"type": "ExpressionStatement",
"span": {
2022-02-04 14:17:42 +03:00
"start": 218,
"end": 234,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
2022-02-04 14:17:42 +03:00
"start": 218,
"end": 233,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "Identifier",
"span": {
2022-02-04 14:17:42 +03:00
"start": 218,
"end": 219,
"ctxt": 0
},
"value": "b",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "BinaryExpression",
"span": {
2022-02-04 14:17:42 +03:00
"start": 222,
"end": 233,
"ctxt": 0
},
"operator": "!==",
"left": {
"type": "Identifier",
"span": {
2022-02-04 14:17:42 +03:00
"start": 222,
"end": 223,
"ctxt": 0
},
"value": "y",
"optional": false
},
"right": {
"type": "StringLiteral",
"span": {
2022-02-04 14:17:42 +03:00
"start": 228,
"end": 233,
"ctxt": 0
},
"value": "foo",
"raw": "\"foo\""
}
}
}
},
{
"type": "ExpressionStatement",
"span": {
2022-02-04 14:17:42 +03:00
"start": 235,
"end": 255,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
2022-02-04 14:17:42 +03:00
"start": 235,
"end": 254,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "Identifier",
"span": {
2022-02-04 14:17:42 +03:00
"start": 235,
"end": 236,
"ctxt": 0
},
"value": "b",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "BinaryExpression",
"span": {
2022-02-04 14:17:42 +03:00
"start": 239,
"end": 254,
"ctxt": 0
},
"operator": "!==",
"left": {
"type": "StringLiteral",
"span": {
2022-02-04 14:17:42 +03:00
"start": 239,
"end": 244,
"ctxt": 0
},
"value": "foo",
"raw": "\"foo\""
},
"right": {
"type": "StringLiteral",
"span": {
2022-02-04 14:17:42 +03:00
"start": 249,
"end": 254,
"ctxt": 0
},
"value": "bar",
"raw": "\"bar\""
}
}
}
},
{
"type": "ExpressionStatement",
"span": {
2022-02-04 14:17:42 +03:00
"start": 256,
"end": 272,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
2022-02-04 14:17:42 +03:00
"start": 256,
"end": 271,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "Identifier",
"span": {
2022-02-04 14:17:42 +03:00
"start": 256,
"end": 257,
"ctxt": 0
},
"value": "b",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "BinaryExpression",
"span": {
2022-02-04 14:17:42 +03:00
"start": 260,
"end": 271,
"ctxt": 0
},
"operator": "!==",
"left": {
"type": "StringLiteral",
"span": {
2022-02-04 14:17:42 +03:00
"start": 260,
"end": 265,
"ctxt": 0
},
"value": "bar",
"raw": "\"bar\""
},
"right": {
"type": "Identifier",
"span": {
2022-02-04 14:17:42 +03:00
"start": 270,
"end": 271,
"ctxt": 0
},
"value": "x",
"optional": false
}
}
}
},
{
"type": "ExpressionStatement",
"span": {
2022-02-04 14:17:42 +03:00
"start": 273,
"end": 289,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
2022-02-04 14:17:42 +03:00
"start": 273,
"end": 288,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "Identifier",
"span": {
2022-02-04 14:17:42 +03:00
"start": 273,
"end": 274,
"ctxt": 0
},
"value": "b",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "BinaryExpression",
"span": {
2022-02-04 14:17:42 +03:00
"start": 277,
"end": 288,
"ctxt": 0
},
"operator": "!==",
"left": {
"type": "Identifier",
"span": {
2022-02-04 14:17:42 +03:00
"start": 277,
"end": 278,
"ctxt": 0
},
"value": "x",
"optional": false
},
"right": {
"type": "StringLiteral",
"span": {
2022-02-04 14:17:42 +03:00
"start": 283,
"end": 288,
"ctxt": 0
},
"value": "bar",
"raw": "\"bar\""
}
}
}
},
{
"type": "ExpressionStatement",
"span": {
2022-02-04 14:17:42 +03:00
"start": 290,
"end": 306,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
2022-02-04 14:17:42 +03:00
"start": 290,
"end": 305,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "Identifier",
"span": {
2022-02-04 14:17:42 +03:00
"start": 290,
"end": 291,
"ctxt": 0
},
"value": "b",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "BinaryExpression",
"span": {
2022-02-04 14:17:42 +03:00
"start": 294,
"end": 305,
"ctxt": 0
},
"operator": "!==",
"left": {
"type": "Identifier",
"span": {
2022-02-04 14:17:42 +03:00
"start": 294,
"end": 295,
"ctxt": 0
},
"value": "y",
"optional": false
},
"right": {
"type": "StringLiteral",
"span": {
2022-02-04 14:17:42 +03:00
"start": 300,
"end": 305,
"ctxt": 0
},
"value": "bar",
"raw": "\"bar\""
}
}
}
},
{
"type": "ExpressionStatement",
"span": {
2022-02-04 14:17:42 +03:00
"start": 307,
"end": 323,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
2022-02-04 14:17:42 +03:00
"start": 307,
"end": 322,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "Identifier",
"span": {
2022-02-04 14:17:42 +03:00
"start": 307,
"end": 308,
"ctxt": 0
},
"value": "b",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "BinaryExpression",
"span": {
2022-02-04 14:17:42 +03:00
"start": 311,
"end": 322,
"ctxt": 0
},
"operator": "!==",
"left": {
"type": "StringLiteral",
"span": {
2022-02-04 14:17:42 +03:00
"start": 311,
"end": 316,
"ctxt": 0
},
"value": "bar",
"raw": "\"bar\""
},
"right": {
"type": "Identifier",
"span": {
2022-02-04 14:17:42 +03:00
"start": 321,
"end": 322,
"ctxt": 0
},
"value": "y",
"optional": false
}
}
}
}
],
"interpreter": null
}