@Override public void visit(UnaryExpr expr) { super.visit(expr); switch (expr.getOperation()) { case NULL_CHECK: consumer.consumeFunction("$rt_nullCheck"); break; default: break; } }
@Override public void visit(UnaryExpr expr) { try { output.writeByte(1); output.writeByte(expr.getOperation().ordinal()); output.writeByte(expr.getType() != null ? expr.getType().ordinal() + 1 : 0); writeExpr(expr.getOperand()); } catch (IOException e) { throw new IOExceptionWrapper(e); } }
@Override public void visit(UnaryExpr expr) { pushLocation(expr.getLocation()); try { expr.getOperand().acceptVisitor(this); Expr operand = resultExpr; if (expr.getOperation() == UnaryOperation.NEGATE && operand instanceof ConstantExpr) { ConstantExpr constantExpr = (ConstantExpr) operand; if (tryMakePositive(constantExpr)) { resultExpr = expr; return; } } expr.setOperand(operand); resultExpr = expr; } finally { popLocation(); } }
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); } }
@Override public void visit(UnaryExpr expr) { switch (expr.getOperation()) { case NOT: writer.print("(");
@Override public void visit(UnaryExpr expr) { switch (expr.getOperation()) { case INT_TO_BYTE: accept(expr.getOperand());
switch (expr.getOperation()) { case NOT: { if (expr.getType() == OperationType.LONG) {
@Override public void visit(UnaryExpr expr) { super.visit(expr); switch (expr.getOperation()) { case NULL_CHECK: consumer.consumeFunction("$rt_nullCheck"); break; default: break; } }
@Override public void visit(UnaryExpr expr) { try { output.writeByte(1); output.writeByte(expr.getOperation().ordinal()); output.writeByte(expr.getType() != null ? expr.getType().ordinal() + 1 : 0); writeExpr(expr.getOperand()); } catch (IOException e) { throw new IOExceptionWrapper(e); } }
@Override public void visit(UnaryExpr expr) { pushLocation(expr.getLocation()); try { expr.getOperand().acceptVisitor(this); Expr operand = resultExpr; if (expr.getOperation() == UnaryOperation.NEGATE && operand instanceof ConstantExpr) { ConstantExpr constantExpr = (ConstantExpr) operand; if (tryMakePositive(constantExpr)) { resultExpr = expr; return; } } expr.setOperand(operand); resultExpr = expr; } finally { popLocation(); } }
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); } }
@Override public void visit(UnaryExpr expr) { switch (expr.getOperation()) { case INT_TO_BYTE: accept(expr.getOperand());
switch (expr.getOperation()) { case NOT: { if (expr.getType() == OperationType.LONG) {