Skip to content

Reuse the readOnlyError helper for private methods#12792

Merged
nicolo-ribaudo merged 1 commit intobabel:mainfrom
nicolo-ribaudo:remove-classPrivateMethodSet
Feb 12, 2021
Merged

Reuse the readOnlyError helper for private methods#12792
nicolo-ribaudo merged 1 commit intobabel:mainfrom
nicolo-ribaudo:remove-classPrivateMethodSet

Conversation

@nicolo-ribaudo
Copy link
Copy Markdown
Member

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

While reviewing #12707, I noticed that classPrivateMethodSet is basically the same as readOnlyError except that it doesn't say exactly what cannot be reassigned.

The readOnlyError helper will throw something like "#foo" is read-only", which is also more correct when reassigning a private getter (since it's not technically a method). Also, we avoid injecting two different helpers in the generated bundle.

This PR also removes classPrivateMethodSet for Babel 8.

@nicolo-ribaudo nicolo-ribaudo added the PR: Polish 💅 A type of pull request used for our changelog categories label Feb 11, 2021
@babel-bot
Copy link
Copy Markdown
Collaborator

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

@codesandbox-ci
Copy link
Copy Markdown

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 b435598:

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

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: Polish 💅 A type of pull request used for our changelog categories Spec: Private Methods

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants