Use Preconditions.checkArgument() in NegateExprVisitor

master
Graham 5 years ago
parent 27346725e3
commit 5e616b2d88
  1. 5
      deob-ast/src/main/java/dev/openrs2/deob/ast/visitor/NegateExprVisitor.java

@ -8,14 +8,13 @@ import com.github.javaparser.ast.expr.EnclosedExpr;
import com.github.javaparser.ast.expr.Expression;
import com.github.javaparser.ast.expr.UnaryExpr;
import com.github.javaparser.ast.visitor.GenericVisitorWithDefaults;
import com.google.common.base.Preconditions;
// TODO(gpe): need to be careful about operator precedence/EnclosedExpr
public final class NegateExprVisitor extends GenericVisitorWithDefaults<Expression, Void> {
@Override
public Expression defaultAction(Node n, Void arg) {
if (!(n instanceof Expression)) {
throw new IllegalArgumentException();
}
Preconditions.checkArgument(n instanceof Expression);
return new UnaryExpr((Expression) n, UnaryExpr.Operator.LOGICAL_COMPLEMENT);
}

Loading…
Cancel
Save