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

240 lines
6.3 KiB
JSON

{
"type": "Script",
"span": {
"start": 1,
"end": 62,
"ctxt": 0
},
"body": [
{
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 10,
"end": 11,
"ctxt": 0
},
"value": "g",
"optional": false
},
"declare": false,
"params": [],
"decorators": [],
"span": {
"start": 1,
"end": 62,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 14,
"end": 62,
"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": 60,
"ctxt": 0
},
"test": {
"type": "CallExpression",
"span": {
"start": 41,
"end": 55,
"ctxt": 0
},
"callee": {
"type": "Identifier",
"span": {
"start": 41,
"end": 42,
"ctxt": 0
},
"value": "a",
"optional": false
},
"arguments": [
{
"spread": null,
"expression": {
"type": "BinaryExpression",
"span": {
"start": 49,
"end": 54,
"ctxt": 0
},
"operator": "+",
"left": {
"type": "Identifier",
"span": {
"start": 49,
"end": 50,
"ctxt": 0
},
"value": "c",
"optional": false
},
"right": {
"type": "NumericLiteral",
"span": {
"start": 53,
"end": 54,
"ctxt": 0
},
"value": 1.0,
"raw": "1"
}
}
}
],
"typeArguments": {
"type": "TsTypeParameterInstantiation",
"span": {
"start": 42,
"end": 48,
"ctxt": 0
},
"params": [
{
"type": "TsTypeReference",
"span": {
"start": 43,
"end": 44,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 43,
"end": 44,
"ctxt": 0
},
"value": "b",
"optional": false
},
"typeParams": null
},
{
"type": "TsTypeReference",
"span": {
"start": 46,
"end": 47,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 46,
"end": 47,
"ctxt": 0
},
"value": "b",
"optional": false
},
"typeParams": null
}
]
}
},
"consequent": {
"type": "BlockStatement",
"span": {
"start": 57,
"end": 60,
"ctxt": 0
},
"stmts": []
},
"alternate": null
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
}
],
"interpreter": null
}