Java 类com.sun.tools.javac.tree.JCTree.JCWhileLoop 实例源码

项目:incubator-netbeans    文件:CasualDiff.java   
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];
}
项目:EasyMPermission    文件:PrettyCommentsPrinter.java   
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);
    }
}
项目:s4j    文件:Pretty.java   
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);
    }
}
项目:error-prone-aspirator    文件:ElementsCountedInLoop.java   
@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;
}
项目:lombok    文件:PrettyCommentsPrinter.java   
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);
    }
}
项目:lombok-ianchiu    文件:PrettyPrinter.java   
@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;
}
项目:javaparser2jctree    文件:PrintAstVisitor.java   
public void visitWhileLoop(JCWhileLoop that) {
    try {
        print("JCWhileLoop:");
    } catch (Exception e) {
    }
    super.visitWhileLoop(that);
}
项目:error-prone    文件:PlaceholderUnificationVisitor.java   
@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);
}
项目:incubator-netbeans    文件:CasualDiff.java   
private boolean matchWhileLoop(JCWhileLoop t1, JCWhileLoop t2) {
    return treesMatch(t1.cond, t2.cond) && treesMatch(t1.body, t2.body);
}
项目:openjdk-jdk10    文件:Analyzer.java   
@Override
public void visitWhileLoop(JCWhileLoop tree) {
    //skip body (to prevents same statements to be analyzed twice)
    scan(tree.getCondition());
}
项目:openjdk9    文件:Analyzer.java   
@Override
public void visitWhileLoop(JCWhileLoop tree) {
    scan(tree.getCondition());
}
项目:lombok-ianchiu    文件:JavacTreeMaker.java   
public JCWhileLoop WhileLoop(JCExpression cond, JCStatement body) {
    return invoke(WhileLoop, cond, body);
}
项目:javaparser2jctree    文件:AJCWhileLoop.java   
public AJCWhileLoop(JCWhileLoop ltree) {
    super(ltree.cond, ltree.body);
}
项目:javaparser2jctree    文件:AJCWhileLoop.java   
public AJCWhileLoop(JCWhileLoop ltree, String lcomment) {
    this(ltree);
    setComment(lcomment);
}
项目:EasyMPermission    文件:JavacTreeMaker.java   
public JCWhileLoop WhileLoop(JCExpression cond, JCStatement body) {
    return invoke(WhileLoop, cond, body);
}
项目:refactor-faster    文件:UWhileLoop.java   
@Override
public JCWhileLoop inline(Inliner inliner) throws CouldNotResolveImportException {
  return inliner.maker().WhileLoop(
      getCondition().inline(inliner),
      getStatement().inline(inliner));
}
项目:android-retrolambda-lombok    文件:JcTreePrinter.java   
@Override public void visitWhileLoop(JCWhileLoop tree) {
    printNode(tree);
    child("cond", tree.cond);
    child("body", tree.body);
    indent--;
}
项目:android-retrolambda-lombok    文件:JcTreeConverter.java   
@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())));
}
项目:error-prone    文件:UWhileLoop.java   
@Override
public JCWhileLoop inline(Inliner inliner) throws CouldNotResolveImportException {
  return inliner
      .maker()
      .WhileLoop(getCondition().inline(inliner), getStatement().inline(inliner));
}
项目:s4j    文件:Attr.java   
public void visitWhileLoop(JCWhileLoop tree) {
    attribExpr(tree.cond, env, syms.booleanType);
    attribStat(tree.body, env.dup(tree));
    result = null;
}
项目:Refaster    文件:UWhileLoop.java   
@Override
public JCWhileLoop inline(Inliner inliner) throws CouldNotResolveImportException {
  return inliner.maker().WhileLoop(
      getCondition().inline(inliner),
      getStatement().inline(inliner));
}