当前位置: 首页>>代码示例>>Java>>正文


Java JCWhileLoop类代码示例

本文整理汇总了Java中com.sun.tools.javac.tree.JCTree.JCWhileLoop的典型用法代码示例。如果您正苦于以下问题:Java JCWhileLoop类的具体用法?Java JCWhileLoop怎么用?Java JCWhileLoop使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


JCWhileLoop类属于com.sun.tools.javac.tree.JCTree包,在下文中一共展示了JCWhileLoop类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: diffWhileLoop

import com.sun.tools.javac.tree.JCTree.JCWhileLoop; //导入依赖的package包/类
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];
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:17,代码来源:CasualDiff.java

示例2: visitWhileLoop

import com.sun.tools.javac.tree.JCTree.JCWhileLoop; //导入依赖的package包/类
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);
	}
}
 
开发者ID:mobmead,项目名称:EasyMPermission,代码行数:17,代码来源:PrettyCommentsPrinter.java

示例3: visitWhileLoop

import com.sun.tools.javac.tree.JCTree.JCWhileLoop; //导入依赖的package包/类
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);
    }
}
 
开发者ID:sebastianoe,项目名称:s4j,代码行数:17,代码来源:Pretty.java

示例4: matchWhileLoop

import com.sun.tools.javac.tree.JCTree.JCWhileLoop; //导入依赖的package包/类
@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;
}
 
开发者ID:diy1,项目名称:error-prone-aspirator,代码行数:17,代码来源:ElementsCountedInLoop.java

示例5: visitWhileLoop

import com.sun.tools.javac.tree.JCTree.JCWhileLoop; //导入依赖的package包/类
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);
    }
}
 
开发者ID:redundent,项目名称:lombok,代码行数:17,代码来源:PrettyCommentsPrinter.java

示例6: visitWhileLoop

import com.sun.tools.javac.tree.JCTree.JCWhileLoop; //导入依赖的package包/类
@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;
}
 
开发者ID:git03394538,项目名称:lombok-ianchiu,代码行数:14,代码来源:PrettyPrinter.java

示例7: visitWhileLoop

import com.sun.tools.javac.tree.JCTree.JCWhileLoop; //导入依赖的package包/类
public void visitWhileLoop(JCWhileLoop that) {
    try {
        print("JCWhileLoop:");
    } catch (Exception e) {
    }
    super.visitWhileLoop(that);
}
 
开发者ID:pcgomes,项目名称:javaparser2jctree,代码行数:8,代码来源:PrintAstVisitor.java

示例8: visitWhileLoop

import com.sun.tools.javac.tree.JCTree.JCWhileLoop; //导入依赖的package包/类
@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);
}
 
开发者ID:google,项目名称:error-prone,代码行数:9,代码来源:PlaceholderUnificationVisitor.java

示例9: matchWhileLoop

import com.sun.tools.javac.tree.JCTree.JCWhileLoop; //导入依赖的package包/类
private boolean matchWhileLoop(JCWhileLoop t1, JCWhileLoop t2) {
    return treesMatch(t1.cond, t2.cond) && treesMatch(t1.body, t2.body);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:4,代码来源:CasualDiff.java

示例10: visitWhileLoop

import com.sun.tools.javac.tree.JCTree.JCWhileLoop; //导入依赖的package包/类
@Override
public void visitWhileLoop(JCWhileLoop tree) {
    //skip body (to prevents same statements to be analyzed twice)
    scan(tree.getCondition());
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:6,代码来源:Analyzer.java

示例11: visitWhileLoop

import com.sun.tools.javac.tree.JCTree.JCWhileLoop; //导入依赖的package包/类
@Override
public void visitWhileLoop(JCWhileLoop tree) {
    scan(tree.getCondition());
}
 
开发者ID:campolake,项目名称:openjdk9,代码行数:5,代码来源:Analyzer.java

示例12: WhileLoop

import com.sun.tools.javac.tree.JCTree.JCWhileLoop; //导入依赖的package包/类
public JCWhileLoop WhileLoop(JCExpression cond, JCStatement body) {
	return invoke(WhileLoop, cond, body);
}
 
开发者ID:git03394538,项目名称:lombok-ianchiu,代码行数:4,代码来源:JavacTreeMaker.java

示例13: AJCWhileLoop

import com.sun.tools.javac.tree.JCTree.JCWhileLoop; //导入依赖的package包/类
public AJCWhileLoop(JCWhileLoop ltree) {
    super(ltree.cond, ltree.body);
}
 
开发者ID:pcgomes,项目名称:javaparser2jctree,代码行数:4,代码来源:AJCWhileLoop.java

示例14: inline

import com.sun.tools.javac.tree.JCTree.JCWhileLoop; //导入依赖的package包/类
@Override
public JCWhileLoop inline(Inliner inliner) throws CouldNotResolveImportException {
  return inliner.maker().WhileLoop(
      getCondition().inline(inliner),
      getStatement().inline(inliner));
}
 
开发者ID:sivakumar-kailasam,项目名称:refactor-faster,代码行数:7,代码来源:UWhileLoop.java

示例15: visitWhileLoop

import com.sun.tools.javac.tree.JCTree.JCWhileLoop; //导入依赖的package包/类
@Override public void visitWhileLoop(JCWhileLoop tree) {
	printNode(tree);
	child("cond", tree.cond);
	child("body", tree.body);
	indent--;
}
 
开发者ID:evant,项目名称:android-retrolambda-lombok,代码行数:7,代码来源:JcTreePrinter.java


注:本文中的com.sun.tools.javac.tree.JCTree.JCWhileLoop类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。