<h3 dir="auto">Input Code</h3>
<div class="highlight highlight-source-js notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="const makePromise = () =&gt; {
  return new Promise((resolve) =&gt; {
    setTimeout(() =&gt; {
      resolve('FOO');
    }, 500);
  });
};

(async () =&gt; {
  const foo = do {
    try {
      await makePromise();
    } catch (error) {

    }
  };

  console.log('foo', foo);
})();"><pre class="notranslate"><span class="pl-k">const</span> <span class="pl-en">makePromise</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-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-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-kos">{</span>
      <span class="pl-s1">resolve</span><span class="pl-kos">(</span><span class="pl-s">'FOO'</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">500</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-kos">(</span><span class="pl-k">async</span> <span class="pl-kos">(</span><span class="pl-kos">)</span> <span class="pl-c1">=&gt;</span> <span class="pl-kos">{</span>
  <span class="pl-k">const</span> <span class="pl-s1">foo</span> <span class="pl-c1">=</span> <span class="pl-s1">do</span><span class="pl-kos"></span> <span class="pl-kos">{</span>
    <span class="pl-k">try</span> <span class="pl-kos">{</span>
      <span class="pl-k">await</span> <span class="pl-en">makePromise</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">catch</span> <span class="pl-kos">(</span><span class="pl-s1">error</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-smi">console</span><span class="pl-kos">.</span><span class="pl-en">log</span><span class="pl-kos">(</span><span class="pl-s">'foo'</span><span class="pl-kos">,</span> <span class="pl-s1">foo</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></pre></div>
<h3 dir="auto">Babel Configuration (.babelrc, package.json, cli command)</h3>
<div class="highlight highlight-source-js notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="{
  &quot;plugins&quot;: [
    &quot;transform-async-to-generator&quot;,
    &quot;transform-do-expressions&quot;
  ]
}
"><pre class="notranslate"><span class="pl-kos">{</span>
  <span class="pl-s">"plugins"</span>: <span class="pl-kos">[</span>
    <span class="pl-s">"transform-async-to-generator"</span><span class="pl-kos">,</span>
    <span class="pl-s">"transform-do-expressions"</span>
  <span class="pl-kos">]</span>
<span class="pl-kos">}</span></pre></div>
<h3 dir="auto">Expected Behavior</h3>
<p dir="auto">Expect program to output: <code class="notranslate">foo FOO</code>.</p>
<h3 dir="auto">Current Behavior</h3>
<p dir="auto">Getting a run-time error:</p>
<div class="highlight highlight-source-shell notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="$ babel-node ./foo.js
/test/foo.js:14
      return yield makePromise();
                   ^^^^^^^^^^^
SyntaxError: Unexpected identifier
    at Object.exports.runInThisContext (vm.js:76:16)
    at Module._compile (module.js:545:28)
    at loader (/test/node_modules/babel-register/lib/node.js:144:5)
    at Object.require.extensions.(anonymous function) [as .js] (/test/node_modules/babel-register/lib/node.js:154:7)
    at Module.load (module.js:490:32)
    at tryModuleLoad (module.js:449:12)
    at Function.Module._load (module.js:441:3)
    at Function.Module.runMain (module.js:607:10)
    at /test/node_modules/babel-cli/lib/_babel-node.js:159:24
    at Object.&lt;anonymous&gt; (/test/node_modules/babel-cli/lib/_babel-node.js:160:7)"><pre class="notranslate">$ babel-node ./foo.js
/test/foo.js:14
      <span class="pl-k">return</span> yield <span class="pl-en">makePromise</span>();
                   ^^^^^^^^^^^
SyntaxError: Unexpected identifier
    at Object.exports.runInThisContext (vm.js:76:16)
    at Module._compile (module.js:545:28)
    at loader (/test/node_modules/babel-register/lib/node.js:144:5)
    at Object.require.extensions.(anonymous function) [as .js] (/test/node_modules/babel-register/lib/node.js:154:7)
    at Module.load (module.js:490:32)
    at tryModuleLoad (module.js:449:12)
    at Function.Module._load (module.js:441:3)
    at Function.Module.runMain (module.js:607:10)
    at /test/node_modules/babel-cli/lib/_babel-node.js:159:24
    at Object.<span class="pl-k">&lt;</span>anonymous<span class="pl-k">&gt;</span> (/test/node_modules/babel-cli/lib/_babel-node.js:160:7)</pre></div>
<h3 dir="auto">Your Environment</h3>
<table role="table">
<thead>
<tr>
<th>software</th>
<th>version</th>
</tr>
</thead>
<tbody>
<tr>
<td>Babel</td>
<td>6.18.0</td>
</tr>
<tr>
<td>node</td>
<td>v7.0.0</td>
</tr>
<tr>
<td>npm</td>
<td>3.10.8</td>
</tr>
<tr>
<td>Operating System</td>
<td>macOS v16.1.0</td>
</tr>
</tbody>
</table>
<blockquote>
<p dir="auto">Issue originally made by @AppShipIt</p>
</blockquote>
<h3 dir="auto">Bug information</h3>
<ul dir="auto">
<li><strong>Babel version:</strong> 6.3.17</li>
<li><strong>Node version:</strong> 5.0.0</li>
<li><strong>npm version:</strong> 3.5.1</li>
</ul>
<h3 dir="auto">Options</h3>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="{
  &quot;presets&quot;: [
    &quot;es2015&quot;,
    &quot;stage-0&quot;
  ]
}"><pre class="notranslate"><code class="notranslate">{
  "presets": [
    "es2015",
    "stage-0"
  ]
}
</code></pre></div>
<h3 dir="auto">Input code</h3>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="const testSwitch = () =&gt; do {
  switch (new Date().getDay()) {
    case 0: case 6: &quot;weekend 🚵&quot;; break
    default: &quot;weekday 🚴&quot;
  }
}

alert(`Today is a ${testSwitch() || &quot;🐛&quot;}`)"><pre class="notranslate"><code class="notranslate">const testSwitch = () =&gt; do {
  switch (new Date().getDay()) {
    case 0: case 6: "weekend 🚵"; break
    default: "weekday 🚴"
  }
}

alert(`Today is a ${testSwitch() || "🐛"}`)
</code></pre></div>
<h3 dir="auto">Description</h3>
<p dir="auto">Per [[ https://twitter.com/BrendanEich/status/676497551495856129 | tweet ]] from Brendan Eich:</p>
<h3 dir="auto">Expected</h3>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="&quot;use strict&quot;;

var testSwitch = function testSwitch() {
  return (function () {
    switch (new Date().getDay()) {
      case 0:case 6:
        return &quot;weekend 🚵&quot;;
      default:
        return &quot;weekday 🚴&quot;;
    }
  })();
};

alert(&quot;Today is a &quot; + (testSwitch() || &quot;🐛&quot;));"><pre class="notranslate"><code class="notranslate">"use strict";

var testSwitch = function testSwitch() {
  return (function () {
    switch (new Date().getDay()) {
      case 0:case 6:
        return "weekend 🚵";
      default:
        return "weekday 🚴";
    }
  })();
};

alert("Today is a " + (testSwitch() || "🐛"));
</code></pre></div>
<h3 dir="auto">Got</h3>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="&quot;use strict&quot;;

var testSwitch = function testSwitch() {
  return (function () {
    switch (new Date().getDay()) {
      case 0:case 6:
        &quot;weekend 🚵&quot;;break;
      default:
        &quot;weekday 🚴&quot;;
    }
  })();
};

alert(&quot;Today is a &quot; + (testSwitch() || &quot;🐛&quot;));"><pre class="notranslate"><code class="notranslate">"use strict";

var testSwitch = function testSwitch() {
  return (function () {
    switch (new Date().getDay()) {
      case 0:case 6:
        "weekend 🚵";break;
      default:
        "weekday 🚴";
    }
  })();
};

alert("Today is a " + (testSwitch() || "🐛"));
</code></pre></div>
<p dir="auto">[[ http://codepen.io/dnalot/pen/VewJez | Live demo ]]</p>