fix(transformer): legacy decorator on computed property key leaves variable unassigned#20430
Merged
Dunqing merged 4 commits intooxc-project:mainfrom Mar 17, 2026
Conversation
…computed key temp var assignment
… effects when removing class fields
4b5b9b8 to
bd8d52f
Compare
Merging this PR will not alter performance
Comparing Footnotes
|
Boshen
added a commit
that referenced
this pull request
Mar 19, 2026
### 🚀 Features - 7215d9e transformer: Support lowering `accessor` with legacy decorators (#20348) (Dunqing) ### 🐛 Bug Fixes - 3bbd0cd transformer: Emit `Object` instead of `void 0` for untyped getter/setter `design:type` metadata (#20488) (Dunqing) - 4ae3f3f ecmascript: Apply coercion-is-pure assumption to constructor side-effect detection (#20420) (Dunqing) - 11f9695 transformer: Legacy decorator on computed property key leaves variable unassigned (#20430) (bab) - efeba28 ecmascript: Add argument validation for NewExpression side-effect detection (#20395) (Dunqing) Co-authored-by: Boshen <1430279+Boshen@users.noreply.github.com>
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.
This PR has two fixes. The second fix exposed a pre-existing bug that needed to be fixed first.
24a72d7:
create_read_write_targetwas used for a simple=assignment when creating a temp var for decorated computed property keys. Should becreate_write_target.f0affc6:
transform_class_on_exitwas removing all no-initializer properties unconditionally. But the legacy decorator embeds an assignment in the computed key ([FIELD_NAME]→[_a = FIELD_NAME]), so removing the property also removes the assignment, leaving_aundefined in_decorate(). Keep properties whose computed keys have side effects, matching TypeScript'sbehavior.
Fixes #20418