swc/crates/swc_ecma_parser/tests/tsc/stringLiteralsWithEqualityChecks01.json
2022-02-04 17:08:38 +09:00

1193 lines
26 KiB
JSON

{
"type": "Script",
"span": {
"start": 0,
"end": 343,
"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",
"hasEscape": false,
"kind": {
"type": "normal",
"containsQuote": true
}
}
}
}
},
"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",
"hasEscape": false,
"kind": {
"type": "normal",
"containsQuote": true
}
}
},
{
"type": "TsLiteralType",
"span": {
"start": 30,
"end": 35,
"ctxt": 0
},
"literal": {
"type": "StringLiteral",
"span": {
"start": 30,
"end": 35,
"ctxt": 0
},
"value": "bar",
"hasEscape": false,
"kind": {
"type": "normal",
"containsQuote": true
}
}
}
]
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 40,
"end": 55,
"ctxt": 0
},
"kind": "let",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 44,
"end": 54,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 44,
"end": 45,
"ctxt": 0
},
"value": "b",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 45,
"end": 54,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 47,
"end": 54,
"ctxt": 0
},
"kind": "boolean"
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "ExpressionStatement",
"span": {
"start": 57,
"end": 69,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 57,
"end": 68,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "Identifier",
"span": {
"start": 57,
"end": 58,
"ctxt": 0
},
"value": "b",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "BinaryExpression",
"span": {
"start": 61,
"end": 68,
"ctxt": 0
},
"operator": "===",
"left": {
"type": "Identifier",
"span": {
"start": 61,
"end": 62,
"ctxt": 0
},
"value": "x",
"optional": false
},
"right": {
"type": "Identifier",
"span": {
"start": 67,
"end": 68,
"ctxt": 0
},
"value": "y",
"optional": false
}
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 71,
"end": 86,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 71,
"end": 86,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "Identifier",
"span": {
"start": 71,
"end": 72,
"ctxt": 0
},
"value": "b",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "BinaryExpression",
"span": {
"start": 75,
"end": 86,
"ctxt": 0
},
"operator": "===",
"left": {
"type": "StringLiteral",
"span": {
"start": 75,
"end": 80,
"ctxt": 0
},
"value": "foo",
"hasEscape": false,
"kind": {
"type": "normal",
"containsQuote": true
}
},
"right": {
"type": "Identifier",
"span": {
"start": 85,
"end": 86,
"ctxt": 0
},
"value": "y",
"optional": false
}
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 88,
"end": 104,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 88,
"end": 103,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "Identifier",
"span": {
"start": 88,
"end": 89,
"ctxt": 0
},
"value": "b",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "BinaryExpression",
"span": {
"start": 92,
"end": 103,
"ctxt": 0
},
"operator": "===",
"left": {
"type": "Identifier",
"span": {
"start": 92,
"end": 93,
"ctxt": 0
},
"value": "y",
"optional": false
},
"right": {
"type": "StringLiteral",
"span": {
"start": 98,
"end": 103,
"ctxt": 0
},
"value": "foo",
"hasEscape": false,
"kind": {
"type": "normal",
"containsQuote": true
}
}
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 106,
"end": 126,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 106,
"end": 125,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "Identifier",
"span": {
"start": 106,
"end": 107,
"ctxt": 0
},
"value": "b",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "BinaryExpression",
"span": {
"start": 110,
"end": 125,
"ctxt": 0
},
"operator": "===",
"left": {
"type": "StringLiteral",
"span": {
"start": 110,
"end": 115,
"ctxt": 0
},
"value": "foo",
"hasEscape": false,
"kind": {
"type": "normal",
"containsQuote": true
}
},
"right": {
"type": "StringLiteral",
"span": {
"start": 120,
"end": 125,
"ctxt": 0
},
"value": "bar",
"hasEscape": false,
"kind": {
"type": "normal",
"containsQuote": true
}
}
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 128,
"end": 144,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 128,
"end": 143,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "Identifier",
"span": {
"start": 128,
"end": 129,
"ctxt": 0
},
"value": "b",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "BinaryExpression",
"span": {
"start": 132,
"end": 143,
"ctxt": 0
},
"operator": "===",
"left": {
"type": "StringLiteral",
"span": {
"start": 132,
"end": 137,
"ctxt": 0
},
"value": "bar",
"hasEscape": false,
"kind": {
"type": "normal",
"containsQuote": true
}
},
"right": {
"type": "Identifier",
"span": {
"start": 142,
"end": 143,
"ctxt": 0
},
"value": "x",
"optional": false
}
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 146,
"end": 162,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 146,
"end": 161,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "Identifier",
"span": {
"start": 146,
"end": 147,
"ctxt": 0
},
"value": "b",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "BinaryExpression",
"span": {
"start": 150,
"end": 161,
"ctxt": 0
},
"operator": "===",
"left": {
"type": "Identifier",
"span": {
"start": 150,
"end": 151,
"ctxt": 0
},
"value": "x",
"optional": false
},
"right": {
"type": "StringLiteral",
"span": {
"start": 156,
"end": 161,
"ctxt": 0
},
"value": "bar",
"hasEscape": false,
"kind": {
"type": "normal",
"containsQuote": true
}
}
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 164,
"end": 180,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 164,
"end": 179,
"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": 179,
"ctxt": 0
},
"operator": "===",
"left": {
"type": "Identifier",
"span": {
"start": 168,
"end": 169,
"ctxt": 0
},
"value": "y",
"optional": false
},
"right": {
"type": "StringLiteral",
"span": {
"start": 174,
"end": 179,
"ctxt": 0
},
"value": "bar",
"hasEscape": false,
"kind": {
"type": "normal",
"containsQuote": true
}
}
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 182,
"end": 198,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 182,
"end": 197,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "Identifier",
"span": {
"start": 182,
"end": 183,
"ctxt": 0
},
"value": "b",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "BinaryExpression",
"span": {
"start": 186,
"end": 197,
"ctxt": 0
},
"operator": "===",
"left": {
"type": "StringLiteral",
"span": {
"start": 186,
"end": 191,
"ctxt": 0
},
"value": "bar",
"hasEscape": false,
"kind": {
"type": "normal",
"containsQuote": true
}
},
"right": {
"type": "Identifier",
"span": {
"start": 196,
"end": 197,
"ctxt": 0
},
"value": "y",
"optional": false
}
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 202,
"end": 214,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 202,
"end": 213,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "Identifier",
"span": {
"start": 202,
"end": 203,
"ctxt": 0
},
"value": "b",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "BinaryExpression",
"span": {
"start": 206,
"end": 213,
"ctxt": 0
},
"operator": "!==",
"left": {
"type": "Identifier",
"span": {
"start": 206,
"end": 207,
"ctxt": 0
},
"value": "x",
"optional": false
},
"right": {
"type": "Identifier",
"span": {
"start": 212,
"end": 213,
"ctxt": 0
},
"value": "y",
"optional": false
}
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 216,
"end": 231,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 216,
"end": 231,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "Identifier",
"span": {
"start": 216,
"end": 217,
"ctxt": 0
},
"value": "b",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "BinaryExpression",
"span": {
"start": 220,
"end": 231,
"ctxt": 0
},
"operator": "!==",
"left": {
"type": "StringLiteral",
"span": {
"start": 220,
"end": 225,
"ctxt": 0
},
"value": "foo",
"hasEscape": false,
"kind": {
"type": "normal",
"containsQuote": true
}
},
"right": {
"type": "Identifier",
"span": {
"start": 230,
"end": 231,
"ctxt": 0
},
"value": "y",
"optional": false
}
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 233,
"end": 249,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 233,
"end": 248,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "Identifier",
"span": {
"start": 233,
"end": 234,
"ctxt": 0
},
"value": "b",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "BinaryExpression",
"span": {
"start": 237,
"end": 248,
"ctxt": 0
},
"operator": "!==",
"left": {
"type": "Identifier",
"span": {
"start": 237,
"end": 238,
"ctxt": 0
},
"value": "y",
"optional": false
},
"right": {
"type": "StringLiteral",
"span": {
"start": 243,
"end": 248,
"ctxt": 0
},
"value": "foo",
"hasEscape": false,
"kind": {
"type": "normal",
"containsQuote": true
}
}
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 251,
"end": 271,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 251,
"end": 270,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "Identifier",
"span": {
"start": 251,
"end": 252,
"ctxt": 0
},
"value": "b",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "BinaryExpression",
"span": {
"start": 255,
"end": 270,
"ctxt": 0
},
"operator": "!==",
"left": {
"type": "StringLiteral",
"span": {
"start": 255,
"end": 260,
"ctxt": 0
},
"value": "foo",
"hasEscape": false,
"kind": {
"type": "normal",
"containsQuote": true
}
},
"right": {
"type": "StringLiteral",
"span": {
"start": 265,
"end": 270,
"ctxt": 0
},
"value": "bar",
"hasEscape": false,
"kind": {
"type": "normal",
"containsQuote": true
}
}
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 273,
"end": 289,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 273,
"end": 288,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "Identifier",
"span": {
"start": 273,
"end": 274,
"ctxt": 0
},
"value": "b",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "BinaryExpression",
"span": {
"start": 277,
"end": 288,
"ctxt": 0
},
"operator": "!==",
"left": {
"type": "StringLiteral",
"span": {
"start": 277,
"end": 282,
"ctxt": 0
},
"value": "bar",
"hasEscape": false,
"kind": {
"type": "normal",
"containsQuote": true
}
},
"right": {
"type": "Identifier",
"span": {
"start": 287,
"end": 288,
"ctxt": 0
},
"value": "x",
"optional": false
}
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 291,
"end": 307,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 291,
"end": 306,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "Identifier",
"span": {
"start": 291,
"end": 292,
"ctxt": 0
},
"value": "b",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "BinaryExpression",
"span": {
"start": 295,
"end": 306,
"ctxt": 0
},
"operator": "!==",
"left": {
"type": "Identifier",
"span": {
"start": 295,
"end": 296,
"ctxt": 0
},
"value": "x",
"optional": false
},
"right": {
"type": "StringLiteral",
"span": {
"start": 301,
"end": 306,
"ctxt": 0
},
"value": "bar",
"hasEscape": false,
"kind": {
"type": "normal",
"containsQuote": true
}
}
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 309,
"end": 325,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 309,
"end": 324,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "Identifier",
"span": {
"start": 309,
"end": 310,
"ctxt": 0
},
"value": "b",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "BinaryExpression",
"span": {
"start": 313,
"end": 324,
"ctxt": 0
},
"operator": "!==",
"left": {
"type": "Identifier",
"span": {
"start": 313,
"end": 314,
"ctxt": 0
},
"value": "y",
"optional": false
},
"right": {
"type": "StringLiteral",
"span": {
"start": 319,
"end": 324,
"ctxt": 0
},
"value": "bar",
"hasEscape": false,
"kind": {
"type": "normal",
"containsQuote": true
}
}
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 327,
"end": 343,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 327,
"end": 342,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "Identifier",
"span": {
"start": 327,
"end": 328,
"ctxt": 0
},
"value": "b",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "BinaryExpression",
"span": {
"start": 331,
"end": 342,
"ctxt": 0
},
"operator": "!==",
"left": {
"type": "StringLiteral",
"span": {
"start": 331,
"end": 336,
"ctxt": 0
},
"value": "bar",
"hasEscape": false,
"kind": {
"type": "normal",
"containsQuote": true
}
},
"right": {
"type": "Identifier",
"span": {
"start": 341,
"end": 342,
"ctxt": 0
},
"value": "y",
"optional": false
}
}
}
}
],
"interpreter": null
}