Visitador: added support and test for foreachStmts
This commit is contained in:
parent
5a1d4b8e8d
commit
a5ba8831b2
2 changed files with 20 additions and 0 deletions
|
@ -137,6 +137,17 @@ public class Visitador extends VoidVisitorAdapter<CFG> {
|
|||
prevNode = Collections.emptyList();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visit(ForeachStmt n, CFG graph) {
|
||||
ForeachStmt copy = new ForeachStmt(n.getTokenRange().get(), n.getVariable(), n.getIterable(), new EmptyStmt());
|
||||
graph.addNode(copy);
|
||||
graph.connect(prevNode, copy);
|
||||
prevNode = Collections.singletonList(copy);
|
||||
n.getBody().accept(this, graph);
|
||||
graph.connect(prevNode, copy);
|
||||
prevNode = Collections.singletonList(copy);
|
||||
}
|
||||
|
||||
// Visitador de expresiones
|
||||
// Cada expresión encontrada genera un nodo en el CFG
|
||||
@Override
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue