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


Java BreakTree类代码示例

本文整理汇总了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;
}
 
开发者ID:reprogrammer,项目名称:checker-framework,代码行数:17,代码来源:CFGBuilder.java

示例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;
    }
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:9,代码来源:TreeDuplicator.java

示例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;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:10,代码来源:CopyFinder.java

示例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;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:8,代码来源:LabelsTest.java

示例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);
        }
    });
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:14,代码来源:BreakContinueTest.java

示例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);
        }
        
    });
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:35,代码来源:BreakContinueTest.java

示例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);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:9,代码来源:CyclomaticComplexityVisitor.java

示例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;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:12,代码来源:TreeNode.java

示例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;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:8,代码来源:TryCatchFinally.java

示例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);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:9,代码来源:ScanStatement.java

示例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;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:10,代码来源:Utilities.java

示例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();
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:10,代码来源:EvaluatorVisitor.java

示例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;
}
 
开发者ID:tranleduy2000,项目名称:javaide,代码行数:14,代码来源:JavaInputAstVisitor.java

示例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);
}
 
开发者ID:google,项目名称:error-prone,代码行数:15,代码来源:ErrorProneScanner.java

示例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);
  }
}
 
开发者ID:google,项目名称:error-prone,代码行数:11,代码来源:UBreak.java


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