Include super.XXX(...) assertion method calls in CFA (#36293)

* Support super.XXX in assertions

* Add tests
This commit is contained in:
Anders Hejlsberg
2020-01-22 11:21:11 -08:00
committed by GitHub
parent c8e2f58ec5
commit da61231039
12 changed files with 337 additions and 47 deletions

View File

@@ -19075,6 +19075,8 @@ namespace ts {
return getExplicitTypeOfSymbol(symbol.flags & SymbolFlags.Alias ? resolveAlias(symbol) : symbol, diagnostic);
case SyntaxKind.ThisKeyword:
return getExplicitThisType(node);
case SyntaxKind.SuperKeyword:
return checkSuperExpression(node);
case SyntaxKind.PropertyAccessExpression:
const type = getTypeOfDottedName((<PropertyAccessExpression>node).expression, diagnostic);
const prop = type && getPropertyOfType(type, (<PropertyAccessExpression>node).name.escapedText);

View File

@@ -4278,7 +4278,7 @@ namespace ts {
}
export function isDottedName(node: Expression): boolean {
return node.kind === SyntaxKind.Identifier || node.kind === SyntaxKind.ThisKeyword ||
return node.kind === SyntaxKind.Identifier || node.kind === SyntaxKind.ThisKeyword || node.kind === SyntaxKind.SuperKeyword ||
node.kind === SyntaxKind.PropertyAccessExpression && isDottedName((<PropertyAccessExpression>node).expression) ||
node.kind === SyntaxKind.ParenthesizedExpression && isDottedName((<ParenthesizedExpression>node).expression);
}