clear scope uids when removing a binding - fixes #2101

This commit is contained in:
Sebastian McKenzie 2015-07-28 16:14:58 +01:00
parent f9a657dd36
commit fc8c38ac0d

View File

@ -1038,7 +1038,18 @@ export default class Scope {
*/
removeBinding(name: string) {
// clear literal binding
var info = this.getBinding(name);
if (info) info.scope.removeOwnBinding(name);
if (info) {
info.scope.removeOwnBinding(name);
}
// clear uids with this name - https://github.com/babel/babel/issues/2101
var scope = this;
do {
if (scope.uids[name]) {
scope.uids[name] = false;
}
} while(scope = scope.parent);
}
}