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

1020 lines
23 KiB
JSON

{
"type": "Script",
"span": {
"start": 107,
"end": 546,
"ctxt": 0
},
"body": [
{
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 116,
"end": 119,
"ctxt": 0
},
"value": "foo",
"optional": false
},
"declare": false,
"params": [],
"decorators": [],
"span": {
"start": 107,
"end": 148,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 128,
"end": 148,
"ctxt": 0
},
"stmts": [
{
"type": "ReturnStatement",
"span": {
"start": 130,
"end": 146,
"ctxt": 0
},
"argument": {
"type": "Identifier",
"span": {
"start": 137,
"end": 146,
"ctxt": 0
},
"value": "undefined",
"optional": false
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": {
"type": "TsTypeAnnotation",
"span": {
"start": 121,
"end": 127,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 123,
"end": 127,
"ctxt": 0
},
"kind": "void"
}
}
},
{
"type": "VariableDeclaration",
"span": {
"start": 150,
"end": 165,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 154,
"end": 164,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 154,
"end": 155,
"ctxt": 0
},
"value": "a",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 155,
"end": 164,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 157,
"end": 164,
"ctxt": 0
},
"kind": "boolean"
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 166,
"end": 180,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 170,
"end": 179,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 170,
"end": 171,
"ctxt": 0
},
"value": "b",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 171,
"end": 179,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 173,
"end": 179,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 173,
"end": 179,
"ctxt": 0
},
"value": "Object",
"optional": false
},
"typeParams": null
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 181,
"end": 193,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 185,
"end": 192,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 185,
"end": 186,
"ctxt": 0
},
"value": "c",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 186,
"end": 192,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 188,
"end": 192,
"ctxt": 0
},
"kind": "void"
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 194,
"end": 208,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 198,
"end": 207,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 198,
"end": 199,
"ctxt": 0
},
"value": "d",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 199,
"end": 207,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 201,
"end": 207,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 201,
"end": 207,
"ctxt": 0
},
"value": "Number",
"optional": false
},
"typeParams": null
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 240,
"end": 263,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 244,
"end": 262,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 244,
"end": 246,
"ctxt": 0
},
"value": "r1",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "BinaryExpression",
"span": {
"start": 249,
"end": 262,
"ctxt": 0
},
"operator": "+",
"left": {
"type": "Identifier",
"span": {
"start": 249,
"end": 258,
"ctxt": 0
},
"value": "undefined",
"optional": false
},
"right": {
"type": "Identifier",
"span": {
"start": 261,
"end": 262,
"ctxt": 0
},
"value": "a",
"optional": false
}
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 264,
"end": 287,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 268,
"end": 286,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 268,
"end": 270,
"ctxt": 0
},
"value": "r2",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "BinaryExpression",
"span": {
"start": 273,
"end": 286,
"ctxt": 0
},
"operator": "+",
"left": {
"type": "Identifier",
"span": {
"start": 273,
"end": 282,
"ctxt": 0
},
"value": "undefined",
"optional": false
},
"right": {
"type": "Identifier",
"span": {
"start": 285,
"end": 286,
"ctxt": 0
},
"value": "b",
"optional": false
}
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 288,
"end": 311,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 292,
"end": 310,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 292,
"end": 294,
"ctxt": 0
},
"value": "r3",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "BinaryExpression",
"span": {
"start": 297,
"end": 310,
"ctxt": 0
},
"operator": "+",
"left": {
"type": "Identifier",
"span": {
"start": 297,
"end": 306,
"ctxt": 0
},
"value": "undefined",
"optional": false
},
"right": {
"type": "Identifier",
"span": {
"start": 309,
"end": 310,
"ctxt": 0
},
"value": "c",
"optional": false
}
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 312,
"end": 335,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 316,
"end": 334,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 316,
"end": 318,
"ctxt": 0
},
"value": "r4",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "BinaryExpression",
"span": {
"start": 321,
"end": 334,
"ctxt": 0
},
"operator": "+",
"left": {
"type": "Identifier",
"span": {
"start": 321,
"end": 322,
"ctxt": 0
},
"value": "a",
"optional": false
},
"right": {
"type": "Identifier",
"span": {
"start": 325,
"end": 334,
"ctxt": 0
},
"value": "undefined",
"optional": false
}
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 336,
"end": 359,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 340,
"end": 358,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 340,
"end": 342,
"ctxt": 0
},
"value": "r5",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "BinaryExpression",
"span": {
"start": 345,
"end": 358,
"ctxt": 0
},
"operator": "+",
"left": {
"type": "Identifier",
"span": {
"start": 345,
"end": 346,
"ctxt": 0
},
"value": "b",
"optional": false
},
"right": {
"type": "Identifier",
"span": {
"start": 349,
"end": 358,
"ctxt": 0
},
"value": "undefined",
"optional": false
}
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 360,
"end": 383,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 364,
"end": 382,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 364,
"end": 366,
"ctxt": 0
},
"value": "r6",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "BinaryExpression",
"span": {
"start": 369,
"end": 382,
"ctxt": 0
},
"operator": "+",
"left": {
"type": "Identifier",
"span": {
"start": 369,
"end": 378,
"ctxt": 0
},
"value": "undefined",
"optional": false
},
"right": {
"type": "Identifier",
"span": {
"start": 381,
"end": 382,
"ctxt": 0
},
"value": "c",
"optional": false
}
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 400,
"end": 423,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 404,
"end": 422,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 404,
"end": 406,
"ctxt": 0
},
"value": "r7",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "BinaryExpression",
"span": {
"start": 409,
"end": 422,
"ctxt": 0
},
"operator": "+",
"left": {
"type": "Identifier",
"span": {
"start": 409,
"end": 418,
"ctxt": 0
},
"value": "undefined",
"optional": false
},
"right": {
"type": "Identifier",
"span": {
"start": 421,
"end": 422,
"ctxt": 0
},
"value": "d",
"optional": false
}
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 424,
"end": 450,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 428,
"end": 449,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 428,
"end": 430,
"ctxt": 0
},
"value": "r8",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "BinaryExpression",
"span": {
"start": 433,
"end": 449,
"ctxt": 0
},
"operator": "+",
"left": {
"type": "Identifier",
"span": {
"start": 433,
"end": 442,
"ctxt": 0
},
"value": "undefined",
"optional": false
},
"right": {
"type": "BooleanLiteral",
"span": {
"start": 445,
"end": 449,
"ctxt": 0
},
"value": true
}
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 451,
"end": 482,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 455,
"end": 481,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 455,
"end": 457,
"ctxt": 0
},
"value": "r9",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "BinaryExpression",
"span": {
"start": 460,
"end": 481,
"ctxt": 0
},
"operator": "+",
"left": {
"type": "Identifier",
"span": {
"start": 460,
"end": 469,
"ctxt": 0
},
"value": "undefined",
"optional": false
},
"right": {
"type": "ObjectExpression",
"span": {
"start": 472,
"end": 481,
"ctxt": 0
},
"properties": [
{
"type": "KeyValueProperty",
"key": {
"type": "Identifier",
"span": {
"start": 474,
"end": 475,
"ctxt": 0
},
"value": "a",
"optional": false
},
"value": {
"type": "StringLiteral",
"span": {
"start": 477,
"end": 479,
"ctxt": 0
},
"value": "",
"raw": "''"
}
}
]
}
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 483,
"end": 511,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 487,
"end": 510,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 487,
"end": 490,
"ctxt": 0
},
"value": "r10",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "BinaryExpression",
"span": {
"start": 493,
"end": 510,
"ctxt": 0
},
"operator": "+",
"left": {
"type": "Identifier",
"span": {
"start": 493,
"end": 502,
"ctxt": 0
},
"value": "undefined",
"optional": false
},
"right": {
"type": "CallExpression",
"span": {
"start": 505,
"end": 510,
"ctxt": 0
},
"callee": {
"type": "Identifier",
"span": {
"start": 505,
"end": 508,
"ctxt": 0
},
"value": "foo",
"optional": false
},
"arguments": [],
"typeArguments": null
}
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 512,
"end": 546,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 516,
"end": 545,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 516,
"end": 519,
"ctxt": 0
},
"value": "r11",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "BinaryExpression",
"span": {
"start": 522,
"end": 545,
"ctxt": 0
},
"operator": "+",
"left": {
"type": "Identifier",
"span": {
"start": 522,
"end": 531,
"ctxt": 0
},
"value": "undefined",
"optional": false
},
"right": {
"type": "ParenthesisExpression",
"span": {
"start": 534,
"end": 545,
"ctxt": 0
},
"expression": {
"type": "ArrowFunctionExpression",
"span": {
"start": 535,
"end": 544,
"ctxt": 0
},
"params": [],
"body": {
"type": "BlockStatement",
"span": {
"start": 541,
"end": 544,
"ctxt": 0
},
"stmts": []
},
"async": false,
"generator": false,
"typeParameters": null,
"returnType": null
}
}
},
"definite": false
}
]
}
],
"interpreter": null
}