Skip to content

Commit 2003bc5

Browse files
committed
support bare for-await-of
1 parent 8e26ceb commit 2003bc5

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/await.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,12 @@ const visitorsWithoutAncestors = {
1111
}
1212
walk.base.ClassDeclaration(node, state, c);
1313
},
14+
ForOfStatement(node, state, c) {
15+
if (node.await === true) {
16+
state.containsAwait = true;
17+
}
18+
walk.base.ForOfStatement(node, state, c);
19+
},
1420
FunctionDeclaration(node, state) {
1521
state.prepend(node, `${node.id.name}=`);
1622
},
@@ -68,7 +74,7 @@ function processTopLevelAwait(src) {
6874
const wrappedArray = wrapped.split('');
6975
let root;
7076
try {
71-
root = acorn.parse(wrapped, { ecmaVersion: 8 });
77+
root = acorn.parse(wrapped, { ecmaVersion: 2019 });
7278
} catch (err) {
7379
return null;
7480
}

0 commit comments

Comments
 (0)