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

1273 lines
28 KiB
JSON

{
"type": "Script",
"span": {
"start": 1,
"end": 455,
"ctxt": 0
},
"body": [
{
"type": "TsInterfaceDeclaration",
"span": {
"start": 1,
"end": 47,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 11,
"end": 19,
"ctxt": 0
},
"value": "Runnable",
"optional": false
},
"declare": false,
"typeParams": null,
"extends": [],
"body": {
"type": "TsInterfaceBody",
"span": {
"start": 20,
"end": 47,
"ctxt": 0
},
"body": [
{
"type": "TsPropertySignature",
"span": {
"start": 26,
"end": 45,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 26,
"end": 35,
"ctxt": 0
},
"value": "isRunning",
"optional": false
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 35,
"end": 44,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 37,
"end": 44,
"ctxt": 0
},
"kind": "boolean"
}
},
"typeParams": null
}
]
}
},
{
"type": "TsInterfaceDeclaration",
"span": {
"start": 49,
"end": 122,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 59,
"end": 71,
"ctxt": 0
},
"value": "Refrigerator",
"optional": false
},
"declare": false,
"typeParams": null,
"extends": [
{
"type": "TsExpressionWithTypeArguments",
"span": {
"start": 80,
"end": 88,
"ctxt": 0
},
"expression": {
"type": "Identifier",
"span": {
"start": 80,
"end": 88,
"ctxt": 0
},
"value": "Runnable",
"optional": false
},
"typeArguments": null
}
],
"body": {
"type": "TsInterfaceBody",
"span": {
"start": 89,
"end": 122,
"ctxt": 0
},
"body": [
{
"type": "TsPropertySignature",
"span": {
"start": 95,
"end": 120,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 95,
"end": 110,
"ctxt": 0
},
"value": "makesFoodGoBrrr",
"optional": false
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 110,
"end": 119,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 112,
"end": 119,
"ctxt": 0
},
"kind": "boolean"
}
},
"typeParams": null
}
]
}
},
{
"type": "VariableDeclaration",
"span": {
"start": 124,
"end": 138,
"ctxt": 0
},
"kind": "let",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 128,
"end": 137,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 128,
"end": 129,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 129,
"end": 137,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 131,
"end": 137,
"ctxt": 0
},
"kind": "string"
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 139,
"end": 167,
"ctxt": 0
},
"kind": "let",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 143,
"end": 166,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 143,
"end": 144,
"ctxt": 0
},
"value": "y",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 144,
"end": 166,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsUnionType",
"span": {
"start": 146,
"end": 166,
"ctxt": 0
},
"types": [
{
"type": "TsLiteralType",
"span": {
"start": 146,
"end": 151,
"ctxt": 0
},
"literal": {
"type": "StringLiteral",
"span": {
"start": 146,
"end": 151,
"ctxt": 0
},
"value": "foo",
"raw": "\"foo\""
}
},
{
"type": "TsTypeReference",
"span": {
"start": 154,
"end": 166,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 154,
"end": 166,
"ctxt": 0
},
"value": "Refrigerator",
"optional": false
},
"typeParams": null
}
]
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 169,
"end": 184,
"ctxt": 0
},
"kind": "let",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 173,
"end": 183,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 173,
"end": 174,
"ctxt": 0
},
"value": "b",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 174,
"end": 183,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 176,
"end": 183,
"ctxt": 0
},
"kind": "boolean"
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "ExpressionStatement",
"span": {
"start": 185,
"end": 197,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 185,
"end": 196,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "Identifier",
"span": {
"start": 185,
"end": 186,
"ctxt": 0
},
"value": "b",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "BinaryExpression",
"span": {
"start": 189,
"end": 196,
"ctxt": 0
},
"operator": "===",
"left": {
"type": "Identifier",
"span": {
"start": 189,
"end": 190,
"ctxt": 0
},
"value": "x",
"optional": false
},
"right": {
"type": "Identifier",
"span": {
"start": 195,
"end": 196,
"ctxt": 0
},
"value": "y",
"optional": false
}
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 198,
"end": 213,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 198,
"end": 213,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "Identifier",
"span": {
"start": 198,
"end": 199,
"ctxt": 0
},
"value": "b",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "BinaryExpression",
"span": {
"start": 202,
"end": 213,
"ctxt": 0
},
"operator": "===",
"left": {
"type": "StringLiteral",
"span": {
"start": 202,
"end": 207,
"ctxt": 0
},
"value": "foo",
"raw": "\"foo\""
},
"right": {
"type": "Identifier",
"span": {
"start": 212,
"end": 213,
"ctxt": 0
},
"value": "y",
"optional": false
}
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 214,
"end": 230,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 214,
"end": 229,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "Identifier",
"span": {
"start": 214,
"end": 215,
"ctxt": 0
},
"value": "b",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "BinaryExpression",
"span": {
"start": 218,
"end": 229,
"ctxt": 0
},
"operator": "===",
"left": {
"type": "Identifier",
"span": {
"start": 218,
"end": 219,
"ctxt": 0
},
"value": "y",
"optional": false
},
"right": {
"type": "StringLiteral",
"span": {
"start": 224,
"end": 229,
"ctxt": 0
},
"value": "foo",
"raw": "\"foo\""
}
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 231,
"end": 251,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 231,
"end": 250,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "Identifier",
"span": {
"start": 231,
"end": 232,
"ctxt": 0
},
"value": "b",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "BinaryExpression",
"span": {
"start": 235,
"end": 250,
"ctxt": 0
},
"operator": "===",
"left": {
"type": "StringLiteral",
"span": {
"start": 235,
"end": 240,
"ctxt": 0
},
"value": "foo",
"raw": "\"foo\""
},
"right": {
"type": "StringLiteral",
"span": {
"start": 245,
"end": 250,
"ctxt": 0
},
"value": "bar",
"raw": "\"bar\""
}
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 252,
"end": 268,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 252,
"end": 267,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "Identifier",
"span": {
"start": 252,
"end": 253,
"ctxt": 0
},
"value": "b",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "BinaryExpression",
"span": {
"start": 256,
"end": 267,
"ctxt": 0
},
"operator": "===",
"left": {
"type": "StringLiteral",
"span": {
"start": 256,
"end": 261,
"ctxt": 0
},
"value": "bar",
"raw": "\"bar\""
},
"right": {
"type": "Identifier",
"span": {
"start": 266,
"end": 267,
"ctxt": 0
},
"value": "x",
"optional": false
}
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 269,
"end": 285,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 269,
"end": 284,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "Identifier",
"span": {
"start": 269,
"end": 270,
"ctxt": 0
},
"value": "b",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "BinaryExpression",
"span": {
"start": 273,
"end": 284,
"ctxt": 0
},
"operator": "===",
"left": {
"type": "Identifier",
"span": {
"start": 273,
"end": 274,
"ctxt": 0
},
"value": "x",
"optional": false
},
"right": {
"type": "StringLiteral",
"span": {
"start": 279,
"end": 284,
"ctxt": 0
},
"value": "bar",
"raw": "\"bar\""
}
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 286,
"end": 302,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 286,
"end": 301,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "Identifier",
"span": {
"start": 286,
"end": 287,
"ctxt": 0
},
"value": "b",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "BinaryExpression",
"span": {
"start": 290,
"end": 301,
"ctxt": 0
},
"operator": "===",
"left": {
"type": "Identifier",
"span": {
"start": 290,
"end": 291,
"ctxt": 0
},
"value": "y",
"optional": false
},
"right": {
"type": "StringLiteral",
"span": {
"start": 296,
"end": 301,
"ctxt": 0
},
"value": "bar",
"raw": "\"bar\""
}
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 303,
"end": 319,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 303,
"end": 318,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "Identifier",
"span": {
"start": 303,
"end": 304,
"ctxt": 0
},
"value": "b",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "BinaryExpression",
"span": {
"start": 307,
"end": 318,
"ctxt": 0
},
"operator": "===",
"left": {
"type": "StringLiteral",
"span": {
"start": 307,
"end": 312,
"ctxt": 0
},
"value": "bar",
"raw": "\"bar\""
},
"right": {
"type": "Identifier",
"span": {
"start": 317,
"end": 318,
"ctxt": 0
},
"value": "y",
"optional": false
}
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 321,
"end": 333,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 321,
"end": 332,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "Identifier",
"span": {
"start": 321,
"end": 322,
"ctxt": 0
},
"value": "b",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "BinaryExpression",
"span": {
"start": 325,
"end": 332,
"ctxt": 0
},
"operator": "!==",
"left": {
"type": "Identifier",
"span": {
"start": 325,
"end": 326,
"ctxt": 0
},
"value": "x",
"optional": false
},
"right": {
"type": "Identifier",
"span": {
"start": 331,
"end": 332,
"ctxt": 0
},
"value": "y",
"optional": false
}
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 334,
"end": 349,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 334,
"end": 349,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "Identifier",
"span": {
"start": 334,
"end": 335,
"ctxt": 0
},
"value": "b",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "BinaryExpression",
"span": {
"start": 338,
"end": 349,
"ctxt": 0
},
"operator": "!==",
"left": {
"type": "StringLiteral",
"span": {
"start": 338,
"end": 343,
"ctxt": 0
},
"value": "foo",
"raw": "\"foo\""
},
"right": {
"type": "Identifier",
"span": {
"start": 348,
"end": 349,
"ctxt": 0
},
"value": "y",
"optional": false
}
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 350,
"end": 366,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 350,
"end": 365,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "Identifier",
"span": {
"start": 350,
"end": 351,
"ctxt": 0
},
"value": "b",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "BinaryExpression",
"span": {
"start": 354,
"end": 365,
"ctxt": 0
},
"operator": "!==",
"left": {
"type": "Identifier",
"span": {
"start": 354,
"end": 355,
"ctxt": 0
},
"value": "y",
"optional": false
},
"right": {
"type": "StringLiteral",
"span": {
"start": 360,
"end": 365,
"ctxt": 0
},
"value": "foo",
"raw": "\"foo\""
}
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 367,
"end": 387,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 367,
"end": 386,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "Identifier",
"span": {
"start": 367,
"end": 368,
"ctxt": 0
},
"value": "b",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "BinaryExpression",
"span": {
"start": 371,
"end": 386,
"ctxt": 0
},
"operator": "!==",
"left": {
"type": "StringLiteral",
"span": {
"start": 371,
"end": 376,
"ctxt": 0
},
"value": "foo",
"raw": "\"foo\""
},
"right": {
"type": "StringLiteral",
"span": {
"start": 381,
"end": 386,
"ctxt": 0
},
"value": "bar",
"raw": "\"bar\""
}
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 388,
"end": 404,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 388,
"end": 403,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "Identifier",
"span": {
"start": 388,
"end": 389,
"ctxt": 0
},
"value": "b",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "BinaryExpression",
"span": {
"start": 392,
"end": 403,
"ctxt": 0
},
"operator": "!==",
"left": {
"type": "StringLiteral",
"span": {
"start": 392,
"end": 397,
"ctxt": 0
},
"value": "bar",
"raw": "\"bar\""
},
"right": {
"type": "Identifier",
"span": {
"start": 402,
"end": 403,
"ctxt": 0
},
"value": "x",
"optional": false
}
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 405,
"end": 421,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 405,
"end": 420,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "Identifier",
"span": {
"start": 405,
"end": 406,
"ctxt": 0
},
"value": "b",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "BinaryExpression",
"span": {
"start": 409,
"end": 420,
"ctxt": 0
},
"operator": "!==",
"left": {
"type": "Identifier",
"span": {
"start": 409,
"end": 410,
"ctxt": 0
},
"value": "x",
"optional": false
},
"right": {
"type": "StringLiteral",
"span": {
"start": 415,
"end": 420,
"ctxt": 0
},
"value": "bar",
"raw": "\"bar\""
}
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 422,
"end": 438,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 422,
"end": 437,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "Identifier",
"span": {
"start": 422,
"end": 423,
"ctxt": 0
},
"value": "b",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "BinaryExpression",
"span": {
"start": 426,
"end": 437,
"ctxt": 0
},
"operator": "!==",
"left": {
"type": "Identifier",
"span": {
"start": 426,
"end": 427,
"ctxt": 0
},
"value": "y",
"optional": false
},
"right": {
"type": "StringLiteral",
"span": {
"start": 432,
"end": 437,
"ctxt": 0
},
"value": "bar",
"raw": "\"bar\""
}
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 439,
"end": 455,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 439,
"end": 454,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "Identifier",
"span": {
"start": 439,
"end": 440,
"ctxt": 0
},
"value": "b",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "BinaryExpression",
"span": {
"start": 443,
"end": 454,
"ctxt": 0
},
"operator": "!==",
"left": {
"type": "StringLiteral",
"span": {
"start": 443,
"end": 448,
"ctxt": 0
},
"value": "bar",
"raw": "\"bar\""
},
"right": {
"type": "Identifier",
"span": {
"start": 453,
"end": 454,
"ctxt": 0
},
"value": "y",
"optional": false
}
}
}
}
],
"interpreter": null
}