Skip to content

Record InvalidFieldError when updating a non-existence slot#308

Merged
jhnaldo merged 8 commits intodevfrom
feat-undefined-internal-slot
Aug 8, 2025
Merged

Record InvalidFieldError when updating a non-existence slot#308
jhnaldo merged 8 commits intodevfrom
feat-undefined-internal-slot

Conversation

@mobius29
Copy link
Copy Markdown
Contributor

@mobius29 mobius29 commented Aug 8, 2025

According to Section 6.1.7.2 of the ECMAScript specification, internal slots cannot be dynamically added to an object. However, issue #3204 in ecma262 describes a case where the ClassDefinitionEvaluation algorithm attempted to access the [[PrivateMethods]] and [[Fields]] slots, which may or may not be defined depending on the situation.

This issue was not detected in esmeta, so this PR modifies the behavior to record an InvalidFieldError when updating an internal slot if it does not exist in the record and is not manually defined in manuals/types.

@jhnaldo jhnaldo merged commit af0f93a into dev Aug 8, 2025
6 checks passed
@jhnaldo jhnaldo deleted the feat-undefined-internal-slot branch August 8, 2025 02:10
@jhnaldo jhnaldo added enhancement Enhance the quality of a feature area:ir Related to intermediate representation (IR) labels Jan 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:ir Related to intermediate representation (IR) enhancement Enhance the quality of a feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants