本文整理汇总了Java中com.sun.source.tree.BreakTree类的典型用法代码示例。如果您正苦于以下问题:Java BreakTree类的具体用法?Java BreakTree怎么用?Java BreakTree使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
BreakTree类属于com.sun.source.tree包,在下文中一共展示了BreakTree类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: visitBreak
import com.sun.source.tree.BreakTree; //导入依赖的package包/类
@Override
public Node visitBreak(BreakTree tree, Void p) {
Name label = tree.getLabel();
if (label == null) {
assert breakTargetL != null : "no target for break statement";
extendWithExtendedNode(new UnconditionalJump(breakTargetL));
} else {
assert breakLabels.containsKey(label);
extendWithExtendedNode(new UnconditionalJump(
breakLabels.get(label)));
}
return null;
}
示例2: visitBreak
import com.sun.source.tree.BreakTree; //导入依赖的package包/类
@Override
public Tree visitBreak(BreakTree tree, Void p) {
BreakTree n = make.Break(tree.getLabel());
// model.setType(n, model.getType(tree));
comments.copyComments(tree, n);
model.setPos(n, model.getPos(tree));
return n;
}
示例3: visitBreak
import com.sun.source.tree.BreakTree; //导入依赖的package包/类
public Boolean visitBreak(BreakTree node, TreePath p) {
if (p == null) {
super.visitBreak(node, p);
return false;
}
//XXX: check labels
return true;
}
示例4: visitBreak
import com.sun.source.tree.BreakTree; //导入依赖的package包/类
public Void visitBreak(BreakTree node, Object p) {
System.err.println("visitBreak: " + node.getLabel());
super.visitBreak(node, p);
BreakTree copy = make.setLabel(node, node.getLabel() + "0");
this.copy.rewrite(node, copy);
return null;
}
示例5: testBreak158130
import com.sun.source.tree.BreakTree; //导入依赖的package包/类
public void testBreak158130() throws Exception {
String test = "public class Test { void m(int p) { loop: while (true) { if (p == 0) { b|reak loop; } } } }";
String golden = "public class Test { void m(int p) { loop: while (true) { if (p == 0) { break; } } } }";
testHelper(test, golden, Kind.BREAK, new Delegate() {
public void run(WorkingCopy copy, Tree tree) {
BreakTree original = (BreakTree) tree;
TreeMaker make = copy.getTreeMaker();
BreakTree modified = make.Break(null);
copy.rewrite(original, modified);
}
});
}
示例6: testBreak166327
import com.sun.source.tree.BreakTree; //导入依赖的package包/类
public void testBreak166327() throws Exception {
String test =
"public class Test {" +
" public static void test(int y) {" +
" for (int u = y;;) {" +
" if (y == 0)" +
" br|eak;" +
" else" +
" y++;" +
" }" +
" }" +
"}";
String golden =
"public class Test {" +
" public static void test(int y) {" +
" for (int u = y;;) {" +
" if (y == 0)" +
" break;" +
" else" +
" y++;" +
" }" +
" }" +
"}";
testHelper(test, golden, Kind.BREAK, new Delegate() {
public void run(WorkingCopy copy, Tree tree) {
BreakTree oldBt = (BreakTree) tree;
BreakTree newBt = copy.getTreeMaker().Break(null);
copy.rewrite(oldBt, newBt);
}
});
}
示例7: visitBreak
import com.sun.source.tree.BreakTree; //导入依赖的package包/类
@Override
public Object visitBreak(BreakTree node, Object p) {
// do not count the break, if it is nested in a switch 'case' statement.
if (node.getLabel() != null || !switchCase) {
complexity++;
}
return super.visitBreak(node, p);
}
示例8: visitBreak
import com.sun.source.tree.BreakTree; //导入依赖的package包/类
@Override
public Void visitBreak(BreakTree tree, List<Node> d) {
List<Node> below = new ArrayList<Node>();
addCorrespondingType(below);
addCorrespondingComments(below);
super.visitBreak(tree, below);
d.add(new TreeNode(info, getCurrentPath(), below));
return null;
}
示例9: visitBreak
import com.sun.source.tree.BreakTree; //导入依赖的package包/类
@Override
public Void visitBreak(BreakTree node, Collection<TreePath> trees) {
if (!analyzeThrows && !seenTrees.contains(info.getTreeUtilities().getBreakContinueTarget(getCurrentPath()))) {
trees.add(getCurrentPath());
}
return null;
}
示例10: visitBreak
import com.sun.source.tree.BreakTree; //导入依赖的package包/类
@Override
public Void visitBreak(BreakTree node, Void p) {
if (isMethodCode() && phase == PHASE_INSIDE_SELECTION && !treesSeensInSelection.contains(info.getTreeUtilities().getBreakContinueTarget(getCurrentPath()))) {
selectionExits.add(getCurrentPath());
hasBreaks = true;
}
return super.visitBreak(node, p);
}
示例11: visitBreak
import com.sun.source.tree.BreakTree; //导入依赖的package包/类
@Override
public Boolean visitBreak(BreakTree node, Void p) {
Tree target = info.getTreeUtilities().getBreakContinueTarget(getCurrentPath());
boolean known = seenTrees.contains(target);
if (known) {
targetTrees.add(target);
}
return !known;
}
示例12: visitBreak
import com.sun.source.tree.BreakTree; //导入依赖的package包/类
@Override
public Mirror visitBreak(BreakTree arg0, EvaluationContext evaluationContext) {
Name label = arg0.getLabel();
if (label != null) {
Assert.error(arg0, "unsupported");
return null;
}
return new Break();
}
示例13: visitBreak
import com.sun.source.tree.BreakTree; //导入依赖的package包/类
@Override
public Void visitBreak(BreakTree node, Void unused) {
sync(node);
builder.open(plusFour);
token("break");
if (node.getLabel() != null) {
builder.breakOp(" ");
visit(node.getLabel());
}
builder.close();
token(";");
return null;
}
示例14: visitBreak
import com.sun.source.tree.BreakTree; //导入依赖的package包/类
@Override
public Void visitBreak(BreakTree tree, VisitorState visitorState) {
VisitorState state = visitorState.withPath(getCurrentPath());
for (BreakTreeMatcher matcher : breakMatchers) {
if (!isSuppressed(matcher, state)) {
try {
reportMatch(matcher.matchBreak(tree, state), tree, state);
} catch (Throwable t) {
handleError(matcher, t);
}
}
}
return super.visitBreak(tree, state);
}
示例15: visitBreak
import com.sun.source.tree.BreakTree; //导入依赖的package包/类
@Override
public Choice<Unifier> visitBreak(BreakTree node, Unifier unifier) {
if (getLabel() == null) {
return Choice.condition(node.getLabel() == null, unifier);
} else {
CharSequence boundName = unifier.getBinding(key());
return Choice.condition(
boundName != null && node.getLabel().contentEquals(boundName), unifier);
}
}