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
Define class elements in the correct order #12723
Define class elements in the correct order #12723
Conversation
Build successful! You can test your changes in the REPL here: https://babeljs.io/repl/build/39267/ |
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. Latest deployment of this branch, based on commit 8c755f3:
|
let descriptor; | ||
if ( | ||
!methods.hasComputed && | ||
t.isStringLiteral(key) && |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not related to this PR, but we should also merge descriptors for NumericLiteral.
class C {
set 0n(v) {}
get 0n() {}
set 1(v) {}
get 1() {}
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This code is new, so I can handle it here (they are merged with main
).
packages/babel-plugin-transform-classes/test/fixtures/spec/computed-methods/output.js
Show resolved
Hide resolved
// infer function name | ||
if (node.kind === "method") { | ||
fn = nameFunction({ id: key, node: node, scope }); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can also infer the name of getters and setters, but I'll do that in a separate PR since it's not strictly related to this one.
This PR fixes a few bugs with class elements coalescing: