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: support optionalCall in replace super handler #12238

Merged
merged 1 commit into from Oct 22, 2020

Conversation

JLHwung
Copy link
Contributor

@JLHwung JLHwung commented Oct 22, 2020

Q                       A
Fixed Issues? Fixes #12229
Patch: Bug Fix? Yes
Tests Added + Pass? Yes
Documentation PR Link
Any Dependency Changes?
License MIT

This PR is a follow-up to #11248. Although plugin-optional-chaining is applied before transform-classes, the transform-classes plugin works on the Class node, ancestry of the optional chain. It is possible that replace-supers might see super.foo?.() and don't know how to handle that.

This PR adds optionalCall handler, so super.foo?.() will be transformed to

Foo.foo?.call(babelHelpers.assertThisInitialized(this));

@JLHwung JLHwung added PR: Bug Fix 🐛 A type of pull request used for our changelog categories Spec: Optional Chaining Spec: Classes labels Oct 22, 2020
@babel-bot
Copy link
Collaborator

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

@JLHwung JLHwung merged commit d6816f0 into babel:main Oct 22, 2020
@JLHwung JLHwung deleted the fix-12229 branch October 22, 2020 20:09
@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 Jan 22, 2021
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 22, 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 Spec: Optional Chaining
Projects
None yet
Development

Successfully merging this pull request may close these issues.

this.optionalCall is not a function
4 participants