facebook / hermes

A JavaScript engine optimized for running React Native.
https://hermesengine.dev/
MIT License
9.41k stars 596 forks source link

Support for top level await #1352

Open ayroblu opened 2 months ago

ayroblu commented 2 months ago

Bug Description

Top level await breaks hermes parser

await Promise.resolve()

The Expected Behavior

Top level await is common in certain scenarios, it should be supported at the parser level

tmikov commented 2 months ago

That is a good catch. I don't think the parser has a way of understanding the script/module distinction. This might require changing the API.