org.eclipse.jdt.core.dom.ContinueStatement Java Examples
The following examples show how to use
org.eclipse.jdt.core.dom.ContinueStatement.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SwitchControlStructure.java From JDeodorant with MIT License | 6 votes |
private List<AbstractControlCase> createSwitchCases(SwitchStatement switchStatement) { List<AbstractControlCase> returnList = new ArrayList<AbstractControlCase>(); List<AbstractControlCase> tempList = new ArrayList<AbstractControlCase>(); List<Statement> switchGroupStatements = switchStatement.statements(); for (Statement currentStatement : switchGroupStatements) { if (currentStatement instanceof SwitchCase) { Expression caseValue = ((SwitchCase)currentStatement).getExpression(); SwitchControlCase newCase = new SwitchControlCase(this.variable, caseValue, new ArrayList<Statement>()); tempList.add(newCase); addToAll((SwitchCase)currentStatement, tempList); } else if (currentStatement instanceof BreakStatement || currentStatement instanceof ReturnStatement || currentStatement instanceof ContinueStatement) { addToAll(currentStatement, tempList); returnList.addAll(tempList); tempList = new ArrayList<AbstractControlCase>(); } } return returnList; }
Example #2
Source File: CFG.java From JDeodorant with MIT License | 6 votes |
private CFGNode createNonCompositeNode(StatementObject statement) { CFGNode currentNode; Statement astStatement = statement.getStatement(); if(astStatement instanceof ReturnStatement) currentNode = new CFGExitNode(statement); else if(astStatement instanceof SwitchCase) currentNode = new CFGSwitchCaseNode(statement); else if(astStatement instanceof BreakStatement) currentNode = new CFGBreakNode(statement); else if(astStatement instanceof ContinueStatement) currentNode = new CFGContinueNode(statement); else if(astStatement instanceof ThrowStatement) currentNode = new CFGThrowNode(statement); else currentNode = new CFGNode(statement); directlyNestedNodeInBlock(currentNode); return currentNode; }
Example #3
Source File: CodeSearch.java From SimFix with GNU General Public License v2.0 | 5 votes |
public boolean visit(ContinueStatement node) { int start = _unit.getLineNumber(node.getStartPosition()); if(start == _extendedLine){ _extendedStatement = node; return false; } return true; }
Example #4
Source File: StyledStringVisitor.java From JDeodorant with MIT License | 5 votes |
public boolean visit(ContinueStatement stmnt){ /* * continue [ Identifier ] ; */ styledString.append("continue", new StyledStringStyler(keywordStyle)); if (stmnt.getLabel() != null){ appendSpace(); handleExpression(stmnt.getLabel()); } appendSemicolon(); return false; }
Example #5
Source File: SwitchControlCase.java From JDeodorant with MIT License | 5 votes |
@Override public boolean match(SwitchControlCase otherCase, ASTNodeMatcher matcher) { if (this.body.size() == otherCase.body.size()) { boolean caseStatementsMatch = true; for (int i = 0; i < this.body.size(); i++) { Statement currentThisStatement = this.body.get(i); Statement currentOtherStatement = otherCase.body.get(i); boolean switchCaseStatementMatch = false; if (currentThisStatement instanceof SwitchCase && currentOtherStatement instanceof SwitchCase) { SwitchCase currentThisSwitchCase = (SwitchCase)currentThisStatement; SwitchCase currentOtherSwitchCase = (SwitchCase)currentOtherStatement; if(currentThisSwitchCase.isDefault() && currentOtherSwitchCase.isDefault()) { switchCaseStatementMatch = true; } else { switchCaseStatementMatch = matchCaseCondition(currentThisSwitchCase.getExpression(), currentOtherSwitchCase.getExpression()); } } boolean endStatementMatch = ((currentThisStatement instanceof BreakStatement && currentOtherStatement instanceof BreakStatement) || (currentThisStatement instanceof ContinueStatement && currentOtherStatement instanceof ContinueStatement) || (currentThisStatement instanceof ReturnStatement && currentOtherStatement instanceof ReturnStatement)); if (!switchCaseStatementMatch && !endStatementMatch) { caseStatementsMatch = false; } } return caseStatementsMatch; } return false; }
Example #6
Source File: JavaElementHyperlinkDetector.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
/** * Finds the target for break or continue node. * * @param input the editor input * @param region the region * @return the break or continue target location or <code>null</code> if none * @since 3.7 */ public static OccurrenceLocation findBreakOrContinueTarget(ITypeRoot input, IRegion region) { CompilationUnit astRoot= SharedASTProvider.getAST(input, SharedASTProvider.WAIT_NO, null); if (astRoot == null) return null; ASTNode node= NodeFinder.perform(astRoot, region.getOffset(), region.getLength()); ASTNode breakOrContinueNode= null; boolean labelSelected= false; if (node instanceof SimpleName) { SimpleName simpleName= (SimpleName) node; StructuralPropertyDescriptor location= simpleName.getLocationInParent(); if (location == ContinueStatement.LABEL_PROPERTY || location == BreakStatement.LABEL_PROPERTY) { breakOrContinueNode= simpleName.getParent(); labelSelected= true; } } else if (node instanceof ContinueStatement || node instanceof BreakStatement) breakOrContinueNode= node; if (breakOrContinueNode == null) return null; BreakContinueTargetFinder finder= new BreakContinueTargetFinder(); if (finder.initialize(astRoot, breakOrContinueNode) == null) { OccurrenceLocation[] locations= finder.getOccurrences(); if (locations != null) { if (breakOrContinueNode instanceof BreakStatement && !labelSelected) return locations[locations.length - 1]; // points to the end of target statement return locations[0]; // points to the beginning of target statement } } return null; }
Example #7
Source File: BreakContinueTargetFinder.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
private SimpleName getLabel() { if (fIsBreak){ BreakStatement bs= (BreakStatement) fSelected; return bs.getLabel(); } else { ContinueStatement cs= (ContinueStatement) fSelected; return cs.getLabel(); } }
Example #8
Source File: BreakContinueTargetFinder.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
private ASTNode getBreakOrContinueNode(ASTNode selectedNode) { if (selectedNode instanceof BreakStatement) return selectedNode; if (selectedNode instanceof ContinueStatement) return selectedNode; if (selectedNode instanceof SimpleName && selectedNode.getParent() instanceof BreakStatement) return selectedNode.getParent(); if (selectedNode instanceof SimpleName && selectedNode.getParent() instanceof ContinueStatement) return selectedNode.getParent(); return null; }
Example #9
Source File: LinkedNodeFinder.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
@Override public boolean visit(ContinueStatement node) { SimpleName label= node.getLabel(); if (fDefiningLabel != null && isSameLabel(label) && ASTNodes.isParent(label, fDefiningLabel)) { fResult.add(label); } return false; }
Example #10
Source File: CodeBlock.java From SimFix with GNU General Public License v2.0 | 5 votes |
private ContinueStmt visit(ContinueStatement node) { int startLine = _cunit.getLineNumber(node.getStartPosition()); int endLine = _cunit.getLineNumber(node.getStartPosition() + node.getLength()); ContinueStmt continueStmt = new ContinueStmt(startLine, endLine, node); if(node.getLabel() != null){ continueStmt.setIdentifier(node.getLabel().getFullyQualifiedName()); } return continueStmt; }
Example #11
Source File: FlowAnalyzer.java From eclipse.jdt.ls with Eclipse Public License 2.0 | 5 votes |
@Override public void endVisit(ContinueStatement node) { if (skipNode(node)) { return; } setFlowInfo(node, createBranch(node.getLabel())); }
Example #12
Source File: JavaASTFlattener.java From xtext-xtend with Eclipse Public License 2.0 | 5 votes |
@Override public boolean visit(final ContinueStatement node) { this.appendToBuffer("/* FIXME Unsupported continue statement */ continue"); this.addProblem(node, "Continue statement is not supported"); SimpleName _label = node.getLabel(); boolean _tripleNotEquals = (_label != null); if (_tripleNotEquals) { this.appendSpaceToBuffer(); node.getLabel().accept(this); } this.appendToBuffer(";"); this.appendLineWrapToBuffer(); return false; }
Example #13
Source File: InstanceOfBranchingStatement.java From JDeodorant with MIT License | 4 votes |
public boolean instanceOf(Statement statement) { if(statement instanceof BreakStatement || statement instanceof ContinueStatement || statement instanceof ReturnStatement) return true; else return false; }
Example #14
Source File: MethodVisitor.java From repositoryminer with Apache License 2.0 | 4 votes |
@Override public boolean visit(ContinueStatement node) { statements.add(new AbstractStatement(NodeType.CONTINUE, null)); return true; }
Example #15
Source File: ReadableFlattener.java From junion with BSD 3-Clause "New" or "Revised" License | 4 votes |
public boolean br(ASTNode node) { return node instanceof ExpressionStatement || node instanceof VariableDeclarationStatement || node instanceof BreakStatement || node instanceof ContinueStatement || node instanceof PackageDeclaration || node instanceof ImportDeclaration || node instanceof Javadoc; }
Example #16
Source File: NavigateToDefinitionHandler.java From eclipse.jdt.ls with Eclipse Public License 2.0 | 4 votes |
private Location computeBreakContinue(ITypeRoot typeRoot, int line, int column) throws CoreException { int offset = JsonRpcHelpers.toOffset(typeRoot.getBuffer(), line, column); if (offset >= 0) { CompilationUnit unit = SharedASTProviderCore.getAST(typeRoot, SharedASTProviderCore.WAIT_YES, null); if (unit == null) { return null; } ASTNode selectedNode = NodeFinder.perform(unit, offset, 0); ASTNode node = null; SimpleName label = null; if (selectedNode instanceof BreakStatement) { node = selectedNode; label = ((BreakStatement) node).getLabel(); } else if (selectedNode instanceof ContinueStatement) { node = selectedNode; label = ((ContinueStatement) node).getLabel(); } else if (selectedNode instanceof SimpleName && selectedNode.getParent() instanceof BreakStatement) { node = selectedNode.getParent(); label = ((BreakStatement) node).getLabel(); } else if (selectedNode instanceof SimpleName && selectedNode.getParent() instanceof ContinueStatement) { node = selectedNode.getParent(); label = ((ContinueStatement) node).getLabel(); } if (node != null) { ASTNode parent = node.getParent(); ASTNode target = null; while (parent != null) { if (parent instanceof MethodDeclaration || parent instanceof Initializer) { break; } if (label == null) { if (parent instanceof ForStatement || parent instanceof EnhancedForStatement || parent instanceof WhileStatement || parent instanceof DoStatement) { target = parent; break; } if (node instanceof BreakStatement) { if (parent instanceof SwitchStatement || parent instanceof SwitchExpression) { target = parent; break; } } if (node instanceof LabeledStatement) { target = parent; break; } } else if (LabeledStatement.class.isInstance(parent)) { LabeledStatement ls = (LabeledStatement) parent; if (ls.getLabel().getIdentifier().equals(label.getIdentifier())) { target = ls; break; } } parent = parent.getParent(); } if (target != null) { int start = target.getStartPosition(); int end = new TokenScanner(unit.getTypeRoot()).getNextEndOffset(node.getStartPosition(), true) - start; if (start >= 0 && end >= 0) { return JDTUtils.toLocation((ICompilationUnit) typeRoot, start, end); } } } } return null; }
Example #17
Source File: CFGContinueNode.java From JDeodorant with MIT License | 4 votes |
public CFGContinueNode(AbstractStatement statement) { super(statement); ContinueStatement continueStatement = (ContinueStatement)statement.getStatement(); if(continueStatement.getLabel() != null) label = continueStatement.getLabel().getIdentifier(); }
Example #18
Source File: ExtractStatementsVisitor.java From JDeodorant with MIT License | 4 votes |
public boolean visit(ContinueStatement node) { statementsList.add(node); return false; }
Example #19
Source File: StatementCollector.java From JDeodorant with MIT License | 4 votes |
public boolean visit(ContinueStatement node) { statementList.add(node); return false; }
Example #20
Source File: ConstraintCollector.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 4 votes |
@Override public boolean visit(ContinueStatement node) { add(fCreator.create(node)); return true; }
Example #21
Source File: InstanceOfContinueStatement.java From JDeodorant with MIT License | 4 votes |
public boolean instanceOf(Statement statement) { if(statement instanceof ContinueStatement) return true; else return false; }
Example #22
Source File: FlowAnalyzer.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 4 votes |
@Override public void endVisit(ContinueStatement node) { if (skipNode(node)) return; setFlowInfo(node, createBranch(node.getLabel())); }
Example #23
Source File: AstMatchingNodeFinder.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 4 votes |
@Override public boolean visit(ContinueStatement node) { if (node.subtreeMatch(fMatcher, fNodeToMatch)) return matches(node); return super.visit(node); }
Example #24
Source File: GenericVisitor.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 4 votes |
@Override public boolean visit(ContinueStatement node) { return visitNode(node); }
Example #25
Source File: GenericVisitor.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 4 votes |
@Override public void endVisit(ContinueStatement node) { endVisitNode(node); }
Example #26
Source File: ConstraintCreator.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 2 votes |
/** * @param node the AST node * @return array of type constraints, may be empty * @see org.eclipse.jdt.core.dom.ASTVisitor#visit(org.eclipse.jdt.core.dom.ContinueStatement) */ public ITypeConstraint[] create(ContinueStatement node) { return EMPTY_ARRAY; }