From b0317f9babc39a92c159e93460a95be268d5dd42 Mon Sep 17 00:00:00 2001 From: Sebastian McKenzie Date: Wed, 13 May 2015 12:33:08 +0100 Subject: [PATCH] don't consider "globals" to cause incompatible scope hoist --- src/babel/traversal/path/hoister.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/babel/traversal/path/hoister.js b/src/babel/traversal/path/hoister.js index 6bb4283364..137fa6c233 100644 --- a/src/babel/traversal/path/hoister.js +++ b/src/babel/traversal/path/hoister.js @@ -16,11 +16,13 @@ var referenceVisitor = { // eg. it's in a closure etc if (bindingInfo !== state.scope.getBinding(node.name)) return; - if (bindingInfo && bindingInfo.constant) { - state.bindings[node.name] = bindingInfo; - } else { - state.foundIncompatible = true; - this.stop(); + if (bindingInfo) { + if (bindingInfo.constant) { + state.bindings[node.name] = bindingInfo; + } else { + state.foundIncompatible = true; + this.stop(); + } } } }