Repository navigation
Conversation
Contributor
Merging this PR will not alter performanceWarning oxc-project has exceeded the Hobby plan limit of 5 active contributors. Upgrade your plan or apply to the open source program by December 8, 2026 to keep using CodSpeed.
Comparing Footnotes
|
Dunqing
force-pushed
the
standard-auto-accessors
branch
from
November 17, 2026 10:57
f37dd00 to
1af8649
Compare
This was referenced Nov 17, 2026
Dunqing
force-pushed
the
standard-auto-accessors
branch
from
November 19, 2026 03:28
1af8649 to
806cdb0
Compare
Dunqing
force-pushed
the
standard-auto-accessors
branch
from
November 19, 2026 11:52
806cdb0 to
6ee2b83
Compare
accessor fields without decorators (1/4)
Dunqing
force-pushed
the
standard-auto-accessors
branch
2 times, most recently
from
November 20, 2026 00:09
2c70bad to
3cb1bfe
Compare
cursor
Bot
changed the base branch from
transformer-shared-auto-accessor
to
graphite-base/29749
November 20, 2026 08:29
Dunqing
force-pushed
the
standard-auto-accessors
branch
from
November 23, 2026 06:40
3cb1bfe to
40433a8
Compare
Dunqing
changed the base branch from
graphite-base/29749
to
transformer-shared-auto-accessor
November 23, 2026 06:40
Dunqing
force-pushed
the
standard-auto-accessors
branch
2 times, most recently
from
November 24, 2026 01:25
af4ee93 to
bdc58ec
Compare
This was referenced Nov 24, 2026
Dunqing
force-pushed
the
standard-auto-accessors
branch
2 times, most recently
from
November 25, 2026 04:01
db16329 to
965fd9d
Compare
Dunqing
marked this pull request as ready for review
November 25, 2026 08:56
Dunqing
force-pushed
the
standard-auto-accessors
branch
from
November 25, 2026 10:35
022c4d8 to
e95c4e5
Compare
Dunqing
added a commit
to rolldown/rolldown
that referenced
this pull request
Nov 25, 2026
Patches every oxc crate to oxc-project/oxc@9e2856b2, the head of the stack that adds standard decorator and auto-accessor lowering (oxc-project/oxc#29749, oxc-project/oxc#29750, oxc-project/oxc#29751, oxc-project/oxc#28882). Drop the patch once an oxc release includes it. The stack sits on a newer oxc main, whose changes update some snapshots: - Legacy decorators: computed and assigned keys are passed to __decorate instead of null, and decorated static fields keep their decorators. - Source maps: calls whose callee is generated, such as a wrapped require(), init_*() or (0, x.f)(), map to their own source call instead of a neighbouring token (oxc-project/oxc#30204).
1 of 17 tasks
Dunqing
force-pushed
the
standard-auto-accessors
branch
2 times, most recently
from
November 26, 2026 02:41
a2c5e7f to
72ce19e
Compare
Lower auto-accessors (`accessor x = 1`) in classes without decorators to
a private storage field plus a getter and setter, when standard
decorator lowering is enabled (`decorator: { lower: true }`). Classes
with decorators pass through unchanged.
philbooth
pushed a commit
to philbooth/oxc-space-before-function-paren
that referenced
this pull request
Nov 26, 2026
…zers to their source (oxc-project#30326) The storage field, getter and setter that lowering generates for an `accessor` field have no source positions. Stepping into the getter or setter in a debugger shows no original location, and the `_defineProperty(...)` / `_classPrivateFieldInitSpec(...)` calls that class-properties emits for field initializers map only their arguments. ### Example Input ([playground for this example](https://playground.oxc.rs/?t=codegen&options=%7B%22run%22%3A%7B%22transform%22%3Atrue%7D%2C%22parser%22%3A%7B%22extension%22%3A%22ts%22%7D%2C%22transformer%22%3A%7B%22target%22%3A%22es2021%22%2C%22experimentalDecorators%22%3Atrue%7D%7D&code=class+C+%7B%0A++%40dec+accessor+x+%3D+1%3B%0A%7D%0Aclass+D+%7B%0A++y+%3D+1%3B%0A++static+z+%3D+2%3B%0A%7D%0A)): ```ts class C { @dec accessor x = 1; } class D { y = 1; static z = 2; } ``` Options: `target: "es2021"`, legacy decorators, source map on. Each line lists its decoded mappings as `generated`→`line:column original`. Before output: ```js _classPrivateFieldInitSpec(this, _x_accessor_storage, 1); // `1`→2:20 `1` get x() { // `x`→2:16 `x` return _classPrivateFieldGet(_x_accessor_storage, this); // (none) set x(value) { // (none) _classPrivateFieldSet(_x_accessor_storage, this, value); // (none) _defineProperty(this, "y", 1); // `"`→5:2 `y`, `1`→5:6 `1` _defineProperty(D, "z", 2); // `"`→6:9 `z`, `2`→6:13 `2` ``` After output: ```js _classPrivateFieldInitSpec(this, _x_accessor_storage, 1); // `_classPrivateFieldInitSpec`→2:2 `@dec`, `1`→2:20 `1`, `)`→2:21 `;` get x() { // `get`→2:2 `@dec`, `x`→2:16 `x`, `{`→2:2 `@dec` return _classPrivateFieldGet(_x_accessor_storage, this); // `return`→2:16 `x` set x(value) { // `set`→2:2 `@dec`, `x`→2:16 `x`, `{`→2:2 `@dec` _classPrivateFieldSet(_x_accessor_storage, this, value); // `_classPrivateFieldSet`→2:16 `x` _defineProperty(this, "y", 1); // `_defineProperty`→5:2 `y`, `1`→5:6 `1`, `)`→5:7 `;` _defineProperty(D, "z", 2); // `_defineProperty`→6:2 `static`, `"`→6:9 `z`, `2`→6:13 `2`, `)`→6:14 `;` ``` [Before and after in the source map viewer](https://source-map-viewer.void.app/compare?a=eJylkm9P4kAQxr_KZO8NmpUG7x0NCUvhPPUwRmLMxTHNZhmhXtnt7W4RNHx3s2DlT5Dcxb5o0t1nfs8z03llI9JkpadhYobEmmwqLaQql85d22wqPf3IKB-e68wPClLQAkt_y8xSDVnbzNRJYc0TKR_ZUvtsQtGY8oKsiz5FIDuKUe-3OSP_BYcz8qcb9CEpEzr7d2JVcSji4EsRB7sRHzNN19YUZP38f4Ju1m0AZ6lUipwzNnXeWDkK3UfH0E7T69ubXprCcQSanuGO5J--LGqhcpkSEnhFjV4Z7bwtlTe2drQ6Qv_5QtT8OHN8nzGHRoCjX4TXiDzM1kBLvrR6_wbU9sKCzwbPLXlTmZd0IOXgEI3DqryCLlB_7EztfkjqgUNSL6zxxs8L4oBshoyDLvN8PbbuobFt_6f3WSGbB0xjx3hL2Q2ylyA7DbIo-gbOlFZRXxZFpke3N79aVVcnE5np-pOrT2SBmnH2obxwRrMme0U2Jesyo5E1v3Nkj1lOyJrIdhHIODItJ-SQNe8fOL6zlp9red07ZBu3idGetF-J1tuEGqA9JAVVHcygBY0YQ8ub8wvCeXUF4Lz0mYIXaMFpJV75TVbdu2X4ePkIIQTvC9HnPSF6cfzcFcnvOL4U4qISJONOfCe6Z7EQvZ9b2o5IrvilEOdB1ruKJx3RHSwPkC3Y4g1Okc8I&b=eJylklFP2zAQx7_KyXspyDSie2tUiWuaMca6VVSIB4yiyLmWQGpnttO1oH73yS2hoSvVJvJgKb7__f5353tmU1JkUkdZpDNiXTZPDSSySK0dmXyeOvqSU5FdqNyNS5LQA0O_qtxQS7AzvZAnpdEPJF1gKuXyGQX3VJRkbPAuQrCjUKj9NufkPuBwTq7ToGckte_s34l1xqESxx8qcbxb4iRXNDK6JOOW_1NoM68BXCSplGStNol12qRT331wDGdJMrq-ipMEjgNQ9BtuKH0cpmXLZ66rhAiehRJOamWdqaTTpnW0uRLu_YVoufvc8n3GHE49XLiVP6bkYLEFGnKVUfs3oLUX5n0aPLvmzdOiogNVjg_ROGzSa-hKqNedad1mJO84RO3SaKfdsiQOgi0E46CqotiObXBobG_f6WVWgi095nTH-I1y4GVPXtbxsiD4BFZXRtIwLctcTa-vvvfqrk4m-aL9YNuztBSKcfYq_Ga1Yl32LNicjM21Eqz7mQs2yQsSrCvYDkEwLphKZ2QF697ecfGCWv9u1W1nBWtEI60cKbcRbXdJKICzjCTUebCAHpyGwjfcnJ4XLusQgHWpyyU8QQ86tXjjN9v0bte1h-sPEZEPEYc8RozDMMboB7cDxMc-jxCjMIwQVZ9fIEp_ZGGMKP3lZTMyfhtBjEw_vMHBeYgYf_3LoNNHvHjhI8ajEHEQ81kf8Se_rEOCrdjqD82N4CU&tab=table&ignore-source-name=0) The storage, getter, setter and their bodies now take the accessor's span, which starts at its first decorator like other class elements. The statements in the bodies map to the accessor's key instead: a source map drops a mapping whose original position repeats the previous one, so giving them the accessor's span would leave those lines unmapped. On main only legacy decorators use this builder; the standard-decorator stack (oxc-project#29749) reuses it and gets the same mappings once rebased. The field initializer calls map to their fields, as the assignments in loose mode already did. `var _x = new WeakMap()` declarations for lowered private fields remain unmapped; that is unchanged here. Transformer tests, transform conformance (`--exec`, no snapshot changes) and the `oxc-transform` napi tests pass. The new `source_map` integration tests fail without the change. AI disclosure: written with Claude Code (Claude Opus 5.5; reasoning effort not recorded).
Dunqing
force-pushed
the
standard-auto-accessors
branch
from
November 26, 2026 09:02
72ce19e to
c9b2669
Compare
accessor fields without decorators (1/4)accessor fields without decorators
camc314
approved these changes
Nov 26, 2026
This branch has not been deployed
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.
Stack 1/4 for standard (TC39 2023-11) decorators. This PR lowers the
accessorkeyword in classes without decorators; classes with decorators pass through unchanged until #29750. Lowering is opt-in withdecorator: { lower: true }(Rust, napi, or Babel'sproposal-decoratorsplugin with version"2023-11") until #28882 makes it the default at concrete targets.Example
Input:
Output with
decorator: { lower: true }at es2022:Each auto-accessor becomes a private storage field and a getter/setter pair, built with the helper shared with legacy decorators (#29449). At targets that also lower class fields, class-properties lowers this result further. No playground link: the released playground doesn't lower auto-accessors.
Points to review
A.#_y_accessor_storage), as in Babel, so a subclass that inherits the accessor passes the private brand check. The spec text reads throughthisinstead; transformer/decorators: follow-ups from the standard-decorators stack review #30265 tracks the difference.toPropertyKeyand shared by the getter and setter; converting twice would define them on different keys when the key'stoStringhas side effects.proposal-decoratorsversion other than"2023-11"are rejected.Transformer tests, clippy, napi tests and transform conformance with execution pass. Compared with main: Babel output 753 → 759/1208, Babel execution 345 → 350/602, Oxc output 374 → 375/495, Oxc execution 88 → 90/386. #28882 has the performance measurements for the whole stack.
Part of #9170.
AI disclosure: implemented and described with AI assistance; this revision was written with Claude Code (Claude Opus 5.5; reasoning effort not recorded).