From c0d05f679266f419f47b2636bd6f8b085ff23f1a Mon Sep 17 00:00:00 2001 From: David Robillard Date: Fri, 10 Dec 2010 18:22:16 +0000 Subject: Fix type of lifted calls. git-svn-id: http://svn.drobilla.net/resp/resp@345 ad02d1e2-f140-0410-9f75-f8b11f17cedd --- src/lift.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'src/lift.cpp') diff --git a/src/lift.cpp b/src/lift.cpp index 5791e41..71843b5 100644 --- a/src/lift.cpp +++ b/src/lift.cpp @@ -223,14 +223,13 @@ lift_call(CEnv& cenv, Code& code, const ATuple* call) throw() copy.head->loc = call->loc; - const AType* copyT = NULL; - const ASymbol* sym = call->head()->to_symbol(); if (sym && !cenv.liftStack.empty() && sym->sym() == cenv.name(cenv.liftStack.top().fn)) { /* Recursive call to innermost function, call implementation directly, * reusing the current "_me" closure parameter (no cons or .). */ copy.push_front(cenv.penv.sym(cenv.liftStack.top().implName)); + cenv.setTypeSameAs(copy, call); } else if (is_form(call, "fn")) { /* Special case: ((fn ...) ...) * Lifting (fn ...) yields: (Fn _impl ...). @@ -243,7 +242,7 @@ lift_call(CEnv& cenv, Code& code, const ATuple* call) throw() const ASymbol* implSym = closure->list_ref(1)->as_symbol(); const AType* implT = cenv.type(cenv.resolve(implSym)); copy.push_front(implSym); - copyT = implT->list_ref(2)->as_type(); + cenv.setType(copy, implT->list_ref(2)->as_type()); } else { // Call to a closure, prepend code to access implementation function ATuple* getFn = tup(call->loc, cenv.penv.sym("."), @@ -254,10 +253,9 @@ lift_call(CEnv& cenv, Code& code, const ATuple* call) throw() const AType* implT = calleeT->list_ref(1)->as_type(); copy.push_front(getFn); cenv.setType(getFn, implT); - copyT = implT->list_ref(2)->as_type(); + cenv.setType(copy, implT->list_ref(2)->as_type()); } - cenv.setType(copy, copyT); return copy; } -- cgit v1.2.1