Exemplo n.º 1
0
 @Override
 public void visit(Tree.InitializerParameter that) {
   super.visit(that);
   Parameter d = that.getParameterModel();
   Declaration a = that.getScope().getDirectMember(d.getName(), null, false);
   if (a != null && a == declaration) {
     specify();
     hasParameter = true;
   }
 }
 private static boolean spreadable(Parameter param, List<Parameter> list) {
   Parameter lastParam = list.get(list.size() - 1);
   if (param == lastParam && param.getModel() instanceof Value) {
     Type type = param.getType();
     Unit unit = param.getDeclaration().getUnit();
     return type != null && unit.isIterableParameterType(type);
   } else {
     return false;
   }
 }
 public static String getDefaultValueDescription(Parameter param, CeylonParseController cpc) {
   if (param.isDefaulted()) {
     FunctionOrValue model = param.getModel();
     if (model instanceof Functional) {
       return " => ...";
     } else {
       return getInitialValueDescription(model, cpc);
     }
   } else {
     return "";
   }
 }
 static List<Parameter> getParameters(
     ParameterList pl, boolean includeDefaults, boolean namedInvocation) {
   List<Parameter> ps = pl.getParameters();
   if (includeDefaults) {
     return ps;
   } else {
     List<Parameter> list = new ArrayList<Parameter>();
     for (Parameter p : ps) {
       if (!p.isDefaulted() || (namedInvocation && spreadable(p, ps))) {
         list.add(p);
       }
     }
     return list;
   }
 }