File tree Expand file tree Collapse file tree 3 files changed +17
-16
lines changed
Expand file tree Collapse file tree 3 files changed +17
-16
lines changed Original file line number Diff line number Diff line change @@ -11766,10 +11766,6 @@ namespace ts {
1176611766 return;
1176711767 }
1176811768
11769- function isSuperCallExpression(n: Node): boolean {
11770- return n.kind === SyntaxKind.CallExpression && (<CallExpression>n).expression.kind === SyntaxKind.SuperKeyword;
11771- }
11772-
1177311769 function containsSuperCallAsComputedPropertyName(n: Declaration): boolean {
1177411770 return n.name && containsSuperCall(n.name);
1177511771 }
Original file line number Diff line number Diff line change @@ -4768,21 +4768,22 @@ const _super = (function (geti, seti) {
47684768
47694769 /**
47704770 * Return the statement at a given index if it is a super-call statement
4771- * @param ctor constructor declaration
4771+ * @param ctor a constructor declaration
47724772 * @param index an index to constructor's body to check
47734773 */
47744774 function getSuperCallAtGivenIndex ( ctor : ConstructorDeclaration , index : number ) : ExpressionStatement {
4775- if ( ctor . body ) {
4776- const statement = ( < Block > ctor . body ) . statements [ index ] ;
4777- if ( statement && statement . kind === SyntaxKind . ExpressionStatement ) {
4778- const expr = ( < ExpressionStatement > statement ) . expression ;
4779- if ( expr && expr . kind === SyntaxKind . CallExpression ) {
4780- const func = ( < CallExpression > expr ) . expression ;
4781- if ( func && func . kind === SyntaxKind . SuperKeyword ) {
4782- return < ExpressionStatement > statement ;
4783- }
4784- }
4785- }
4775+ if ( ! ctor . body ) {
4776+ return undefined ;
4777+ }
4778+ const statements = ctor . body . statements ;
4779+
4780+ if ( ! statements || index >= statements . length ) {
4781+ return undefined ;
4782+ }
4783+
4784+ const statement = statements [ index ] ;
4785+ if ( statement . kind === SyntaxKind . ExpressionStatement ) {
4786+ return isSuperCallExpression ( ( < ExpressionStatement > statement ) . expression ) ? < ExpressionStatement > statement : undefined ;
47864787 }
47874788 }
47884789
Original file line number Diff line number Diff line change @@ -464,6 +464,10 @@ namespace ts {
464464 return ! ! ( getCombinedNodeFlags ( node ) & NodeFlags . Let ) ;
465465 }
466466
467+ export function isSuperCallExpression ( n : Node ) : boolean {
468+ return n . kind === SyntaxKind . CallExpression && ( < CallExpression > n ) . expression . kind === SyntaxKind . SuperKeyword ;
469+ }
470+
467471 export function isPrologueDirective ( node : Node ) : boolean {
468472 return node . kind === SyntaxKind . ExpressionStatement && ( < ExpressionStatement > node ) . expression . kind === SyntaxKind . StringLiteral ;
469473 }
You can’t perform that action at this time.
0 commit comments