JsExpression condExpr = x.getTestExpression();
JsExpression thenExpr = x.getThenExpression();
JsExpression elseExpr = x.getElseExpression();
if (condExpr instanceof CanBooleanEval) {
CanBooleanEval condEval = (CanBooleanEval) condExpr;
if (condEval.isBooleanTrue()) {
// e.g. (true() ? then : else) -> true() && then
JsBinaryOperation binOp = new JsBinaryOperation(JsBinaryOperator.AND,
condExpr, thenExpr);
ctx.replaceMe(accept(binOp));
} else if (condEval.isBooleanFalse()) {
// e.g. (false() ? then : else) -> false() || else
JsBinaryOperation binOp = new JsBinaryOperation(JsBinaryOperator.OR,
condExpr, elseExpr);
ctx.replaceMe(accept(binOp));
}