diff options
author | David Robillard <d@drobilla.net> | 2010-08-22 19:16:28 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2010-08-22 19:16:28 +0000 |
commit | b4dba561084b7ce60a8b1cfdb4e3b9de87de8d35 (patch) | |
tree | 4bdd431a1af0885a27c4c4c582bd721862629a84 /src/c.cpp | |
parent | 6f63ae0e3e9af059c7cac3d3a29e4fb34b0b0e28 (diff) | |
download | resp-b4dba561084b7ce60a8b1cfdb4e3b9de87de8d35.tar.gz resp-b4dba561084b7ce60a8b1cfdb4e3b9de87de8d35.tar.bz2 resp-b4dba561084b7ce60a8b1cfdb4e3b9de87de8d35.zip |
Simplify Engine::startFunction.
git-svn-id: http://svn.drobilla.net/resp/resp@267 ad02d1e2-f140-0410-9f75-f8b11f17cedd
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; |