private boolean isEnhancedForStatementVariable(Statement statement, SimpleName name) { if (statement instanceof EnhancedForStatement) { EnhancedForStatement forStatement= (EnhancedForStatement) statement; SingleVariableDeclaration param= forStatement.getParameter(); return param.getType() == name.getParent(); // strange recovery, see https://bugs.eclipse.org/180456 } return false; }
private boolean isEnhancedForStatementVariable(Statement statement, SimpleName name) { if (statement instanceof EnhancedForStatement) { EnhancedForStatement forStatement= (EnhancedForStatement) statement; SingleVariableDeclaration param= forStatement.getParameter(); return param.getType() == name.getParent(); // strange recovery, see https://bugs.eclipse.org/180456 } return false; }
@Override public boolean visit(EnhancedForStatement node) { printIndent(); this.buffer.append("for (");//$NON-NLS-1$ node.getParameter().accept(this); this.buffer.append(" : ");//$NON-NLS-1$ node.getExpression().accept(this); this.buffer.append(") ");//$NON-NLS-1$ node.getBody().accept(this); return false; }
@Override public void endVisit(EnhancedForStatement node) { super.endVisit(node); clearAccessMode(accessFlowInfo(node), node.getParameter()); }
@Override public void endVisit(EnhancedForStatement node) { super.endVisit(node); clearAccessMode(accessFlowInfo(node), node.getParameter()); }
public boolean visit(EnhancedForStatement node) { printIndent(); this.buffer.append("for (");//$NON-NLS-1$ node.getParameter().accept(this); this.buffer.append(" : ");//$NON-NLS-1$ node.getExpression().accept(this); this.buffer.append(") ");//$NON-NLS-1$ node.getBody().accept(this); return false; }
public boolean visit(EnhancedForStatement node) { printIndent(); this.buffer.append("for (");//$NON-NLS-1$ node.getParameter().accept(this); this.buffer.append(" : ");//$NON-NLS-1$ node.getExpression().accept(this); this.buffer.append(") ");//$NON-NLS-1$ node.getBody().accept(this); return false; }
@Override public boolean visit(EnhancedForStatement node) { handleToken(node, TokenNameLPAREN, this.options.insert_space_before_opening_paren_in_for, this.options.insert_space_after_opening_paren_in_for); handleTokenBefore(node.getBody(), TokenNameRPAREN, this.options.insert_space_before_closing_paren_in_for, false); handleTokenAfter(node.getParameter(), TokenNameCOLON, this.options.insert_space_before_colon_in_for, this.options.insert_space_after_colon_in_for); return true; }
@Override public boolean visit(EnhancedForStatement node) { pushNode(node, node.getParameter().toString() + COLON + node.getExpression().toString()); return true; }
int treeSize() { return memSize() + (this.parameter == null ? 0 : getParameter().treeSize()) + (this.expression == null ? 0 : getExpression().treeSize()) + (this.body == null ? 0 : getBody().treeSize()); } }
int treeSize() { return memSize() + (this.parameter == null ? 0 : getParameter().treeSize()) + (this.expression == null ? 0 : getExpression().treeSize()) + (this.body == null ? 0 : getBody().treeSize()); } }
@Override int treeSize() { return memSize() + (this.parameter == null ? 0 : getParameter().treeSize()) + (this.expression == null ? 0 : getExpression().treeSize()) + (this.body == null ? 0 : getBody().treeSize()); } }
void accept0(ASTVisitor visitor) { boolean visitChildren = visitor.visit(this); if (visitChildren) { // visit children in normal left to right reading order acceptChild(visitor, getParameter()); acceptChild(visitor, getExpression()); acceptChild(visitor, getBody()); } visitor.endVisit(this); }
void accept0(ASTVisitor visitor) { boolean visitChildren = visitor.visit(this); if (visitChildren) { // visit children in normal left to right reading order acceptChild(visitor, getParameter()); acceptChild(visitor, getExpression()); acceptChild(visitor, getBody()); } visitor.endVisit(this); }
@Override public void endVisit(EnhancedForStatement node) { if (getSelection().getEndVisitSelectionMode(node) == Selection.AFTER) { if (node.getParameter() == getFirstSelectedNode()) { invalidSelection(RefactoringCoreMessages.ExtractMethodAnalyzer_cannot_extract_for_initializer, JavaStatusContext.create(fCUnit, getSelection())); } } super.endVisit(node); }
@Override public boolean visit(EnhancedForStatement node) { CSForEachStatement stmt = new CSForEachStatement(node.getStartPosition(), mapExpression(node.getExpression())); stmt.variable(createParameter(node.getParameter())); visitBlock(stmt.body(), node.getBody()); addStatement(stmt); return false; }
@Override public void endVisit(EnhancedForStatement node) { if (skipNode(node)) return; EnhancedForFlowInfo forInfo= createEnhancedFor(); setFlowInfo(node, forInfo); forInfo.mergeParameter(getFlowInfo(node.getParameter()), fFlowContext); forInfo.mergeExpression(getFlowInfo(node.getExpression()), fFlowContext); forInfo.mergeAction(getFlowInfo(node.getBody()), fFlowContext); forInfo.removeLabel(null); }
@Override public void endVisit(EnhancedForStatement node) { if (skipNode(node)) { return; } EnhancedForFlowInfo forInfo = createEnhancedFor(); setFlowInfo(node, forInfo); forInfo.mergeParameter(getFlowInfo(node.getParameter()), fFlowContext); forInfo.mergeExpression(getFlowInfo(node.getExpression()), fFlowContext); forInfo.mergeAction(getFlowInfo(node.getBody()), fFlowContext); forInfo.removeLabel(null); }
ASTNode clone0(AST target) { EnhancedForStatement result = new EnhancedForStatement(target); result.setSourceRange(getStartPosition(), getLength()); result.copyLeadingComment(this); result.setParameter((SingleVariableDeclaration) getParameter().clone(target)); result.setExpression((Expression) getExpression().clone(target)); result.setBody( (Statement) ASTNode.copySubtree(target, getBody())); return result; }
@Override ASTNode clone0(AST target) { EnhancedForStatement result = new EnhancedForStatement(target); result.setSourceRange(getStartPosition(), getLength()); result.copyLeadingComment(this); result.setParameter((SingleVariableDeclaration) getParameter().clone(target)); result.setExpression((Expression) getExpression().clone(target)); result.setBody( (Statement) ASTNode.copySubtree(target, getBody())); return result; }