Skip to content

for await of syntax doesn't work with --experimental-repl-await #23836

Closed
@RangerMauve

Description

@RangerMauve
  • Version: v10.9.0
  • Platform: Windows 10 Pro 10.0.17134 x64
  • Subsystem: REPL

The REPL is working great with regular await, but doesn't seem to be able to handle the new for await of syntax that was introduced as part of the async-iteration spec.

for await of works when wrapping the call with an async function, it only fails if used at the top level.

This fails:

$ node --experimental-repl-await
> for await (let i of [1,2,3]) console.log(i)
for await (let i of [1,2,3]) console.log(i)
    ^^^^^

SyntaxError: Unexpected reserved word

This works:

> (async () => { for await(let i of [1,2,3]) console.log(i) })()
Promise {
  <pending>,
  domain: ...etc }
> 1
2
3

Metadata

Metadata

Assignees

Labels

promisesIssues and PRs related to ECMAScript promises.replIssues and PRs related to the REPL subsystem.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions