JBinaryOperation binOp = new JBinaryOperation(sourceInfo, type,
JBinaryOperator.OR, condExpr, elseExpr);
return binOp;
} else {
// e.g. (cond ? false : else) -> !cond && else
JPrefixOperation notCondExpr = new JPrefixOperation(
condExpr.getSourceInfo(), JUnaryOperator.NOT, condExpr);
JBinaryOperation binOp = new JBinaryOperation(sourceInfo, type,
JBinaryOperator.AND, notCondExpr, elseExpr);
return binOp;
}
} else if (elseExpr instanceof JBooleanLiteral) {
if (((JBooleanLiteral) elseExpr).getValue()) {
// e.g. (cond ? then : true) -> !cond || then
JPrefixOperation notCondExpr = new JPrefixOperation(
condExpr.getSourceInfo(), JUnaryOperator.NOT, condExpr);
JBinaryOperation binOp = new JBinaryOperation(sourceInfo, type,
JBinaryOperator.OR, notCondExpr, thenExpr);
return binOp;
} else {