Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inherit properties in function from method in loose mode #9135

Conversation

rubennorte
Copy link
Contributor

Q                       A
Patch: Bug Fix? Yes
Major: Breaking Change?
Minor: New Feature?
Tests Added + Pass? There was a test for this and keeps passing
Documentation PR Link
Any Dependency Changes? No
License MIT

This modifies the class transform to inherit the properties from methods to the function that's generated in loose mode.

There was a test to ensure the return type was copied to the new function, but the loc of the node was lost because it was copied manually instead of using inherits.

This is tested in packages/babel-plugin-transform-classes/test/fixtures/loose/method-return-type-annotation and the test keeps passing.

Perhaps I should add a test for the location, but so far all tests for the package only check input/output, not the node state.

@babel-bot
Copy link
Collaborator

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

1 similar comment
@babel-bot
Copy link
Collaborator

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

@existentialism existentialism added the PR: Bug Fix 🐛 A type of pull request used for our changelog categories label Dec 7, 2018
Copy link
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.

It's ok without tests, but I think there could be many other places where we don't copy the location.

@nicolo-ribaudo nicolo-ribaudo merged commit 4fdb711 into babel:master Dec 7, 2018
@rubennorte rubennorte deleted the preserve-node-info-in-class-transform branch December 7, 2018 15:52
@lock lock bot added the outdated A closed issue/PR that is archived due to age. Recommended to make a new issue label Oct 4, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Oct 4, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants