delay binding reassignment to after reference replacements - #751
This commit is contained in:
parent
85d33536e0
commit
34ca1ac04f
@ -155,11 +155,6 @@ Scope.prototype.rename = function (oldName, newName) {
|
||||
var binding = info.identifier;
|
||||
var scope = info.scope;
|
||||
|
||||
this.clearOwnBinding(oldName);
|
||||
scope.bindings[newName] = info;
|
||||
|
||||
binding.name = newName;
|
||||
|
||||
scope.traverse(scope.block, {
|
||||
enter: function (node, parent, scope) {
|
||||
if (t.isReferencedIdentifier(node, parent) && node.name === oldName) {
|
||||
@ -171,6 +166,11 @@ Scope.prototype.rename = function (oldName, newName) {
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
this.clearOwnBinding(oldName);
|
||||
scope.bindings[newName] = info;
|
||||
|
||||
binding.name = newName;
|
||||
};
|
||||
|
||||
Scope.prototype.inferType = function (node) {
|
||||
@ -312,7 +312,7 @@ var programReferenceVisitor = {
|
||||
state.addGlobal(node);
|
||||
} else if (t.isLabeledStatement(node)) {
|
||||
state.addGlobal(node);
|
||||
} else if (t.isAssignmentExpression(node)) {
|
||||
} else if (t.isAssignmentExpression(node) || t.isUpdateExpression(node)) {
|
||||
scope.registerBindingReassignment(node);
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user