Skip to content

Fix receiver extensibility checks in property sets - #1464

Merged
saghul merged 2 commits into
quickjs-ng:masterfrom
jiang1997:fix/super-assignment-tdz-precedence
May 10, 2026
Merged

saghul merged 2 commits into
quickjs-ng:masterfrom
jiang1997:fix/super-assignment-tdz-precedence

Conversation

@jiang1997

@jiang1997 jiang1997 commented May 8, 2026 •

Copy link
Copy Markdown
Contributor

This PR fixes property assignment by delaying the receiver extensibility check until the assignment would create a new own property.

This fixes two issues:

  1. It preserves TDZ ReferenceError precedence for module namespace super assignment.
  2. It matches ES semantics: a non-extensible receiver can still update an existing writable own property.

Delay the receiver extensibility check in JS_SetPropertyInternal2 until the set
would create a new own property. This lets Receiver.[[GetOwnProperty]] run
first, preserving TDZ ReferenceError precedence for module namespace super
assignment and allowing writes to existing properties on non-extensible
receivers.
@jiang1997
jiang1997 force-pushed the fix/super-assignment-tdz-precedence branch from 17947c1 to 09ed586 Compare May 9, 2026 08:45
@jiang1997
jiang1997 marked this pull request as ready for review May 9, 2026 08:45

@bnoordhuis bnoordhuis left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, LGTM but can you move the test to tests/test_language.js?

@jiang1997
jiang1997 requested a review from bnoordhuis May 10, 2026 11:21
@saghul
saghul merged commit a7f0b8a into quickjs-ng:master May 10, 2026
124 checks passed
mochaaP pushed a commit to mcha-forks/quickjs that referenced this pull request May 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants