本文整理汇总了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];
}
示例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);
}
}
示例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);
}
}
示例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;
}
示例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);
}
}
示例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;
}
示例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);
}
示例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);
}
示例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);
}
示例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());
}
示例11: visitWhileLoop
import com.sun.tools.javac.tree.JCTree.JCWhileLoop; //导入依赖的package包/类
@Override
public void visitWhileLoop(JCWhileLoop tree) {
scan(tree.getCondition());
}
示例12: WhileLoop
import com.sun.tools.javac.tree.JCTree.JCWhileLoop; //导入依赖的package包/类
public JCWhileLoop WhileLoop(JCExpression cond, JCStatement body) {
return invoke(WhileLoop, cond, body);
}
示例13: AJCWhileLoop
import com.sun.tools.javac.tree.JCTree.JCWhileLoop; //导入依赖的package包/类
public AJCWhileLoop(JCWhileLoop ltree) {
super(ltree.cond, ltree.body);
}
示例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));
}
示例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--;
}