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

267 lines
6.4 KiB
JSON

{
"type": "Script",
"span": {
"start": 1,
"end": 94,
"ctxt": 0
},
"body": [
{
"type": "VariableDeclaration",
"span": {
"start": 1,
"end": 12,
"ctxt": 0
},
"kind": "let",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 5,
"end": 11,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 5,
"end": 6,
"ctxt": 0
},
"value": "a",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 6,
"end": 11,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 8,
"end": 11,
"ctxt": 0
},
"kind": "any"
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 13,
"end": 52,
"ctxt": 0
},
"kind": "const",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 19,
"end": 51,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 19,
"end": 20,
"ctxt": 0
},
"value": "c",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "ConditionalExpression",
"span": {
"start": 23,
"end": 51,
"ctxt": 0
},
"test": {
"type": "BooleanLiteral",
"span": {
"start": 23,
"end": 27,
"ctxt": 0
},
"value": true
},
"consequent": {
"type": "ParenthesisExpression",
"span": {
"start": 30,
"end": 33,
"ctxt": 0
},
"expression": {
"type": "Identifier",
"span": {
"start": 31,
"end": 32,
"ctxt": 0
},
"value": "a",
"optional": false
}
},
"alternate": {
"type": "ParenthesisExpression",
"span": {
"start": 36,
"end": 51,
"ctxt": 0
},
"expression": {
"type": "FunctionExpression",
"identifier": null,
"params": [],
"decorators": [],
"span": {
"start": 37,
"end": 50,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 48,
"end": 50,
"ctxt": 0
},
"stmts": []
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
}
}
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 53,
"end": 94,
"ctxt": 0
},
"kind": "const",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 59,
"end": 93,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 59,
"end": 60,
"ctxt": 0
},
"value": "d",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "ConditionalExpression",
"span": {
"start": 63,
"end": 93,
"ctxt": 0
},
"test": {
"type": "BooleanLiteral",
"span": {
"start": 63,
"end": 67,
"ctxt": 0
},
"value": true
},
"consequent": {
"type": "ParenthesisExpression",
"span": {
"start": 70,
"end": 73,
"ctxt": 0
},
"expression": {
"type": "Identifier",
"span": {
"start": 71,
"end": 72,
"ctxt": 0
},
"value": "a",
"optional": false
}
},
"alternate": {
"type": "ParenthesisExpression",
"span": {
"start": 76,
"end": 93,
"ctxt": 0
},
"expression": {
"type": "ParenthesisExpression",
"span": {
"start": 77,
"end": 92,
"ctxt": 0
},
"expression": {
"type": "FunctionExpression",
"identifier": null,
"params": [],
"decorators": [],
"span": {
"start": 78,
"end": 91,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 89,
"end": 91,
"ctxt": 0
},
"stmts": []
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
}
}
}
},
"definite": false
}
]
}
],
"interpreter": null
}