Skip to content

Commit

Permalink
support bare for-await-of
Browse files Browse the repository at this point in the history
  • Loading branch information
devsnek committed Oct 24, 2018
1 parent 8e26ceb commit 2003bc5
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/await.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@ const visitorsWithoutAncestors = {
}
walk.base.ClassDeclaration(node, state, c);
},
ForOfStatement(node, state, c) {
if (node.await === true) {
state.containsAwait = true;
}
walk.base.ForOfStatement(node, state, c);
},
FunctionDeclaration(node, state) {
state.prepend(node, `${node.id.name}=`);
},
Expand Down Expand Up @@ -68,7 +74,7 @@ function processTopLevelAwait(src) {
const wrappedArray = wrapped.split('');
let root;
try {
root = acorn.parse(wrapped, { ecmaVersion: 8 });
root = acorn.parse(wrapped, { ecmaVersion: 2019 });
} catch (err) {
return null;
}
Expand Down

0 comments on commit 2003bc5

Please sign in to comment.