summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/internal/repl/await.js6
-rw-r--r--test/parallel/test-repl-top-level-await.js3
2 files changed, 8 insertions, 1 deletions
diff --git a/lib/internal/repl/await.js b/lib/internal/repl/await.js
index e0b79805df..2f3e754b5d 100644
--- a/lib/internal/repl/await.js
+++ b/lib/internal/repl/await.js
@@ -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, c) {
state.prepend(node, `${node.id.name}=`);
},
diff --git a/test/parallel/test-repl-top-level-await.js b/test/parallel/test-repl-top-level-await.js
index 9194c4a449..c6717a2120 100644
--- a/test/parallel/test-repl-top-level-await.js
+++ b/test/parallel/test-repl-top-level-await.js
@@ -130,7 +130,8 @@ async function ordinaryTests() {
[ 'let o = await 1, p', 'undefined' ],
[ 'p', 'undefined' ],
[ 'let q = 1, s = await 2', 'undefined' ],
- [ 's', '2' ]
+ [ 's', '2' ],
+ [ 'for await (let i of [1,2,3]) console.log(i)', 'undefined', { line: 3 } ]
];
for (const [input, expected, options = {}] of testCases) {