aboutsummaryrefslogtreecommitdiffstats
path: root/llvm.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm.cpp')
-rw-r--r--llvm.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/llvm.cpp b/llvm.cpp
index 240cb2f..2493056 100644
--- a/llvm.cpp
+++ b/llvm.cpp
@@ -308,7 +308,7 @@ maybeLookup(CEnv& cenv, AST* ast)
{
ASymbol* s = dynamic_cast<ASymbol*>(ast);
if (s && s->addr)
- return cenv.code.deref(s->addr);
+ return cenv.tenv.deref(s->addr).first;
return ast;
}
@@ -371,8 +371,6 @@ ACall::compile(CEnv& cenv)
void
ADefinition::lift(CEnv& cenv)
{
- if (cenv.code.lookup(at(1)->as<ASymbol*>()))
- throw Error(string("`") + at(1)->str() + "' redefined", loc);
// Define first for recursion
cenv.def(at(1)->as<ASymbol*>(), at(2), cenv.type(at(2)), NULL);
at(2)->lift(cenv);
@@ -381,6 +379,8 @@ ADefinition::lift(CEnv& cenv)
CValue
ADefinition::compile(CEnv& cenv)
{
+ // Define first for recursion
+ cenv.def(at(1)->as<ASymbol*>(), at(2), cenv.type(at(2)), NULL);
return cenv.compile(at(2));
}