Thanks to visit codestin.com
Credit goes to github.com

Skip to content

fix: Class decorator correctly passes return value#16199

Merged
JLHwung merged 2 commits into
babel:mainfrom
liuxingbaoyu:fix-class-dec-return
Jan 3, 2024
Merged

fix: Class decorator correctly passes return value#16199
JLHwung merged 2 commits into
babel:mainfrom
liuxingbaoyu:fix-class-dec-return

Conversation

@liuxingbaoyu
Copy link
Copy Markdown
Member

@liuxingbaoyu liuxingbaoyu commented Dec 30, 2023

Q                       A
Fixed Issues? Fixes #16198
Patch: Bug Fix?
Major: Breaking Change?
Minor: New Feature?
Tests Added + Pass?
Documentation PR Link
Any Dependency Changes?
License MIT

Edit by @JLHwung

In this PR we fix a regression introduced in #16160. Currently when multiple class decorators are applied, they are provided with the unmodified classes, this is incorrect as per 15.7.7 ApplyDecoratorsToClassDefinition step 1.e, the next decorator should be applied on the modified class.

@babel-bot
Copy link
Copy Markdown
Collaborator

babel-bot commented Dec 30, 2023

Build successful! You can test your changes in the REPL here: https://babeljs.io/repl/build/56084/

Copy link
Copy Markdown
Contributor

@JLHwung JLHwung left a comment

Choose a reason for hiding this comment

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

Can we rename the test case to decorator-access-modified-classes? We already have decorator-access-modified-{fields,methods} for the same purposes.

@JLHwung
Copy link
Copy Markdown
Contributor

JLHwung commented Dec 30, 2023

I updated the PR's description, I hope it can help reviewers pick up the PR's intention. Please do fill in the descriptions in the PR template, it will also help our future selves when trying to understand why changes are made.

@liuxingbaoyu
Copy link
Copy Markdown
Member Author

liuxingbaoyu commented Dec 30, 2023

Thanks!
In fact, the detailed description of the issue exists in #16198, and this PR only has small changes, and the added tests also help with review, so I did not add a detailed description. :)
The section on specs is really helpful, but I actually did this by comparing the code before regression was introduced.🤦‍♂️

Copy link
Copy Markdown
Member

@nicolo-ribaudo nicolo-ribaudo left a comment

Choose a reason for hiding this comment

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

👍

@JLHwung
Copy link
Copy Markdown
Contributor

JLHwung commented Jan 3, 2024

CI error is not related.

@JLHwung JLHwung merged commit 5c81253 into babel:main Jan 3, 2024
@github-actions github-actions Bot added the outdated A closed issue/PR that is archived due to age. Recommended to make a new issue label Apr 4, 2024
@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Apr 4, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

i: regression outdated A closed issue/PR that is archived due to age. Recommended to make a new issue PR: Bug Fix 🐛 A type of pull request used for our changelog categories Spec: Decorators

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: decorators are broken and when applied, they override the preceding value.

4 participants