diff options
Diffstat (limited to 'src/llvm.cpp')
-rw-r--r-- | src/llvm.cpp | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/src/llvm.cpp b/src/llvm.cpp index 2bd1930..3110c72 100644 --- a/src/llvm.cpp +++ b/src/llvm.cpp @@ -184,7 +184,7 @@ LLVMEngine::~LLVMEngine() Type* LLVMEngine::llType(const AST* t, const char* name) { - if (t == NULL) { + if (t == NULL || AType::is_var(t)) { return NULL; } else if (AType::is_name(t)) { const std::string sym(t->as_symbol()->sym()); @@ -207,8 +207,8 @@ LLVMEngine::llType(const AST* t, const char* name) return NULL; } - THROW_IF(!isupper(t->as_tuple()->fst()->str()[0]), t->loc, - "Lower-case type expression"); + THROW_IF(t->as_tuple()->fst() && !isupper(t->as_tuple()->fst()->str()[0]), + t->loc, "Lower-case type expression"); // Function type if (is_form(t, "Fn")) { @@ -414,12 +414,14 @@ LLVMEngine::compileProt( Function::LinkageTypes linkage = Function::ExternalLinkage; vector<Type*> cprot; - for (const auto& i : *argsT) { - const CType iT = (i->to_symbol()) - ? compileType(cenv, i->str(), cenv.resolveType(i)) - : compileType(cenv, i->as_tuple()->fst()->str(), i); - THROW_IF(!iT, Cursor(), string("non-concrete parameter :: ") + i->str()); - cprot.push_back((Type*)iT); + if (argsT) { + for (const auto& i : *argsT) { + const CType iT = (i->to_symbol()) + ? compileType(cenv, i->str(), cenv.resolveType(i)) + : compileType(cenv, i->as_tuple()->fst()->str(), i); + THROW_IF(!iT, Cursor(), string("non-concrete parameter :: ") + i->str()); + cprot.push_back((Type*)iT); + } } THROW_IF(!llType(retT), Cursor(), |