Skip to content

Commit

Permalink
hotfix [for]: Fixed for..in unset scope
Browse files Browse the repository at this point in the history
For..in loops would pass a `SCOPE` argument, however this was not
defined at the same of the evaluation of the first iterator. This
resulted in it unable to lookup variables

Signed-off-by: Vihan B <contact@vihan.org>
  • Loading branch information
vihanb committed Dec 18, 2016
1 parent 75b5f45 commit 13f9bdb
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions src/cli/repl.es6
Expand Up @@ -144,7 +144,10 @@ The following commands are available:
else if (!Output) {
console.log(String(Output).red);
} else if (!printed) {
if (Output && Output.Cast && (
if (Output instanceof NIL) {
// do nothing?
}
else if (Output && Output.Cast && (
Output.Operator.has('repr') ||
Output.Cast.has('String'))) {

Expand All @@ -157,9 +160,6 @@ The following commands are available:
}
console.log(txt.magenta);
}
else if (Output instanceof NIL) {
// do nothing?
}
else if (Output instanceof CheddarScope) {
console.log(`< Instance of "${Output.constructor.Name}" >`.cyan);
}
Expand Down
2 changes: 1 addition & 1 deletion src/interpreter/states/for.es6
Expand Up @@ -14,7 +14,7 @@ export default class CheddarFor {

exec() {
// Create `for`'s scope, inherits from parent
let SCOPE;
let SCOPE = this.scope;

// Determine whether for..in or for (a; b; c)
// 4 tokens === for..in
Expand Down

0 comments on commit 13f9bdb

Please sign in to comment.