diff options
Diffstat (limited to 'src/compile.cpp')
-rw-r--r-- | src/compile.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/compile.cpp b/src/compile.cpp index 2a716c2..605ec40 100644 --- a/src/compile.cpp +++ b/src/compile.cpp @@ -34,7 +34,10 @@ COMPILE_LITERAL(bool); CVal ASymbol::compile(CEnv& cenv) { - return *cenv.vals.ref(this); + if (cenv.vals.topLevel(this) && cenv.type(this)->head()->str() != "Fn") + return cenv.engine()->getGlobal(cenv, *cenv.vals.ref(this)); + else + return *cenv.vals.ref(this); } CVal @@ -72,8 +75,7 @@ ACall::compile(CEnv& cenv) CVal ADef::compile(CEnv& cenv) { - // Define stub first for recursion - cenv.def(sym(), body(), cenv.type(body()), NULL); + cenv.def(sym(), body(), cenv.type(body()), NULL); // define stub first for recursion CVal val = body()->compile(cenv); cenv.vals.def(sym(), val); return val; |