Skip to content

Commit

Permalink
fix: for-of transform should skip for-await-of (#11023)
Browse files Browse the repository at this point in the history
  • Loading branch information
JLHwung authored and nicolo-ribaudo committed Jan 16, 2020
1 parent 3daab41 commit 06dace1
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
5 changes: 4 additions & 1 deletion packages/babel-plugin-transform-for-of/src/index.js
Expand Up @@ -19,7 +19,10 @@ export default declare((api, options) => {
visitor: {
ForOfStatement(path) {
const { scope } = path;
const { left, right, body } = path.node;
const { left, right, body, await: isAwait } = path.node;
if (isAwait) {
return;
}
const i = scope.generateUidIdentifier("i");
let array = scope.maybeGenerateMemoised(right, true);

Expand Down
@@ -0,0 +1 @@
async () => { for await (let foo of []); };
@@ -0,0 +1,3 @@
async () => {
for await (let foo of []);
};

0 comments on commit 06dace1

Please sign in to comment.