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

1401 lines
30 KiB
JSON

{
"type": "Script",
"span": {
"start": 1,
"end": 551,
"ctxt": 0
},
"body": [
{
"type": "TsTypeAliasDeclaration",
"span": {
"start": 1,
"end": 51,
"ctxt": 0
},
"declare": false,
"id": {
"type": "Identifier",
"span": {
"start": 6,
"end": 16,
"ctxt": 0
},
"value": "BrandedNum",
"optional": false
},
"typeParams": null,
"typeAnnotation": {
"type": "TsIntersectionType",
"span": {
"start": 19,
"end": 50,
"ctxt": 0
},
"types": [
{
"type": "TsKeywordType",
"span": {
"start": 19,
"end": 25,
"ctxt": 0
},
"kind": "number"
},
{
"type": "TsTypeLiteral",
"span": {
"start": 28,
"end": 50,
"ctxt": 0
},
"members": [
{
"type": "TsPropertySignature",
"span": {
"start": 30,
"end": 48,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 30,
"end": 43,
"ctxt": 0
},
"value": "__numberBrand",
"optional": false
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 43,
"end": 48,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 45,
"end": 48,
"ctxt": 0
},
"kind": "any"
}
},
"typeParams": null
}
]
}
]
}
},
{
"type": "VariableDeclaration",
"span": {
"start": 52,
"end": 71,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 56,
"end": 70,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 56,
"end": 57,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 58,
"end": 70,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 60,
"end": 70,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 60,
"end": 70,
"ctxt": 0
},
"value": "BrandedNum",
"optional": false
},
"typeParams": null
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "ExpressionStatement",
"span": {
"start": 87,
"end": 93,
"ctxt": 0
},
"expression": {
"type": "BinaryExpression",
"span": {
"start": 87,
"end": 92,
"ctxt": 0
},
"operator": ">",
"left": {
"type": "Identifier",
"span": {
"start": 87,
"end": 88,
"ctxt": 0
},
"value": "x",
"optional": false
},
"right": {
"type": "NumericLiteral",
"span": {
"start": 91,
"end": 92,
"ctxt": 0
},
"value": 0.0,
"raw": "0"
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 94,
"end": 108,
"ctxt": 0
},
"expression": {
"type": "BinaryExpression",
"span": {
"start": 94,
"end": 107,
"ctxt": 0
},
"operator": ">",
"left": {
"type": "Identifier",
"span": {
"start": 94,
"end": 95,
"ctxt": 0
},
"value": "x",
"optional": false
},
"right": {
"type": "TsTypeAssertion",
"span": {
"start": 98,
"end": 107,
"ctxt": 0
},
"expression": {
"type": "NumericLiteral",
"span": {
"start": 106,
"end": 107,
"ctxt": 0
},
"value": 0.0,
"raw": "0"
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 99,
"end": 105,
"ctxt": 0
},
"kind": "number"
}
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 109,
"end": 127,
"ctxt": 0
},
"expression": {
"type": "BinaryExpression",
"span": {
"start": 109,
"end": 126,
"ctxt": 0
},
"operator": ">",
"left": {
"type": "Identifier",
"span": {
"start": 109,
"end": 110,
"ctxt": 0
},
"value": "x",
"optional": false
},
"right": {
"type": "TsTypeAssertion",
"span": {
"start": 113,
"end": 126,
"ctxt": 0
},
"expression": {
"type": "NumericLiteral",
"span": {
"start": 125,
"end": 126,
"ctxt": 0
},
"value": 0.0,
"raw": "0"
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 114,
"end": 124,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 114,
"end": 124,
"ctxt": 0
},
"value": "BrandedNum",
"optional": false
},
"typeParams": null
}
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 143,
"end": 149,
"ctxt": 0
},
"expression": {
"type": "BinaryExpression",
"span": {
"start": 143,
"end": 148,
"ctxt": 0
},
"operator": "<",
"left": {
"type": "Identifier",
"span": {
"start": 143,
"end": 144,
"ctxt": 0
},
"value": "x",
"optional": false
},
"right": {
"type": "NumericLiteral",
"span": {
"start": 147,
"end": 148,
"ctxt": 0
},
"value": 0.0,
"raw": "0"
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 150,
"end": 164,
"ctxt": 0
},
"expression": {
"type": "BinaryExpression",
"span": {
"start": 150,
"end": 163,
"ctxt": 0
},
"operator": "<",
"left": {
"type": "Identifier",
"span": {
"start": 150,
"end": 151,
"ctxt": 0
},
"value": "x",
"optional": false
},
"right": {
"type": "TsTypeAssertion",
"span": {
"start": 154,
"end": 163,
"ctxt": 0
},
"expression": {
"type": "NumericLiteral",
"span": {
"start": 162,
"end": 163,
"ctxt": 0
},
"value": 0.0,
"raw": "0"
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 155,
"end": 161,
"ctxt": 0
},
"kind": "number"
}
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 165,
"end": 183,
"ctxt": 0
},
"expression": {
"type": "BinaryExpression",
"span": {
"start": 165,
"end": 182,
"ctxt": 0
},
"operator": "<",
"left": {
"type": "Identifier",
"span": {
"start": 165,
"end": 166,
"ctxt": 0
},
"value": "x",
"optional": false
},
"right": {
"type": "TsTypeAssertion",
"span": {
"start": 169,
"end": 182,
"ctxt": 0
},
"expression": {
"type": "NumericLiteral",
"span": {
"start": 181,
"end": 182,
"ctxt": 0
},
"value": 0.0,
"raw": "0"
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 170,
"end": 180,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 170,
"end": 180,
"ctxt": 0
},
"value": "BrandedNum",
"optional": false
},
"typeParams": null
}
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 200,
"end": 207,
"ctxt": 0
},
"expression": {
"type": "BinaryExpression",
"span": {
"start": 200,
"end": 206,
"ctxt": 0
},
"operator": ">=",
"left": {
"type": "Identifier",
"span": {
"start": 200,
"end": 201,
"ctxt": 0
},
"value": "x",
"optional": false
},
"right": {
"type": "NumericLiteral",
"span": {
"start": 205,
"end": 206,
"ctxt": 0
},
"value": 0.0,
"raw": "0"
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 208,
"end": 223,
"ctxt": 0
},
"expression": {
"type": "BinaryExpression",
"span": {
"start": 208,
"end": 222,
"ctxt": 0
},
"operator": ">=",
"left": {
"type": "Identifier",
"span": {
"start": 208,
"end": 209,
"ctxt": 0
},
"value": "x",
"optional": false
},
"right": {
"type": "TsTypeAssertion",
"span": {
"start": 213,
"end": 222,
"ctxt": 0
},
"expression": {
"type": "NumericLiteral",
"span": {
"start": 221,
"end": 222,
"ctxt": 0
},
"value": 0.0,
"raw": "0"
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 214,
"end": 220,
"ctxt": 0
},
"kind": "number"
}
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 224,
"end": 243,
"ctxt": 0
},
"expression": {
"type": "BinaryExpression",
"span": {
"start": 224,
"end": 242,
"ctxt": 0
},
"operator": ">=",
"left": {
"type": "Identifier",
"span": {
"start": 224,
"end": 225,
"ctxt": 0
},
"value": "x",
"optional": false
},
"right": {
"type": "TsTypeAssertion",
"span": {
"start": 229,
"end": 242,
"ctxt": 0
},
"expression": {
"type": "NumericLiteral",
"span": {
"start": 241,
"end": 242,
"ctxt": 0
},
"value": 0.0,
"raw": "0"
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 230,
"end": 240,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 230,
"end": 240,
"ctxt": 0
},
"value": "BrandedNum",
"optional": false
},
"typeParams": null
}
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 260,
"end": 267,
"ctxt": 0
},
"expression": {
"type": "BinaryExpression",
"span": {
"start": 260,
"end": 266,
"ctxt": 0
},
"operator": "<=",
"left": {
"type": "Identifier",
"span": {
"start": 260,
"end": 261,
"ctxt": 0
},
"value": "x",
"optional": false
},
"right": {
"type": "NumericLiteral",
"span": {
"start": 265,
"end": 266,
"ctxt": 0
},
"value": 0.0,
"raw": "0"
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 268,
"end": 283,
"ctxt": 0
},
"expression": {
"type": "BinaryExpression",
"span": {
"start": 268,
"end": 282,
"ctxt": 0
},
"operator": "<=",
"left": {
"type": "Identifier",
"span": {
"start": 268,
"end": 269,
"ctxt": 0
},
"value": "x",
"optional": false
},
"right": {
"type": "TsTypeAssertion",
"span": {
"start": 273,
"end": 282,
"ctxt": 0
},
"expression": {
"type": "NumericLiteral",
"span": {
"start": 281,
"end": 282,
"ctxt": 0
},
"value": 0.0,
"raw": "0"
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 274,
"end": 280,
"ctxt": 0
},
"kind": "number"
}
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 284,
"end": 303,
"ctxt": 0
},
"expression": {
"type": "BinaryExpression",
"span": {
"start": 284,
"end": 302,
"ctxt": 0
},
"operator": "<=",
"left": {
"type": "Identifier",
"span": {
"start": 284,
"end": 285,
"ctxt": 0
},
"value": "x",
"optional": false
},
"right": {
"type": "TsTypeAssertion",
"span": {
"start": 289,
"end": 302,
"ctxt": 0
},
"expression": {
"type": "NumericLiteral",
"span": {
"start": 301,
"end": 302,
"ctxt": 0
},
"value": 0.0,
"raw": "0"
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 290,
"end": 300,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 290,
"end": 300,
"ctxt": 0
},
"value": "BrandedNum",
"optional": false
},
"typeParams": null
}
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 320,
"end": 327,
"ctxt": 0
},
"expression": {
"type": "BinaryExpression",
"span": {
"start": 320,
"end": 326,
"ctxt": 0
},
"operator": "==",
"left": {
"type": "Identifier",
"span": {
"start": 320,
"end": 321,
"ctxt": 0
},
"value": "x",
"optional": false
},
"right": {
"type": "NumericLiteral",
"span": {
"start": 325,
"end": 326,
"ctxt": 0
},
"value": 0.0,
"raw": "0"
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 328,
"end": 343,
"ctxt": 0
},
"expression": {
"type": "BinaryExpression",
"span": {
"start": 328,
"end": 342,
"ctxt": 0
},
"operator": "==",
"left": {
"type": "Identifier",
"span": {
"start": 328,
"end": 329,
"ctxt": 0
},
"value": "x",
"optional": false
},
"right": {
"type": "TsTypeAssertion",
"span": {
"start": 333,
"end": 342,
"ctxt": 0
},
"expression": {
"type": "NumericLiteral",
"span": {
"start": 341,
"end": 342,
"ctxt": 0
},
"value": 0.0,
"raw": "0"
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 334,
"end": 340,
"ctxt": 0
},
"kind": "number"
}
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 344,
"end": 363,
"ctxt": 0
},
"expression": {
"type": "BinaryExpression",
"span": {
"start": 344,
"end": 362,
"ctxt": 0
},
"operator": "==",
"left": {
"type": "Identifier",
"span": {
"start": 344,
"end": 345,
"ctxt": 0
},
"value": "x",
"optional": false
},
"right": {
"type": "TsTypeAssertion",
"span": {
"start": 349,
"end": 362,
"ctxt": 0
},
"expression": {
"type": "NumericLiteral",
"span": {
"start": 361,
"end": 362,
"ctxt": 0
},
"value": 0.0,
"raw": "0"
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 350,
"end": 360,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 350,
"end": 360,
"ctxt": 0
},
"value": "BrandedNum",
"optional": false
},
"typeParams": null
}
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 380,
"end": 387,
"ctxt": 0
},
"expression": {
"type": "BinaryExpression",
"span": {
"start": 380,
"end": 386,
"ctxt": 0
},
"operator": "!=",
"left": {
"type": "Identifier",
"span": {
"start": 380,
"end": 381,
"ctxt": 0
},
"value": "x",
"optional": false
},
"right": {
"type": "NumericLiteral",
"span": {
"start": 385,
"end": 386,
"ctxt": 0
},
"value": 0.0,
"raw": "0"
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 388,
"end": 403,
"ctxt": 0
},
"expression": {
"type": "BinaryExpression",
"span": {
"start": 388,
"end": 402,
"ctxt": 0
},
"operator": "!=",
"left": {
"type": "Identifier",
"span": {
"start": 388,
"end": 389,
"ctxt": 0
},
"value": "x",
"optional": false
},
"right": {
"type": "TsTypeAssertion",
"span": {
"start": 393,
"end": 402,
"ctxt": 0
},
"expression": {
"type": "NumericLiteral",
"span": {
"start": 401,
"end": 402,
"ctxt": 0
},
"value": 0.0,
"raw": "0"
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 394,
"end": 400,
"ctxt": 0
},
"kind": "number"
}
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 404,
"end": 423,
"ctxt": 0
},
"expression": {
"type": "BinaryExpression",
"span": {
"start": 404,
"end": 422,
"ctxt": 0
},
"operator": "!=",
"left": {
"type": "Identifier",
"span": {
"start": 404,
"end": 405,
"ctxt": 0
},
"value": "x",
"optional": false
},
"right": {
"type": "TsTypeAssertion",
"span": {
"start": 409,
"end": 422,
"ctxt": 0
},
"expression": {
"type": "NumericLiteral",
"span": {
"start": 421,
"end": 422,
"ctxt": 0
},
"value": 0.0,
"raw": "0"
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 410,
"end": 420,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 410,
"end": 420,
"ctxt": 0
},
"value": "BrandedNum",
"optional": false
},
"typeParams": null
}
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 441,
"end": 449,
"ctxt": 0
},
"expression": {
"type": "BinaryExpression",
"span": {
"start": 441,
"end": 448,
"ctxt": 0
},
"operator": "===",
"left": {
"type": "Identifier",
"span": {
"start": 441,
"end": 442,
"ctxt": 0
},
"value": "x",
"optional": false
},
"right": {
"type": "NumericLiteral",
"span": {
"start": 447,
"end": 448,
"ctxt": 0
},
"value": 0.0,
"raw": "0"
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 450,
"end": 466,
"ctxt": 0
},
"expression": {
"type": "BinaryExpression",
"span": {
"start": 450,
"end": 465,
"ctxt": 0
},
"operator": "===",
"left": {
"type": "Identifier",
"span": {
"start": 450,
"end": 451,
"ctxt": 0
},
"value": "x",
"optional": false
},
"right": {
"type": "TsTypeAssertion",
"span": {
"start": 456,
"end": 465,
"ctxt": 0
},
"expression": {
"type": "NumericLiteral",
"span": {
"start": 464,
"end": 465,
"ctxt": 0
},
"value": 0.0,
"raw": "0"
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 457,
"end": 463,
"ctxt": 0
},
"kind": "number"
}
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 467,
"end": 487,
"ctxt": 0
},
"expression": {
"type": "BinaryExpression",
"span": {
"start": 467,
"end": 486,
"ctxt": 0
},
"operator": "===",
"left": {
"type": "Identifier",
"span": {
"start": 467,
"end": 468,
"ctxt": 0
},
"value": "x",
"optional": false
},
"right": {
"type": "TsTypeAssertion",
"span": {
"start": 473,
"end": 486,
"ctxt": 0
},
"expression": {
"type": "NumericLiteral",
"span": {
"start": 485,
"end": 486,
"ctxt": 0
},
"value": 0.0,
"raw": "0"
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 474,
"end": 484,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 474,
"end": 484,
"ctxt": 0
},
"value": "BrandedNum",
"optional": false
},
"typeParams": null
}
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 505,
"end": 513,
"ctxt": 0
},
"expression": {
"type": "BinaryExpression",
"span": {
"start": 505,
"end": 512,
"ctxt": 0
},
"operator": "!==",
"left": {
"type": "Identifier",
"span": {
"start": 505,
"end": 506,
"ctxt": 0
},
"value": "x",
"optional": false
},
"right": {
"type": "NumericLiteral",
"span": {
"start": 511,
"end": 512,
"ctxt": 0
},
"value": 0.0,
"raw": "0"
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 514,
"end": 530,
"ctxt": 0
},
"expression": {
"type": "BinaryExpression",
"span": {
"start": 514,
"end": 529,
"ctxt": 0
},
"operator": "!==",
"left": {
"type": "Identifier",
"span": {
"start": 514,
"end": 515,
"ctxt": 0
},
"value": "x",
"optional": false
},
"right": {
"type": "TsTypeAssertion",
"span": {
"start": 520,
"end": 529,
"ctxt": 0
},
"expression": {
"type": "NumericLiteral",
"span": {
"start": 528,
"end": 529,
"ctxt": 0
},
"value": 0.0,
"raw": "0"
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 521,
"end": 527,
"ctxt": 0
},
"kind": "number"
}
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 531,
"end": 551,
"ctxt": 0
},
"expression": {
"type": "BinaryExpression",
"span": {
"start": 531,
"end": 550,
"ctxt": 0
},
"operator": "!==",
"left": {
"type": "Identifier",
"span": {
"start": 531,
"end": 532,
"ctxt": 0
},
"value": "x",
"optional": false
},
"right": {
"type": "TsTypeAssertion",
"span": {
"start": 537,
"end": 550,
"ctxt": 0
},
"expression": {
"type": "NumericLiteral",
"span": {
"start": 549,
"end": 550,
"ctxt": 0
},
"value": 0.0,
"raw": "0"
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 538,
"end": 548,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 538,
"end": 548,
"ctxt": 0
},
"value": "BrandedNum",
"optional": false
},
"typeParams": null
}
}
}
}
],
"interpreter": null
}