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

1341 lines
30 KiB
JSON

{
"type": "Script",
"span": {
"start": 0,
"end": 438,
"ctxt": 0
},
"body": [
{
"type": "TsInterfaceDeclaration",
"span": {
"start": 0,
"end": 46,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 10,
"end": 18,
"ctxt": 0
},
"value": "Runnable",
"optional": false
},
"declare": false,
"typeParams": null,
"extends": [],
"body": {
"type": "TsInterfaceBody",
"span": {
"start": 19,
"end": 46,
"ctxt": 0
},
"body": [
{
"type": "TsPropertySignature",
"span": {
"start": 25,
"end": 44,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 25,
"end": 34,
"ctxt": 0
},
"value": "isRunning",
"optional": false
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 34,
"end": 43,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 36,
"end": 43,
"ctxt": 0
},
"kind": "boolean"
}
},
"typeParams": null
}
]
}
},
{
"type": "TsInterfaceDeclaration",
"span": {
"start": 48,
"end": 121,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 58,
"end": 70,
"ctxt": 0
},
"value": "Refrigerator",
"optional": false
},
"declare": false,
"typeParams": null,
"extends": [
{
"type": "TsExpressionWithTypeArguments",
"span": {
"start": 79,
"end": 87,
"ctxt": 0
},
"expression": {
"type": "Identifier",
"span": {
"start": 79,
"end": 87,
"ctxt": 0
},
"value": "Runnable",
"optional": false
},
"typeArguments": null
}
],
"body": {
"type": "TsInterfaceBody",
"span": {
"start": 88,
"end": 121,
"ctxt": 0
},
"body": [
{
"type": "TsPropertySignature",
"span": {
"start": 94,
"end": 119,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 94,
"end": 109,
"ctxt": 0
},
"value": "makesFoodGoBrrr",
"optional": false
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 109,
"end": 118,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 111,
"end": 118,
"ctxt": 0
},
"kind": "boolean"
}
},
"typeParams": null
}
]
}
},
{
"type": "VariableDeclaration",
"span": {
"start": 123,
"end": 137,
"ctxt": 0
},
"kind": "let",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 127,
"end": 136,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 127,
"end": 128,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 128,
"end": 136,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 130,
"end": 136,
"ctxt": 0
},
"kind": "string"
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 138,
"end": 166,
"ctxt": 0
},
"kind": "let",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 142,
"end": 165,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 142,
"end": 143,
"ctxt": 0
},
"value": "y",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 143,
"end": 165,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsUnionType",
"span": {
"start": 145,
"end": 165,
"ctxt": 0
},
"types": [
{
"type": "TsLiteralType",
"span": {
"start": 145,
"end": 150,
"ctxt": 0
},
"literal": {
"type": "StringLiteral",
"span": {
"start": 145,
"end": 150,
"ctxt": 0
},
"value": "foo",
"hasEscape": false,
"kind": {
"type": "normal",
"containsQuote": true
}
}
},
{
"type": "TsTypeReference",
"span": {
"start": 153,
"end": 165,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 153,
"end": 165,
"ctxt": 0
},
"value": "Refrigerator",
"optional": false
},
"typeParams": null
}
]
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 168,
"end": 183,
"ctxt": 0
},
"kind": "let",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 172,
"end": 182,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 172,
"end": 173,
"ctxt": 0
},
"value": "b",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 173,
"end": 182,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 175,
"end": 182,
"ctxt": 0
},
"kind": "boolean"
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "ExpressionStatement",
"span": {
"start": 184,
"end": 195,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 184,
"end": 194,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "Identifier",
"span": {
"start": 184,
"end": 185,
"ctxt": 0
},
"value": "b",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "BinaryExpression",
"span": {
"start": 188,
"end": 194,
"ctxt": 0
},
"operator": "==",
"left": {
"type": "Identifier",
"span": {
"start": 188,
"end": 189,
"ctxt": 0
},
"value": "x",
"optional": false
},
"right": {
"type": "Identifier",
"span": {
"start": 193,
"end": 194,
"ctxt": 0
},
"value": "y",
"optional": false
}
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 196,
"end": 210,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 196,
"end": 210,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "Identifier",
"span": {
"start": 196,
"end": 197,
"ctxt": 0
},
"value": "b",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "BinaryExpression",
"span": {
"start": 200,
"end": 210,
"ctxt": 0
},
"operator": "==",
"left": {
"type": "StringLiteral",
"span": {
"start": 200,
"end": 205,
"ctxt": 0
},
"value": "foo",
"hasEscape": false,
"kind": {
"type": "normal",
"containsQuote": true
}
},
"right": {
"type": "Identifier",
"span": {
"start": 209,
"end": 210,
"ctxt": 0
},
"value": "y",
"optional": false
}
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 211,
"end": 226,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 211,
"end": 225,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "Identifier",
"span": {
"start": 211,
"end": 212,
"ctxt": 0
},
"value": "b",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "BinaryExpression",
"span": {
"start": 215,
"end": 225,
"ctxt": 0
},
"operator": "==",
"left": {
"type": "Identifier",
"span": {
"start": 215,
"end": 216,
"ctxt": 0
},
"value": "y",
"optional": false
},
"right": {
"type": "StringLiteral",
"span": {
"start": 220,
"end": 225,
"ctxt": 0
},
"value": "foo",
"hasEscape": false,
"kind": {
"type": "normal",
"containsQuote": true
}
}
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 227,
"end": 246,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 227,
"end": 245,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "Identifier",
"span": {
"start": 227,
"end": 228,
"ctxt": 0
},
"value": "b",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "BinaryExpression",
"span": {
"start": 231,
"end": 245,
"ctxt": 0
},
"operator": "==",
"left": {
"type": "StringLiteral",
"span": {
"start": 231,
"end": 236,
"ctxt": 0
},
"value": "foo",
"hasEscape": false,
"kind": {
"type": "normal",
"containsQuote": true
}
},
"right": {
"type": "StringLiteral",
"span": {
"start": 240,
"end": 245,
"ctxt": 0
},
"value": "bar",
"hasEscape": false,
"kind": {
"type": "normal",
"containsQuote": true
}
}
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 247,
"end": 262,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 247,
"end": 261,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "Identifier",
"span": {
"start": 247,
"end": 248,
"ctxt": 0
},
"value": "b",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "BinaryExpression",
"span": {
"start": 251,
"end": 261,
"ctxt": 0
},
"operator": "==",
"left": {
"type": "StringLiteral",
"span": {
"start": 251,
"end": 256,
"ctxt": 0
},
"value": "bar",
"hasEscape": false,
"kind": {
"type": "normal",
"containsQuote": true
}
},
"right": {
"type": "Identifier",
"span": {
"start": 260,
"end": 261,
"ctxt": 0
},
"value": "x",
"optional": false
}
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 263,
"end": 278,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 263,
"end": 277,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "Identifier",
"span": {
"start": 263,
"end": 264,
"ctxt": 0
},
"value": "b",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "BinaryExpression",
"span": {
"start": 267,
"end": 277,
"ctxt": 0
},
"operator": "==",
"left": {
"type": "Identifier",
"span": {
"start": 267,
"end": 268,
"ctxt": 0
},
"value": "x",
"optional": false
},
"right": {
"type": "StringLiteral",
"span": {
"start": 272,
"end": 277,
"ctxt": 0
},
"value": "bar",
"hasEscape": false,
"kind": {
"type": "normal",
"containsQuote": true
}
}
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 279,
"end": 294,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 279,
"end": 293,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "Identifier",
"span": {
"start": 279,
"end": 280,
"ctxt": 0
},
"value": "b",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "BinaryExpression",
"span": {
"start": 283,
"end": 293,
"ctxt": 0
},
"operator": "==",
"left": {
"type": "Identifier",
"span": {
"start": 283,
"end": 284,
"ctxt": 0
},
"value": "y",
"optional": false
},
"right": {
"type": "StringLiteral",
"span": {
"start": 288,
"end": 293,
"ctxt": 0
},
"value": "bar",
"hasEscape": false,
"kind": {
"type": "normal",
"containsQuote": true
}
}
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 295,
"end": 310,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 295,
"end": 309,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "Identifier",
"span": {
"start": 295,
"end": 296,
"ctxt": 0
},
"value": "b",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "BinaryExpression",
"span": {
"start": 299,
"end": 309,
"ctxt": 0
},
"operator": "==",
"left": {
"type": "StringLiteral",
"span": {
"start": 299,
"end": 304,
"ctxt": 0
},
"value": "bar",
"hasEscape": false,
"kind": {
"type": "normal",
"containsQuote": true
}
},
"right": {
"type": "Identifier",
"span": {
"start": 308,
"end": 309,
"ctxt": 0
},
"value": "y",
"optional": false
}
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 312,
"end": 323,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 312,
"end": 322,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "Identifier",
"span": {
"start": 312,
"end": 313,
"ctxt": 0
},
"value": "b",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "BinaryExpression",
"span": {
"start": 316,
"end": 322,
"ctxt": 0
},
"operator": "!=",
"left": {
"type": "Identifier",
"span": {
"start": 316,
"end": 317,
"ctxt": 0
},
"value": "x",
"optional": false
},
"right": {
"type": "Identifier",
"span": {
"start": 321,
"end": 322,
"ctxt": 0
},
"value": "y",
"optional": false
}
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 324,
"end": 338,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 324,
"end": 338,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "Identifier",
"span": {
"start": 324,
"end": 325,
"ctxt": 0
},
"value": "b",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "BinaryExpression",
"span": {
"start": 328,
"end": 338,
"ctxt": 0
},
"operator": "!=",
"left": {
"type": "StringLiteral",
"span": {
"start": 328,
"end": 333,
"ctxt": 0
},
"value": "foo",
"hasEscape": false,
"kind": {
"type": "normal",
"containsQuote": true
}
},
"right": {
"type": "Identifier",
"span": {
"start": 337,
"end": 338,
"ctxt": 0
},
"value": "y",
"optional": false
}
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 339,
"end": 354,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 339,
"end": 353,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "Identifier",
"span": {
"start": 339,
"end": 340,
"ctxt": 0
},
"value": "b",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "BinaryExpression",
"span": {
"start": 343,
"end": 353,
"ctxt": 0
},
"operator": "!=",
"left": {
"type": "Identifier",
"span": {
"start": 343,
"end": 344,
"ctxt": 0
},
"value": "y",
"optional": false
},
"right": {
"type": "StringLiteral",
"span": {
"start": 348,
"end": 353,
"ctxt": 0
},
"value": "foo",
"hasEscape": false,
"kind": {
"type": "normal",
"containsQuote": true
}
}
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 355,
"end": 374,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 355,
"end": 373,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "Identifier",
"span": {
"start": 355,
"end": 356,
"ctxt": 0
},
"value": "b",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "BinaryExpression",
"span": {
"start": 359,
"end": 373,
"ctxt": 0
},
"operator": "!=",
"left": {
"type": "StringLiteral",
"span": {
"start": 359,
"end": 364,
"ctxt": 0
},
"value": "foo",
"hasEscape": false,
"kind": {
"type": "normal",
"containsQuote": true
}
},
"right": {
"type": "StringLiteral",
"span": {
"start": 368,
"end": 373,
"ctxt": 0
},
"value": "bar",
"hasEscape": false,
"kind": {
"type": "normal",
"containsQuote": true
}
}
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 375,
"end": 390,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 375,
"end": 389,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "Identifier",
"span": {
"start": 375,
"end": 376,
"ctxt": 0
},
"value": "b",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "BinaryExpression",
"span": {
"start": 379,
"end": 389,
"ctxt": 0
},
"operator": "!=",
"left": {
"type": "StringLiteral",
"span": {
"start": 379,
"end": 384,
"ctxt": 0
},
"value": "bar",
"hasEscape": false,
"kind": {
"type": "normal",
"containsQuote": true
}
},
"right": {
"type": "Identifier",
"span": {
"start": 388,
"end": 389,
"ctxt": 0
},
"value": "x",
"optional": false
}
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 391,
"end": 406,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 391,
"end": 405,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "Identifier",
"span": {
"start": 391,
"end": 392,
"ctxt": 0
},
"value": "b",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "BinaryExpression",
"span": {
"start": 395,
"end": 405,
"ctxt": 0
},
"operator": "!=",
"left": {
"type": "Identifier",
"span": {
"start": 395,
"end": 396,
"ctxt": 0
},
"value": "x",
"optional": false
},
"right": {
"type": "StringLiteral",
"span": {
"start": 400,
"end": 405,
"ctxt": 0
},
"value": "bar",
"hasEscape": false,
"kind": {
"type": "normal",
"containsQuote": true
}
}
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 407,
"end": 422,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 407,
"end": 421,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "Identifier",
"span": {
"start": 407,
"end": 408,
"ctxt": 0
},
"value": "b",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "BinaryExpression",
"span": {
"start": 411,
"end": 421,
"ctxt": 0
},
"operator": "!=",
"left": {
"type": "Identifier",
"span": {
"start": 411,
"end": 412,
"ctxt": 0
},
"value": "y",
"optional": false
},
"right": {
"type": "StringLiteral",
"span": {
"start": 416,
"end": 421,
"ctxt": 0
},
"value": "bar",
"hasEscape": false,
"kind": {
"type": "normal",
"containsQuote": true
}
}
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 423,
"end": 438,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 423,
"end": 437,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "Identifier",
"span": {
"start": 423,
"end": 424,
"ctxt": 0
},
"value": "b",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "BinaryExpression",
"span": {
"start": 427,
"end": 437,
"ctxt": 0
},
"operator": "!=",
"left": {
"type": "StringLiteral",
"span": {
"start": 427,
"end": 432,
"ctxt": 0
},
"value": "bar",
"hasEscape": false,
"kind": {
"type": "normal",
"containsQuote": true
}
},
"right": {
"type": "Identifier",
"span": {
"start": 436,
"end": 437,
"ctxt": 0
},
"value": "y",
"optional": false
}
}
}
}
],
"interpreter": null
}