Search in sources :

Example 6 with ContinueStatement

use of org.eclipse.jdt.core.dom.ContinueStatement in project AutoRefactor by JnRouvignac.

the class CFGBuilder method buildCFG.

/**
 * Builds a CFG for the provided node.
 *
 * @param node the node for which to build a CFG.
 * @param state the blocks liveness state before current node
 * @param throwers the thrower blocks information
 * @return the blocks liveness state after current node
 */
public LivenessState buildCFG(ContinueStatement node, LivenessState state, ThrowerBlocks throwers) {
    final CFGBasicBlock basicBlock = getCFGBasicBlock(node, state);
    final Statement targetStmt;
    if (node.getLabel() != null) {
        targetStmt = findLabeledParentStmt(node);
    } else {
        targetStmt = findContinuableParentStmt(node);
    }
    addEdgeToBuild(targetStmt, new CFGEdgeBuilder(basicBlock), false);
    return state.copyLiveBasicBlock();
}
Also used : DoStatement(org.eclipse.jdt.core.dom.DoStatement) Statement(org.eclipse.jdt.core.dom.Statement) ContinueStatement(org.eclipse.jdt.core.dom.ContinueStatement) SynchronizedStatement(org.eclipse.jdt.core.dom.SynchronizedStatement) ThrowStatement(org.eclipse.jdt.core.dom.ThrowStatement) EnhancedForStatement(org.eclipse.jdt.core.dom.EnhancedForStatement) SwitchStatement(org.eclipse.jdt.core.dom.SwitchStatement) IfStatement(org.eclipse.jdt.core.dom.IfStatement) TypeDeclarationStatement(org.eclipse.jdt.core.dom.TypeDeclarationStatement) WhileStatement(org.eclipse.jdt.core.dom.WhileStatement) BreakStatement(org.eclipse.jdt.core.dom.BreakStatement) EmptyStatement(org.eclipse.jdt.core.dom.EmptyStatement) ExpressionStatement(org.eclipse.jdt.core.dom.ExpressionStatement) TryStatement(org.eclipse.jdt.core.dom.TryStatement) AssertStatement(org.eclipse.jdt.core.dom.AssertStatement) ReturnStatement(org.eclipse.jdt.core.dom.ReturnStatement) LabeledStatement(org.eclipse.jdt.core.dom.LabeledStatement) ForStatement(org.eclipse.jdt.core.dom.ForStatement) VariableDeclarationStatement(org.eclipse.jdt.core.dom.VariableDeclarationStatement) CFGEdgeBuilder(org.autorefactor.cfg.CFGEdgeBuilder)

Aggregations

ContinueStatement (org.eclipse.jdt.core.dom.ContinueStatement)6 DoStatement (org.eclipse.jdt.core.dom.DoStatement)6 EnhancedForStatement (org.eclipse.jdt.core.dom.EnhancedForStatement)6 ForStatement (org.eclipse.jdt.core.dom.ForStatement)6 Statement (org.eclipse.jdt.core.dom.Statement)6 VariableDeclarationStatement (org.eclipse.jdt.core.dom.VariableDeclarationStatement)6 WhileStatement (org.eclipse.jdt.core.dom.WhileStatement)6 LabeledStatement (org.eclipse.jdt.core.dom.LabeledStatement)5 ASTNode (org.eclipse.jdt.core.dom.ASTNode)4 ASTVisitor (org.eclipse.jdt.core.dom.ASTVisitor)4 BreakStatement (org.eclipse.jdt.core.dom.BreakStatement)4 ExpressionStatement (org.eclipse.jdt.core.dom.ExpressionStatement)4 ReturnStatement (org.eclipse.jdt.core.dom.ReturnStatement)4 SimpleName (org.eclipse.jdt.core.dom.SimpleName)4 SwitchStatement (org.eclipse.jdt.core.dom.SwitchStatement)4 Block (org.eclipse.jdt.core.dom.Block)3 TryStatement (org.eclipse.jdt.core.dom.TryStatement)3 ArrayList (java.util.ArrayList)2 LinkedList (java.util.LinkedList)2 AssertStatement (org.eclipse.jdt.core.dom.AssertStatement)2