Package com.strobel.expressions
Class StackSpiller.ChildRewriter
- java.lang.Object
-
- com.strobel.expressions.StackSpiller.ChildRewriter
-
- Enclosing class:
- StackSpiller
private final class StackSpiller.ChildRewriter extends java.lang.Object
Rewrites child expressions, spilling them into temps if needed. The stack starts in the initial state, and after the first sub-expression is added, it is change to non-empty. This behavior can be overridden by setting the stack manually between adds. When all children have been added, the caller should rewrite the node if didRewrite() is true. Then, it should call finish() with either the original expression or the rewritten expression. finish() will call Expression.comma() if necessary and return a new Result.
-
-
Field Summary
Fields Modifier and Type Field Description private StackSpiller.RewriteAction
_action
private java.util.List<Expression>
_comma
private boolean
_done
private Expression[]
_expressions
private int
_expressionsCount
private StackSpiller.Stack
_stack
-
Constructor Summary
Constructors Constructor Description ChildRewriter(StackSpiller.Stack stack, int count)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) void
add(Expression node)
(package private) void
add(ExpressionList expressions)
(package private) void
addArguments(IArgumentProvider expressions)
(package private) boolean
didRewrite()
private void
ensureDone()
(package private) StackSpiller.Result
Finish(Expression expr)
(package private) Expression
get(int index)
(package private) ExpressionList<? extends Expression>
get(int first, int last)
(package private) StackSpiller.RewriteAction
getAction()
-
-
-
Field Detail
-
_expressions
private final Expression[] _expressions
-
_expressionsCount
private int _expressionsCount
-
_comma
private java.util.List<Expression> _comma
-
_action
private StackSpiller.RewriteAction _action
-
_stack
private StackSpiller.Stack _stack
-
_done
private boolean _done
-
-
Constructor Detail
-
ChildRewriter
ChildRewriter(StackSpiller.Stack stack, int count)
-
-
Method Detail
-
add
void add(Expression node)
-
add
void add(ExpressionList expressions)
-
addArguments
void addArguments(IArgumentProvider expressions)
-
ensureDone
private void ensureDone()
-
didRewrite
boolean didRewrite()
-
getAction
StackSpiller.RewriteAction getAction()
-
Finish
StackSpiller.Result Finish(Expression expr)
-
get
Expression get(int index)
-
get
ExpressionList<? extends Expression> get(int first, int last)
-
-