fix: for-of transform should skip for-await-of (#11023)

This commit is contained in:
Huáng Jùnliàng 2020-01-16 18:15:31 -05:00 committed by Nicolò Ribaudo
parent 3daab41e61
commit 06dace1cdb
3 changed files with 8 additions and 1 deletions

View File

@ -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);

View File

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

View File

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