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

fix: correctly transform __proto__ properties #12664

Merged
merged 2 commits into from Jan 22, 2021

Conversation

ExE-Boss
Copy link
Contributor

@ExE-Boss ExE-Boss commented Jan 20, 2021

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

This fixes the transform of __proto__ to match the spec, where only the non‑computed, non‑shorthand form of __proto__ ({ __proto__: prototype }) is special. All other forms create an own enumerable __proto__ property.

To do:

  • Add tests for when both @babel/plugin‑transform‑computed‑properties and @babel/plugin‑transform‑shorthand‑properties are used.
  • Decide whether to treat { ["__proto__"]: anything } as special (always use [[Define]]) in setComputedProperties mode.

@babel-bot
Copy link
Collaborator

babel-bot commented Jan 20, 2021

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

@codesandbox-ci
Copy link

codesandbox-ci bot commented Jan 20, 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 0357fe1:

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

@nicolo-ribaudo nicolo-ribaudo added the PR: Spec Compliance 👓 A type of pull request used for our changelog categories label Jan 20, 2021
@nicolo-ribaudo
Copy link
Member

nicolo-ribaudo commented Jan 20, 2021

Add tests for when both @babel/plugin‑transform‑computed‑properties and @babel/plugin‑transform‑shorthand‑properties are used.

This can be put either in one plugin or in the other, we don't have a general rule for choosing where to put cross-plugin tests.

Decide whether to treat { ["__proto__"]: anything } as special (always use [[Define]]) in setComputedProperties mode.

Imo we can leave it as [[Set]] and document it in the setComputedProperties docs

@ExE-Boss ExE-Boss requested a review from JLHwung January 21, 2021 10:29
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.

Thanks!

@nicolo-ribaudo nicolo-ribaudo merged commit f1314a1 into babel:main Jan 22, 2021
@nicolo-ribaudo nicolo-ribaudo deleted the fix/transform-proto-property branch January 22, 2021 09:58
@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 May 21, 2021
@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 21, 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: Spec Compliance 👓 A type of pull request used for our changelog categories
Projects
None yet
4 participants