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

1377 lines
30 KiB
JSON

{
"type": "Script",
"span": {
"start": 0,
"end": 550,
"ctxt": 0
},
"body": [
{
"type": "TsTypeAliasDeclaration",
"span": {
"start": 0,
"end": 50,
"ctxt": 0
},
"declare": false,
"id": {
"type": "Identifier",
"span": {
"start": 5,
"end": 15,
"ctxt": 0
},
"value": "BrandedNum",
"optional": false
},
"typeParams": null,
"typeAnnotation": {
"type": "TsIntersectionType",
"span": {
"start": 18,
"end": 49,
"ctxt": 0
},
"types": [
{
"type": "TsKeywordType",
"span": {
"start": 18,
"end": 24,
"ctxt": 0
},
"kind": "number"
},
{
"type": "TsTypeLiteral",
"span": {
"start": 27,
"end": 49,
"ctxt": 0
},
"members": [
{
"type": "TsPropertySignature",
"span": {
"start": 29,
"end": 47,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 29,
"end": 42,
"ctxt": 0
},
"value": "__numberBrand",
"optional": false
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 42,
"end": 47,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 44,
"end": 47,
"ctxt": 0
},
"kind": "any"
}
},
"typeParams": null
}
]
}
]
}
},
{
"type": "VariableDeclaration",
"span": {
"start": 51,
"end": 70,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 55,
"end": 69,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 55,
"end": 56,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 57,
"end": 69,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 59,
"end": 69,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 59,
"end": 69,
"ctxt": 0
},
"value": "BrandedNum",
"optional": false
},
"typeParams": null
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "ExpressionStatement",
"span": {
"start": 86,
"end": 92,
"ctxt": 0
},
"expression": {
"type": "BinaryExpression",
"span": {
"start": 86,
"end": 91,
"ctxt": 0
},
"operator": ">",
"left": {
"type": "Identifier",
"span": {
"start": 86,
"end": 87,
"ctxt": 0
},
"value": "x",
"optional": false
},
"right": {
"type": "NumericLiteral",
"span": {
"start": 90,
"end": 91,
"ctxt": 0
},
"value": 0.0
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 93,
"end": 107,
"ctxt": 0
},
"expression": {
"type": "BinaryExpression",
"span": {
"start": 93,
"end": 106,
"ctxt": 0
},
"operator": ">",
"left": {
"type": "Identifier",
"span": {
"start": 93,
"end": 94,
"ctxt": 0
},
"value": "x",
"optional": false
},
"right": {
"type": "TsTypeAssertion",
"span": {
"start": 97,
"end": 106,
"ctxt": 0
},
"expression": {
"type": "NumericLiteral",
"span": {
"start": 105,
"end": 106,
"ctxt": 0
},
"value": 0.0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 98,
"end": 104,
"ctxt": 0
},
"kind": "number"
}
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 108,
"end": 126,
"ctxt": 0
},
"expression": {
"type": "BinaryExpression",
"span": {
"start": 108,
"end": 125,
"ctxt": 0
},
"operator": ">",
"left": {
"type": "Identifier",
"span": {
"start": 108,
"end": 109,
"ctxt": 0
},
"value": "x",
"optional": false
},
"right": {
"type": "TsTypeAssertion",
"span": {
"start": 112,
"end": 125,
"ctxt": 0
},
"expression": {
"type": "NumericLiteral",
"span": {
"start": 124,
"end": 125,
"ctxt": 0
},
"value": 0.0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 113,
"end": 123,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 113,
"end": 123,
"ctxt": 0
},
"value": "BrandedNum",
"optional": false
},
"typeParams": null
}
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 142,
"end": 148,
"ctxt": 0
},
"expression": {
"type": "BinaryExpression",
"span": {
"start": 142,
"end": 147,
"ctxt": 0
},
"operator": "<",
"left": {
"type": "Identifier",
"span": {
"start": 142,
"end": 143,
"ctxt": 0
},
"value": "x",
"optional": false
},
"right": {
"type": "NumericLiteral",
"span": {
"start": 146,
"end": 147,
"ctxt": 0
},
"value": 0.0
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 149,
"end": 163,
"ctxt": 0
},
"expression": {
"type": "BinaryExpression",
"span": {
"start": 149,
"end": 162,
"ctxt": 0
},
"operator": "<",
"left": {
"type": "Identifier",
"span": {
"start": 149,
"end": 150,
"ctxt": 0
},
"value": "x",
"optional": false
},
"right": {
"type": "TsTypeAssertion",
"span": {
"start": 153,
"end": 162,
"ctxt": 0
},
"expression": {
"type": "NumericLiteral",
"span": {
"start": 161,
"end": 162,
"ctxt": 0
},
"value": 0.0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 154,
"end": 160,
"ctxt": 0
},
"kind": "number"
}
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 164,
"end": 182,
"ctxt": 0
},
"expression": {
"type": "BinaryExpression",
"span": {
"start": 164,
"end": 181,
"ctxt": 0
},
"operator": "<",
"left": {
"type": "Identifier",
"span": {
"start": 164,
"end": 165,
"ctxt": 0
},
"value": "x",
"optional": false
},
"right": {
"type": "TsTypeAssertion",
"span": {
"start": 168,
"end": 181,
"ctxt": 0
},
"expression": {
"type": "NumericLiteral",
"span": {
"start": 180,
"end": 181,
"ctxt": 0
},
"value": 0.0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 169,
"end": 179,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 169,
"end": 179,
"ctxt": 0
},
"value": "BrandedNum",
"optional": false
},
"typeParams": null
}
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 199,
"end": 206,
"ctxt": 0
},
"expression": {
"type": "BinaryExpression",
"span": {
"start": 199,
"end": 205,
"ctxt": 0
},
"operator": ">=",
"left": {
"type": "Identifier",
"span": {
"start": 199,
"end": 200,
"ctxt": 0
},
"value": "x",
"optional": false
},
"right": {
"type": "NumericLiteral",
"span": {
"start": 204,
"end": 205,
"ctxt": 0
},
"value": 0.0
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 207,
"end": 222,
"ctxt": 0
},
"expression": {
"type": "BinaryExpression",
"span": {
"start": 207,
"end": 221,
"ctxt": 0
},
"operator": ">=",
"left": {
"type": "Identifier",
"span": {
"start": 207,
"end": 208,
"ctxt": 0
},
"value": "x",
"optional": false
},
"right": {
"type": "TsTypeAssertion",
"span": {
"start": 212,
"end": 221,
"ctxt": 0
},
"expression": {
"type": "NumericLiteral",
"span": {
"start": 220,
"end": 221,
"ctxt": 0
},
"value": 0.0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 213,
"end": 219,
"ctxt": 0
},
"kind": "number"
}
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 223,
"end": 242,
"ctxt": 0
},
"expression": {
"type": "BinaryExpression",
"span": {
"start": 223,
"end": 241,
"ctxt": 0
},
"operator": ">=",
"left": {
"type": "Identifier",
"span": {
"start": 223,
"end": 224,
"ctxt": 0
},
"value": "x",
"optional": false
},
"right": {
"type": "TsTypeAssertion",
"span": {
"start": 228,
"end": 241,
"ctxt": 0
},
"expression": {
"type": "NumericLiteral",
"span": {
"start": 240,
"end": 241,
"ctxt": 0
},
"value": 0.0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 229,
"end": 239,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 229,
"end": 239,
"ctxt": 0
},
"value": "BrandedNum",
"optional": false
},
"typeParams": null
}
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 259,
"end": 266,
"ctxt": 0
},
"expression": {
"type": "BinaryExpression",
"span": {
"start": 259,
"end": 265,
"ctxt": 0
},
"operator": "<=",
"left": {
"type": "Identifier",
"span": {
"start": 259,
"end": 260,
"ctxt": 0
},
"value": "x",
"optional": false
},
"right": {
"type": "NumericLiteral",
"span": {
"start": 264,
"end": 265,
"ctxt": 0
},
"value": 0.0
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 267,
"end": 282,
"ctxt": 0
},
"expression": {
"type": "BinaryExpression",
"span": {
"start": 267,
"end": 281,
"ctxt": 0
},
"operator": "<=",
"left": {
"type": "Identifier",
"span": {
"start": 267,
"end": 268,
"ctxt": 0
},
"value": "x",
"optional": false
},
"right": {
"type": "TsTypeAssertion",
"span": {
"start": 272,
"end": 281,
"ctxt": 0
},
"expression": {
"type": "NumericLiteral",
"span": {
"start": 280,
"end": 281,
"ctxt": 0
},
"value": 0.0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 273,
"end": 279,
"ctxt": 0
},
"kind": "number"
}
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 283,
"end": 302,
"ctxt": 0
},
"expression": {
"type": "BinaryExpression",
"span": {
"start": 283,
"end": 301,
"ctxt": 0
},
"operator": "<=",
"left": {
"type": "Identifier",
"span": {
"start": 283,
"end": 284,
"ctxt": 0
},
"value": "x",
"optional": false
},
"right": {
"type": "TsTypeAssertion",
"span": {
"start": 288,
"end": 301,
"ctxt": 0
},
"expression": {
"type": "NumericLiteral",
"span": {
"start": 300,
"end": 301,
"ctxt": 0
},
"value": 0.0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 289,
"end": 299,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 289,
"end": 299,
"ctxt": 0
},
"value": "BrandedNum",
"optional": false
},
"typeParams": null
}
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 319,
"end": 326,
"ctxt": 0
},
"expression": {
"type": "BinaryExpression",
"span": {
"start": 319,
"end": 325,
"ctxt": 0
},
"operator": "==",
"left": {
"type": "Identifier",
"span": {
"start": 319,
"end": 320,
"ctxt": 0
},
"value": "x",
"optional": false
},
"right": {
"type": "NumericLiteral",
"span": {
"start": 324,
"end": 325,
"ctxt": 0
},
"value": 0.0
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 327,
"end": 342,
"ctxt": 0
},
"expression": {
"type": "BinaryExpression",
"span": {
"start": 327,
"end": 341,
"ctxt": 0
},
"operator": "==",
"left": {
"type": "Identifier",
"span": {
"start": 327,
"end": 328,
"ctxt": 0
},
"value": "x",
"optional": false
},
"right": {
"type": "TsTypeAssertion",
"span": {
"start": 332,
"end": 341,
"ctxt": 0
},
"expression": {
"type": "NumericLiteral",
"span": {
"start": 340,
"end": 341,
"ctxt": 0
},
"value": 0.0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 333,
"end": 339,
"ctxt": 0
},
"kind": "number"
}
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 343,
"end": 362,
"ctxt": 0
},
"expression": {
"type": "BinaryExpression",
"span": {
"start": 343,
"end": 361,
"ctxt": 0
},
"operator": "==",
"left": {
"type": "Identifier",
"span": {
"start": 343,
"end": 344,
"ctxt": 0
},
"value": "x",
"optional": false
},
"right": {
"type": "TsTypeAssertion",
"span": {
"start": 348,
"end": 361,
"ctxt": 0
},
"expression": {
"type": "NumericLiteral",
"span": {
"start": 360,
"end": 361,
"ctxt": 0
},
"value": 0.0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 349,
"end": 359,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 349,
"end": 359,
"ctxt": 0
},
"value": "BrandedNum",
"optional": false
},
"typeParams": null
}
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 379,
"end": 386,
"ctxt": 0
},
"expression": {
"type": "BinaryExpression",
"span": {
"start": 379,
"end": 385,
"ctxt": 0
},
"operator": "!=",
"left": {
"type": "Identifier",
"span": {
"start": 379,
"end": 380,
"ctxt": 0
},
"value": "x",
"optional": false
},
"right": {
"type": "NumericLiteral",
"span": {
"start": 384,
"end": 385,
"ctxt": 0
},
"value": 0.0
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 387,
"end": 402,
"ctxt": 0
},
"expression": {
"type": "BinaryExpression",
"span": {
"start": 387,
"end": 401,
"ctxt": 0
},
"operator": "!=",
"left": {
"type": "Identifier",
"span": {
"start": 387,
"end": 388,
"ctxt": 0
},
"value": "x",
"optional": false
},
"right": {
"type": "TsTypeAssertion",
"span": {
"start": 392,
"end": 401,
"ctxt": 0
},
"expression": {
"type": "NumericLiteral",
"span": {
"start": 400,
"end": 401,
"ctxt": 0
},
"value": 0.0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 393,
"end": 399,
"ctxt": 0
},
"kind": "number"
}
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 403,
"end": 422,
"ctxt": 0
},
"expression": {
"type": "BinaryExpression",
"span": {
"start": 403,
"end": 421,
"ctxt": 0
},
"operator": "!=",
"left": {
"type": "Identifier",
"span": {
"start": 403,
"end": 404,
"ctxt": 0
},
"value": "x",
"optional": false
},
"right": {
"type": "TsTypeAssertion",
"span": {
"start": 408,
"end": 421,
"ctxt": 0
},
"expression": {
"type": "NumericLiteral",
"span": {
"start": 420,
"end": 421,
"ctxt": 0
},
"value": 0.0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 409,
"end": 419,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 409,
"end": 419,
"ctxt": 0
},
"value": "BrandedNum",
"optional": false
},
"typeParams": null
}
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 440,
"end": 448,
"ctxt": 0
},
"expression": {
"type": "BinaryExpression",
"span": {
"start": 440,
"end": 447,
"ctxt": 0
},
"operator": "===",
"left": {
"type": "Identifier",
"span": {
"start": 440,
"end": 441,
"ctxt": 0
},
"value": "x",
"optional": false
},
"right": {
"type": "NumericLiteral",
"span": {
"start": 446,
"end": 447,
"ctxt": 0
},
"value": 0.0
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 449,
"end": 465,
"ctxt": 0
},
"expression": {
"type": "BinaryExpression",
"span": {
"start": 449,
"end": 464,
"ctxt": 0
},
"operator": "===",
"left": {
"type": "Identifier",
"span": {
"start": 449,
"end": 450,
"ctxt": 0
},
"value": "x",
"optional": false
},
"right": {
"type": "TsTypeAssertion",
"span": {
"start": 455,
"end": 464,
"ctxt": 0
},
"expression": {
"type": "NumericLiteral",
"span": {
"start": 463,
"end": 464,
"ctxt": 0
},
"value": 0.0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 456,
"end": 462,
"ctxt": 0
},
"kind": "number"
}
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 466,
"end": 486,
"ctxt": 0
},
"expression": {
"type": "BinaryExpression",
"span": {
"start": 466,
"end": 485,
"ctxt": 0
},
"operator": "===",
"left": {
"type": "Identifier",
"span": {
"start": 466,
"end": 467,
"ctxt": 0
},
"value": "x",
"optional": false
},
"right": {
"type": "TsTypeAssertion",
"span": {
"start": 472,
"end": 485,
"ctxt": 0
},
"expression": {
"type": "NumericLiteral",
"span": {
"start": 484,
"end": 485,
"ctxt": 0
},
"value": 0.0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 473,
"end": 483,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 473,
"end": 483,
"ctxt": 0
},
"value": "BrandedNum",
"optional": false
},
"typeParams": null
}
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 504,
"end": 512,
"ctxt": 0
},
"expression": {
"type": "BinaryExpression",
"span": {
"start": 504,
"end": 511,
"ctxt": 0
},
"operator": "!==",
"left": {
"type": "Identifier",
"span": {
"start": 504,
"end": 505,
"ctxt": 0
},
"value": "x",
"optional": false
},
"right": {
"type": "NumericLiteral",
"span": {
"start": 510,
"end": 511,
"ctxt": 0
},
"value": 0.0
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 513,
"end": 529,
"ctxt": 0
},
"expression": {
"type": "BinaryExpression",
"span": {
"start": 513,
"end": 528,
"ctxt": 0
},
"operator": "!==",
"left": {
"type": "Identifier",
"span": {
"start": 513,
"end": 514,
"ctxt": 0
},
"value": "x",
"optional": false
},
"right": {
"type": "TsTypeAssertion",
"span": {
"start": 519,
"end": 528,
"ctxt": 0
},
"expression": {
"type": "NumericLiteral",
"span": {
"start": 527,
"end": 528,
"ctxt": 0
},
"value": 0.0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 520,
"end": 526,
"ctxt": 0
},
"kind": "number"
}
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 530,
"end": 550,
"ctxt": 0
},
"expression": {
"type": "BinaryExpression",
"span": {
"start": 530,
"end": 549,
"ctxt": 0
},
"operator": "!==",
"left": {
"type": "Identifier",
"span": {
"start": 530,
"end": 531,
"ctxt": 0
},
"value": "x",
"optional": false
},
"right": {
"type": "TsTypeAssertion",
"span": {
"start": 536,
"end": 549,
"ctxt": 0
},
"expression": {
"type": "NumericLiteral",
"span": {
"start": 548,
"end": 549,
"ctxt": 0
},
"value": 0.0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 537,
"end": 547,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 537,
"end": 547,
"ctxt": 0
},
"value": "BrandedNum",
"optional": false
},
"typeParams": null
}
}
}
}
],
"interpreter": null
}