Skip to content

fix(partial-app): support super method call#17662

Merged
JLHwung merged 2 commits intobabel:mainfrom
JLHwung:support-partial-application-super-method
Jan 23, 2026
Merged

fix(partial-app): support super method call#17662
JLHwung merged 2 commits intobabel:mainfrom
JLHwung:support-partial-application-super-method

Conversation

@JLHwung
Copy link
Contributor

@JLHwung JLHwung commented Dec 12, 2025

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

This PR improves the member expression handling such that it supports the super method. Previously we generated invalid lone super node. The handling logic here is copied from the decorators transform. As a bonus the new logic will reuse the this expression when possible. Hence there are a few output changes.

Also left a todo comment in the plugin since partial applications nested within NewExpression and OptionalCallExpression are not yet supported.

@JLHwung JLHwung added Spec: Partial Application PR: Bug Fix (next major) 🐛 A type of pull request used for our changelog categories for next major release labels Dec 12, 2025
@babel-bot
Copy link
Collaborator

babel-bot commented Dec 12, 2025

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

@pkg-pr-new
Copy link

pkg-pr-new bot commented Dec 12, 2025

Open in StackBlitz

commit: 4622ec4

return _this$compare.call(_this, _argPlaceholder, _argPlaceholder2);
var _this$compare;
this.compare = (_this$compare = this.compare, function compare(_argPlaceholder, _argPlaceholder2) {
return _this$compare.call(this, _argPlaceholder, _argPlaceholder2);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This change is not correct, although this is static in _this$compare = this.compare, the result is no longer a bound method because the function wrapper compare has its own this binding. We should still memoise this to ensure that the method is bound.

The test suite does not actually test the this binding, so the test still passes.

@JLHwung JLHwung force-pushed the support-partial-application-super-method branch from 541ef74 to 4622ec4 Compare January 22, 2026 15:56
@JLHwung JLHwung requested a review from liuxingbaoyu January 22, 2026 15:56
@JLHwung JLHwung merged commit c279a5a into babel:main Jan 23, 2026
54 checks passed
@JLHwung JLHwung deleted the support-partial-application-super-method branch January 23, 2026 18:40
@nicolo-ribaudo nicolo-ribaudo added the PR: Bug Fix 🐛 A type of pull request used for our changelog categories label Mar 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

PR: Bug Fix 🐛 A type of pull request used for our changelog categories PR: Bug Fix (next major) 🐛 A type of pull request used for our changelog categories for next major release Spec: Partial Application

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Partial application transform does not support super method call

4 participants