Fixed comprehension magic's scoping.

This commit is contained in:
Timothy Jones
2010-10-20 03:59:01 +13:00
parent 7b1902183c
commit d14ba6ac53
3 changed files with 7 additions and 8 deletions

View File

@@ -1724,7 +1724,7 @@
if (this.guard) {
body = Expressions.wrap([new If(this.guard, body)]);
}
if (codeInBody) {
if (codeInBody && !body.containsPureStatement()) {
if (range) {
body.unshift(new Literal("var " + name + " = " + ivar));
}
@@ -1742,7 +1742,8 @@
body.push(new Assign(new Literal(nvar), new Literal(name)));
}
body.push(lastLine);
body = Closure.wrap(body, true, true);
o.indent = this.idt(1);
body = Expressions.wrap([new Literal(body.compile(o))]);
if (index) {
body.push(new Assign(new Literal(index), new Literal(ivar)));
}