aboutsummaryrefslogtreecommitdiffstats
path: root/llvm.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm.cpp')
-rw-r--r--llvm.cpp11
1 files changed, 4 insertions, 7 deletions
diff --git a/llvm.cpp b/llvm.cpp
index a599872..f4576ce 100644
--- a/llvm.cpp
+++ b/llvm.cpp
@@ -124,7 +124,6 @@ CEnv::compile(AST* obj)
void
CEnv::optimise(CFunction f)
{
- _pimpl->module->dump();
verifyFunction(*static_cast<Function*>(f));
_pimpl->opt.run(*static_cast<Function*>(f));
}
@@ -264,10 +263,9 @@ AClosure::liftCall(CEnv& cenv, const vector<AType*>& argsT)
argsSubst[dynamic_cast<AType*>(genericProtT->at(i))] = dynamic_cast<AType*>(argsT.at(i));
AType* thisType = new AType(*dynamic_cast<ATuple*>(argsSubst.apply(genericType)), loc);
- cenv.err << "THIS TYPE: " << thisType << endl;
- //if (!thisType->concrete())
- // throw Error("unable to resolve concrete type for function", loc);
+ if (!thisType->concrete())
+ throw Error("unable to resolve concrete type for function", loc);
if (funcs.find(thisType))
return;
@@ -601,15 +599,15 @@ eval(CEnv& cenv, const string& name, istream& is)
list< pair<SExp, AST*> > exprs;
Cursor cursor(name);
try {
- Constraints c;
while (true) {
SExp exp = readExpression(cursor, is);
if (exp.type == SExp::LIST && exp.list.empty())
break;
result = cenv.penv.parse(exp); // Parse input
+ Constraints c;
result->constrain(cenv.tenv, c); // Constrain types
- cenv.tsubst = TEnv::unify(c); // Solve type constraints
+ cenv.tsubst = Subst::compose(cenv.tsubst, TEnv::unify(c)); // Solve type constraints
resultType = cenv.type(result);
result->lift(cenv); // Lift functions
exprs.push_back(make_pair(exp, result));
@@ -650,7 +648,6 @@ repl(CEnv& cenv)
Cursor cursor("(stdin)");
Constraints c;
try {
-
SExp exp = readExpression(cursor, std::cin);
if (exp.type == SExp::LIST && exp.list.empty())
break;