don't consider the LHS of an AssignmentExpression to be a reference
This commit is contained in:
parent
45b0d63d72
commit
355ffbdaf8
@ -105,14 +105,6 @@ var renameVisitor = {
|
||||
}
|
||||
},
|
||||
|
||||
Declaration(node, parent, scope, state) {
|
||||
var ids = this.getBindingIdentifiers();
|
||||
|
||||
for (var name in ids) {
|
||||
if (name === state.oldName) ids[name].name = state.newName;
|
||||
}
|
||||
},
|
||||
|
||||
Scope(node, parent, scope, state) {
|
||||
if (!scope.bindingIdentifierEquals(state.oldName, state.binding)) {
|
||||
this.skip();
|
||||
@ -120,6 +112,15 @@ var renameVisitor = {
|
||||
}
|
||||
};
|
||||
|
||||
renameVisitor.AssignmentExpression =
|
||||
renameVisitor.Declaration = function (node, parent, scope, state) {
|
||||
var ids = this.getBindingIdentifiers();
|
||||
|
||||
for (var name in ids) {
|
||||
if (name === state.oldName) ids[name].name = state.newName;
|
||||
}
|
||||
};
|
||||
|
||||
export default class Scope {
|
||||
|
||||
/**
|
||||
@ -548,15 +549,6 @@ export default class Scope {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Description
|
||||
*/
|
||||
|
||||
recrawl() {
|
||||
this.path.setData("scopeInfo", null);
|
||||
this.crawl();
|
||||
}
|
||||
|
||||
/**
|
||||
* Description
|
||||
*/
|
||||
|
||||
@ -99,6 +99,7 @@ export function isReferenced(node: Object, parent: Object): boolean {
|
||||
|
||||
// no: [NODE = foo] = [];
|
||||
// yes: [foo = NODE] = [];
|
||||
case "AssignmentExpression":
|
||||
case "AssignmentPattern":
|
||||
return parent.right === node;
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user