[ty] Rename `all_members_of_scope` to `all_end_of_scope_members`

This reflects more precisely its behavior based on how it uses the
use-def map.
This commit is contained in:
Andrew Gallant 2025-12-10 11:20:24 -05:00 committed by Andrew Gallant
parent c1c45a6a13
commit 1dcb7f89f1
3 changed files with 8 additions and 8 deletions

View File

@ -11,7 +11,7 @@ use crate::module_resolver::{KnownModule, Module, list_modules, resolve_module};
use crate::semantic_index::definition::Definition;
use crate::semantic_index::scope::FileScopeId;
use crate::semantic_index::semantic_index;
use crate::types::list_members::{Member, all_members, all_members_of_scope};
use crate::types::list_members::{Member, all_end_of_scope_members, all_members};
use crate::types::{Type, binding_type, infer_scope_types};
use crate::{Db, resolve_real_shadowable_module};
@ -76,7 +76,7 @@ impl<'db> SemanticModel<'db> {
for (file_scope, _) in index.ancestor_scopes(file_scope) {
for memberdef in
all_members_of_scope(self.db, file_scope.to_scope_id(self.db, self.file))
all_end_of_scope_members(self.db, file_scope.to_scope_id(self.db, self.file))
{
members.insert(
memberdef.member.name,
@ -221,7 +221,7 @@ impl<'db> SemanticModel<'db> {
let mut completions = vec![];
for (file_scope, _) in index.ancestor_scopes(file_scope) {
completions.extend(
all_members_of_scope(self.db, file_scope.to_scope_id(self.db, self.file)).map(
all_end_of_scope_members(self.db, file_scope.to_scope_id(self.db, self.file)).map(
|memberdef| Completion {
name: memberdef.member.name,
ty: Some(memberdef.member.ty),

View File

@ -26,7 +26,7 @@ use crate::{
};
/// Iterate over all declarations and bindings in the given scope.
pub(crate) fn all_members_of_scope<'db>(
pub(crate) fn all_end_of_scope_members<'db>(
db: &'db dyn Db,
scope_id: ScopeId<'db>,
) -> impl Iterator<Item = MemberWithDefinition<'db>> + 'db {
@ -359,7 +359,7 @@ impl<'db> AllMembers<'db> {
.map(|class| class.class_literal(db).0)
{
let parent_scope = parent.body_scope(db);
for memberdef in all_members_of_scope(db, parent_scope) {
for memberdef in all_end_of_scope_members(db, parent_scope) {
let result = ty.member(db, memberdef.member.name.as_str());
let Some(ty) = result.place.ignore_possibly_undefined() else {
continue;
@ -407,7 +407,7 @@ impl<'db> AllMembers<'db> {
// class member. This gets us the right type for each
// member, e.g., `SomeClass.__delattr__` is not a bound
// method, but `instance_of_SomeClass.__delattr__` is.
for memberdef in all_members_of_scope(db, class_body_scope) {
for memberdef in all_end_of_scope_members(db, class_body_scope) {
let result = ty.member(db, memberdef.member.name.as_str());
let Some(ty) = result.place.ignore_possibly_undefined() else {
continue;

View File

@ -25,7 +25,7 @@ use crate::{
report_overridden_final_method,
},
function::{FunctionDecorators, FunctionType, KnownFunction},
list_members::{Member, MemberWithDefinition, all_members_of_scope},
list_members::{Member, MemberWithDefinition, all_end_of_scope_members},
},
};
@ -54,7 +54,7 @@ pub(super) fn check_class<'db>(context: &InferContext<'db, '_>, class: ClassLite
let class_specialized = class.identity_specialization(db);
let scope = class.body_scope(db);
let own_class_members: FxHashSet<_> = all_members_of_scope(db, scope).collect();
let own_class_members: FxHashSet<_> = all_end_of_scope_members(db, scope).collect();
for member in own_class_members {
check_class_declaration(context, configuration, class_specialized, scope, &member);