@Override public boolean visit(final EnhancedForStatement node) { if (isPassive(node.getExpression()) && node.getExpression().resolveTypeBinding().isArray()) { return maybeRemoveStmtWithEmptyBody(node, node.getBody()); } return VISIT_SUBTREE; }
@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; }
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; }
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) { pushNode(node, node.getParameter().toString() + COLON + node.getExpression().toString()); return true; }
/** * Expands the form: for ( [final] Type var: iterable ) { ... } Into something equivalent to: for ( Iterator iter = * iterable.iter(); iter.hasNext(); ) { [final] Type var = (Type) iter.next(); ... } Or, in the case of an array: for ( int idx = * 0; i < iterable.length; i++ ) { [final] Type var = iterable[idx]; ... } Except that the expression "iterable" is only evaluate * once (or is it?) */ private CAstNode visit(EnhancedForStatement n, WalkContext context) { if (n.getExpression().resolveTypeBinding().isArray()) return makeArrayEnhancedForLoop(n, context); else return makeIteratorEnhancedForLoop(n, context); }
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()); } }
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 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 boolean visit(final EnhancedForStatement node) { this.appendToBuffer("for ("); node.getParameter().accept(this); this.appendToBuffer(" : "); node.getExpression().accept(this); this.appendToBuffer(") "); node.getBody().accept(this); return false; }
@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); }
@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; }
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; }