mirror of
https://github.com/microsoft/pyright.git
synced 2024-09-11 16:06:39 +03:00
Fixed performance issue that affected long if/elif chains. This addresses https://github.com/microsoft/pyright/issues/4728.
This commit is contained in:
parent
a36c24c39f
commit
58db719c67
@ -20018,7 +20018,7 @@ export function createTypeEvaluator(importLookup: ImportLookup, evaluatorOptions
|
||||
|
||||
if (symbolWithScope && honorCodeFlow && scopeTypeHonorsCodeFlow) {
|
||||
// Filter the declarations based on flow reachability.
|
||||
const reachableDecls = symbolWithScope.symbol.getDeclarations().filter((decl) => {
|
||||
const reachableDecl = symbolWithScope.symbol.getDeclarations().find((decl) => {
|
||||
if (decl.type !== DeclarationType.Alias && decl.type !== DeclarationType.Intrinsic) {
|
||||
// Is the declaration in the same execution scope as the "usageNode" node?
|
||||
const usageScope = ParseTreeUtils.getExecutionScopeNode(node);
|
||||
@ -20051,7 +20051,7 @@ export function createTypeEvaluator(importLookup: ImportLookup, evaluatorOptions
|
||||
|
||||
// If none of the declarations are reachable from the current node,
|
||||
// search for the symbol in outer scopes.
|
||||
if (reachableDecls.length === 0) {
|
||||
if (!reachableDecl) {
|
||||
if (symbolWithScope.scope.type !== ScopeType.Function) {
|
||||
let nextScopeToSearch = symbolWithScope.scope.parent;
|
||||
const isOutsideCallerModule =
|
||||
|
Loading…
Reference in New Issue
Block a user