Visitador: implemented doStmts
This commit is contained in:
parent
dc51f39176
commit
af1e41c592
1 changed files with 11 additions and 0 deletions
|
@ -2,6 +2,7 @@ package grafos;
|
|||
|
||||
import com.github.javaparser.ast.Node;
|
||||
import com.github.javaparser.ast.body.MethodDeclaration;
|
||||
import com.github.javaparser.ast.stmt.DoStmt;
|
||||
import com.github.javaparser.ast.stmt.ExpressionStmt;
|
||||
import com.github.javaparser.ast.stmt.IfStmt;
|
||||
import com.github.javaparser.ast.stmt.WhileStmt;
|
||||
|
@ -79,6 +80,16 @@ public class Visitador extends VoidVisitorAdapter<CFG> {
|
|||
prevNode = Collections.singletonList(whileStart);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visit(DoStmt n, CFG graph) {
|
||||
prevNode = new LinkedList<>(prevNode);
|
||||
prevNode.add(n.getCondition());
|
||||
n.getBody().accept(this, graph);
|
||||
graph.addNode(n.getCondition());
|
||||
graph.connect(prevNode, n.getCondition());
|
||||
prevNode = Collections.singletonList(n.getCondition());
|
||||
}
|
||||
|
||||
// Visitador de expresiones
|
||||
// Cada expresión encontrada genera un nodo en el CFG
|
||||
@Override
|
||||
|
|
Loading…
Reference in a new issue