From fc8c38ac0d72350632e9261bba00a5f1674e20a3 Mon Sep 17 00:00:00 2001 From: Sebastian McKenzie Date: Tue, 28 Jul 2015 16:14:58 +0100 Subject: [PATCH] clear scope uids when removing a binding - fixes #2101 --- packages/babel/src/traversal/scope/index.js | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/packages/babel/src/traversal/scope/index.js b/packages/babel/src/traversal/scope/index.js index 4a0145a135..a7542bf069 100644 --- a/packages/babel/src/traversal/scope/index.js +++ b/packages/babel/src/traversal/scope/index.js @@ -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); } }