-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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 emitting super-call when using prologue directives #6911
Conversation
* @param ctor constructor declaration | ||
* @param index an index to constructor's body to check | ||
*/ | ||
function getSuperCallAtGivenIndex(ctor: ConstructorDeclaration, index: number): ExpressionStatement { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd just take a NodeArray<Statement>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add an explicit return at the end?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why doesn't this just return a boolean if there's a super call at that index?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can't just return boolean because we should the super-call found here for emitting later
Is it guaranteed that the initial super call will be an expression statement? Is it not possible to have the following? 1 && super() |
yes, otherwise we error. we only skip prologues (e.g. "use strict"). |
👍 |
please port to master as well. |
@DanielRosenwasser yep it will an error. There is a discussion/issue whether we should allow that :) #6908 |
Fix emitting super-call when using prologue directives
Fix #6901