-
Notifications
You must be signed in to change notification settings - Fork 12.5k
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
Use returned values from super calls as 'this' #10762
Conversation
…ing 'super(...)'.
…r of a derived class.
…eserved. This came up when a `super()` call was nested in another constructor body. Current logic in the transform says that if the last containing non-arrow function body is non-static, and the current parent isn't a call expression, the call target of a `super` call will become `_super.prototype` instead of `super`. If the state is not saved, the containing arrow function and parent are not saved, and the information for this check won't be accurate.
Awesome work! |
… generated 'super()' calls.
36a5c42
to
b5a1031
Compare
@sandersn how have we been operating like this? In any case, it looks like GitHub just has a limitation and might not be showing that file. I seem to have it locally. |
It's only been since we made the tests run faster by not writing output for passing tests. I have the PR open in codeflow too or I would not have noticed the missing file at all. But maybe it's missing at the API level, not just the UI level. |
@sandersn are you sure you don't see a |
When I check out the branch myself I see it, but I don't find it in the github list of files either. I guess it's a limitation of github proper, not just its UI. |
@DanielRosenwasser after the removal of |
@rbuckton nope, no changes. |
This PR fixes #7574.
In ES2015, constructors which return a value (which is an object) implicitly substitute the value of
this
for any callers ofsuper()
. As a result, it is necessary to capture any potential return value ofsuper()
and replace it withthis
.Some remaining work might be to do some refactoring on the emit code.
I'd suggest reading one commit at a time.