assorted minor cleanup of variables

This commit is contained in:
Sebastian McKenzie 2015-04-13 21:56:37 -07:00
parent 64f5480f96
commit 46b7cc0a72
3 changed files with 9 additions and 9 deletions

View File

@ -465,14 +465,14 @@ class BlockScoping {
var declar;
//
for (var i = 0; i < declarators.length; i++) {
for (let i = 0; i < declarators.length; i++) {
declar = declarators[i];
extend(this.outsideLetReferences, t.getBindingIdentifiers(declar));
}
//
if (block.body) {
for (i = 0; i < block.body.length; i++) {
for (let i = 0; i < block.body.length; i++) {
declar = block.body[i];
if (isLet(declar, block)) {
declarators = declarators.concat(declar.declarations);
@ -481,7 +481,7 @@ class BlockScoping {
}
//
for (i = 0; i < declarators.length; i++) {
for (let i = 0; i < declarators.length; i++) {
declar = declarators[i];
var keys = t.getBindingIdentifiers(declar);
extend(this.letReferences, keys);

View File

@ -29,14 +29,11 @@ var immutabilityVisitor = {
};
export function JSXElement(node, parent, scope, file) {
if (node._ignoreConstant) return;
if (node._hoisted) return;
var state = { isImmutable: true };
this.traverse(immutabilityVisitor, state);
this.skip();
if (state.isImmutable) {
this.hoist();
node._ignoreConstant = true;
}
if (state.isImmutable) this.hoist();
}

View File

@ -19,7 +19,6 @@ var referenceVisitor = {
if (bindingInfo && bindingInfo.constant) {
state.bindings[node.name] = bindingInfo;
} else {
scope.dump();
state.foundIncompatible = true;
this.stop();
}
@ -90,6 +89,10 @@ export default class PathHoister {
}
run() {
var node = this.path.node;
if (node._hoisted) return;
this.path._hoisted = true;
this.path.traverse(referenceVisitor, this);
if (this.foundIncompatible) return;