<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="var x = function() {
  if (!y) {
    y = 1;
  }
};
x();
var y = null;"><pre class="notranslate"><code class="notranslate">var x = function() {
  if (!y) {
    y = 1;
  }
};
x();
var y = null;
</code></pre></div>
<p dir="auto">The binding object for y:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="constant: true,
references: 0,
referenced: false,"><pre class="notranslate"><code class="notranslate">constant: true,
references: 0,
referenced: false,
</code></pre></div>
<p dir="auto">expected:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="constant: false,
references: 2,
referenced: true,"><pre class="notranslate"><code class="notranslate">constant: false,
references: 2,
referenced: true,
</code></pre></div>
<p dir="auto">This results in a constant binding:</p>
<div class="highlight highlight-source-js notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="bar = 2;
var bar = 1;"><pre class="notranslate"><span class="pl-s1">bar</span> <span class="pl-c1">=</span> <span class="pl-c1">2</span><span class="pl-kos">;</span>
<span class="pl-k">var</span> <span class="pl-s1">bar</span> <span class="pl-c1">=</span> <span class="pl-c1">1</span><span class="pl-kos">;</span></pre></div>
<p dir="auto">So does this:</p>
<div class="highlight highlight-source-js notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="function foo() {
  bar = 2;
}
var bar = 1;"><pre class="notranslate"><span class="pl-k">function</span> <span class="pl-en">foo</span><span class="pl-kos">(</span><span class="pl-kos">)</span> <span class="pl-kos">{</span>
  <span class="pl-s1">bar</span> <span class="pl-c1">=</span> <span class="pl-c1">2</span><span class="pl-kos">;</span>
<span class="pl-kos">}</span>
<span class="pl-k">var</span> <span class="pl-s1">bar</span> <span class="pl-c1">=</span> <span class="pl-c1">1</span><span class="pl-kos">;</span></pre></div>
<p dir="auto">According to <code class="notranslate">scope.bindings.bar.constant</code>, but I would expect it to be <code class="notranslate">false</code>.</p>
<p dir="auto">(Babel 5.8.25)</p>