<h2 dir="auto">Bug</h2>
<h3 dir="auto">Input Code</h3>
<p dir="auto"><a href="http://babeljs.io/repl/#?babili=false&amp;evaluate=true&amp;lineWrap=false&amp;presets=es2015%2Creact%2Cstage-2&amp;targets=&amp;browsers=&amp;builtIns=false&amp;debug=false&amp;code=function%20delay(time)%20%7B%0A%20%20return%20new%20Promise((resolve%2C%20reject)%3D%3E%7B%0A%20%20%20%20setTimeout(()%3D%3Eresolve()%2C%20time)%3B%0A%20%20%7D)%3B%0A%7D%0A%0A%5B1000%2C2000%2C3000%2C4000%5D.forEach(async%20(time)%20%3D%3E%20%7B%0A%20%20await%20delay(time)%3B%0A%20%20console.log(time)%3B%0A%7D)%0A%0Aconsole.log(%5B100000%5D)%0A" rel="nofollow">REPL LINK</a></p>
<div class="highlight highlight-source-js notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="function delay(time) {
  return new Promise((resolve, reject)=&gt;{
    setTimeout(()=&gt;resolve(), time);
  });
}

[1000,2000,3000,4000].forEach(async (time) =&gt; {
  await delay(time);
  console.log(time);
})

console.log([100000])"><pre class="notranslate"><span class="pl-k">function</span> <span class="pl-en">delay</span><span class="pl-kos">(</span><span class="pl-s1">time</span><span class="pl-kos">)</span> <span class="pl-kos">{</span>
  <span class="pl-k">return</span> <span class="pl-k">new</span> <span class="pl-v">Promise</span><span class="pl-kos">(</span><span class="pl-kos">(</span><span class="pl-s1">resolve</span><span class="pl-kos">,</span> <span class="pl-s1">reject</span><span class="pl-kos">)</span><span class="pl-c1">=&gt;</span><span class="pl-kos">{</span>
    <span class="pl-en">setTimeout</span><span class="pl-kos">(</span><span class="pl-kos">(</span><span class="pl-kos">)</span><span class="pl-c1">=&gt;</span><span class="pl-s1">resolve</span><span class="pl-kos">(</span><span class="pl-kos">)</span><span class="pl-kos">,</span> <span class="pl-s1">time</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">1000</span><span class="pl-kos">,</span><span class="pl-c1">2000</span><span class="pl-kos">,</span><span class="pl-c1">3000</span><span class="pl-kos">,</span><span class="pl-c1">4000</span><span class="pl-kos">]</span><span class="pl-kos">.</span><span class="pl-en">forEach</span><span class="pl-kos">(</span><span class="pl-k">async</span> <span class="pl-kos">(</span><span class="pl-s1">time</span><span class="pl-kos">)</span> <span class="pl-c1">=&gt;</span> <span class="pl-kos">{</span>
  <span class="pl-k">await</span> <span class="pl-en">delay</span><span class="pl-kos">(</span><span class="pl-s1">time</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
  <span class="pl-smi">console</span><span class="pl-kos">.</span><span class="pl-en">log</span><span class="pl-kos">(</span><span class="pl-s1">time</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
<span class="pl-kos">}</span><span class="pl-kos">)</span>

<span class="pl-smi">console</span><span class="pl-kos">.</span><span class="pl-en">log</span><span class="pl-kos">(</span><span class="pl-kos">[</span><span class="pl-c1">100000</span><span class="pl-kos">]</span><span class="pl-kos">)</span></pre></div>
<h3 dir="auto">Expected Behavior</h3>
<p dir="auto">Output:</p>
<div class="highlight highlight-source-js notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="Array [100000]    // at 0s
1000  // at 1s
2000  // at 2s
3000  // at 3s
4000  // at 4s"><pre class="notranslate"><span class="pl-v">Array</span> <span class="pl-kos">[</span><span class="pl-c1">100000</span><span class="pl-kos">]</span>    <span class="pl-c">// at 0s</span>
<span class="pl-c1">1000</span>  <span class="pl-c">// at 1s</span>
<span class="pl-c1">2000</span>  <span class="pl-c">// at 2s</span>
<span class="pl-c1">3000</span>  <span class="pl-c">// at 3s</span>
<span class="pl-c1">4000</span>  <span class="pl-c">// at 4s</span></pre></div>
<blockquote>
<p dir="auto">And the Chrome newest version just act like this.</p>
</blockquote>
<h3 dir="auto">Current Behavior</h3>


<p dir="auto">Output:</p>
<div class="highlight highlight-source-js notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="// at 0s
Array [100000]

// at 1s
Array [100000]
1000

// at 2s
Array [100000]
1000
2000

// at 3s
Array [100000]
1000
2000
3000

// at 4s
Array [100000]
1000
2000
3000
4000"><pre class="notranslate"><span class="pl-c">// at 0s</span>
<span class="pl-v">Array</span> <span class="pl-kos">[</span><span class="pl-c1">100000</span><span class="pl-kos">]</span>

<span class="pl-c">// at 1s</span>
<span class="pl-v">Array</span> <span class="pl-kos">[</span><span class="pl-c1">100000</span><span class="pl-kos">]</span>
<span class="pl-c1">1000</span>

<span class="pl-c">// at 2s</span>
<span class="pl-v">Array</span> <span class="pl-kos">[</span><span class="pl-c1">100000</span><span class="pl-kos">]</span>
<span class="pl-c1">1000</span>
<span class="pl-c1">2000</span>

<span class="pl-c">// at 3s</span>
<span class="pl-v">Array</span> <span class="pl-kos">[</span><span class="pl-c1">100000</span><span class="pl-kos">]</span>
<span class="pl-c1">1000</span>
<span class="pl-c1">2000</span>
<span class="pl-c1">3000</span>

<span class="pl-c">// at 4s</span>
<span class="pl-v">Array</span> <span class="pl-kos">[</span><span class="pl-c1">100000</span><span class="pl-kos">]</span>
<span class="pl-c1">1000</span>
<span class="pl-c1">2000</span>
<span class="pl-c1">3000</span>
<span class="pl-c1">4000</span></pre></div>
<blockquote>
<p dir="auto">I thought the problem is at the function <code class="notranslate">_asyncToGenerator</code>.</p>
</blockquote>
<h2 dir="auto">Bug Report</h2>
<p dir="auto"><strong>Current Behavior</strong><br>
using decorators with stage-0 doesn't work as before; no mix of syntax-decorators and decoratorsBefore or legacy works;<br>
throws mix of errors like legacy true and/or decoratorsBeforeExport true/false required<br>
see duplicate code throughout babel handling decorators, all start with <code class="notranslate">var decoratorsBeforeExport =</code> followed by this bizarre throw sequence of checks:</p>
<div class="highlight highlight-source-js notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="var decoratorsBeforeExport = ....
if( ... null
throw ... Error
other cases...
throw Error(s)"><pre class="notranslate"><span class="pl-k">var</span> <span class="pl-s1">decoratorsBeforeExport</span> <span class="pl-c1">=</span> ...<span class="pl-kos">.</span>
<span class="pl-k">if</span><span class="pl-kos">(</span> ... <span class="pl-s1">null</span>
<span class="pl-s1">throw</span> ... <span class="pl-v">Error</span>
<span class="pl-s1">other</span> <span class="pl-s1">cases</span><span class="pl-kos">.</span><span class="pl-kos">.</span><span class="pl-kos">.</span>
<span class="pl-c1">throw</span> <span class="pl-v">Error</span><span class="pl-kos">(</span><span class="pl-s1">s</span><span class="pl-kos">)</span></pre></div>
<p dir="auto"><strong>Input Code</strong></p>
<ul dir="auto">
<li>REPL or Repo link if applicable:</li>
</ul>
<div class="highlight highlight-source-js notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="@Thing
export default class Stuff extends Extensible"><pre class="notranslate">@<span class="pl-v">Thing</span>
<span class="pl-k">export</span> <span class="pl-k">default</span> <span class="pl-k">class</span> <span class="pl-v">Stuff</span> <span class="pl-k">extends</span> <span class="pl-v">Extensible</span></pre></div>
<p dir="auto"><strong>Expected behavior/code</strong><br>
A clear and concise description of what you expected to happen (or code).</p>
<p dir="auto"><strong>Babel Configuration (.babelrc, package.json, cli command)</strong></p>
<div class="highlight highlight-source-js notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="various combinations of:
{
presets: [&quot;stage-0&quot;,&quot;react&quot;]
,plugins: [[&quot;syntax-decorators&quot;, {&quot;legacy&quot;:true, &quot;decoratorsBeforeExport&quot;:true}]]
}"><pre class="notranslate">various <span class="pl-s1">combinations</span> <span class="pl-k">of</span>:
<span class="pl-kos">{</span>
<span class="pl-c1">presets</span>: <span class="pl-kos">[</span><span class="pl-s">"stage-0"</span><span class="pl-kos">,</span><span class="pl-s">"react"</span><span class="pl-kos">]</span>
<span class="pl-kos">,</span><span class="pl-c1">plugins</span>: <span class="pl-kos">[</span><span class="pl-kos">[</span><span class="pl-s">"syntax-decorators"</span><span class="pl-kos">,</span> <span class="pl-kos">{</span><span class="pl-s">"legacy"</span>:<span class="pl-c1">true</span><span class="pl-kos">,</span> <span class="pl-s">"decoratorsBeforeExport"</span>:<span class="pl-c1">true</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"><strong>Environment</strong></p>
<ul dir="auto">
<li>Babel version 7.0.0</li>
<li>How you are using Babel: web browser</li>
</ul>
<p dir="auto"><strong>Possible Solution</strong><br>
handle decorators in one place, comment in code how to properly set the options so that the old stage-0 legacy behavior (sample above) works as before</p>
<p dir="auto"><strong>Additional context/Screenshots</strong><br>
context: all the projects with this old approach</p>