void writeExpr(Expr expr) throws IOException { writeLocation(expr.getLocation()); expr.acceptVisitor(this); }
public static Expr invert(Expr expr) { UnaryExpr result = new UnaryExpr(); result.setOperand(expr); result.setOperation(UnaryOperation.NOT); result.setLocation(expr.getLocation()); return result; }
public static Expr invert(Expr expr) { if (expr instanceof UnaryExpr) { UnaryExpr unary = (UnaryExpr) expr; if (unary.getOperation() == UnaryOperation.NOT) { return unary.getOperand(); } } else if (expr instanceof BinaryExpr) { BinaryExpr binary = (BinaryExpr) expr; Expr a = binary.getFirstOperand(); Expr b = binary.getSecondOperand(); switch (binary.getOperation()) { case EQUALS: return Expr.binary(BinaryOperation.NOT_EQUALS, binary.getType(), a, b, expr.getLocation()); case NOT_EQUALS: return Expr.binary(BinaryOperation.EQUALS, binary.getType(), a, b, expr.getLocation()); case LESS: return Expr.binary(BinaryOperation.GREATER_OR_EQUALS, binary.getType(), a, b, expr.getLocation()); case LESS_OR_EQUALS: return Expr.binary(BinaryOperation.GREATER, binary.getType(), a, b, expr.getLocation()); case GREATER: return Expr.binary(BinaryOperation.LESS_OR_EQUALS, binary.getType(), a, b, expr.getLocation()); case GREATER_OR_EQUALS: return Expr.binary(BinaryOperation.LESS, binary.getType(), a, b, expr.getLocation()); default: break; } } return Expr.invert(expr); } }
cond.getConsequent().addAll(innerCond.getConsequent()); cond.setCondition(Expr.binary(BinaryOperation.AND, null, cond.getCondition(), innerCond.getCondition(), cond.getCondition().getLocation())); --i; } else if (cond.getAlternative().size() != 1
Expr newCondition = Expr.binary(BinaryOperation.AND, null, statement.getCondition(), ExprOptimizer.invert(cond.getCondition())); newCondition.setLocation(statement.getCondition().getLocation()); statement.setCondition(newCondition); } else {
while (true) { debugEmitter.emitStatementStart(); if (statement.getCondition().getLocation() != null) { pushLocation(statement.getCondition().getLocation()); precedence = Precedence.COMMA; statement.getCondition().acceptVisitor(this); if (statement.getCondition().getLocation() != null) { popLocation();
try { debugEmitter.emitStatementStart(); if (statement.getCondition() != null && statement.getCondition().getLocation() != null) { pushLocation(statement.getCondition().getLocation()); statement.getCondition().acceptVisitor(this); debugEmitter.emitCallSite(); if (statement.getCondition().getLocation() != null) { popLocation();
conditionalExpr.setConsequent(firstAssignment.getRightValue()); conditionalExpr.setAlternative(secondAssignment.getRightValue()); conditionalExpr.setLocation(statement.getCondition().getLocation()); AssignmentStatement assignment = new AssignmentStatement(); assignment.setLocation(conditionalExpr.getLocation());
try { debugEmitter.emitStatementStart(); if (statement.getValue().getLocation() != null) { pushLocation(statement.getValue().getLocation()); precedence = Precedence.min(); statement.getValue().acceptVisitor(this); if (statement.getValue().getLocation() != null) { popLocation();
void writeExpr(Expr expr) throws IOException { writeLocation(expr.getLocation()); expr.acceptVisitor(this); }
public static Expr invert(Expr expr) { UnaryExpr result = new UnaryExpr(); result.setOperand(expr); result.setOperation(UnaryOperation.NOT); result.setLocation(expr.getLocation()); return result; }
public static Expr invert(Expr expr) { if (expr instanceof UnaryExpr) { UnaryExpr unary = (UnaryExpr) expr; if (unary.getOperation() == UnaryOperation.NOT) { return unary.getOperand(); } } else if (expr instanceof BinaryExpr) { BinaryExpr binary = (BinaryExpr) expr; Expr a = binary.getFirstOperand(); Expr b = binary.getSecondOperand(); switch (binary.getOperation()) { case EQUALS: return Expr.binary(BinaryOperation.NOT_EQUALS, binary.getType(), a, b, expr.getLocation()); case NOT_EQUALS: return Expr.binary(BinaryOperation.EQUALS, binary.getType(), a, b, expr.getLocation()); case LESS: return Expr.binary(BinaryOperation.GREATER_OR_EQUALS, binary.getType(), a, b, expr.getLocation()); case LESS_OR_EQUALS: return Expr.binary(BinaryOperation.GREATER, binary.getType(), a, b); case GREATER: return Expr.binary(BinaryOperation.LESS_OR_EQUALS, binary.getType(), a, b, expr.getLocation()); case GREATER_OR_EQUALS: return Expr.binary(BinaryOperation.LESS, binary.getType(), a, b, expr.getLocation()); default: break; } } return Expr.invert(expr); } }
cond.getConsequent().addAll(innerCond.getConsequent()); cond.setCondition(Expr.binary(BinaryOperation.AND, null, cond.getCondition(), innerCond.getCondition(), cond.getCondition().getLocation())); --i; } else if (cond.getAlternative().size() != 1
Expr newCondition = Expr.binary(BinaryOperation.AND, null, statement.getCondition(), ExprOptimizer.invert(cond.getCondition())); newCondition.setLocation(statement.getCondition().getLocation()); statement.setCondition(newCondition); } else {
while (true) { debugEmitter.emitStatementStart(); if (statement.getCondition().getLocation() != null) { pushLocation(statement.getCondition().getLocation()); precedence = Precedence.COMMA; statement.getCondition().acceptVisitor(this); if (statement.getCondition().getLocation() != null) { popLocation();
try { debugEmitter.emitStatementStart(); if (statement.getCondition() != null && statement.getCondition().getLocation() != null) { pushLocation(statement.getCondition().getLocation()); statement.getCondition().acceptVisitor(this); debugEmitter.emitCallSite(); if (statement.getCondition().getLocation() != null) { popLocation();
conditionalExpr.setConsequent(firstAssignment.getRightValue()); conditionalExpr.setAlternative(secondAssignment.getRightValue()); conditionalExpr.setLocation(statement.getCondition().getLocation()); AssignmentStatement assignment = new AssignmentStatement(); assignment.setLocation(conditionalExpr.getLocation());
try { debugEmitter.emitStatementStart(); if (statement.getValue().getLocation() != null) { pushLocation(statement.getValue().getLocation()); precedence = Precedence.min(); statement.getValue().acceptVisitor(this); if (statement.getValue().getLocation() != null) { popLocation();