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

234 lines
6.0 KiB
JSON

{
"type": "Script",
"span": {
"start": 1,
"end": 69,
"ctxt": 0
},
"body": [
{
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 10,
"end": 12,
"ctxt": 0
},
"value": "f1",
"optional": false
},
"declare": false,
"params": [],
"decorators": [],
"span": {
"start": 1,
"end": 69,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 15,
"end": 69,
"ctxt": 0
},
"stmts": [
{
"type": "VariableDeclaration",
"span": {
"start": 21,
"end": 33,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 25,
"end": 26,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 25,
"end": 26,
"ctxt": 0
},
"value": "a",
"optional": false,
"typeAnnotation": null
},
"init": null,
"definite": false
},
{
"type": "VariableDeclarator",
"span": {
"start": 28,
"end": 29,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 28,
"end": 29,
"ctxt": 0
},
"value": "b",
"optional": false,
"typeAnnotation": null
},
"init": null,
"definite": false
},
{
"type": "VariableDeclarator",
"span": {
"start": 31,
"end": 32,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 31,
"end": 32,
"ctxt": 0
},
"value": "c",
"optional": false,
"typeAnnotation": null
},
"init": null,
"definite": false
}
]
},
{
"type": "IfStatement",
"span": {
"start": 38,
"end": 67,
"ctxt": 0
},
"test": {
"type": "BinaryExpression",
"span": {
"start": 42,
"end": 62,
"ctxt": 0
},
"operator": "||",
"left": {
"type": "BinaryExpression",
"span": {
"start": 42,
"end": 47,
"ctxt": 0
},
"operator": "<",
"left": {
"type": "Identifier",
"span": {
"start": 42,
"end": 43,
"ctxt": 0
},
"value": "a",
"optional": false
},
"right": {
"type": "Identifier",
"span": {
"start": 46,
"end": 47,
"ctxt": 0
},
"value": "b",
"optional": false
}
},
"right": {
"type": "BinaryExpression",
"span": {
"start": 51,
"end": 62,
"ctxt": 0
},
"operator": ">",
"left": {
"type": "Identifier",
"span": {
"start": 51,
"end": 52,
"ctxt": 0
},
"value": "b",
"optional": false
},
"right": {
"type": "ParenthesisExpression",
"span": {
"start": 55,
"end": 62,
"ctxt": 0
},
"expression": {
"type": "BinaryExpression",
"span": {
"start": 56,
"end": 61,
"ctxt": 0
},
"operator": "+",
"left": {
"type": "Identifier",
"span": {
"start": 56,
"end": 57,
"ctxt": 0
},
"value": "c",
"optional": false
},
"right": {
"type": "NumericLiteral",
"span": {
"start": 60,
"end": 61,
"ctxt": 0
},
"value": 1.0,
"raw": "1"
}
}
}
}
},
"consequent": {
"type": "BlockStatement",
"span": {
"start": 64,
"end": 67,
"ctxt": 0
},
"stmts": []
},
"alternate": null
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
}
],
"interpreter": null
}