mirror of
https://github.com/jashkenas/coffeescript.git
synced 2026-02-18 11:31:20 -05:00
Avoids unnecessary temporary in comprehensions with pure statements in them.
This commit is contained in:
@@ -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));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user