This source file includes following definitions.
- visit
- flush
package org.chromium.devtools.jsdoc;
import com.google.javascript.rhino.head.ast.AstNode;
import com.google.javascript.rhino.head.ast.NodeVisitor;
import java.util.ArrayDeque;
import java.util.Deque;
public abstract class DoDidVisitorAdapter implements DoDidNodeVisitor, NodeVisitor {
private final Deque<AstNode> nodeStack = new ArrayDeque<>();
@Override
public boolean visit(AstNode node) {
AstNode topNode = nodeStack.peek();
if (topNode != null && topNode != node.getParent()) {
do {
topNode = nodeStack.pop();
didVisit(topNode);
} while (topNode.getParent() != node.getParent());
}
nodeStack.push(node);
doVisit(node);
return true;
}
public void flush() {
while (!nodeStack.isEmpty()) {
didVisit(nodeStack.remove());
}
}
}