Use returned values from super calls as 'this'#10762
Use returned values from super calls as 'this'#10762DanielRosenwasser merged 44 commits intomasterfrom
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
thisfor 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.