<blockquote>
<p dir="auto">Issue originally made by <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/Ginden/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/Ginden">@Ginden</a></p>
</blockquote>
<h3 dir="auto">Bug information</h3>
<ul dir="auto">
<li><strong>Babel version:</strong> 5 (REPL)</li>
<li><strong>Node version:</strong> REPL</li>
<li><strong>npm version:</strong> REPL</li>
</ul>
<h3 dir="auto">Input code</h3>
<div class="highlight highlight-source-js notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="(function(x, f = () =&gt; x) {
      var x;
      var y = x;
      x = 2;
      return [x, y, f()];
   })(1)"><pre class="notranslate"><span class="pl-kos">(</span><span class="pl-k">function</span><span class="pl-kos">(</span><span class="pl-s1">x</span><span class="pl-kos">,</span> <span class="pl-s1">f</span> <span class="pl-c1">=</span> <span class="pl-kos">(</span><span class="pl-kos">)</span> <span class="pl-c1">=&gt;</span> <span class="pl-s1">x</span><span class="pl-kos">)</span> <span class="pl-kos">{</span>
      <span class="pl-k">var</span> <span class="pl-s1">x</span><span class="pl-kos">;</span>
      <span class="pl-k">var</span> <span class="pl-s1">y</span> <span class="pl-c1">=</span> <span class="pl-s1">x</span><span class="pl-kos">;</span>
      <span class="pl-s1">x</span> <span class="pl-c1">=</span> <span class="pl-c1">2</span><span class="pl-kos">;</span>
      <span class="pl-k">return</span> <span class="pl-kos">[</span><span class="pl-s1">x</span><span class="pl-kos">,</span> <span class="pl-s1">y</span><span class="pl-kos">,</span> <span class="pl-s1">f</span><span class="pl-kos">(</span><span class="pl-kos">)</span><span class="pl-kos">]</span><span class="pl-kos">;</span>
   <span class="pl-kos">}</span><span class="pl-kos">)</span><span class="pl-kos">(</span><span class="pl-c1">1</span><span class="pl-kos">)</span></pre></div>
<h3 dir="auto">Description</h3>
<p dir="auto">Valid ES2015 behavior: <code class="notranslate">f= () =&gt; x</code> should return value of x, regardless of further <code class="notranslate">var x;</code> statement.</p>
<p dir="auto">The following snippet:</p>
<div class="highlight highlight-source-js notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="(function(x, f = () =&gt; x) { 
  var x; 
  var y = x; 
  x = 2; 
  return [x, y, f()];
})(1)"><pre class="notranslate"><span class="pl-kos">(</span><span class="pl-k">function</span><span class="pl-kos">(</span><span class="pl-s1">x</span><span class="pl-kos">,</span> <span class="pl-s1">f</span> <span class="pl-c1">=</span> <span class="pl-kos">(</span><span class="pl-kos">)</span> <span class="pl-c1">=&gt;</span> <span class="pl-s1">x</span><span class="pl-kos">)</span> <span class="pl-kos">{</span> 
  <span class="pl-k">var</span> <span class="pl-s1">x</span><span class="pl-kos">;</span> 
  <span class="pl-k">var</span> <span class="pl-s1">y</span> <span class="pl-c1">=</span> <span class="pl-s1">x</span><span class="pl-kos">;</span> 
  <span class="pl-s1">x</span> <span class="pl-c1">=</span> <span class="pl-c1">2</span><span class="pl-kos">;</span> 
  <span class="pl-k">return</span> <span class="pl-kos">[</span><span class="pl-s1">x</span><span class="pl-kos">,</span> <span class="pl-s1">y</span><span class="pl-kos">,</span> <span class="pl-s1">f</span><span class="pl-kos">(</span><span class="pl-kos">)</span><span class="pl-kos">]</span><span class="pl-kos">;</span>
<span class="pl-kos">}</span><span class="pl-kos">)</span><span class="pl-kos">(</span><span class="pl-c1">1</span><span class="pl-kos">)</span></pre></div>
<p dir="auto">gives <code class="notranslate">[2, null, 1]</code> in Babel. Aside from <code class="notranslate">x</code> shadowing behavior (and what <code class="notranslate">f</code> should resolve to — 1 or 2 (which Babel and FF disagree on)), <code class="notranslate">y</code> definitely shouldn't be <code class="notranslate">null</code> here (as far as I can tell), so this looks like a bug?</p>