Implement TC39 Stage 3 decorators and auto-accessors (preliminary)#2368
Merged
Conversation
Add support for the TC39 Stage 3 decorators proposal:
Auto-accessors (accessor keyword):
- Public, private, and static auto-accessors with getter/setter pairs
- Backed by per-instance private storage using PrivateName
- Correct override and inheritance semantics
Decorator evaluation:
- Method/getter/setter decorators: receive function value, can return replacement
- Field decorators: receive undefined, can return initializer wrapper
- Auto-accessor decorators: receive {get, set}, can return {get?, set?, init?}
- Class decorators: receive constructor, can return replacement
- addInitializer callback for both instance and static contexts
- Correct application order (last decorator applied first)
- Decorator context with kind, name, static, private, addInitializer
Note: This is preliminary support - the decorators specification has not yet
been formally approved into the ECMAScript standard. The implementation follows
the TC39 Stage 3 proposal as of 2024.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
lahma
enabled auto-merge (squash)
March 26, 2026 10:24
This was referenced Mar 27, 2026
This was referenced Jun 8, 2026
This was referenced Jun 29, 2026
This was referenced Jul 7, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Preliminary support for the TC39 Stage 3 decorators proposal. The decorators specification has not yet been formally approved into the ECMAScript standard — this implementation follows the Stage 3 proposal.
Auto-accessors (
accessorkeyword):Decorator evaluation:
{get, set}, can return{get?, set?, init?}addInitializercallback for both instance and static contextskind,name,static,private,addInitializerTest plan
🤖 Generated with Claude Code