Remove EnclosedExpr support from functions that no longer require it

bzip2
Graham 5 years ago
parent 4e3c5f3d4d
commit 81f5fcf6dc
  1. 5
      deob-ast/src/main/java/dev/openrs2/deob/ast/util/ExprUtils.java

@ -32,7 +32,6 @@ public final class ExprUtils {
} }
} }
// TODO(gpe): need to be careful about operator precedence/EnclosedExpr
public static Expression not(Expression expr) { public static Expression not(Expression expr) {
if (expr.isUnaryExpr()) { if (expr.isUnaryExpr()) {
var unary = expr.asUnaryExpr(); var unary = expr.asUnaryExpr();
@ -65,8 +64,6 @@ public final class ExprUtils {
} }
} else if (expr.isBooleanLiteralExpr()) { } else if (expr.isBooleanLiteralExpr()) {
return new BooleanLiteralExpr(!expr.asBooleanLiteralExpr().getValue()); return new BooleanLiteralExpr(!expr.asBooleanLiteralExpr().getValue());
} else if (expr.isEnclosedExpr()) {
return not(expr.asEnclosedExpr().getInner());
} }
return new UnaryExpr(expr.clone(), UnaryExpr.Operator.LOGICAL_COMPLEMENT); return new UnaryExpr(expr.clone(), UnaryExpr.Operator.LOGICAL_COMPLEMENT);
} }
@ -92,8 +89,6 @@ public final class ExprUtils {
public static boolean hasSideEffects(Expression expr) { public static boolean hasSideEffects(Expression expr) {
if (expr.isLiteralExpr() || expr.isNameExpr() | expr.isFieldAccessExpr()) { if (expr.isLiteralExpr() || expr.isNameExpr() | expr.isFieldAccessExpr()) {
return false; return false;
} else if (expr.isEnclosedExpr()) {
return hasSideEffects(expr.asEnclosedExpr().getInner());
} else if (expr.isUnaryExpr()) { } else if (expr.isUnaryExpr()) {
return hasSideEffects(expr.asUnaryExpr().getExpression()); return hasSideEffects(expr.asUnaryExpr().getExpression());
} else if (expr.isBinaryExpr()) { } else if (expr.isBinaryExpr()) {

Loading…
Cancel
Save