Skip to content

Commit dc8e0cc

Browse files
author
Kanchalai Tanglertsampan
committed
Address PR
1 parent 1cfce12 commit dc8e0cc

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

src/compiler/checker.ts

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7306,10 +7306,6 @@ namespace ts {
73067306
}
73077307
}
73087308

7309-
function isSuperCallExpression(n: Node): boolean {
7310-
return n.kind === SyntaxKind.CallExpression && (<CallExpression>n).expression.kind === SyntaxKind.SuperKeyword;
7311-
}
7312-
73137309
function findFirstSuperCall(n: Node): Node {
73147310
if (isSuperCallExpression(n)) {
73157311
return n;
@@ -11885,14 +11881,14 @@ namespace ts {
1188511881
}
1188611882

1188711883
// TS 1.0 spec (April 2014): 8.3.2
11888-
// Constructors of classes with no extends clause and constructors of classes that extends null may not contain super calls,
11889-
// whereas constructors of derived classes must contain at least one super call somewhere in their function body.
11884+
// Constructors of classes with no extends clause may not contain super calls, whereas
11885+
// constructors of derived classes must contain at least one super call somewhere in their function body.
1189011886
const containingClassDecl = <ClassDeclaration>node.parent;
1189111887
if (getClassExtendsHeritageClauseElement(containingClassDecl)) {
11892-
const isClassExtendNull = classDeclarationExtendsNull(containingClassDecl);
11888+
const classExtendsNull = classDeclarationExtendsNull(containingClassDecl);
1189311889

1189411890
if (getSuperCallInConstructor(node)) {
11895-
if (isClassExtendNull) {
11891+
if (classExtendsNull) {
1189611892
error(node, Diagnostics.A_constructor_cannot_contain_a_super_call_when_its_class_extends_null);
1189711893
}
1189811894

@@ -11925,7 +11921,7 @@ namespace ts {
1192511921
}
1192611922
}
1192711923
}
11928-
else if (!isClassExtendNull) {
11924+
else if (!classExtendsNull) {
1192911925
error(node, Diagnostics.Constructors_for_derived_classes_must_contain_a_super_call);
1193011926
}
1193111927
}

0 commit comments

Comments
 (0)