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

Extract computed keys from the class closure #13600

Merged
merged 4 commits into from Jul 26, 2021

Conversation

nicolo-ribaudo
Copy link
Member

@nicolo-ribaudo nicolo-ribaudo commented Jul 26, 2021

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

The other two tests are bugs which have never been reported, but which are also fixed by this new computed keys approach.

cc @benjamn

@nicolo-ribaudo nicolo-ribaudo added PR: Bug Fix 🐛 A type of pull request used for our changelog categories Spec: Classes labels Jul 26, 2021
@babel-bot
Copy link
Collaborator

babel-bot commented Jul 26, 2021

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

static [log.push(4)]() {}
}

expect(log).toEqual([1, 2, 3, 4]);
Copy link
Member Author

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.

@codesandbox-ci
Copy link

codesandbox-ci bot commented Jul 26, 2021

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:

Sandbox Source
babel-repl-custom-plugin Configuration
babel-plugin-multi-config Configuration

Copy link
Contributor

@benjamn benjamn left a 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;
Copy link
Contributor

@JLHwung JLHwung Jul 26, 2021

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.

Copy link
Member Author

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.

@nicolo-ribaudo nicolo-ribaudo merged commit 790c518 into babel:main Jul 26, 2021
@nicolo-ribaudo nicolo-ribaudo deleted the yield-await-class-key branch July 26, 2021 21:31
nicolo-ribaudo added a commit to nicolo-ribaudo/babel that referenced this pull request Jul 30, 2021
@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 Oct 26, 2021
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 26, 2021
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 Spec: Classes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Yield and await in class methods keys
6 participants