Ejemplo n.º 1
0
 @Override
 public Void visitFieldDeclaration(FieldDeclaration node) {
   visit(node.getKeyword(), " ");
   visit(node.getFields());
   writer.print(";");
   return null;
 }
Ejemplo n.º 2
0
  public void test_visitFieldDeclaration() {
    ElementHolder holder = new ElementHolder();
    ElementBuilder builder = new ElementBuilder(holder);
    String firstFieldName = "x";
    String secondFieldName = "y";
    FieldDeclaration fieldDeclaration =
        fieldDeclaration(
            false, null, variableDeclaration(firstFieldName), variableDeclaration(secondFieldName));
    fieldDeclaration.accept(builder);
    FieldElement[] fields = holder.getFields();
    assertLength(2, fields);

    FieldElement firstField = fields[0];
    assertNotNull(firstField);
    assertEquals(firstFieldName, firstField.getName());
    assertNull(firstField.getInitializer());
    assertFalse(firstField.isConst());
    assertFalse(firstField.isFinal());
    assertFalse(firstField.isSynthetic());

    FieldElement secondField = fields[1];
    assertNotNull(secondField);
    assertEquals(secondFieldName, secondField.getName());
    assertNull(secondField.getInitializer());
    assertFalse(secondField.isConst());
    assertFalse(secondField.isFinal());
    assertFalse(secondField.isSynthetic());
  }
Ejemplo n.º 3
0
 @Override
 public Void visitFieldDeclaration(FieldDeclaration node) {
   boolean wasInField = inFieldContext;
   inFieldContext = true;
   try {
     node.visitChildren(this);
   } finally {
     inFieldContext = wasInField;
   }
   return null;
 }
 @Override
 public R visitFieldDeclaration(FieldDeclaration node) {
   node.visitChildren(this);
   return null;
 }