Skip to content

fix emit for super calls that has preceding prologue directives#8028

Merged
vladima merged 4 commits into
transformsfrom
fixLocationOfSuperCall
Apr 15, 2016
Merged

fix emit for super calls that has preceding prologue directives#8028
vladima merged 4 commits into
transformsfrom
fixLocationOfSuperCall

Conversation

@vladima
Copy link
Copy Markdown
Contributor

@vladima vladima commented Apr 12, 2016

don't assume that super call is the first statement in the list. Fixes #7877.

@rbuckton rbuckton added the Domain: API: Transforms Relates to the public transform API label Apr 13, 2016
* @returns index of the statement that follows super call
*/
function findInitialSuperCall(ctor: ConstructorDeclaration): ExpressionStatement {
function addPrologueDirectivesAndInitialSuperCall(ctor: ConstructorDeclaration, result: Statement[]): number {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

There's already an addPrologueDirectives function. Can we that instead?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

sure

@vladima
Copy link
Copy Markdown
Contributor Author

vladima commented Apr 14, 2016

@rbuckton any other comments?

Comment thread src/compiler/transformers/ts.ts Outdated
if (statement.kind === SyntaxKind.ExpressionStatement) {
const expression = (<ExpressionStatement>statement).expression;
if (expression.kind === SyntaxKind.CallExpression) {
if ((<CallExpression>expression).expression.kind === SyntaxKind.SuperKeyword) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

There is an isSuperCallExpression function.

@DanielRosenwasser
Copy link
Copy Markdown
Member

👍 apart from the last comment I left.

@mhegazy
Copy link
Copy Markdown
Contributor

mhegazy commented Apr 15, 2016

👍

@vladima vladima merged commit c997669 into transforms Apr 15, 2016
@vladima vladima deleted the fixLocationOfSuperCall branch April 15, 2016 22:26
@microsoft microsoft locked and limited conversation to collaborators Jun 19, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Domain: API: Transforms Relates to the public transform API

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants