pub struct CodebaseReflection {
pub constant_reflections: HashMap<Name, ConstantReflection>,
pub constant_names: HashMap<StringIdentifier, Name>,
pub constant_names_lowercase: HashMap<StringIdentifier, Name>,
pub function_like_reflections: HashMap<FunctionLikeName, FunctionLikeReflection>,
pub function_names: HashMap<StringIdentifier, FunctionLikeName>,
pub function_names_lowercase: HashMap<StringIdentifier, FunctionLikeName>,
pub class_like_reflections: HashMap<ClassLikeName, ClassLikeReflection>,
pub class_like_names: HashMap<StringIdentifier, ClassLikeName>,
pub class_like_names_lowercase: HashMap<StringIdentifier, ClassLikeName>,
pub direct_classlike_descendants: HashMap<StringIdentifier, HashSet<StringIdentifier>>,
pub all_classlike_descendants: HashMap<StringIdentifier, HashSet<StringIdentifier>>,
pub populated: bool,
}Fields§
§constant_reflections: HashMap<Name, ConstantReflection>§constant_names: HashMap<StringIdentifier, Name>§constant_names_lowercase: HashMap<StringIdentifier, Name>§function_like_reflections: HashMap<FunctionLikeName, FunctionLikeReflection>§function_names: HashMap<StringIdentifier, FunctionLikeName>§function_names_lowercase: HashMap<StringIdentifier, FunctionLikeName>§class_like_reflections: HashMap<ClassLikeName, ClassLikeReflection>§class_like_names: HashMap<StringIdentifier, ClassLikeName>§class_like_names_lowercase: HashMap<StringIdentifier, ClassLikeName>§direct_classlike_descendants: HashMap<StringIdentifier, HashSet<StringIdentifier>>§all_classlike_descendants: HashMap<StringIdentifier, HashSet<StringIdentifier>>§populated: boolImplementations§
Source§impl CodebaseReflection
impl CodebaseReflection
Sourcepub fn register_constant(
&mut self,
interner: &ThreadedInterner,
reflection: ConstantReflection,
) -> bool
pub fn register_constant( &mut self, interner: &ThreadedInterner, reflection: ConstantReflection, ) -> bool
Registers a new constant in the codebase.
If the constant already exists, it will not be added again.
Returns false if the constant already exists.
Sourcepub fn register_function_like(
&mut self,
interner: &ThreadedInterner,
reflection: FunctionLikeReflection,
) -> bool
pub fn register_function_like( &mut self, interner: &ThreadedInterner, reflection: FunctionLikeReflection, ) -> bool
Registers a new function-like entity in the codebase.
If the function-like entity already exists, it will not be added again.
Returns false if the function-like entity already exists.
Sourcepub fn register_class_like(
&mut self,
interner: &ThreadedInterner,
reflection: ClassLikeReflection,
) -> bool
pub fn register_class_like( &mut self, interner: &ThreadedInterner, reflection: ClassLikeReflection, ) -> bool
Registers a new class-like entity (class, enum, interface, or trait) in the codebase.
If the class-like entity already exists, it will not be added again.
Returns false if the class-like entity already exists.
pub fn constant_exists( &self, interner: &ThreadedInterner, id: &StringIdentifier, ) -> bool
pub fn function_exists( &self, interner: &ThreadedInterner, id: &StringIdentifier, ) -> bool
pub fn class_exists( &self, interner: &ThreadedInterner, id: &StringIdentifier, ) -> bool
pub fn enum_exists( &self, interner: &ThreadedInterner, id: &StringIdentifier, ) -> bool
pub fn interface_exists( &self, interner: &ThreadedInterner, id: &StringIdentifier, ) -> bool
pub fn trait_exists( &self, interner: &ThreadedInterner, id: &StringIdentifier, ) -> bool
pub fn get_constant( &self, interner: &ThreadedInterner, id: &StringIdentifier, ) -> Option<&ConstantReflection>
pub fn get_function_like( &self, name: FunctionLikeName, ) -> Option<&FunctionLikeReflection>
Sourcepub fn get_function(
&self,
interner: &ThreadedInterner,
id: &StringIdentifier,
) -> Option<&FunctionLikeReflection>
pub fn get_function( &self, interner: &ThreadedInterner, id: &StringIdentifier, ) -> Option<&FunctionLikeReflection>
Retrieves a function by name, if it exists.
Sourcepub fn get_closure(
&self,
position: &impl HasPosition,
) -> Option<&FunctionLikeReflection>
pub fn get_closure( &self, position: &impl HasPosition, ) -> Option<&FunctionLikeReflection>
Retrieves a closure by its position, if it exists.
Sourcepub fn get_arrow_function(
&self,
position: &impl HasPosition,
) -> Option<&FunctionLikeReflection>
pub fn get_arrow_function( &self, position: &impl HasPosition, ) -> Option<&FunctionLikeReflection>
Retrieves an arrow function by its position, if it exists.
Sourcepub fn get_class_like(
&self,
name: ClassLikeName,
) -> Option<&ClassLikeReflection>
pub fn get_class_like( &self, name: ClassLikeName, ) -> Option<&ClassLikeReflection>
Retrieves a class-like entity by its identifier, if it exists.
Sourcepub fn get_named_class_like(
&self,
interner: &ThreadedInterner,
id: &StringIdentifier,
) -> Option<&ClassLikeReflection>
pub fn get_named_class_like( &self, interner: &ThreadedInterner, id: &StringIdentifier, ) -> Option<&ClassLikeReflection>
Retrieves a class-like entity by its name, if it exists.
Sourcepub fn get_class(
&self,
interner: &ThreadedInterner,
id: &StringIdentifier,
) -> Option<&ClassLikeReflection>
pub fn get_class( &self, interner: &ThreadedInterner, id: &StringIdentifier, ) -> Option<&ClassLikeReflection>
Retrieves a class by name, if it exists.
Sourcepub fn get_enum(
&self,
interner: &ThreadedInterner,
id: &StringIdentifier,
) -> Option<&ClassLikeReflection>
pub fn get_enum( &self, interner: &ThreadedInterner, id: &StringIdentifier, ) -> Option<&ClassLikeReflection>
Retrieves an enum by name, if it exists.
Sourcepub fn get_interface(
&self,
interner: &ThreadedInterner,
id: &StringIdentifier,
) -> Option<&ClassLikeReflection>
pub fn get_interface( &self, interner: &ThreadedInterner, id: &StringIdentifier, ) -> Option<&ClassLikeReflection>
Retrieves an interface by name, if it exists.
Sourcepub fn get_trait(
&self,
interner: &ThreadedInterner,
id: &StringIdentifier,
) -> Option<&ClassLikeReflection>
pub fn get_trait( &self, interner: &ThreadedInterner, id: &StringIdentifier, ) -> Option<&ClassLikeReflection>
Retrieves a trait by name, if it exists.
Sourcepub fn get_enclosing_function_like(
&self,
has_position: &impl HasPosition,
) -> Option<&FunctionLikeReflection>
pub fn get_enclosing_function_like( &self, has_position: &impl HasPosition, ) -> Option<&FunctionLikeReflection>
Returns the function-like reflection (function, closure, etc.) that encloses the given offset.
This method iterates through the reflections in the codebase, filtering for function-like reflections that contain the given offset in their definition range. It returns the reflection with the largest starting offset, effectively finding the innermost function-like reflection containing the offset.
§Arguments
has_position- The position to search for.
§Returns
Option<&FunctionLikeReflection>- The enclosing function-like reflection, if found.
Sourcepub fn get_enclosing_class_like(
&self,
has_position: &impl HasPosition,
) -> Option<&ClassLikeReflection>
pub fn get_enclosing_class_like( &self, has_position: &impl HasPosition, ) -> Option<&ClassLikeReflection>
Returns the class-like reflection (class, trait, etc.) that encloses the given offset.
This method iterates through the reflections in the codebase, filtering for class-like reflections that contain the given offset in their definition range. It returns the reflection with the largest starting offset, effectively finding the innermost class-like reflection containing the offset.
§Arguments
has_position- The position to search for.
§Returns
Option<&ClassLikeReflection>- The enclosing class-like reflection, if found.
Trait Implementations§
Source§impl Clone for CodebaseReflection
impl Clone for CodebaseReflection
Source§fn clone(&self) -> CodebaseReflection
fn clone(&self) -> CodebaseReflection
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more