Skip to content

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

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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