Add super to control flow.
It is handled the same way as 'this'
This commit is contained in:
parent
0459987673
commit
a4a7669a4b
2 changed files with 4 additions and 0 deletions
|
@ -703,6 +703,7 @@ namespace ts {
|
||||||
function isNarrowableReference(expr: Expression): boolean {
|
function isNarrowableReference(expr: Expression): boolean {
|
||||||
return expr.kind === SyntaxKind.Identifier ||
|
return expr.kind === SyntaxKind.Identifier ||
|
||||||
expr.kind === SyntaxKind.ThisKeyword ||
|
expr.kind === SyntaxKind.ThisKeyword ||
|
||||||
|
expr.kind === SyntaxKind.SuperKeyword ||
|
||||||
expr.kind === SyntaxKind.PropertyAccessExpression && isNarrowableReference((<PropertyAccessExpression>expr).expression);
|
expr.kind === SyntaxKind.PropertyAccessExpression && isNarrowableReference((<PropertyAccessExpression>expr).expression);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -10347,6 +10347,8 @@ namespace ts {
|
||||||
getExportSymbolOfValueSymbolIfExported(getResolvedSymbol(<Identifier>source)) === getSymbolOfNode(target);
|
getExportSymbolOfValueSymbolIfExported(getResolvedSymbol(<Identifier>source)) === getSymbolOfNode(target);
|
||||||
case SyntaxKind.ThisKeyword:
|
case SyntaxKind.ThisKeyword:
|
||||||
return target.kind === SyntaxKind.ThisKeyword;
|
return target.kind === SyntaxKind.ThisKeyword;
|
||||||
|
case SyntaxKind.SuperKeyword:
|
||||||
|
return target.kind === SyntaxKind.SuperKeyword;
|
||||||
case SyntaxKind.PropertyAccessExpression:
|
case SyntaxKind.PropertyAccessExpression:
|
||||||
return target.kind === SyntaxKind.PropertyAccessExpression &&
|
return target.kind === SyntaxKind.PropertyAccessExpression &&
|
||||||
(<PropertyAccessExpression>source).name.text === (<PropertyAccessExpression>target).name.text &&
|
(<PropertyAccessExpression>source).name.text === (<PropertyAccessExpression>target).name.text &&
|
||||||
|
@ -11483,6 +11485,7 @@ namespace ts {
|
||||||
switch (expr.kind) {
|
switch (expr.kind) {
|
||||||
case SyntaxKind.Identifier:
|
case SyntaxKind.Identifier:
|
||||||
case SyntaxKind.ThisKeyword:
|
case SyntaxKind.ThisKeyword:
|
||||||
|
case SyntaxKind.SuperKeyword:
|
||||||
case SyntaxKind.PropertyAccessExpression:
|
case SyntaxKind.PropertyAccessExpression:
|
||||||
return narrowTypeByTruthiness(type, expr, assumeTrue);
|
return narrowTypeByTruthiness(type, expr, assumeTrue);
|
||||||
case SyntaxKind.CallExpression:
|
case SyntaxKind.CallExpression:
|
||||||
|
|
Loading…
Reference in a new issue