-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
Extract computed keys from the class closure #13600
Extract computed keys from the class closure #13600
Conversation
Build successful! You can test your changes in the REPL here: https://babeljs.io/repl/build/47547/ |
7b31316
to
4536255
Compare
static [log.push(4)]() {} | ||
} | ||
|
||
expect(log).toEqual([1, 2, 3, 4]); |
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.
On main
this is 1, 3, 2, 4
.
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 451ac46:
|
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.
LGTM (this should resolve facebook/regenerator#487). Thanks @nicolo-ribaudo!
}; | ||
|
||
node.body.body.forEach(elem => { | ||
if (!t.isClassMethod(elem) || !elem.computed) return; |
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.
Q: Why should we exclude non-method elements? I think we are preserving the order of ClassElementName
evaluation and thus we should apply it to any named class elements.
Ah I see, the transform-classes
only take care class methods.
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.
Yeah, this plugin doesn't support class fields.
The other two tests are bugs which have never been reported, but which are also fixed by this new computed keys approach.
cc @benjamn