use of org.eclipse.n4js.flowgraphs.model.DelegatingNode in project n4js by eclipse.
the class DelegatingNodeFactory method create.
/**
* Returns control flow after the delegate {@link ControlFlowElement} was visited.
*
* @return a new {@link DelegatingNode} instance
*/
static DelegatingNode create(ReentrantASTIterator astpp, String name, ControlFlowElement parent, ControlFlowElement delegate) {
if (delegate == null) {
return null;
}
DelegatingNode node = new DelegatingNode(name, astpp.pos(), parent, delegate);
astpp.visitUtil(delegate);
return node;
}
use of org.eclipse.n4js.flowgraphs.model.DelegatingNode in project n4js by eclipse.
the class CFEChildren method addDelegatingNode.
static Node addDelegatingNode(ReentrantASTIterator astIter, List<Node> cfc, String name, ControlFlowElement cfe, ControlFlowElement delegate) {
if (delegate != null) {
DelegatingNode delegatingNode = DelegatingNodeFactory.create(astIter, name, cfe, delegate);
cfc.add(delegatingNode);
return delegatingNode;
}
return null;
}
use of org.eclipse.n4js.flowgraphs.model.DelegatingNode in project n4js by eclipse.
the class AbstractCaseClauseFactory method buildComplexNode.
static ComplexNode buildComplexNode(ReentrantASTIterator astpp, AbstractCaseClause abstrCaseClause) {
ComplexNode cNode = new ComplexNode(astpp.container(), abstrCaseClause);
Node entryNode = new HelperNode(NodeNames.ENTRY, astpp.pos(), abstrCaseClause);
List<Node> stmtNodes = new LinkedList<>();
Node caseConditionNode = null;
if (abstrCaseClause instanceof CaseClause) {
CaseClause caseClause = (CaseClause) abstrCaseClause;
caseConditionNode = DelegatingNodeFactory.create(astpp, NodeNames.CONDITION, caseClause, caseClause.getExpression());
}
EList<Statement> stmts = abstrCaseClause.getStatements();
for (int i = 0; i < stmts.size(); i++) {
Statement stmt = stmts.get(i);
Node blockNode = new DelegatingNode("stmt_" + i, astpp.pos(), abstrCaseClause, stmt);
stmtNodes.add(blockNode);
astpp.visitUtil(blockNode.getDelegatedControlFlowElement());
}
Node exitNode = new HelperNode(NodeNames.EXIT, astpp.pos(), abstrCaseClause);
cNode.addNode(entryNode);
cNode.addNode(caseConditionNode);
for (Node blockNode : stmtNodes) cNode.addNode(blockNode);
cNode.addNode(exitNode);
List<Node> nodes = new LinkedList<>();
nodes.add(entryNode);
nodes.add(caseConditionNode);
nodes.addAll(stmtNodes);
nodes.add(exitNode);
cNode.connectInternalSucc(nodes);
cNode.setEntryNode(entryNode);
cNode.setExitNode(exitNode);
return cNode;
}
Aggregations