Registry Mirror
Skip to content

Conversation

@lehni

@lehni lehni commented Oct 21, 2026

Copy link
Copy Markdown

Fixes #5602.

using starts a using declaration only when an identifier follows it on the same line (UsingDeclaration : using [no LineTerminator here] BindingList[~Pattern]); elsewhere it's an identifier. Boa's lexer always makes it a keyword token, and the parser then rejected using[id] = true, !using[id], delete using[id] and using.x = 1, which V8 parses.

  • PrimaryExpression takes Keyword::Using as an identifier reference, as it takes let, yield, await and of.
  • StatementListItem starts a declaration with using only when allowed_token_after_using() says the next token on the same line can begin its binding list (an identifier, not [, . or (), as allowed_token_after_let() does for let.
  • The test that using [a, b] = resource; is rejected now checks test262's using [] = resource; (using-invalid-arraybindingpattern.js): with using an identifier, the former is the computed member assignment using[a, b] = resource, which V8 accepts too.
  • New test using_as_identifier covers the forms above, a line break after using, and using as a parameter.

`using` starts a `using` declaration only when an identifier follows it on the same line (the binding list can't be a pattern); elsewhere it is an identifier, as in `using[id] = true`, `!using[id]` or `using.x = 1`, which V8 parses. The primary expression now takes `Keyword::Using` as an identifier reference, and a statement list item starts a declaration with `using` only when `allowed_token_after_using()` says the next token on the same line can start its binding list. The test that `using [a, b] = resource` is rejected now checks test262's `using [] = resource`: the former is a computed member assignment.
@lehni
lehni requested a review from a team as a code owner October 21, 2026 00:10
@github-actions github-actions Bot added Waiting On Review Waiting on reviews from the maintainers C-Parser Issues surrounding the parser labels Oct 21, 2026
@github-actions github-actions Bot added this to the v0.23 milestone Oct 21, 2026
@github-actions github-actions Bot added the C-Tests Issues and PRs related to the tests. label Oct 21, 2026

This branch has not been deployed

No deployments
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. Waiting On Review Waiting on reviews from the maintainers

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Parser rejects using as an identifier in expressions (e.g. using[id], !using[id])

1 participant