Skip to content
This repository has been archived by the owner on Jan 16, 2021. It is now read-only.

Commit

Permalink
1558 - holy fuck, eval was mismanaging scopes
Browse files Browse the repository at this point in the history
  • Loading branch information
akkartik committed Feb 17, 2012
1 parent 7ae2569 commit 704e66d
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions 008eval.cc
Expand Up @@ -351,6 +351,8 @@ Cell* eval(Cell* expr, Cell* scope) {
// lexical scope is already attached
return mkref(expr);

newDynamicScope(CURR_LEXICAL_SCOPE, scope);
dbg << expr << " || " << scope << endl;
// expr is a function call
Cell* fn = eval(car(expr), scope);
if (fn != nil && !isFunc(fn))
Expand Down Expand Up @@ -393,6 +395,7 @@ Cell* eval(Cell* expr, Cell* scope) {
rmref(orderedArgs);
rmref(splicedArgs);
rmref(fn);
endDynamicScope(CURR_LEXICAL_SCOPE);
return result; // already mkref'd
}

Expand Down

0 comments on commit 704e66d

Please sign in to comment.