Extract computed keys from the class closure#13600
Extract computed keys from the class closure#13600nicolo-ribaudo merged 4 commits intobabel:mainfrom
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.
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:
|
benjamn
left a comment
There was a problem hiding this comment.
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.
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.
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