diff options
-rw-r--r-- | llvm.cpp | 5 | ||||
-rw-r--r-- | tuplr.hpp | 5 | ||||
-rw-r--r-- | typing.cpp | 8 |
3 files changed, 5 insertions, 13 deletions
@@ -237,7 +237,6 @@ AClosure::lift(CEnv& cenv) CValue retVal = cenv.compile(at(2)); llengine(cenv)->builder.CreateRet(LLVal(retVal)); // Finish function cenv.optimise(LLFunc(f)); - } catch (Error& e) { f->eraseFromParent(); // Error reading body, remove function cenv.pop(); @@ -501,7 +500,7 @@ AConsCall::lift(CEnv& cenv) ACall::lift(cenv); - ATuple* prot = new ATuple(loc, at(1), at(2), 0); + ATuple* protT = new ATuple(loc, cenv.type(at(1)), cenv.type(at(2)), 0); vector<const Type*> types; size_t sz = 0; @@ -521,7 +520,7 @@ AConsCall::lift(CEnv& cenv) vector<string> argNames; argNames.push_back("car"); argNames.push_back("cdr"); - Function* func = compileFunction(cenv, cenv.gensym("cons"), pT, *prot, argNames); + Function* func = compileFunction(cenv, cenv.gensym("cons"), pT, *protT, argNames); Value* mem = builder.CreateCall(LLVal(cenv.alloc), ConstantInt::get(Type::Int32Ty, sz), "mem"); Value* cell = builder.CreateBitCast(mem, pT, "cell"); @@ -74,11 +74,6 @@ struct LAddr { unsigned up, over; }; -inline ostream& operator<<(ostream& out, const LAddr& addr) { - out << addr.up << ":" << addr.over; - return out; -} - /// Generic Lexical Environment template<typename K, typename V> struct Env : public list< vector< pair<K,V> > > { @@ -36,11 +36,9 @@ ASymbol::constrain(TEnv& tenv, Constraints& c) const if (!addr) throw Error((format("undefined symbol `%1%'") % cppstr).str(), loc); AType* t = tenv.deref(addr); - if (!t) - throw Error((format("unresolved symbol `%1%'") % cppstr).str(), loc); - AType* var = tenv.deref(addr); - var->addr = addr; - c.push_back(Constraint(tenv.var(this), var, loc)); + assert(t); + t->addr = addr; + c.push_back(Constraint(tenv.var(this), t, loc)); } void |