예제 #1
0
 @Override
 public Void visitFormalParameterList(FormalParameterList node) {
   String groupEnd = null;
   writer.print('(');
   NodeList<FormalParameter> parameters = node.getParameters();
   int size = parameters.size();
   for (int i = 0; i < size; i++) {
     FormalParameter parameter = parameters.get(i);
     if (i > 0) {
       writer.print(", ");
     }
     if (groupEnd == null && parameter instanceof DefaultFormalParameter) {
       if (parameter.getKind() == ParameterKind.NAMED) {
         groupEnd = "}";
         writer.print('{');
       } else {
         groupEnd = "]";
         writer.print('[');
       }
     }
     parameter.accept(this);
   }
   if (groupEnd != null) {
     writer.print(groupEnd);
   }
   writer.print(')');
   return null;
 }
예제 #2
0
 /**
  *
  *
  * <pre>
  * StrictFormalParameters :
  *     FormalParameters
  * FormalParameters :
  *     [empty]
  *     FormalParameterList
  * FormalParameterList :
  *     FunctionRestParameter
  *     FormalsList
  *     FormalsList , FunctionRestParameter
  * FormalsList :
  *     FormalParameter
  *     FormalsList , FormalParameter
  * </pre>
  */
 @Override
 public List<Name> visit(FormalParameterList node, List<Name> names) {
   return forEach(node.getFormals(), names);
 }