aboutsummaryrefslogtreecommitdiffstats
path: root/src/lift.cpp
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2010-12-10 18:22:16 +0000
committerDavid Robillard <d@drobilla.net>2010-12-10 18:22:16 +0000
commitc0d05f679266f419f47b2636bd6f8b085ff23f1a (patch)
treec72ca6e46b514f8062ddd33596ed87507deae68e /src/lift.cpp
parent22e329617866a6580ccff5636f148d72603fa8fc (diff)
downloadresp-c0d05f679266f419f47b2636bd6f8b085ff23f1a.tar.gz
resp-c0d05f679266f419f47b2636bd6f8b085ff23f1a.tar.bz2
resp-c0d05f679266f419f47b2636bd6f8b085ff23f1a.zip
Fix type of lifted calls.
git-svn-id: http://svn.drobilla.net/resp/resp@345 ad02d1e2-f140-0410-9f75-f8b11f17cedd
Diffstat (limited to 'src/lift.cpp')
-rw-r--r--src/lift.cpp8
1 files changed, 3 insertions, 5 deletions
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<ATuple>(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;
}