<h3 dir="auto">💻</h3>
<ul class="contains-task-list">
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> Would you like to work on a fix?</li>
</ul>
<h3 dir="auto">How are you using Babel?</h3>
<p dir="auto">@babel/cli</p>
<h3 dir="auto">Input code</h3>
<p dir="auto">I tried to reproduce this in the REPL, but 7.17.10 isn't an option there and that's the only version where I've seen this happen.</p>
<h3 dir="auto">Configuration file name</h3>
<p dir="auto">babel.config.js</p>
<h3 dir="auto">Configuration</h3>
<p dir="auto"><em>No response</em></p>
<h3 dir="auto">Current and expected behavior</h3>
<p dir="auto">I have this simple method that produces a <code class="notranslate">get</code> function that will be used to build an accessor.  It' simple enough that up through 7.17.8 it came out of the transpiler with only whitespace changes:</p>
<div class="highlight highlight-source-js notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="makeGetter() {
  const wrapper = this;
  return function get() { return wrapper.getInfo( this ); };
}"><pre class="notranslate"><span class="pl-en">makeGetter</span><span class="pl-kos">(</span><span class="pl-kos">)</span><span class="pl-kos"></span> <span class="pl-kos">{</span>
  <span class="pl-k">const</span> <span class="pl-s1">wrapper</span> <span class="pl-c1">=</span> <span class="pl-smi">this</span><span class="pl-kos">;</span>
  <span class="pl-k">return</span> <span class="pl-k">function</span> <span class="pl-en">get</span><span class="pl-kos">(</span><span class="pl-kos">)</span> <span class="pl-kos">{</span> <span class="pl-k">return</span> <span class="pl-s1">wrapper</span><span class="pl-kos">.</span><span class="pl-en">getInfo</span><span class="pl-kos">(</span> <span class="pl-smi">this</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></pre></div>
<p dir="auto">After updating <code class="notranslate">@babel/core</code> from <code class="notranslate">7.17.8</code> to <code class="notranslate">7.17.10</code> it's getting transpiled to this:</p>
<div class="highlight highlight-source-js notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="  makeGetter() {
    return function get() {
      return this.getInfo(this);
    };
  }"><pre class="notranslate">  <span class="pl-en">makeGetter</span><span class="pl-kos">(</span><span class="pl-kos">)</span><span class="pl-kos"></span> <span class="pl-kos">{</span>
    <span class="pl-k">return</span> <span class="pl-k">function</span> <span class="pl-en">get</span><span class="pl-kos">(</span><span class="pl-kos">)</span> <span class="pl-kos">{</span>
      <span class="pl-k">return</span> <span class="pl-smi">this</span><span class="pl-kos">.</span><span class="pl-en">getInfo</span><span class="pl-kos">(</span><span class="pl-smi">this</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></pre></div>
<h3 dir="auto">Environment</h3>
<p dir="auto"><code class="notranslate">@babel/core</code> - <code class="notranslate">7.17.10</code><br>
<code class="notranslate">node v16.14.0</code></p>
<h3 dir="auto">Possible solution</h3>
<p dir="auto"><em>No response</em></p>
<h3 dir="auto">Additional context</h3>
<p dir="auto"><em>No response</em></p>
<h3 dir="auto"><g-emoji class="g-emoji" alias="computer" fallback-src="https://github.githubassets.com/images/icons/emoji/unicode/1f4bb.png">💻</g-emoji></h3>
<ul class="contains-task-list">
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> Would you like to work on a fix?</li>
</ul>
<h3 dir="auto">How are you using Babel?</h3>
<p dir="auto">@babel/cli</p>
<h3 dir="auto">Input code</h3>
<p dir="auto">Reproduced in <a href="https://babel.dev/repl#?browsers=defaults%2C%20not%20ie%2011%2C%20not%20ie_mob%2011&amp;build=&amp;builtIns=false&amp;corejs=3.21&amp;spec=false&amp;loose=false&amp;code_lz=MYGwhgzhAEBiD28BGYBO0DeAoa1jwDsIAXVAV2GPlQAoBKTHXaYgCwEsIA6AM0RXQBeaABYATAG4muGvWiCAfI2bN2PaDTade_NNACEg4eIbYVKtqngB3aAQCmtgKKortAORaYfZGnsATdzopc2gAX2lwunoQ8KwI_CJiaB95O0c4XVpgrCA&amp;debug=false&amp;forceAllTransforms=true&amp;shippedProposals=false&amp;circleciRepo=&amp;evaluate=false&amp;fileSize=false&amp;timeTravel=false&amp;sourceType=module&amp;lineWrap=false&amp;presets=env&amp;prettier=false&amp;targets=&amp;version=7.17.11&amp;externalPlugins=babel-plugin-minify-dead-code-elimination%400.5.1&amp;assumptions=%7B%7D" rel="nofollow">Babel REPL</a>.</p>
<h3 dir="auto">Configuration file name</h3>
<p dir="auto"><em>No response</em></p>
<h3 dir="auto">Configuration</h3>
<p dir="auto"><em>No response</em></p>
<h3 dir="auto">Current and expected behavior</h3>
<p dir="auto">Enabling <code class="notranslate">babel-plugin-minify-dead-code-elimination</code> plugin destroys <code class="notranslate">this</code> scope for arrow functions inside classes.</p>
<p dir="auto">The <code class="notranslate">var _this = this</code> workaround should not be eliminated as it is absolutely necessary for the <code class="notranslate">this</code> scope to work in locally defined arrow functions.</p>
<h3 dir="auto">Environment</h3>
<ul dir="auto">
<li>Babel version v7.17.11</li>
</ul>
<h3 dir="auto">Possible solution</h3>
<p dir="auto"><em>No response</em></p>
<h3 dir="auto">Additional context</h3>
<p dir="auto">I narrowed the problem down locally to <code class="notranslate">@babel/traverse</code> v7.17.10. By reverting that package to v7.17.9 this problem does not occur.</p>