protected int diffWhileLoop(JCWhileLoop oldT, JCWhileLoop newT, int[] bounds) { int localPointer = bounds[0]; // condition int[] condPos = getBounds(oldT.cond); copyTo(localPointer, condPos[0]); localPointer = diffTree(oldT.cond, newT.cond, condPos); // body int[] bodyPos = new int[] { localPointer, endPos(oldT.body) }; int oldIndent = newT.body.hasTag(Tag.BLOCK) ? -1 : printer.indent(); localPointer = diffTree(oldT.body, newT.body, bodyPos, oldT.getKind()); if (!newT.body.hasTag(Tag.BLOCK)) printer.undent(oldIndent); copyTo(localPointer, bounds[1]); return bounds[1]; }
public void visitWhileLoop(JCWhileLoop tree) { try { print("while "); if (PARENS.equals(treeTag(tree.cond))) { printExpr(tree.cond); } else { print("("); printExpr(tree.cond); print(")"); } print(" "); printStat(tree.body); } catch (IOException e) { throw new UncheckedIOException(e); } }
public void visitWhileLoop(JCWhileLoop tree) { try { print("while "); if (tree.cond.getTag() == JCTree.PARENS) { printExpr(tree.cond); } else { print("("); printExpr(tree.cond); print(")"); } print(" "); printStat(tree.body); } catch (IOException e) { throw new UncheckedIOException(e); } }
@Override public Description matchWhileLoop(WhileLoopTree tree, VisitorState state) { JCWhileLoop whileLoop = (JCWhileLoop) tree; JCExpression whileExpression = ((JCParens) whileLoop.getCondition()).getExpression(); if (whileExpression instanceof MethodInvocationTree) { MethodInvocationTree methodInvocation = (MethodInvocationTree) whileExpression; if (methodSelect(isDescendantOfMethod("java.util.Iterator", "hasNext()")).matches( methodInvocation, state)) { IdentifierTree identifier = getIncrementedIdentifer(extractSingleStatement(whileLoop.body)); if (identifier != null) { return describeMatch(tree, new SuggestedFix()); } } } return Description.NO_MATCH; }
public void visitWhileLoop(JCWhileLoop tree) { try { print("while "); if (getTag(tree.cond) == PARENS) { printExpr(tree.cond); } else { print("("); printExpr(tree.cond); print(")"); } print(" "); printStat(tree.body); } catch (IOException e) { throw new UncheckedIOException(e); } }
@Override public void visitWhileLoop(JCWhileLoop tree) { aPrint("while "); if (tree.cond instanceof JCParens) { print(tree.cond); } else { print("("); print(tree.cond); print(")"); } print(" "); print(tree.body); // make sure to test while (true) ; and while(true){} and while(true) x = 5; }
public void visitWhileLoop(JCWhileLoop that) { try { print("JCWhileLoop:"); } catch (Exception e) { } super.visitWhileLoop(that); }
@Override public Choice<State<JCWhileLoop>> visitWhileLoop(final WhileLoopTree node, State<?> state) { return chooseSubtrees( state, s -> unifyExpression(node.getCondition(), s), s -> unifyStatement(node.getStatement(), s), maker()::WhileLoop); }
private boolean matchWhileLoop(JCWhileLoop t1, JCWhileLoop t2) { return treesMatch(t1.cond, t2.cond) && treesMatch(t1.body, t2.body); }
@Override public void visitWhileLoop(JCWhileLoop tree) { //skip body (to prevents same statements to be analyzed twice) scan(tree.getCondition()); }
@Override public void visitWhileLoop(JCWhileLoop tree) { scan(tree.getCondition()); }
public JCWhileLoop WhileLoop(JCExpression cond, JCStatement body) { return invoke(WhileLoop, cond, body); }
public AJCWhileLoop(JCWhileLoop ltree) { super(ltree.cond, ltree.body); }
public AJCWhileLoop(JCWhileLoop ltree, String lcomment) { this(ltree); setComment(lcomment); }
@Override public JCWhileLoop inline(Inliner inliner) throws CouldNotResolveImportException { return inliner.maker().WhileLoop( getCondition().inline(inliner), getStatement().inline(inliner)); }
@Override public void visitWhileLoop(JCWhileLoop tree) { printNode(tree); child("cond", tree.cond); child("body", tree.body); indent--; }
@Override public void visitWhileLoop(JCWhileLoop node) { While w = new While(); JCExpression cond = node.getCondition(); setConversionPositionInfo(w, "()", getPosition(cond)); set(node, w.rawCondition(toTree(removeParens(cond))).rawStatement(toTree(node.getStatement()))); }
@Override public JCWhileLoop inline(Inliner inliner) throws CouldNotResolveImportException { return inliner .maker() .WhileLoop(getCondition().inline(inliner), getStatement().inline(inliner)); }
public void visitWhileLoop(JCWhileLoop tree) { attribExpr(tree.cond, env, syms.booleanType); attribStat(tree.body, env.dup(tree)); result = null; }