예제 #1
0
 @Override
 public void visit(VariableDeclarator n, Object arg) {
   n.getId().accept(this, arg);
   if (n.getInit() != null) {
     printer.print(" = ");
     n.getInit().accept(this, arg);
   }
 }
 @Override
 public Void visit(FieldDeclaration decl, AElement elem) {
   for (VariableDeclarator v : decl.getVariables()) {
     AClass clazz = (AClass) elem;
     AField field = clazz.fields.vivify(v.getId().getName());
     visitDecl(decl, field);
     visitType(decl.getType(), field.type);
   }
   return null;
 }
예제 #3
0
  @Override
  public void visit(VariableDeclarationExpr n, Object arg) {
    printMemberAnnotations(n.getAnnotations(), arg);
    printModifiers(n.getModifiers());

    n.getType().accept(this, arg);
    printer.print(" ");

    for (Iterator<VariableDeclarator> i = n.getVars().iterator(); i.hasNext(); ) {
      VariableDeclarator v = i.next();
      v.accept(this, arg);
      if (i.hasNext()) {
        printer.print(", ");
      }
    }
  }
예제 #4
0
  @Override
  public void visit(FieldDeclaration n, Object arg) {
    printJavadoc(n.getJavaDoc(), arg);
    printMemberAnnotations(n.getAnnotations(), arg);
    printModifiers(n.getModifiers());
    n.getType().accept(this, arg);

    printer.print(" ");
    for (Iterator<VariableDeclarator> i = n.getVariables().iterator(); i.hasNext(); ) {
      VariableDeclarator var = i.next();
      var.accept(this, arg);
      if (i.hasNext()) {
        printer.print(", ");
      }
    }

    printer.print(";");
  }
 @Override
 public Void visit(VariableDeclarationExpr expr, AElement elem) {
   List<AnnotationExpr> annos = expr.getAnnotations();
   AMethod method = (AMethod) elem;
   int i = 0;
   for (VariableDeclarator decl : expr.getVars()) {
     LocalLocation loc = new LocalLocation(decl.getId().getName(), i);
     AField field = method.body.locals.vivify(loc);
     visitType(expr.getType(), field.type);
     if (annos != null) {
       for (AnnotationExpr annoExpr : annos) {
         Annotation anno = extractAnnotation(annoExpr);
         field.tlAnnotationsHere.add(anno);
       }
     }
     ++i;
   }
   return null;
 }