コード例 #1
0
  @Override
  public Type getKeywordArgumentTypes(Environment scope) {
    ArrayList<String> labels = new ArrayList<>();
    ArrayList<Type> types = new ArrayList<>();
    // TODO: I am not sure this is what we want. Double names will end up twice in the tuple type...

    for (AbstractFunction c : primaryCandidates) {
      Type args = c.getKeywordArgumentTypes(scope);

      if (args != null && args.hasFieldNames()) {
        for (String label : args.getFieldNames()) {
          labels.add(label);
          types.add(args.getFieldType(label));
        }
      }
    }

    for (AbstractFunction c : defaultCandidates) {
      Type args = c.getKeywordArgumentTypes(scope);

      if (args != null && args.hasFieldNames()) {
        for (String label : args.getFieldNames()) {
          labels.add(label);
          types.add(args.getFieldType(label));
        }
      }
    }

    return TF.tupleType(
        types.toArray(new Type[types.size()]), labels.toArray(new String[labels.size()]));
  }
コード例 #2
0
ファイル: ArgumentMismatch.java プロジェクト: stil4m/rascal
 private static void argumentTypes(Type argTypes, StringBuilder b) {
   int i = 0;
   for (Type arg : argTypes) {
     if (i != 0) b.append(", ");
     b.append(arg);
     if (argTypes.hasFieldNames()) {
       b.append(' ');
       b.append(argTypes.getFieldName(i));
     }
     i++;
   }
 }