Skip to content

fix: correctly transform __proto__ properties#12664

Merged
nicolo-ribaudo merged 2 commits intobabel:mainfrom
EB-Forks:fix/transform-proto-property
Jan 22, 2021
Merged

fix: correctly transform __proto__ properties#12664
nicolo-ribaudo merged 2 commits intobabel:mainfrom
EB-Forks:fix/transform-proto-property

Conversation

@ExE-Boss
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown

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
Copy Markdown
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

Comment thread packages/babel-plugin-transform-shorthand-properties/src/index.js
Comment thread packages/babel-plugin-transform-shorthand-properties/src/index.js Outdated
@ExE-Boss ExE-Boss requested a review from JLHwung January 21, 2021 10:29
Copy link
Copy Markdown
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