Remove Expr.visit. (#10437)

* Remove Expr.visit.

It isn't used and doesn't have tests.

* Remove Visitor too.
This commit is contained in:
Gian Merlino 2020-09-28 22:13:10 -07:00 committed by GitHub
parent 1d6cb624f4
commit 599aacce0f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 2 additions and 95 deletions

View File

@ -46,14 +46,6 @@ abstract class BinaryOpExprBase implements Expr
this.right = right; this.right = right;
} }
@Override
public void visit(Visitor visitor)
{
left.visit(visitor);
right.visit(visitor);
visitor.visit(this);
}
@Override @Override
public Expr visit(Shuttle shuttle) public Expr visit(Shuttle shuttle)
{ {

View File

@ -57,12 +57,6 @@ abstract class ConstantExpr implements Expr
return true; return true;
} }
@Override
public void visit(Visitor visitor)
{
visitor.visit(this);
}
@Override @Override
public Expr visit(Shuttle shuttle) public Expr visit(Shuttle shuttle)
{ {

View File

@ -112,12 +112,6 @@ public interface Expr
*/ */
String stringify(); String stringify();
/**
* Programmatically inspect the {@link Expr} tree with a {@link Visitor}. Each {@link Expr} is responsible for
* ensuring the {@link Visitor} can visit all of its {@link Expr} children before visiting itself
*/
void visit(Visitor visitor);
/** /**
* Programatically rewrite the {@link Expr} tree with a {@link Shuttle}. Each {@link Expr} is responsible for * Programatically rewrite the {@link Expr} tree with a {@link Shuttle}. Each {@link Expr} is responsible for
* ensuring the {@link Shuttle} can visit all of its {@link Expr} children, as well as updating its children * ensuring the {@link Shuttle} can visit all of its {@link Expr} children, as well as updating its children
@ -252,25 +246,15 @@ public interface Expr
<T> T[] getObjectVector(String name); <T> T[] getObjectVector(String name);
long[] getLongVector(String name); long[] getLongVector(String name);
double[] getDoubleVector(String name); double[] getDoubleVector(String name);
@Nullable @Nullable
boolean[] getNullVector(String name); boolean[] getNullVector(String name);
int getCurrentVectorSize(); int getCurrentVectorSize();
} }
/**
* Mechanism to inspect an {@link Expr}, implementing a {@link Visitor} allows visiting all children of an
* {@link Expr}
*/
interface Visitor
{
/**
* Provide the {@link Visitor} with an {@link Expr} to inspect
*/
void visit(Expr expr);
}
/** /**
* Mechanism to rewrite an {@link Expr}, implementing a {@link Shuttle} allows visiting all children of an * Mechanism to rewrite an {@link Expr}, implementing a {@link Shuttle} allows visiting all children of an
* {@link Expr}, and replacing them as desired. * {@link Expr}, and replacing them as desired.

View File

@ -111,13 +111,6 @@ public class ExprMacroTable
analyzeInputsSupplier = Suppliers.memoize(this::supplyAnalyzeInputs); analyzeInputsSupplier = Suppliers.memoize(this::supplyAnalyzeInputs);
} }
@Override
public void visit(final Visitor visitor)
{
arg.visit(visitor);
visitor.visit(this);
}
@Override @Override
public BindingAnalysis analyzeInputs() public BindingAnalysis analyzeInputs()
{ {
@ -184,15 +177,6 @@ public class ExprMacroTable
); );
} }
@Override
public void visit(final Visitor visitor)
{
for (Expr arg : args) {
arg.visit(visitor);
}
visitor.visit(this);
}
@Override @Override
public BindingAnalysis analyzeInputs() public BindingAnalysis analyzeInputs()
{ {

View File

@ -101,13 +101,6 @@ class LambdaExpr implements Expr
return StringUtils.format("(%s) -> %s", ARG_JOINER.join(getIdentifiers()), expr.stringify()); return StringUtils.format("(%s) -> %s", ARG_JOINER.join(getIdentifiers()), expr.stringify());
} }
@Override
public void visit(Visitor visitor)
{
expr.visit(visitor);
visitor.visit(this);
}
@Override @Override
public Expr visit(Shuttle shuttle) public Expr visit(Shuttle shuttle)
{ {
@ -201,15 +194,6 @@ class FunctionExpr implements Expr
return StringUtils.format("%s(%s)", name, ARG_JOINER.join(args.stream().map(Expr::stringify).iterator())); return StringUtils.format("%s(%s)", name, ARG_JOINER.join(args.stream().map(Expr::stringify).iterator()));
} }
@Override
public void visit(Visitor visitor)
{
for (Expr child : args) {
child.visit(visitor);
}
visitor.visit(this);
}
@Override @Override
public Expr visit(Shuttle shuttle) public Expr visit(Shuttle shuttle)
{ {
@ -338,16 +322,6 @@ class ApplyFunctionExpr implements Expr
); );
} }
@Override
public void visit(Visitor visitor)
{
lambdaExpr.visit(visitor);
for (Expr arg : argsExpr) {
arg.visit(visitor);
}
visitor.visit(this);
}
@Override @Override
public Expr visit(Shuttle shuttle) public Expr visit(Shuttle shuttle)
{ {

View File

@ -131,12 +131,6 @@ class IdentifierExpr implements Expr
return StringUtils.format("\"%s\"", StringEscapeUtils.escapeJava(binding)); return StringUtils.format("\"%s\"", StringEscapeUtils.escapeJava(binding));
} }
@Override
public void visit(Visitor visitor)
{
visitor.visit(this);
}
@Override @Override
public Expr visit(Shuttle shuttle) public Expr visit(Shuttle shuttle)
{ {

View File

@ -45,13 +45,6 @@ abstract class UnaryExpr implements Expr
abstract UnaryExpr copy(Expr expr); abstract UnaryExpr copy(Expr expr);
@Override
public void visit(Visitor visitor)
{
expr.visit(visitor);
visitor.visit(this);
}
@Override @Override
public Expr visit(Shuttle shuttle) public Expr visit(Shuttle shuttle)
{ {

View File

@ -282,14 +282,6 @@ public abstract class TrimExprMacro implements ExprMacroTable.ExprMacro
return StringUtils.format("%s(%s, %s)", mode.getFnName(), stringExpr.stringify(), charsExpr.stringify()); return StringUtils.format("%s(%s, %s)", mode.getFnName(), stringExpr.stringify(), charsExpr.stringify());
} }
@Override
public void visit(final Visitor visitor)
{
stringExpr.visit(visitor);
charsExpr.visit(visitor);
visitor.visit(this);
}
@Override @Override
public Expr visit(Shuttle shuttle) public Expr visit(Shuttle shuttle)
{ {