use of com.google.javascript.jscomp.ControlFlowGraph.Branch in project closure-compiler by google.
the class ControlFlowAnalysisTest method getAllDownEdges.
/**
* Gets all the control flow edges of the given type from some node with
* the first token to some node with the second token.
* This edge must flow from a parent to one of its descendants.
*/
private static List<DiGraphEdge<Node, Branch>> getAllDownEdges(ControlFlowGraph<Node> cfg, Token startToken, Token endToken, Branch type) {
List<DiGraphEdge<Node, Branch>> edges = getAllEdges(cfg, startToken, endToken, type);
Iterator<DiGraphEdge<Node, Branch>> it = edges.iterator();
while (it.hasNext()) {
DiGraphEdge<Node, Branch> edge = it.next();
Node source = edge.getSource().getValue();
Node dest = edge.getDestination().getValue();
if (!isAncestor(source, dest)) {
it.remove();
}
}
return edges;
}
Aggregations