diff options
author | David Robillard <d@drobilla.net> | 2009-10-13 20:54:01 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2009-10-13 20:54:01 +0000 |
commit | 3bed7f70fb2793cf7ba82473526ac1ac97de1973 (patch) | |
tree | ef20e640a9976916642a056631e6b1b5c24dd7b6 /src/c.cpp | |
parent | 67165233421d658a901ebf4eba7c14cda85f34d3 (diff) | |
download | resp-3bed7f70fb2793cf7ba82473526ac1ac97de1973.tar.gz resp-3bed7f70fb2793cf7ba82473526ac1ac97de1973.tar.bz2 resp-3bed7f70fb2793cf7ba82473526ac1ac97de1973.zip |
liftCall -> compileFunction.
git-svn-id: http://svn.drobilla.net/resp/tuplr@208 ad02d1e2-f140-0410-9f75-f8b11f17cedd
Diffstat (limited to 'src/c.cpp')
-rw-r--r-- | src/c.cpp | 14 |
1 files changed, 8 insertions, 6 deletions
@@ -130,7 +130,7 @@ struct CEngine : public Engine { return varname; } - void liftCall(CEnv& cenv, AFn* fn, const AType& argsT); + CFunction compileFunction(CEnv& cenv, AFn* fn, const AType& argsT); CValue compileLiteral(CEnv& cenv, AST* lit); CValue compilePrimitive(CEnv& cenv, APrimitive* prim); @@ -164,8 +164,8 @@ CEngine::compileLiteral(CEnv& cenv, AST* lit) return new Value(lit->str()); } -void -CEngine::liftCall(CEnv& cenv, AFn* fn, const AType& argsT) +CFunction +CEngine::compileFunction(CEnv& cenv, AFn* fn, const AType& argsT) { TEnv::GenericTypes::const_iterator gt = cenv.tenv.genericTypes.find(fn); assert(gt != cenv.tenv.genericTypes.end()); @@ -184,8 +184,9 @@ CEngine::liftCall(CEnv& cenv, AFn* fn, const AType& argsT) string("call has non-concrete type %1%\n") + thisType->str()); Object::pool.addRoot(thisType); - if (fn->impls.find(thisType)) - return; + CFunction f = fn->impls.find(thisType); + if (f) + return f; ATuple* protT = thisType->at(1)->as<ATuple*>(); @@ -195,7 +196,7 @@ CEngine::liftCall(CEnv& cenv, AFn* fn, const AType& argsT) // Write function declaration const string name = (fn->name == "") ? cenv.penv.gensymstr("_fn") : fn->name; - Function* f = llFunc(cenv.engine()->startFunction(cenv, name, + f = llFunc(cenv.engine()->startFunction(cenv, name, thisType->at(thisType->size()-1)->to<AType*>(), *protT, argNames)); @@ -229,6 +230,7 @@ CEngine::liftCall(CEnv& cenv, AFn* fn, const AType& argsT) } cenv.tsubst = oldSubst; cenv.pop(); + return f; } CValue |