public ASTNode rewriteTo() {
    // Declared in VariableDeclaration.jrag at line 124
    if (getNumVariableDecl() == 1) {
      state().duringVariableDeclaration++;
      ASTNode result = rewriteRule0();
      state().duringVariableDeclaration--;
      return result;
    }

    // Declared in VariableDeclaration.jrag at line 135
    if (getParent().getParent() instanceof TypeDecl
        && ((TypeDecl) getParent().getParent()).getBodyDeclListNoTransform() == getParent()
        && getNumVariableDecl() > 1) {
      state().duringVariableDeclaration++;
      List list = (List) getParent();
      int i = list.getIndexOfChild(this);
      List newList = rewriteTypeDecl_getBodyDecl();
      for (int j = 1; j < newList.getNumChildNoTransform(); j++)
        list.insertChild(newList.getChildNoTransform(j), ++i);
      state().duringVariableDeclaration--;
      return newList.getChildNoTransform(0);
    }
    return super.rewriteTo();
  }
 @SuppressWarnings({"unchecked", "cast"})
 public List<Expr> getArgList() {
   List<Expr> list = (List<Expr>) getChild(0);
   list.getNumChild();
   return list;
 }
Exemplo n.º 3
1
 /**
  * Getter for list ExceptionList
  *
  * @apilevel high-level
  * @ast method
  * @declaredat java.ast:63
  */
 @SuppressWarnings({"unchecked", "cast"})
 public List<Access> getExceptionList() {
   List<Access> list = (List<Access>) getChild(3);
   list.getNumChild();
   return list;
 }
Exemplo n.º 4
1
 @SuppressWarnings({"unchecked", "cast"})
 public List<BodyDecl> getBodyDeclList() {
   List<BodyDecl> list = (List<BodyDecl>) getChild(2);
   list.getNumChild();
   return list;
 }
Exemplo n.º 5
1
 /**
  * Getter for list ParameterList
  *
  * @apilevel high-level
  * @ast method
  * @declaredat java.ast:63
  */
 @SuppressWarnings({"unchecked", "cast"})
 public List<ParameterDeclaration> getParameterList() {
   List<ParameterDeclaration> list = (List<ParameterDeclaration>) getChild(2);
   list.getNumChild();
   return list;
 }
 @SuppressWarnings({"unchecked", "cast"})
 public List<Access> getTypeArgumentList() {
   List<Access> list = (List<Access>) getChild(1);
   list.getNumChild();
   return list;
 }
 public void addTypeArgument(Access node) {
   List<Access> list =
       (parent == null || state == null)
           ? getTypeArgumentListNoTransform()
           : getTypeArgumentList();
   list.addChild(node);
 }
Exemplo n.º 8
0
 /**
  * Add element to list SuperInterfaceIdList
  *
  * @apilevel high-level
  * @ast method
  * @declaredat java.ast:27
  */
 public void addSuperInterfaceId(Access node) {
   List<Access> list =
       (parent == null || state == null)
           ? getSuperInterfaceIdListNoTransform()
           : getSuperInterfaceIdList();
   list.addChild(node);
 }
 public void addVariableDecl(VariableDecl node) {
   List<VariableDecl> list =
       (parent == null || state == null)
           ? getVariableDeclListNoTransform()
           : getVariableDeclList();
   list.addChild(node);
 }
Exemplo n.º 10
0
 private List createVariableDeclarationList() {
   List varList = new List();
   for (int j = 0; j < getNumVariableDecl(); j++) {
     VariableDeclaration v =
         getVariableDecl(j)
             .createVariableDeclarationFrom(
                 (Modifiers) getModifiers().fullCopy(), (Access) getTypeAccess().fullCopy());
     if (j == 0) v.setStart(start);
     varList.add(v);
   }
   return varList;
 }
 // Declared in VariableDeclaration.jrag at line 135
 private List rewriteTypeDecl_getBodyDecl() {
   {
     List varList = new List();
     for (int j = 0; j < getNumVariableDecl(); j++) {
       FieldDeclaration f =
           getVariableDecl(j)
               .createFieldDeclarationFrom(
                   (Modifiers) getModifiers().fullCopy(), (Access) getTypeAccess().fullCopy());
       if (j == 0) f.setStart(start);
       else {
         f.getModifiersNoTransform().clearLocations();
         f.getTypeAccessNoTransform().clearLocations();
       }
       f.setFieldDecl(this);
       varList.add(f);
     }
     return varList;
   }
 }
Exemplo n.º 12
0
  // Declared in AnonymousClasses.jrag at line 52
  private AnonymousDecl rewriteRule0() {
    {
      setModifiers(new Modifiers(new List().add(new Modifier("final"))));

      ConstructorDecl constructor = new ConstructorDecl();
      addBodyDecl(constructor);

      constructor.setModifiers((Modifiers) constructorDecl().getModifiers().fullCopy());
      String name = "Anonymous" + nextAnonymousIndex();
      setID(name);
      constructor.setID(name);

      List parameterList = new List();
      for (int i = 0; i < constructorDecl().getNumParameter(); i++) {
        parameterList.add(
            new ParameterDeclaration(
                constructorDecl().getParameter(i).type().createBoundAccess(),
                constructorDecl().getParameter(i).name()));
      }
      constructor.setParameterList(parameterList);

      List argList = new List();
      for (int i = 0; i < constructor.getNumParameter(); i++)
        argList.add(new VarAccess(constructor.getParameter(i).name()));
      constructor.setConstructorInvocation(
          new ExprStmt(new SuperConstructorAccess("super", argList)));
      constructor.setBlock(new Block());

      HashSet set = new HashSet();
      for (int i = 0; i < getNumBodyDecl(); i++) {
        if (getBodyDecl(i) instanceof InstanceInitializer) {
          InstanceInitializer init = (InstanceInitializer) getBodyDecl(i);
          set.addAll(init.exceptions());
        } else if (getBodyDecl(i) instanceof FieldDeclaration) {
          FieldDeclaration f = (FieldDeclaration) getBodyDecl(i);
          if (f.isInstanceVariable()) {
            set.addAll(f.exceptions());
          }
        }
      }
      List exceptionList = new List();
      for (Iterator iter = set.iterator(); iter.hasNext(); ) {
        TypeDecl exceptionType = (TypeDecl) iter.next();
        if (exceptionType.isNull()) exceptionType = typeNullPointerException();
        exceptionList.add(exceptionType.createQualifiedAccess());
      }
      constructor.setExceptionList(exceptionList);
      return this;
    }
  }
 public void addTypeArgumentNoTransform(Access node) {
   List<Access> list = getTypeArgumentListNoTransform();
   list.addChild(node);
 }
Exemplo n.º 14
0
 /**
  * Add element to list ExceptionList
  *
  * @apilevel high-level
  * @ast method
  * @declaredat java.ast:27
  */
 public void addException(Access node) {
   List<Access> list =
       (parent == null || state == null) ? getExceptionListNoTransform() : getExceptionList();
   list.addChild(node);
 }
Exemplo n.º 15
0
 /**
  * Setter for child in list ParameterList
  *
  * @apilevel high-level
  * @ast method
  * @declaredat java.ast:42
  */
 public void setParameter(ParameterDeclaration node, int i) {
   List<ParameterDeclaration> list = getParameterList();
   list.setChild(node, i);
 }
 public void addArgNoTransform(Expr node) {
   List<Expr> list = getArgListNoTransform();
   list.addChild(node);
 }
 public void setArg(Expr node, int i) {
   List<Expr> list = getArgList();
   list.setChild(node, i);
 }
Exemplo n.º 18
0
 public void setImplements(Access node, int i) {
   List<Access> list = getImplementsList();
   list.setChild(node, i);
 }
 public void addArg(Expr node) {
   List<Expr> list = (parent == null || state == null) ? getArgListNoTransform() : getArgList();
   list.addChild(node);
 }
Exemplo n.º 20
0
 public void addBodyDeclNoTransform(BodyDecl node) {
   List<BodyDecl> list = getBodyDeclListNoTransform();
   list.addChild(node);
 }
Exemplo n.º 21
0
 public void setBodyDecl(BodyDecl node, int i) {
   List<BodyDecl> list = getBodyDeclList();
   list.setChild(node, i);
 }
Exemplo n.º 22
0
 /**
  * Setter for child in list ExceptionList
  *
  * @apilevel high-level
  * @ast method
  * @declaredat java.ast:42
  */
 public void setException(Access node, int i) {
   List<Access> list = getExceptionList();
   list.setChild(node, i);
 }
Exemplo n.º 23
0
 public void addBodyDecl(BodyDecl node) {
   List<BodyDecl> list =
       (parent == null || state == null) ? getBodyDeclListNoTransform() : getBodyDeclList();
   list.addChild(node);
 }
Exemplo n.º 24
0
 public void addArgument(Access node) {
   List<Access> list = getArgumentList();
   list.addChild(node);
 }
Exemplo n.º 25
0
 public void addImplements(Access node) {
   List<Access> list = getImplementsList();
   list.addChild(node);
 }
 public void addVariableDeclNoTransform(VariableDecl node) {
   List<VariableDecl> list = getVariableDeclListNoTransform();
   list.addChild(node);
 }
 public void setTypeArgument(Access node, int i) {
   List<Access> list = getTypeArgumentList();
   list.setChild(node, i);
 }
Exemplo n.º 28
0
 /**
  * @apilevel low-level
  * @ast method
  * @declaredat java.ast:34
  */
 public void addExceptionNoTransform(Access node) {
   List<Access> list = getExceptionListNoTransform();
   list.addChild(node);
 }
 public void setVariableDecl(VariableDecl node, int i) {
   List<VariableDecl> list = getVariableDeclList();
   list.setChild(node, i);
 }
Exemplo n.º 30
0
 public void addBodyDecl(BodyDecl node) {
   List<BodyDecl> list = getBodyDeclList();
   list.addChild(node);
 }