removed useless property accesses from for-of

This commit is contained in:
satyr
2010-09-22 12:55:19 +09:00
parent 07d9e9b71e
commit 540783a6dd
2 changed files with 9 additions and 8 deletions

View File

@@ -1648,8 +1648,8 @@
return n instanceof CodeNode;
});
scope = o.scope;
name = (this.name && this.name.compile(o)) || scope.freeVariable('i');
index = this.index && this.index.compile(o);
name = this.name == null ? undefined : this.name.compile(o);
index = this.index == null ? undefined : this.index.compile(o);
if (name && !this.pattern && (range || !codeInBody)) {
scope.find(name, {
immediate: true
@@ -1665,13 +1665,13 @@
}
ivar = (function() {
if (codeInBody) {
return scope.freeVariable('i');
return null;
} else if (range) {
return name;
} else {
return index || scope.freeVariable('i');
return index;
}
})();
})() || scope.freeVariable('i');
varPart = '';
guardPart = '';
body = Expressions.wrap([this.body]);