From 2d0355b3b94351c96fb40ba6f3230a8ff75f19a8 Mon Sep 17 00:00:00 2001 From: Sebastian McKenzie Date: Mon, 8 Jun 2015 14:49:09 +0100 Subject: [PATCH] merge previous bindings constantViolations and path onto new bindings constantViolations --- src/babel/traversal/scope/binding.js | 9 ++++++++- src/babel/traversal/scope/index.js | 1 + 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/babel/traversal/scope/binding.js b/src/babel/traversal/scope/binding.js index fdb3471090..0f08028910 100644 --- a/src/babel/traversal/scope/binding.js +++ b/src/babel/traversal/scope/binding.js @@ -1,5 +1,5 @@ export default class Binding { - constructor({ identifier, scope, path, kind }) { + constructor({ existing, identifier, scope, path, kind }) { this.constantViolations = []; this.constant = true; @@ -12,6 +12,13 @@ export default class Binding { this.kind = kind; this.clearValue(); + + if (existing) { + this.constantViolations = this.constantViolations.concat( + existing.path, + existing.constantViolations + ); + } } /** diff --git a/src/babel/traversal/scope/index.js b/src/babel/traversal/scope/index.js index 7d828b5d04..20ba1065b8 100644 --- a/src/babel/traversal/scope/index.js +++ b/src/babel/traversal/scope/index.js @@ -508,6 +508,7 @@ export default class Scope { this.bindings[name] = new Binding({ identifier: id, + existing: local, scope: this, path: path, kind: kind