From dc8e0ccd3d21744ca3678ade3d97d60da47cb6e3 Mon Sep 17 00:00:00 2001 From: Kanchalai Tanglertsampan Date: Mon, 8 Feb 2016 13:04:48 -0800 Subject: [PATCH] Address PR --- src/compiler/checker.ts | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 925aae2783b..4a824e3bbb4 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -7306,10 +7306,6 @@ namespace ts { } } - function isSuperCallExpression(n: Node): boolean { - return n.kind === SyntaxKind.CallExpression && (n).expression.kind === SyntaxKind.SuperKeyword; - } - function findFirstSuperCall(n: Node): Node { if (isSuperCallExpression(n)) { return n; @@ -11885,14 +11881,14 @@ namespace ts { } // TS 1.0 spec (April 2014): 8.3.2 - // Constructors of classes with no extends clause and constructors of classes that extends null may not contain super calls, - // whereas constructors of derived classes must contain at least one super call somewhere in their function body. + // Constructors of classes with no extends clause may not contain super calls, whereas + // constructors of derived classes must contain at least one super call somewhere in their function body. const containingClassDecl = node.parent; if (getClassExtendsHeritageClauseElement(containingClassDecl)) { - const isClassExtendNull = classDeclarationExtendsNull(containingClassDecl); + const classExtendsNull = classDeclarationExtendsNull(containingClassDecl); if (getSuperCallInConstructor(node)) { - if (isClassExtendNull) { + if (classExtendsNull) { error(node, Diagnostics.A_constructor_cannot_contain_a_super_call_when_its_class_extends_null); } @@ -11925,7 +11921,7 @@ namespace ts { } } } - else if (!isClassExtendNull) { + else if (!classExtendsNull) { error(node, Diagnostics.Constructors_for_derived_classes_must_contain_a_super_call); } }