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

234 lines
6.0 KiB
JSON

{
"type": "Script",
"span": {
"start": 1,
"end": 68,
"ctxt": 0
},
"body": [
{
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 10,
"end": 11,
"ctxt": 0
},
"value": "f",
"optional": false
},
"declare": false,
"params": [],
"decorators": [],
"span": {
"start": 1,
"end": 68,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 14,
"end": 68,
"ctxt": 0
},
"stmts": [
{
"type": "VariableDeclaration",
"span": {
"start": 20,
"end": 32,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 24,
"end": 25,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 24,
"end": 25,
"ctxt": 0
},
"value": "a",
"optional": false,
"typeAnnotation": null
},
"init": null,
"definite": false
},
{
"type": "VariableDeclarator",
"span": {
"start": 27,
"end": 28,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 27,
"end": 28,
"ctxt": 0
},
"value": "b",
"optional": false,
"typeAnnotation": null
},
"init": null,
"definite": false
},
{
"type": "VariableDeclarator",
"span": {
"start": 30,
"end": 31,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 30,
"end": 31,
"ctxt": 0
},
"value": "c",
"optional": false,
"typeAnnotation": null
},
"init": null,
"definite": false
}
]
},
{
"type": "IfStatement",
"span": {
"start": 37,
"end": 66,
"ctxt": 0
},
"test": {
"type": "BinaryExpression",
"span": {
"start": 41,
"end": 61,
"ctxt": 0
},
"operator": "&&",
"left": {
"type": "BinaryExpression",
"span": {
"start": 41,
"end": 46,
"ctxt": 0
},
"operator": "<",
"left": {
"type": "Identifier",
"span": {
"start": 41,
"end": 42,
"ctxt": 0
},
"value": "a",
"optional": false
},
"right": {
"type": "Identifier",
"span": {
"start": 45,
"end": 46,
"ctxt": 0
},
"value": "b",
"optional": false
}
},
"right": {
"type": "BinaryExpression",
"span": {
"start": 50,
"end": 61,
"ctxt": 0
},
"operator": ">",
"left": {
"type": "Identifier",
"span": {
"start": 50,
"end": 51,
"ctxt": 0
},
"value": "b",
"optional": false
},
"right": {
"type": "ParenthesisExpression",
"span": {
"start": 54,
"end": 61,
"ctxt": 0
},
"expression": {
"type": "BinaryExpression",
"span": {
"start": 55,
"end": 60,
"ctxt": 0
},
"operator": "+",
"left": {
"type": "Identifier",
"span": {
"start": 55,
"end": 56,
"ctxt": 0
},
"value": "c",
"optional": false
},
"right": {
"type": "NumericLiteral",
"span": {
"start": 59,
"end": 60,
"ctxt": 0
},
"value": 1.0,
"raw": "1"
}
}
}
}
},
"consequent": {
"type": "BlockStatement",
"span": {
"start": 63,
"end": 66,
"ctxt": 0
},
"stmts": []
},
"alternate": null
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
}
],
"interpreter": null
}