@Override public Node visitContinue(ContinueTree tree, Void p) { Name label = tree.getLabel(); if (label == null) { assert continueTargetL != null : "no target for continue statement"; extendWithExtendedNode(new UnconditionalJump(continueTargetL)); } else { assert continueLabels.containsKey(label); extendWithExtendedNode(new UnconditionalJump( continueLabels.get(label))); } return null; }
@Override public Tree visitContinue(ContinueTree tree, Void p) { ContinueTree n = make.Continue(tree.getLabel()); // model.setType(n, model.getType(tree)); comments.copyComments(tree, n); model.setPos(n, model.getPos(tree)); return n; }
public Boolean visitContinue(ContinueTree node, TreePath p) { if (p == null) { super.visitContinue(node, p); return false; } //XXX: check labels return true; }
public Void visitContinue(ContinueTree node, Object p) { System.err.println("visitContinue: " + node.getLabel()); super.visitContinue(node, p); ContinueTree copy = make.setLabel(node, node.getLabel() + "0"); this.copy.rewrite(node, copy); return null; }
public void testContinue158130() throws Exception { String test = "public class Test { void m(int p) { loop: while (true) { if (p == 0) { con|tinue loop; } } } }"; String golden = "public class Test { void m(int p) { loop: while (true) { if (p == 0) { continue; } } } }"; testHelper(test, golden, Kind.CONTINUE, new Delegate() { public void run(WorkingCopy copy, Tree tree) { ContinueTree original = (ContinueTree) tree; TreeMaker make = copy.getTreeMaker(); ContinueTree modified = make.Continue(null); copy.rewrite(original, modified); } }); }
@Override public Void visitContinue(ContinueTree tree, List<Node> d) { List<Node> below = new ArrayList<Node>(); addCorrespondingType(below); addCorrespondingComments(below); super.visitContinue(tree, below); d.add(new TreeNode(info, getCurrentPath(), below)); return null; }
@Override public Tree visitContinue(ContinueTree that, Trees trees) { if (that.getLabel() != null || !isIfWithContinueOnly(that)) { this.hasContinue = true; } return super.visitContinue(that, trees); }
private boolean isIfWithContinueOnly(ContinueTree that) { TreePath currentTreePath = this.getCurrentPath(); TreePath parentPath = currentTreePath.getParentPath(); Tree parentTree = parentPath.getLeaf(); if (parentTree.getKind() == Tree.Kind.IF) { return true; } else if (parentTree.getKind() == Tree.Kind.BLOCK) { BlockTree parentBlock = (BlockTree) parentTree; if (parentBlock.getStatements().size() == 1) { return true; } } return false; }
@Override public Void visitContinue(ContinueTree node, Collection<TreePath> trees) { if (!analyzeThrows && !seenTrees.contains(info.getTreeUtilities().getBreakContinueTarget(getCurrentPath()))) { trees.add(getCurrentPath()); } return null; }
@Override public Void visitContinue(ContinueTree node, Void p) { if (isMethodCode() && phase == PHASE_INSIDE_SELECTION && !treesSeensInSelection.contains(info.getTreeUtilities().getBreakContinueTarget(getCurrentPath()))) { selectionExits.add(getCurrentPath()); hasContinues = true; } return super.visitContinue(node, p); }
@Override public Mirror visitContinue(ContinueTree arg0, EvaluationContext evaluationContext) { Name label = arg0.getLabel(); if (label != null) { Assert.error(arg0, "unsupported"); return null; } return new Continue(); }
@Override public Void visitContinue(ContinueTree node, Void unused) { sync(node); builder.open(plusFour); token("continue"); if (node.getLabel() != null) { builder.breakOp(" "); visit(node.getLabel()); } token(";"); builder.close(); return null; }
/** Matches a {@code continue} statement. */ public static Matcher<StatementTree> continueStatement() { return new Matcher<StatementTree>() { @Override public boolean matches(StatementTree statementTree, VisitorState state) { return statementTree instanceof ContinueTree; } }; }
@Override public Void visitContinue(ContinueTree tree, VisitorState visitorState) { VisitorState state = visitorState.withPath(getCurrentPath()); for (ContinueTreeMatcher matcher : continueMatchers) { if (!isSuppressed(matcher, state)) { try { reportMatch(matcher.matchContinue(tree, state), tree, state); } catch (Throwable t) { handleError(matcher, t); } } } return super.visitContinue(tree, state); }
@Override public Choice<Unifier> visitContinue(ContinueTree 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 visitContinue(ContinueTree 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 matchContinue(ContinueTree tree, VisitorState state) { if (new FinallyJumpMatcher((JCContinue) tree).matches(tree, state)) { return describeMatch(tree); } return Description.NO_MATCH; }
@Override public Description matchContinue(ContinueTree tree, VisitorState state) { if (new FinallyJumpMatcher((JCContinue) tree).matches(tree, state)) { return describeMatch(tree, NO_FIX); } return Description.NO_MATCH; }
@Override public Node visitContinue(ContinueTree tree, Void p) { Name label = tree.getLabel(); if (label == null) { assert continueTargetL != null : "no target for continue statement"; extendWithExtendedNode(new UnconditionalJump(continueTargetL)); } else { assert continueLabels.containsKey(label); extendWithExtendedNode(new UnconditionalJump(continueLabels.get(label))); } return null; }
@Override public Void visitContinue(ContinueTree expected, Tree actual) { Optional<ContinueTree> other = checkTypeAndCast(expected, actual); if (!other.isPresent()) { addTypeMismatch(expected, actual); return null; } checkForDiff(namesEqual(expected.getLabel(), other.get().getLabel()), "Expected label on continue statement to be <%s> but was <%s>.", expected.getLabel(), other.get().getLabel()); return null; }
@Override public Optional<TreePath> visitContinue(@Nullable ContinueTree node, Void v) { if (node == null) { return Optional.absent(); } else if (isMatch(node, node.getLabel())) { return currentPathPlus(node); } return super.visitContinue(node, v); }
@Override public Object visitContinue(ContinueTree node, Object p) { statements++; return super.visitContinue(node, p); }
@Override public Object visitContinue(ContinueTree node, Object p) { complexity++; return super.visitContinue(node, p); }
@Override public State visitContinue(ContinueTree node, Void p) { StatementTree target = ci.getTreeUtilities().getBreakContinueTarget(getCurrentPath()); breakContinueJumps.add(target); return State.NO; }
public Boolean visitContinue(ContinueTree node, ConstructorData p) { StatementTree loop = info.getTreeUtilities().getBreakContinueTarget(getCurrentPath()); if (loop == null) { super.visitContinue(node, p); return null; } Tree resumePoint; if (loop.getKind() == Kind.LABELED_STATEMENT) { loop = ((LabeledStatementTree) loop).getStatement(); } switch (loop.getKind()) { case WHILE_LOOP: resumePoint = ((WhileLoopTree) loop).getCondition(); break; case FOR_LOOP: { ForLoopTree flt = (ForLoopTree)loop; resumePoint = null; if (flt.getUpdate() != null && !flt.getUpdate().isEmpty()) { // resume will react on the 1st Tree of the update statement (always processed left to right) resumePoint = flt.getUpdate().get(0); } if (resumePoint == null) { resumePoint = flt.getCondition(); } if (resumePoint == null) { resumePoint = flt.getStatement(); } } break; case DO_WHILE_LOOP: resumePoint = ((DoWhileLoopTree) loop).getCondition(); break; case ENHANCED_FOR_LOOP: resumePoint = ((EnhancedForLoopTree) loop).getStatement(); break; default: resumePoint = null; break; } if (resumePoint != null) { recordResume(resumeBefore, resumePoint, variable2State); } variable2State = new HashMap< Element, State>(); super.visitContinue(node, p); return null; }
@Override public Boolean visitContinue(ContinueTree node, Void p) { return visitBreak(null, p); }
@Override public List<? extends TypeMirror> visitContinue(ContinueTree node, Object p) { return null; }
private boolean isLegal(StatementTree st) { return !(st instanceof ReturnTree) && !(st instanceof ContinueTree) && !(st instanceof BreakTree); }
@Override public R visitContinue(ContinueTree ct, P p) { return null; }
@Override public List<T> visitContinue(ContinueTree node, T p) { return checkForCriteria(node); }
@Override public ContinueTree createContinue() { return new ContinueTreeImpl(); }
@Override public Object visitContinue(ContinueTree t, Trees p) { info("ContinueTree" + CL + t.getKind() + SP + t); return super.visitContinue(t, p); }
@Override public Boolean visitContinue(ContinueTree tree, Void unused) { continues.add(skipLabel(requireNonNull(((JCTree.JCContinue) tree).target))); return false; }
@Override public UContinue visitContinue(ContinueTree tree, Void v) { return UContinue.create(tree.getLabel()); }
void visit(ContinueTree node, List<ErrMsg> errMsgs, GlobalContext globalCtx, Closure<List<Map<String, Long>>> resolveRowAndCol, Closure<Void> setError);
@Override public PurityResult visitContinue(ContinueTree node, PurityResult p) { return p; }
@Override public String visitContinue(ContinueTree reference, Void v) { return (reference != null) ? detailedKindString(reference, reference.getLabel()) : ""; }
@Override public Wrapper visitContinue(ContinueTree arg0, Void arg1) { Name label = arg0.getLabel(); return new ContinueWrapper(arg0, label != null ? label.toString() : null); }