static class NodeIterators.LocalVarMotion extends java.lang.Object implements java.util.Iterator<Node>
var X = 1; var Y = 3; // X is still 1 if (Y) { // X is still 1 } else { X = 5; } // X may not be 1In the above example, the iterator will iterate past the declaration of Y and into the first block of the IF branch, and will stop at the assignment
X = 5
.Modifier and Type | Field and Description |
---|---|
private NodeIterators.FunctionlessLocalScope |
iterator |
private Node |
lookAhead |
private boolean |
valueHasSideEffects |
private java.lang.String |
varName |
Modifier | Constructor and Description |
---|---|
private |
LocalVarMotion(Node nameNode,
NodeIterators.FunctionlessLocalScope iterator) |
Modifier and Type | Method and Description |
---|---|
private void |
advanceLookAhead(boolean atStart) |
(package private) static NodeIterators.LocalVarMotion |
forAssign(Node name,
Node assign,
Node expr,
Node block) |
(package private) static NodeIterators.LocalVarMotion |
forVar(Node name,
Node var,
Node block) |
boolean |
hasNext() |
Node |
next() |
void |
remove() |
private final boolean valueHasSideEffects
private final NodeIterators.FunctionlessLocalScope iterator
private final java.lang.String varName
private Node lookAhead
private LocalVarMotion(Node nameNode, NodeIterators.FunctionlessLocalScope iterator)
iterator
- The iterator to use while inspecting the node
beginning with the deepest ancestor.static NodeIterators.LocalVarMotion forVar(Node name, Node var, Node block)
static NodeIterators.LocalVarMotion forAssign(Node name, Node assign, Node expr, Node block)
public boolean hasNext()
hasNext
in interface java.util.Iterator<Node>
public void remove()
remove
in interface java.util.Iterator<Node>
private void advanceLookAhead(boolean atStart)