<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="function returnX(x, f = function () { return x }) {
    var x;
    return x;
}
returnX(42);"><pre class="notranslate"><code class="notranslate">function returnX(x, f = function () { return x }) {
    var x;
    return x;
}
returnX(42);
</code></pre></div>
<p dir="auto">In Firefox, this produces 42. In babel, this produces undefined.</p>
<p dir="auto">In the <a href="http://www.ecma-international.org/ecma-262/6.0/index.html#sec-functiondeclarationinstantiation" rel="nofollow">ECMAScript spec for FunctionDeclarationInstantiation</a>, item 28 &gt; f &gt; i &gt; 4/5, if a var name is also a parameter name, then it should get the parameter's value, even when the parameters have expressions (that is, default values).</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>