oxc
oxc copied to clipboard
parser: `ModuleKind::Unambiguous` does not allow Top-level await
await new Promise(resolve => {}) cannot be parsed with ModuleKind::Unambiguous.
This is allowed by babel.
Babel REPL (strict is enabled, so that means it's parsing in module mode)
Related code: https://github.com/oxc-project/oxc/blob/ecdda9e66a08310f95eae623583560ee0485a5a7/crates/oxc_parser/src/lib.rs#L481-L487 (we may need to add a separate flag for TLA as whether TLA is a module syntax can be controversial)
tsc has some logic to reparse https://github.com/microsoft/TypeScript/blob/efca03ffed10dccede4fbc8dd8a624374e5424d9/src/compiler/parser.ts#L1862 https://github.com/oxc-project/oxc/pull/15494#pullrequestreview-3440660441
Previously:
- https://github.com/oxc-project/backlog/issues/149