diff options
author | David Robillard <d@drobilla.net> | 2009-03-06 01:43:02 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2009-03-06 01:43:02 +0000 |
commit | 43410b02c4a4d8c3476880f4b073e5bf5adc5acb (patch) | |
tree | a8c5a04752e96f6db18e84e6f176150f29390a9b | |
parent | 11a8a861a1f026a9c1869fc1a164dfb62fbcb956 (diff) | |
download | resp-43410b02c4a4d8c3476880f4b073e5bf5adc5acb.tar.gz resp-43410b02c4a4d8c3476880f4b073e5bf5adc5acb.tar.bz2 resp-43410b02c4a4d8c3476880f4b073e5bf5adc5acb.zip |
Fix polymorphic lifting (sort of, can only lift once still).
git-svn-id: http://svn.drobilla.net/resp/tuplr@54 ad02d1e2-f140-0410-9f75-f8b11f17cedd
-rw-r--r-- | tuplr.hpp | 4 | ||||
-rw-r--r-- | tuplr_llvm.cpp | 12 |
2 files changed, 5 insertions, 11 deletions
@@ -82,8 +82,8 @@ SExp readExpression(Cursor& cur, std::istream& in); * Abstract Syntax Tree * ***************************************************************************/ -struct TEnv; ///< Type-Time Environment -struct CEnv; ///< Compile-Time Environment +struct TEnv; ///< Type-Time Environment +struct CEnv; ///< Compile-Time Environment /// Base class for all AST nodes struct AST { diff --git a/tuplr_llvm.cpp b/tuplr_llvm.cpp index 4ed3ba5..8d1f1db 100644 --- a/tuplr_llvm.cpp +++ b/tuplr_llvm.cpp @@ -208,14 +208,9 @@ void ASTClosure::lift(CEnv& cenv) { AType* type = cenv.tenv.type(this); - if (!type->concrete()) { - err << "closure is untyped, not lifting" << endl; + if (!type->concrete() || funcs.find(type)) return; - } - if (funcs.find(type)) - return; - cenv.push(); // Write function declaration @@ -288,7 +283,7 @@ ASTCall::compile(CEnv& cenv) } assert(c); - Function* f = dynamic_cast<Function*>(LLVal(cenv.compile(c))); + Function* f = dynamic_cast<Function*>(LLVal(c->compile(cenv))); if (!f) throw Error("callee failed to compile", exp.loc); vector<Value*> params(size() - 1); @@ -570,8 +565,7 @@ repl(CEnv& cenv) cenv.tenv.solve(); // Solve and apply type constraints AType* bodyT = cenv.tenv.type(body); - if (!bodyT) throw Error("call to untyped body", cursor); - if (!bodyT->concrete()) throw Error("call to variable typed body", cursor); + if (!bodyT) throw Error("call to untyped body", cursor); body->lift(cenv); |