merging in satyr/for-of-diet

This commit is contained in:
Jeremy Ashkenas
2010-09-22 23:26:11 -04:00
2 changed files with 8 additions and 4 deletions

View File

@@ -1644,7 +1644,7 @@
return n instanceof CodeNode;
});
scope = o.scope;
name = (this.name && this.name.compile(o)) || scope.freeVariable('i');
name = this.name && this.name.compile(o);
index = this.index && this.index.compile(o);
if (name && !this.pattern && (range || !codeInBody)) {
scope.find(name, {
@@ -1659,7 +1659,10 @@
if (!(topLevel)) {
rvar = scope.freeVariable('result');
}
ivar = codeInBody ? scope.freeVariable('i') : (range ? name : index || scope.freeVariable('i'));
ivar = range ? name : index;
if (!ivar || codeInBody) {
ivar = scope.freeVariable('i');
}
varPart = '';
guardPart = '';
body = Expressions.wrap([this.body]);