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

376 lines
8.4 KiB
JSON
Raw Normal View History

{
"type": "Script",
"span": {
"start": 0,
"end": 125,
"ctxt": 0
},
"body": [
{
"type": "VariableDeclaration",
"span": {
"start": 0,
"end": 33,
"ctxt": 0
},
"kind": "let",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 4,
"end": 32,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 4,
"end": 5,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 5,
"end": 32,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsUnionType",
"span": {
"start": 7,
"end": 32,
"ctxt": 0
},
"types": [
{
"type": "TsKeywordType",
"span": {
"start": 7,
"end": 13,
"ctxt": 0
},
"kind": "string"
},
{
"type": "TsKeywordType",
"span": {
"start": 16,
"end": 22,
"ctxt": 0
},
"kind": "number"
},
{
"type": "TsKeywordType",
"span": {
"start": 25,
"end": 32,
"ctxt": 0
},
"kind": "boolean"
}
]
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 34,
"end": 52,
"ctxt": 0
},
"kind": "let",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 38,
"end": 51,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 38,
"end": 42,
"ctxt": 0
},
"value": "cond",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 42,
"end": 51,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 44,
"end": 51,
"ctxt": 0
},
"kind": "boolean"
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "ExpressionStatement",
"span": {
"start": 54,
"end": 74,
"ctxt": 0
},
"expression": {
"type": "BinaryExpression",
"span": {
"start": 54,
"end": 73,
"ctxt": 0
},
"operator": "&&",
"left": {
"type": "ParenthesisExpression",
"span": {
"start": 54,
"end": 62,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 55,
"end": 61,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "Identifier",
"span": {
"start": 55,
"end": 56,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "StringLiteral",
"span": {
"start": 59,
"end": 61,
"ctxt": 0
},
"value": "",
"hasEscape": false,
"kind": {
"type": "normal",
"containsQuote": true
}
}
}
},
"right": {
"type": "ParenthesisExpression",
"span": {
"start": 66,
"end": 73,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 67,
"end": 72,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "Identifier",
"span": {
"start": 67,
"end": 68,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "NumericLiteral",
"span": {
"start": 71,
"end": 72,
"ctxt": 0
},
"value": 0.0
}
}
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 75,
"end": 77,
"ctxt": 0
},
"expression": {
"type": "Identifier",
"span": {
"start": 75,
"end": 76,
"ctxt": 0
},
"value": "x",
"optional": false
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 98,
"end": 105,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 98,
"end": 104,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "Identifier",
"span": {
"start": 98,
"end": 99,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "StringLiteral",
"span": {
"start": 102,
"end": 104,
"ctxt": 0
},
"value": "",
"hasEscape": false,
"kind": {
"type": "normal",
"containsQuote": true
}
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 106,
"end": 122,
"ctxt": 0
},
"expression": {
"type": "BinaryExpression",
"span": {
"start": 106,
"end": 121,
"ctxt": 0
},
"operator": "&&",
"left": {
"type": "Identifier",
"span": {
"start": 106,
"end": 110,
"ctxt": 0
},
"value": "cond",
"optional": false
},
"right": {
"type": "ParenthesisExpression",
"span": {
"start": 114,
"end": 121,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 115,
"end": 120,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "Identifier",
"span": {
"start": 115,
"end": 116,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "NumericLiteral",
"span": {
"start": 119,
"end": 120,
"ctxt": 0
},
"value": 0.0
}
}
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 123,
"end": 125,
"ctxt": 0
},
"expression": {
"type": "Identifier",
"span": {
"start": 123,
"end": 124,
"ctxt": 0
},
"value": "x",
"optional": false
}
}
],
"interpreter": null
}