class NodeIterators.FunctionlessLocalScope {
@Override
public Node next() {
Node current = ancestors.pop();
if (current.getNext() == null) {
current = ancestors.peek();
// If this is a function node, skip it.
if (current.getType() == Token.FUNCTION) {
return next();
}
} else {
current = current.getNext();
ancestors.push(current);
// If this is a function node, skip it.
if (current.getType() == Token.FUNCTION) {
return next();
}
while (current.hasChildren()) {
current = current.getFirstChild();
ancestors.push(current);
// If this is a function node, skip it.
if (current.getType() == Token.FUNCTION) {
return next();
}
}
}
return current;
}
}
class NodeIterators.LocalVarMotion {
@Override
public Node next() {
Node next = lookAhead;
advanceLookAhead(false);
return next;
}
}
|