From a4a7669a4ba37c13afe3f1d41404681e98945f94 Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders Date: Fri, 31 Mar 2017 14:17:37 -0700 Subject: [PATCH] Add super to control flow. It is handled the same way as 'this' --- src/compiler/binder.ts | 1 + src/compiler/checker.ts | 3 +++ 2 files changed, 4 insertions(+) diff --git a/src/compiler/binder.ts b/src/compiler/binder.ts index 45e8efdf51..2d346bc9d1 100644 --- a/src/compiler/binder.ts +++ b/src/compiler/binder.ts @@ -703,6 +703,7 @@ namespace ts { function isNarrowableReference(expr: Expression): boolean { return expr.kind === SyntaxKind.Identifier || expr.kind === SyntaxKind.ThisKeyword || + expr.kind === SyntaxKind.SuperKeyword || expr.kind === SyntaxKind.PropertyAccessExpression && isNarrowableReference((expr).expression); } diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index d36aae6bdd..e5271d882c 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -10347,6 +10347,8 @@ namespace ts { getExportSymbolOfValueSymbolIfExported(getResolvedSymbol(source)) === getSymbolOfNode(target); case SyntaxKind.ThisKeyword: return target.kind === SyntaxKind.ThisKeyword; + case SyntaxKind.SuperKeyword: + return target.kind === SyntaxKind.SuperKeyword; case SyntaxKind.PropertyAccessExpression: return target.kind === SyntaxKind.PropertyAccessExpression && (source).name.text === (target).name.text && @@ -11483,6 +11485,7 @@ namespace ts { switch (expr.kind) { case SyntaxKind.Identifier: case SyntaxKind.ThisKeyword: + case SyntaxKind.SuperKeyword: case SyntaxKind.PropertyAccessExpression: return narrowTypeByTruthiness(type, expr, assumeTrue); case SyntaxKind.CallExpression: