Skip to content

fix(parser): accept of and async as default import bindings - #5593

Closed
andreasrosdal wants to merge 1 commit into
boa-dev:mainfrom
nordstjernen-web:fix/import-default-binding-of-async
Closed

andreasrosdal wants to merge 1 commit into
boa-dev:mainfrom
nordstjernen-web:fix/import-default-binding-of-async

Conversation

@andreasrosdal

@andreasrosdal andreasrosdal commented Oct 17, 2026 •

Copy link
Copy Markdown

It changes the following:

  • ImportDeclaration accepts the contextual keywords of and async as the default import binding (import of from "m", import async from "m").
  • Adds a parser test for both.

The lexer produces Keyword::Of / Keyword::Async for these words, and the import clause only started on an identifier name or await/yield, so these valid ImportedBindings were SyntaxErrors. Minifiers do hand out of as a name: a production site's advertising module (import of from ".../react.production.min.js") failed to compile. Found while embedding Boa in the Southstar browser.

Tested with cargo test -p boa_parser import_default_binding.

Implemented for https://github.com/nordstjernen-web/southstar-browser

The lexer produces `Keyword::Of` and `Keyword::Async` for these contextual
keywords, and `ImportDeclaration` only let an identifier name or the
`await`/`yield` keywords start a default import, so `import of from "m"`
and `import async from "m"` were SyntaxErrors although both are valid
`ImportedBinding`s. `ImportedBinding` already accepts them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions github-actions Bot added Waiting On Review Waiting on reviews from the maintainers C-Parser Issues surrounding the parser C-Tests Issues and PRs related to the tests. labels Oct 17, 2026
@github-actions github-actions Bot added this to the v0.23 milestone Oct 17, 2026
@jedel1043

Copy link
Copy Markdown
Member

PR spamming is not allowed.

@jedel1043 jedel1043 closed this Oct 17, 2026
@github-actions github-actions Bot removed the Waiting On Review Waiting on reviews from the maintainers label Oct 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

C-Parser Issues surrounding the parser C-Tests Issues and PRs related to the tests.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants