Avoids unnecessary temporary in comprehensions with pure statements in them.

This commit is contained in:
Timothy Jones
2010-10-20 07:57:40 +13:00
parent 1442262376
commit a3500e807a
2 changed files with 2 additions and 5 deletions

View File

@@ -1654,7 +1654,7 @@
topLevel = del(o, 'top') && !this.returns;
range = this.source instanceof Value && this.source.base instanceof Range && !this.source.properties.length;
source = range ? this.source.base : this.source;
codeInBody = this.body.contains(function(node) {
codeInBody = !this.body.containsPureStatement() && this.body.contains(function(node) {
return node instanceof Code;
});
scope = o.scope;
@@ -1722,8 +1722,6 @@
if (range) {
body.unshift(new Literal("var " + name + " = " + ivar));
}
}
if (codeInBody && !body.containsPureStatement()) {
if (namePart) {
body.unshift(new Literal("var " + namePart));
}