From 9dc74f15acec8daac019f21ec0834827a5c5fd51 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Tue, 31 Mar 2009 00:51:31 +0000 Subject: Fix polymorphic functions (somewhat). git-svn-id: http://svn.drobilla.net/resp/tuplr@112 ad02d1e2-f140-0410-9f75-f8b11f17cedd --- llvm.cpp | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'llvm.cpp') diff --git a/llvm.cpp b/llvm.cpp index 7786bf5..4585a7c 100644 --- a/llvm.cpp +++ b/llvm.cpp @@ -220,7 +220,7 @@ AClosure::liftCall(CEnv& cenv, const vector& argsT) assert(argsT.size() == prot()->size()); ATuple* genericProtT = genericType->at(1)->as(); for (size_t i = 0; i < argsT.size(); ++i) - argsSubst[genericProtT->at(i)->to()] = argsT.at(i)->to(); + argsSubst[*genericProtT->at(i)->to()] = argsT.at(i)->to(); thisType = argsSubst.apply(genericType)->as(); if (!thisType->concrete()) throw Error("unable to resolve concrete type for function", loc); @@ -310,11 +310,9 @@ ACall::compile(CEnv& cenv) TEnv::GenericTypes::const_iterator gt = cenv.tenv.genericTypes.find(c); assert(gt != cenv.tenv.genericTypes.end()); - const AType* polyT = gt->second; - AType* fnT = new AType(loc, cenv.penv.sym("Fn"), protT, polyT->at(polyT->size()-1), 0); - - Function* f = (Function*)c->funcs.find(fnT); - if (!f) throw Error("callee failed to compile", loc); + AType* fnT = new AType(loc, cenv.penv.sym("Fn"), protT, cenv.type(this), 0); + Function* f = (Function*)c->funcs.find(fnT); + if (!f) throw Error((format("callee failed to compile for type %1%") % fnT->str()).str(), loc); vector params(size() - 1); for (size_t i = 1; i < size(); ++i) -- cgit v1.2.1