diff options
Diffstat (limited to 'src/c.cpp')
-rw-r--r-- | src/c.cpp | 15 |
1 files changed, 5 insertions, 10 deletions
@@ -101,8 +101,7 @@ struct CEngine : public Engine { } CFunc startFunction(CEnv& cenv, - const std::string& name, const AType* retT, const ATuple& argsT, - const vector<string> argNames) + const std::string& name, const ATuple* args, const AType* retT, const ATuple& argsT) { vector<const Type*> cprot; FOREACH(ATuple::const_iterator, i, argsT) { @@ -119,12 +118,12 @@ struct CEngine : public Engine { f->returnType = *llType(retT); f->name = name; f->text += f->returnType + "\n" + f->name + "("; - ATuple::const_iterator ai = argsT.begin(); - vector<string>::const_iterator ni = argNames.begin(); + ATuple::const_iterator ai = argsT.begin(); + ATuple::const_iterator ni = args->begin(); for (; ai != argsT.end(); ++ai, ++ni) { if (ai != argsT.begin()) f->text += ", "; - f->text += *llType((*ai)->as<const AType*>()) + " " + *ni; + f->text += *llType((*ai)->as<const AType*>()) + " " + (*ni)->as<const ASymbol*>()->cppstr; } f->text += ")\n{\n"; @@ -216,13 +215,9 @@ CEngine::compileFunction(CEnv& cenv, const AFn* fn, const AType* type) const AType* retT = type->last()->as<const AType*>(); Subst argsSubst = cenv.tenv.buildSubst(type, *argsT); - vector<string> argNames; - for (ATuple::const_iterator i = fn->prot()->begin(); i != fn->prot()->end(); ++i) - argNames.push_back((*i)->str()); - // Write function declaration const string name = (fn->name == "") ? cenv.penv.gensymstr("_fn") : fn->name; - Function* f = llFunc(cenv.engine()->startFunction(cenv, name, retT, *argsT, argNames)); + Function* f = llFunc(cenv.engine()->startFunction(cenv, name, fn->prot(), retT, *argsT)); cenv.push(); Subst oldSubst = cenv.tsubst; |