compiler/resolution/preFold.cpp
/*
  Builds up the name of the parent for lookup by looking through the types
  of the arguments, either formal or actual
*/
Builds up the name of the parent for lookup by looking through the types
of the arguments, either formal or actual
Builds up the name of the parent for lookup by looking through the types of the arguments either formal or actual
static std::string buildParentName(AList& arg_list,
                                   bool   isFormal,
                                   Type*  retType) {
  std::ostringstream oss;
  bool               isFirst = true;
  oss << "chpl__fcf_type_";
  if (isFormal) {
    if (arg_list.length == 0) {
      oss << "void";
    } else {
      for_alist(formalExpr, arg_list) {
        DefExpr* dExp = toDefExpr(formalExpr);
        ArgSymbol* fArg = toArgSymbol(dExp->sym);
        if (!isFirst)
          oss << "_";
        oss << fArg->type->symbol->cname;
        isFirst = false;
      }
    }
    oss << "_";
    oss << retType->symbol->cname;
  } else {
    int i = 0, alength = arg_list.length;
    if (alength == 1) {
      oss << "void_";
    }
    for_alist(actualExpr, arg_list) {
      if (!isFirst)
        oss << "_";
      SymExpr* sExpr = toSymExpr(actualExpr);
      ++i;
      oss << sExpr->symbol()->type->symbol->cname;
      isFirst = false;
    }
  }
  return oss.str();
}
static std :: string buildParentName ( AList & arg_list , bool isFormal , Type * retType ) { std :: ostringstream oss ; bool isFirst = true ; oss << " " ; if ( isFormal ) { if ( arg_list . length == 0 ) { oss << " " ; } else { for_alist ( formalExpr , arg_list ) { DefExpr * dExp = toDefExpr ( formalExpr ) ; ArgSymbol * fArg = toArgSymbol ( dExp -> sym ) ; if ( ! isFirst ) oss << " " ; oss << fArg -> type -> symbol -> cname ; isFirst = false ; } } oss << " " ; oss << retType -> symbol -> cname ; } else { int i = 0 , alength = arg_list . length ; if ( alength == 1 ) { oss << " " ; } for_alist ( actualExpr , arg_list ) { if ( ! isFirst ) oss << " " ; SymExpr * sExpr = toSymExpr ( actualExpr ) ; ++ i ; oss << sExpr -> symbol ( ) -> type -> symbol -> cname ; isFirst = false ; } } return oss . str ( ) ; }
Builds up the name of the parent for lookup by looking through the types
of the arguments, either formal or actual
Builds up the name of the parent for lookup by looking through the types of the arguments either formal or actual