Skip to content

fix(annex-b): CallExpression as assignment LHS throws ReferenceError at runtime#5402

Open
Cypher-CP0 wants to merge 1 commit into
boa-dev:mainfrom
Cypher-CP0:fix/annex-b-call-expression-lhs-5374
Open

fix(annex-b): CallExpression as assignment LHS throws ReferenceError at runtime#5402
Cypher-CP0 wants to merge 1 commit into
boa-dev:mainfrom
Cypher-CP0:fix/annex-b-call-expression-lhs-5374

Conversation

@Cypher-CP0

Copy link
Copy Markdown

This Pull Request fixes #5374.

It changes the following:

  • Adds a Call variant (gated on the annex-b feature) to AssignTarget,
    UpdateTarget, and IterableLoopInitializer in the AST
  • The parser now accepts a CallExpression as LHS in non-strict mode for
    assignments (=, +=, etc.), update expressions (++f(), f()++),
    and for-in/of loops (for (f() in [])) instead of throwing a SyntaxError
  • The bytecompiler evaluates the call for its side effects then emits
    ThrowNewReferenceError without evaluating the RHS, matching the behaviour
    required by Annex B sec-runtime-errors-for-function-call-assignment-targets
  • Updates 3 existing tests that incorrectly expected SyntaxError for these cases

@Cypher-CP0 Cypher-CP0 requested a review from a team as a code owner June 18, 2026 21:16
@github-actions github-actions Bot added the Waiting On Review Waiting on reviews from the maintainers label Jun 18, 2026
@github-actions github-actions Bot added this to the v1.0.0 milestone Jun 18, 2026
@github-actions github-actions Bot added C-Parser Issues surrounding the parser C-Tests Issues and PRs related to the tests. C-VM Issues and PRs related to the Boa Virtual Machine. C-AST Issue surrounding the abstract syntax tree labels Jun 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

C-AST Issue surrounding the abstract syntax tree C-Parser Issues surrounding the parser C-Tests Issues and PRs related to the tests. C-VM Issues and PRs related to the Boa Virtual Machine. Waiting On Review Waiting on reviews from the maintainers

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Annex B: f() = g() in non-strict mode raises SyntaxError at parse; should be runtime ReferenceError

1 participant