More cleanup.

This commit is contained in:
Eric Traut 2019-11-09 21:36:20 -08:00
parent 3e892f97fd
commit 9439c739e9

View File

@ -294,7 +294,7 @@ export class TypeAnalyzer extends ParseTreeWalker {
returnType = NoneType.create();
}
if (this._isNodeReachable(node) && enclosingFunctionNode) {
if (this._evaluator.isNodeReachable(node) && enclosingFunctionNode) {
if (declaredReturnType) {
if (isNoReturnType(declaredReturnType)) {
this._evaluator.addError(
@ -747,21 +747,6 @@ export class TypeAnalyzer extends ParseTreeWalker {
}
}
private _getAliasedSymbolTypeForName(name: string): Type | undefined {
const symbolWithScope = this._currentScope.lookUpSymbolRecursive(name);
if (!symbolWithScope) {
return undefined;
}
const aliasDecl = symbolWithScope.symbol.getDeclarations().find(
decl => decl.type === DeclarationType.Alias);
if (!aliasDecl) {
return undefined;
}
return DeclarationUtils.getInferredTypeOfDeclaration(aliasDecl, this._fileInfo.importLookup);
}
// Validates that a call to isinstance or issubclass are necessary. This is a
// common source of programming errors.
private _validateIsInstanceCallNecessary(node: CallNode) {
@ -1354,7 +1339,7 @@ export class TypeAnalyzer extends ParseTreeWalker {
}
}
if (this._isNodeReachable(node)) {
if (this._evaluator.isNodeReachable(node)) {
if (declaredYieldType) {
if (isNoReturnType(declaredYieldType)) {
this._evaluator.addError(
@ -1433,10 +1418,6 @@ export class TypeAnalyzer extends ParseTreeWalker {
}
}
private _isNodeReachable(node: ParseNode): boolean {
return this._evaluator.isNodeReachable(node);
}
private _getTypeOfExpression(node: ExpressionNode, flags = EvaluatorFlags.None, expectedType?: Type): Type {
return this._evaluator.getType(node, { method: 'get', expectedType }, flags);
}