예제 #1
0
 @Override
 public Void visitLabeledStatement(LabeledStatement node) {
   boolean onSwitchStatement = node.getStatement() instanceof SwitchStatement;
   for (Label label : node.getLabels()) {
     LabelElementImpl element = new LabelElementImpl(label.getLabel(), onSwitchStatement, false);
     currentHolder.addLabel(element);
   }
   return null;
 }
예제 #2
0
  @Override
  public Void visitLabeledStatement(LabeledStatement node) {
    boolean onSwitchStatement = node.getStatement() instanceof SwitchStatement;
    for (Label label : node.getLabels()) {
      SimpleIdentifier labelName = label.getLabel();
      LabelElementImpl element = new LabelElementImpl(labelName, onSwitchStatement, false);

      currentHolder.addLabel(element);
      labelName.setStaticElement(element);
    }
    return super.visitLabeledStatement(node);
  }
예제 #3
0
  public void test_visitLabeledStatement() {
    ElementHolder holder = new ElementHolder();
    ElementBuilder builder = new ElementBuilder(holder);
    String labelName = "l";
    LabeledStatement statement = labeledStatement(list(label(labelName)), breakStatement());
    statement.accept(builder);
    LabelElement[] labels = holder.getLabels();
    assertLength(1, labels);

    LabelElement label = labels[0];
    assertNotNull(label);
    assertEquals(labelName, label.getName());
    assertFalse(label.isSynthetic());
  }
예제 #4
0
 @Override
 public Void visitLabeledStatement(LabeledStatement node) {
   visitList(node.getLabels(), " ", " ");
   visit(node.getStatement());
   return null;
 }
 @Override
 public R visitLabeledStatement(LabeledStatement node) {
   node.visitChildren(this);
   return null;
 }
 public void test_multipleLabels_statement() throws Exception {
   LabeledStatement statement = parseStatement("a: b: c: return x;");
   assertSize(3, statement.getLabels());
   assertInstanceOf(ReturnStatement.class, statement.getStatement());
 }