@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; }
@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; }
public Boolean visitBreak(BreakTree node, TreePath p) { if (p == null) { super.visitBreak(node, p); return false; } //XXX: check labels return true; }
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; }
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); } }); }
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); } }); }
@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); }
@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; }
@Override public Void visitBreak(BreakTree node, Collection<TreePath> trees) { if (!analyzeThrows && !seenTrees.contains(info.getTreeUtilities().getBreakContinueTarget(getCurrentPath()))) { trees.add(getCurrentPath()); } return null; }
@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); }
@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; }
@Override public Mirror visitBreak(BreakTree arg0, EvaluationContext evaluationContext) { Name label = arg0.getLabel(); if (label != null) { Assert.error(arg0, "unsupported"); return null; } return new Break(); }
@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; }
@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); }
@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); } }
@Override public Result visitBreak(BreakTree node, BreakContext cxt) { if (cxt.internalLabels.contains(node.getLabel()) || (node.getLabel() == null && cxt.loopDepth > 0)) { return NEVER_EXITS; } else { return MAY_BREAK_OR_RETURN; } }
@Override public Description matchBreak(BreakTree tree, VisitorState state) { if (new FinallyJumpMatcher((JCBreak) tree).matches(tree, state)) { return describeMatch(tree); } return Description.NO_MATCH; }
@Override public Description matchBreak(BreakTree tree, VisitorState state) { if (new FinallyJumpMatcher((JCBreak) tree).matches(tree, state)) { return describeMatch(tree, NO_FIX); } return Description.NO_MATCH; }
@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; }
@Override public Void visitBreak(BreakTree expected, Tree actual) { Optional<BreakTree> other = checkTypeAndCast(expected, actual); if (!other.isPresent()) { addTypeMismatch(expected, actual); return null; } checkForDiff(namesEqual(expected.getLabel(), other.get().getLabel()), "Expected label on break statement to be <%s> but was <%s>.", expected.getLabel(), other.get().getLabel()); return null; }
@Override public Optional<TreePath> visitBreak(@Nullable BreakTree node, Void v) { if (node == null) { return Optional.absent(); } return isMatch(node, node.getLabel()) ? currentPathPlus(node) : Optional.<TreePath>absent(); }
@Override public Object visitBreak(BreakTree node, Object p) { statements++; return super.visitBreak(node, p); }
@Override public Tree visitBreak(BreakTree that, Trees trees) { this.hasBreaks = true; return super.visitBreak(that, trees); }
@Override public State visitBreak(BreakTree node, Void p) { StatementTree target = ci.getTreeUtilities().getBreakContinueTarget(getCurrentPath()); breakContinueJumps.add(target); return State.NO; }
@Override public List<? extends TypeMirror> visitBreak(BreakTree node, Object p) { return null; }
private boolean isLegal(StatementTree st) { return !(st instanceof ReturnTree) && !(st instanceof ContinueTree) && !(st instanceof BreakTree); }
@Override public R visitBreak(BreakTree bt, P p) { return null; }
@Override public List<T> visitBreak(BreakTree node, T p) { return checkForCriteria(node); }
@Override public BreakTree createBreak() { return new BreakTreeImpl(); }
@Override public Object visitBreak(BreakTree t, Trees p) { info("BreakTree" + CL + t.getKind() + SP + t); return super.visitBreak(t, p); }
@Override public Boolean visitBreak(BreakTree tree, Void unused) { breaks.add(skipLabel(requireNonNull(((JCTree.JCBreak) tree).target))); return false; }
@Override public UBreak visitBreak(BreakTree tree, Void v) { return UBreak.create(tree.getLabel()); }
void visit(BreakTree node, List<ErrMsg> errMsgs, GlobalContext globalCtx, Closure<List<Map<String, Long>>> resolveRowAndCol, Closure<Void> setError);
@Override public PurityResult visitBreak(BreakTree node, PurityResult p) { return p; }
@Override public String visitBreak(BreakTree reference, Void v) { return (reference != null) ? detailedKindString(reference, reference.getLabel()) : ""; }
@Override public Wrapper visitBreak(BreakTree arg0, Void arg1) { Name label = arg0.getLabel(); return new BreakWrapper(arg0, label != null ? label.toString() : null); }
public Boolean visitBreak(BreakTree node, ConstructorData p) { super.visitBreak(node, p); StatementTree target = info.getTreeUtilities().getBreakContinueTarget(getCurrentPath()); resumeAfter(target, variable2State); variable2State = new HashMap< Element, State>(); return null; }
/** * Creates a tree node for a 'break' statement. * @return */ BreakTree createBreak();