Skip to content

Save full descriptor instead of only value for private fields.#8318

Merged
hzoo merged 3 commits intobabel:masterfrom
nicolo-ribaudo:private-fields-descriptor
Jul 27, 2018
Merged

Save full descriptor instead of only value for private fields.#8318
hzoo merged 3 commits intobabel:masterfrom
nicolo-ribaudo:private-fields-descriptor

Conversation

@nicolo-ribaudo
Copy link
Copy Markdown
Member

@nicolo-ribaudo nicolo-ribaudo commented Jul 13, 2018

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

Decorators can make private fields non-writable, so we need to store this information smewhere.
The descriptor can also be used to implement private accessors.

This patch isn't needed for loose mose because we already use defineProperty with a property descriptor.

Decorators can make private fields non-writable, so we need to store this
information smewhere.
The descriptor can also be used to implement private accessors.
@nicolo-ribaudo nicolo-ribaudo added PR: Internal 🏠 A type of pull request used for our changelog categories Spec: Class Fields labels Jul 13, 2018
@babel-bot
Copy link
Copy Markdown
Collaborator

babel-bot commented Jul 13, 2018

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

@nicolo-ribaudo nicolo-ribaudo added this to the Babel 7 RC milestone Jul 26, 2018
@hzoo hzoo merged commit ec69b4b into babel:master Jul 27, 2018
MAP.set(REF, {
// configurable is always false for private elements
// enumerable is always false for private elements
writable: true,
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can save bytes be doing an explicit check for === false. Then, we don't have to always include the writable: true.

@nicolo-ribaudo nicolo-ribaudo deleted the private-fields-descriptor branch July 28, 2018 06:02
@lock lock bot added the outdated A closed issue/PR that is archived due to age. Recommended to make a new issue label Oct 4, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Oct 4, 2019
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: Internal 🏠 A type of pull request used for our changelog categories Spec: Class Fields

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants