aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--tuplr.hpp4
-rw-r--r--tuplr_llvm.cpp12
2 files changed, 5 insertions, 11 deletions
diff --git a/tuplr.hpp b/tuplr.hpp
index d253a49..45d5908 100644
--- a/tuplr.hpp
+++ b/tuplr.hpp
@@ -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);