diff options
-rw-r--r-- | src/flatten.cpp | 4 | ||||
-rw-r--r-- | src/llvm.cpp | 12 |
2 files changed, 8 insertions, 8 deletions
diff --git a/src/flatten.cpp b/src/flatten.cpp index 59748f3..613403b 100644 --- a/src/flatten.cpp +++ b/src/flatten.cpp @@ -127,7 +127,7 @@ flatten_if(CEnv& cenv, Code& code, const ATuple* aif) throw() code.push_back(else_goto); List end(Cursor(), cenv.penv.sym("if-end"), if_lab, NULL); - List def(Cursor(), cenv.penv.sym("def"), result, end, NULL); + List def(Cursor(), cenv.penv.sym("def"), result, end.head, NULL); code.push_back(def); cenv.setTypeSameAs(end, aif); @@ -155,7 +155,7 @@ flatten_call(CEnv& cenv, Code& code, const ATuple* call) throw() copy.push_back(arg); } const ASymbol* sym = cenv.penv.gensym(); - List def(Cursor(), cenv.penv.sym("def"), sym, copy, NULL); + List def(Cursor(), cenv.penv.sym("def"), sym, copy.head, NULL); code.push_back(def); cenv.setTypeSameAs(copy, call); diff --git a/src/llvm.cpp b/src/llvm.cpp index 4bb21ec..532051e 100644 --- a/src/llvm.cpp +++ b/src/llvm.cpp @@ -178,9 +178,6 @@ LLVMEngine::llType(const AST* t, const char* name) { if (t == NULL) { return NULL; - } else if (AType::is_var(t)) { - // Kludge for _me closure parameter, will be casted - return PointerType::get(Type::getInt8Ty(context), 0); } else if (AType::is_name(t)) { const std::string sym(t->as_symbol()->sym()); if (sym == "Nothing") return Type::getVoidTy(context); @@ -198,10 +195,13 @@ LLVMEngine::llType(const AST* t, const char* name) CTypes::const_iterator i = compiledTypes.find(sym); if (i != compiledTypes.end()) return i->second; - } - if (!AType::is_expr(t)) + cerr << "WARNING: No low-level type for " << t << endl; return NULL; + } + + THROW_IF(!isupper(t->as_tuple()->fst()->str()[0]), t->loc, + "Lower-case type expression"); // Define opaque type to stand for name in recursive type body if (name) { @@ -229,7 +229,7 @@ LLVMEngine::llType(const AST* t, const char* name) ret = FunctionType::get(llType(retT), cprot, false); - } else if (isupper(t->as_tuple()->fst()->str()[0])) { + } else { vector<const Type*> ctypes; ctypes.push_back(PointerType::get(Type::getInt8Ty(context), 0)); // RTTI for (ATuple::const_iterator i = t->as_tuple()->iter_at(1); i != t->as_tuple()->end(); ++i) { |