mirror of
https://github.com/microsoft/pyright.git
synced 2024-09-20 04:37:57 +03:00
More cleanup.
This commit is contained in:
parent
3e892f97fd
commit
9439c739e9
@ -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);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user