aboutsummaryrefslogtreecommitdiffstats
path: root/tuplr.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tuplr.cpp')
-rw-r--r--tuplr.cpp14
1 files changed, 6 insertions, 8 deletions
diff --git a/tuplr.cpp b/tuplr.cpp
index 31a83e5..6bea056 100644
--- a/tuplr.cpp
+++ b/tuplr.cpp
@@ -811,12 +811,10 @@ ASTSymbol::compile(CEnv& cenv)
void
ASTClosure::lift(CEnv& cenv)
{
- if (cenv.tenv.type(at(2))->var)
- throw Error("Closure with untyped body lifted");
- for (size_t i = 0; i < prot->size(); ++i)
- if (cenv.tenv.type(prot->at(i))->var)
- throw Error("Closure with untyped parameter lifted");
-
+ if (cenv.tenv.type(at(2))->var || !cenv.tenv.type(prot)->concrete()) {
+ std::cerr << "Closure has variable type, not lifting" << endl;
+ return;
+ }
assert(!func);
cenv.push();
@@ -851,8 +849,7 @@ ASTClosure::lift(CEnv& cenv)
Value*
ASTClosure::compile(CEnv& cenv)
{
- assert(func);
- return func; // Function was already compiled in the lifting pass
+ return func;
}
void
@@ -1139,6 +1136,7 @@ eval(CEnv& cenv, ExecutionEngine* engine, const string& name, istream& is)
// Create function for top-level of program
ASTTuple prot;
const Type* ctype = resultType->type();
+ assert(ctype);
Function* f = compileFunction(cenv, cenv.gensym("input"), ctype, prot);
BasicBlock* bb = BasicBlock::Create("entry", f);
cenv.builder.SetInsertPoint(bb);