예제 #1
0
 /**
  * generate the parameter declarations of this method.
  *
  * @param env
  */
 public void genJava(PWInterface pw, Env env) {
   int size = parameterList.size();
   for (ParameterDec paramDec : parameterList) {
     paramDec.genJava(pw, env);
     if (--size > 0) pw.print(", ");
   }
 }
예제 #2
0
  @Override
  public void genCyan(
      PWInterface pw, boolean printInMoreThanOneLine, CyanEnv cyanEnv, boolean genFunctions) {

    if (cyanEnv.getCreatingInstanceGenericPrototype()) {
      pw.print(cyanEnv.formalGenericParamToRealParam(selector.getSymbolString()));
    } else {
      pw.print(selector.getSymbolString());
    }
    int size = parameterList.size();
    boolean onlyOneTypeWithoutParameterName = false;
    if (size == 1 && parameterList.get(0).getVariableSymbol() == null) {
      // there is one parameter and the first one does not have a type
      onlyOneTypeWithoutParameterName = true;
    } else if (size == 0) onlyOneTypeWithoutParameterName = true;

    pw.print(" ");
    if (!onlyOneTypeWithoutParameterName) pw.print("(");
    for (ParameterDec p : parameterList) {
      p.genCyan(pw, false, cyanEnv, genFunctions);
      --size;
      if (size > 0) pw.print(", ");
    }
    if (!onlyOneTypeWithoutParameterName) pw.print(")");
    pw.print(" ");
  }