swc/crates/swc_ecma_parser/tests/tsc/parser15.4.4.14-9-2.json

1018 lines
32 KiB
JSON

{
"type": "Script",
"span": {
"start": 514,
"end": 1031,
"ctxt": 0
},
"body": [
{
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 523,
"end": 531,
"ctxt": 0
},
"value": "testcase",
"optional": false
},
"declare": false,
"params": [],
"decorators": [],
"span": {
"start": 514,
"end": 1008,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 534,
"end": 1008,
"ctxt": 0
},
"stmts": [
{
"type": "VariableDeclaration",
"span": {
"start": 538,
"end": 581,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 542,
"end": 580,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 542,
"end": 545,
"ctxt": 0
},
"value": "obj",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "ObjectExpression",
"span": {
"start": 548,
"end": 580,
"ctxt": 0
},
"properties": [
{
"type": "KeyValueProperty",
"key": {
"type": "Identifier",
"span": {
"start": 549,
"end": 557,
"ctxt": 0
},
"value": "toString",
"optional": false
},
"value": {
"type": "FunctionExpression",
"identifier": null,
"params": [],
"decorators": [],
"span": {
"start": 558,
"end": 579,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 569,
"end": 579,
"ctxt": 0
},
"stmts": [
{
"type": "ReturnStatement",
"span": {
"start": 570,
"end": 578,
"ctxt": 0
},
"argument": {
"type": "NumericLiteral",
"span": {
"start": 577,
"end": 578,
"ctxt": 0
},
"value": 0.0,
"raw": "0"
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
}
}
]
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 584,
"end": 596,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 588,
"end": 595,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 588,
"end": 591,
"ctxt": 0
},
"value": "one",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "NumericLiteral",
"span": {
"start": 594,
"end": 595,
"ctxt": 0
},
"value": 1.0,
"raw": "1"
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 599,
"end": 619,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 603,
"end": 618,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 603,
"end": 609,
"ctxt": 0
},
"value": "_float",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "UnaryExpression",
"span": {
"start": 612,
"end": 618,
"ctxt": 0
},
"operator": "-",
"argument": {
"type": "ParenthesisExpression",
"span": {
"start": 613,
"end": 618,
"ctxt": 0
},
"expression": {
"type": "BinaryExpression",
"span": {
"start": 614,
"end": 617,
"ctxt": 0
},
"operator": "/",
"left": {
"type": "NumericLiteral",
"span": {
"start": 614,
"end": 615,
"ctxt": 0
},
"value": 4.0,
"raw": "4"
},
"right": {
"type": "NumericLiteral",
"span": {
"start": 616,
"end": 617,
"ctxt": 0
},
"value": 3.0,
"raw": "3"
}
}
}
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 622,
"end": 738,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 626,
"end": 737,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 626,
"end": 627,
"ctxt": 0
},
"value": "a",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "NewExpression",
"span": {
"start": 630,
"end": 737,
"ctxt": 0
},
"callee": {
"type": "Identifier",
"span": {
"start": 634,
"end": 639,
"ctxt": 0
},
"value": "Array",
"optional": false
},
"arguments": [
{
"spread": null,
"expression": {
"type": "BooleanLiteral",
"span": {
"start": 640,
"end": 645,
"ctxt": 0
},
"value": false
}
},
{
"spread": null,
"expression": {
"type": "Identifier",
"span": {
"start": 646,
"end": 655,
"ctxt": 0
},
"value": "undefined",
"optional": false
}
},
{
"spread": null,
"expression": {
"type": "NullLiteral",
"span": {
"start": 656,
"end": 660,
"ctxt": 0
}
}
},
{
"spread": null,
"expression": {
"type": "StringLiteral",
"span": {
"start": 661,
"end": 664,
"ctxt": 0
},
"value": "0",
"raw": "\"0\""
}
},
{
"spread": null,
"expression": {
"type": "Identifier",
"span": {
"start": 665,
"end": 668,
"ctxt": 0
},
"value": "obj",
"optional": false
}
},
{
"spread": null,
"expression": {
"type": "UnaryExpression",
"span": {
"start": 669,
"end": 685,
"ctxt": 0
},
"operator": "-",
"argument": {
"type": "NumericLiteral",
"span": {
"start": 670,
"end": 685,
"ctxt": 0
},
"value": 1.3333333333333,
"raw": "1.3333333333333"
}
}
},
{
"spread": null,
"expression": {
"type": "StringLiteral",
"span": {
"start": 687,
"end": 692,
"ctxt": 0
},
"value": "str",
"raw": "\"str\""
}
},
{
"spread": null,
"expression": {
"type": "UnaryExpression",
"span": {
"start": 693,
"end": 695,
"ctxt": 0
},
"operator": "-",
"argument": {
"type": "NumericLiteral",
"span": {
"start": 694,
"end": 695,
"ctxt": 0
},
"value": 0.0,
"raw": "0"
}
}
},
{
"spread": null,
"expression": {
"type": "BooleanLiteral",
"span": {
"start": 696,
"end": 700,
"ctxt": 0
},
"value": true
}
},
{
"spread": null,
"expression": {
"type": "UnaryExpression",
"span": {
"start": 701,
"end": 703,
"ctxt": 0
},
"operator": "+",
"argument": {
"type": "NumericLiteral",
"span": {
"start": 702,
"end": 703,
"ctxt": 0
},
"value": 0.0,
"raw": "0"
}
}
},
{
"spread": null,
"expression": {
"type": "Identifier",
"span": {
"start": 705,
"end": 708,
"ctxt": 0
},
"value": "one",
"optional": false
}
},
{
"spread": null,
"expression": {
"type": "NumericLiteral",
"span": {
"start": 710,
"end": 711,
"ctxt": 0
},
"value": 1.0,
"raw": "1"
}
},
{
"spread": null,
"expression": {
"type": "NumericLiteral",
"span": {
"start": 712,
"end": 713,
"ctxt": 0
},
"value": 0.0,
"raw": "0"
}
},
{
"spread": null,
"expression": {
"type": "BooleanLiteral",
"span": {
"start": 715,
"end": 720,
"ctxt": 0
},
"value": false
}
},
{
"spread": null,
"expression": {
"type": "Identifier",
"span": {
"start": 722,
"end": 728,
"ctxt": 0
},
"value": "_float",
"optional": false
}
},
{
"spread": null,
"expression": {
"type": "UnaryExpression",
"span": {
"start": 730,
"end": 736,
"ctxt": 0
},
"operator": "-",
"argument": {
"type": "ParenthesisExpression",
"span": {
"start": 731,
"end": 736,
"ctxt": 0
},
"expression": {
"type": "BinaryExpression",
"span": {
"start": 732,
"end": 735,
"ctxt": 0
},
"operator": "/",
"left": {
"type": "NumericLiteral",
"span": {
"start": 732,
"end": 733,
"ctxt": 0
},
"value": 4.0,
"raw": "4"
},
"right": {
"type": "NumericLiteral",
"span": {
"start": 734,
"end": 735,
"ctxt": 0
},
"value": 3.0,
"raw": "3"
}
}
}
}
}
],
"typeArguments": null
},
"definite": false
}
]
},
{
"type": "IfStatement",
"span": {
"start": 741,
"end": 1005,
"ctxt": 0
},
"test": {
"type": "BinaryExpression",
"span": {
"start": 745,
"end": 948,
"ctxt": 0
},
"operator": "&&",
"left": {
"type": "BinaryExpression",
"span": {
"start": 745,
"end": 888,
"ctxt": 0
},
"operator": "&&",
"left": {
"type": "BinaryExpression",
"span": {
"start": 745,
"end": 827,
"ctxt": 0
},
"operator": "&&",
"left": {
"type": "BinaryExpression",
"span": {
"start": 745,
"end": 769,
"ctxt": 0
},
"operator": "===",
"left": {
"type": "CallExpression",
"span": {
"start": 745,
"end": 762,
"ctxt": 0
},
"callee": {
"type": "MemberExpression",
"span": {
"start": 745,
"end": 754,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 745,
"end": 746,
"ctxt": 0
},
"value": "a",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 747,
"end": 754,
"ctxt": 0
},
"value": "indexOf",
"optional": false
}
},
"arguments": [
{
"spread": null,
"expression": {
"type": "UnaryExpression",
"span": {
"start": 755,
"end": 761,
"ctxt": 0
},
"operator": "-",
"argument": {
"type": "ParenthesisExpression",
"span": {
"start": 756,
"end": 761,
"ctxt": 0
},
"expression": {
"type": "BinaryExpression",
"span": {
"start": 757,
"end": 760,
"ctxt": 0
},
"operator": "/",
"left": {
"type": "NumericLiteral",
"span": {
"start": 757,
"end": 758,
"ctxt": 0
},
"value": 4.0,
"raw": "4"
},
"right": {
"type": "NumericLiteral",
"span": {
"start": 759,
"end": 760,
"ctxt": 0
},
"value": 3.0,
"raw": "3"
}
}
}
}
}
],
"typeArguments": null
},
"right": {
"type": "NumericLiteral",
"span": {
"start": 767,
"end": 769,
"ctxt": 0
},
"value": 14.0,
"raw": "14"
}
},
"right": {
"type": "BinaryExpression",
"span": {
"start": 809,
"end": 827,
"ctxt": 0
},
"operator": "===",
"left": {
"type": "CallExpression",
"span": {
"start": 809,
"end": 821,
"ctxt": 0
},
"callee": {
"type": "MemberExpression",
"span": {
"start": 809,
"end": 818,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 809,
"end": 810,
"ctxt": 0
},
"value": "a",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 811,
"end": 818,
"ctxt": 0
},
"value": "indexOf",
"optional": false
}
},
"arguments": [
{
"spread": null,
"expression": {
"type": "NumericLiteral",
"span": {
"start": 819,
"end": 820,
"ctxt": 0
},
"value": 0.0,
"raw": "0"
}
}
],
"typeArguments": null
},
"right": {
"type": "NumericLiteral",
"span": {
"start": 826,
"end": 827,
"ctxt": 0
},
"value": 7.0,
"raw": "7"
}
}
},
"right": {
"type": "BinaryExpression",
"span": {
"start": 869,
"end": 888,
"ctxt": 0
},
"operator": "===",
"left": {
"type": "CallExpression",
"span": {
"start": 869,
"end": 882,
"ctxt": 0
},
"callee": {
"type": "MemberExpression",
"span": {
"start": 869,
"end": 878,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 869,
"end": 870,
"ctxt": 0
},
"value": "a",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 871,
"end": 878,
"ctxt": 0
},
"value": "indexOf",
"optional": false
}
},
"arguments": [
{
"spread": null,
"expression": {
"type": "UnaryExpression",
"span": {
"start": 879,
"end": 881,
"ctxt": 0
},
"operator": "-",
"argument": {
"type": "NumericLiteral",
"span": {
"start": 880,
"end": 881,
"ctxt": 0
},
"value": 0.0,
"raw": "0"
}
}
}
],
"typeArguments": null
},
"right": {
"type": "NumericLiteral",
"span": {
"start": 887,
"end": 888,
"ctxt": 0
},
"value": 7.0,
"raw": "7"
}
}
},
"right": {
"type": "BinaryExpression",
"span": {
"start": 929,
"end": 948,
"ctxt": 0
},
"operator": "===",
"left": {
"type": "CallExpression",
"span": {
"start": 929,
"end": 941,
"ctxt": 0
},
"callee": {
"type": "MemberExpression",
"span": {
"start": 929,
"end": 938,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 929,
"end": 930,
"ctxt": 0
},
"value": "a",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 931,
"end": 938,
"ctxt": 0
},
"value": "indexOf",
"optional": false
}
},
"arguments": [
{
"spread": null,
"expression": {
"type": "NumericLiteral",
"span": {
"start": 939,
"end": 940,
"ctxt": 0
},
"value": 1.0,
"raw": "1"
}
}
],
"typeArguments": null
},
"right": {
"type": "NumericLiteral",
"span": {
"start": 946,
"end": 948,
"ctxt": 0
},
"value": 10.0,
"raw": "10"
}
}
},
"consequent": {
"type": "BlockStatement",
"span": {
"start": 983,
"end": 1005,
"ctxt": 0
},
"stmts": [
{
"type": "ReturnStatement",
"span": {
"start": 989,
"end": 1001,
"ctxt": 0
},
"argument": {
"type": "BooleanLiteral",
"span": {
"start": 996,
"end": 1000,
"ctxt": 0
},
"value": true
}
}
]
},
"alternate": null
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
},
{
"type": "ExpressionStatement",
"span": {
"start": 1009,
"end": 1031,
"ctxt": 0
},
"expression": {
"type": "CallExpression",
"span": {
"start": 1009,
"end": 1030,
"ctxt": 0
},
"callee": {
"type": "Identifier",
"span": {
"start": 1009,
"end": 1020,
"ctxt": 0
},
"value": "runTestCase",
"optional": false
},
"arguments": [
{
"spread": null,
"expression": {
"type": "Identifier",
"span": {
"start": 1021,
"end": 1029,
"ctxt": 0
},
"value": "testcase",
"optional": false
}
}
],
"typeArguments": null
}
}
],
"interpreter": null
}