use of org.eclipse.n4js.flowgraphs.model.RepresentingNode in project n4js by eclipse.
the class PathWalkerGuide method visitNode.
@Override
public void visitNode(Node node) {
if (node instanceof RepresentingNode) {
ControlFlowElement cfeEnd = node.getRepresentedControlFlowElement();
if (lastVisitedNode != null) {
ControlFlowElement cfeStart = lastVisitedNode.getRepresentedControlFlowElement();
FlowEdge edge = new FlowEdge(cfeStart, cfeEnd, cfTypes);
walker.visit(edge);
}
cfTypes.clear();
walker.visit(cfeEnd);
lastVisitedNode = node;
}
}
use of org.eclipse.n4js.flowgraphs.model.RepresentingNode in project n4js by eclipse.
the class BranchWalker method visit.
@Override
protected final void visit(Node node) {
if (node instanceof RepresentingNode) {
lastRN = node;
ControlFlowElement cfe = node.getRepresentedControlFlowElement();
visit(cfe);
return;
}
if (this.getContainer() == node.getControlFlowElement()) {
ControlFlowElement cfe = node.getControlFlowElement();
if (lastRN == null) {
enterContainer(cfe);
} else {
exitContainer(cfe);
}
lastRN = node;
}
}
use of org.eclipse.n4js.flowgraphs.model.RepresentingNode in project n4js by eclipse.
the class ConditionalExpressionFactory method buildComplexNode.
static ComplexNode buildComplexNode(ReentrantASTIterator astpp, ConditionalExpression condExpr) {
ComplexNode cNode = new ComplexNode(astpp.container(), condExpr);
HelperNode entryNode = new HelperNode(NodeNames.ENTRY, astpp.pos(), condExpr);
Node conditionNode = DelegatingNodeFactory.createOrHelper(astpp, NodeNames.CONDITION, condExpr, condExpr.getExpression());
HelperNode conditionForkNode = new HelperNode(NodeNames.CONDITION_FORK, astpp.pos(), condExpr);
Node thenNode = DelegatingNodeFactory.createOrHelper(astpp, NodeNames.THEN, condExpr, condExpr.getTrueExpression());
Node elseNode = DelegatingNodeFactory.createOrHelper(astpp, NodeNames.ELSE, condExpr, condExpr.getFalseExpression());
Node exitNode = new RepresentingNode(NodeNames.EXIT, astpp.pos(), condExpr);
cNode.addNode(entryNode);
cNode.addNode(conditionNode);
cNode.addNode(conditionForkNode);
cNode.addNode(thenNode);
cNode.addNode(elseNode);
cNode.addNode(exitNode);
cNode.connectInternalSucc(entryNode, conditionNode, conditionForkNode);
cNode.connectInternalSucc(ControlFlowType.IfTrue, conditionForkNode, thenNode);
cNode.connectInternalSucc(thenNode, exitNode);
cNode.connectInternalSucc(ControlFlowType.IfFalse, conditionForkNode, elseNode);
cNode.connectInternalSucc(elseNode, exitNode);
// catch for short-circuits
thenNode.addCatchToken(new CatchToken(ControlFlowType.IfTrue));
// catch for short-circuits
elseNode.addCatchToken(new CatchToken(ControlFlowType.IfFalse));
cNode.setEntryNode(entryNode);
cNode.setExitNode(exitNode);
return cNode;
}
use of org.eclipse.n4js.flowgraphs.model.RepresentingNode in project n4js by eclipse.
the class DebuggerStatementFactory method buildComplexNode.
static ComplexNode buildComplexNode(ReentrantASTIterator astpp, DebuggerStatement empty) {
ComplexNode cNode = new ComplexNode(astpp.container(), empty);
Node entryAndExitNode = new RepresentingNode(NodeNames.ENTRY_EXIT, astpp.pos(), empty);
cNode.addNode(entryAndExitNode);
cNode.setEntryNode(entryAndExitNode);
cNode.setExitNode(entryAndExitNode);
return cNode;
}
use of org.eclipse.n4js.flowgraphs.model.RepresentingNode in project n4js by eclipse.
the class EmptyStatementFactory method buildComplexNode.
static ComplexNode buildComplexNode(ReentrantASTIterator astpp, Statement empty) {
ComplexNode cNode = new ComplexNode(astpp.container(), empty);
Node entryAndExitNode = new RepresentingNode(NodeNames.ENTRY_EXIT, astpp.pos(), empty);
cNode.addNode(entryAndExitNode);
cNode.setEntryNode(entryAndExitNode);
cNode.setExitNode(entryAndExitNode);
return cNode;
}
Aggregations