pub struct RubySemanticIndex<'a> {
pub graph: RubyGraphSource<'a>,
pub ruby: &'a dyn RubySource,
pub factory_return_cache: RefCell<HashMap<FactoryInferenceKey, Option<String>>>,
/* private fields */
}Fields§
§graph: RubyGraphSource<'a>§ruby: &'a dyn RubySource§factory_return_cache: RefCell<HashMap<FactoryInferenceKey, Option<String>>>Implementations§
Source§impl<'a> RubySemanticIndex<'a>
impl<'a> RubySemanticIndex<'a>
pub fn build( graph: RubyGraphSource<'a>, ruby: &'a dyn RubySource, spec: &RubyTargetSpec, ) -> Self
pub fn build_for_lookup( graph: RubyGraphSource<'a>, ruby: &'a dyn RubySource, ) -> Self
pub fn visible_files_from(&self, file: &ProjectFile) -> HashSet<ProjectFile>
Sourcepub fn visible_files_from_bounded(
&self,
file: &ProjectFile,
max_files: usize,
) -> Option<HashSet<ProjectFile>>
pub fn visible_files_from_bounded( &self, file: &ProjectFile, max_files: usize, ) -> Option<HashSet<ProjectFile>>
Follows only explicit project-local require edges and fails closed
when the dependency closure is too broad for a latency-sensitive caller.
Diagnostics use this instead of the navigation-oriented visibility
closure. Callers that want convention-derived Zeitwerk visibility must
continue using Self::visible_files_from.
pub fn resolve_constant( &self, file: &ProjectFile, visible_files: &HashSet<ProjectFile>, lexical_stack: &[String], node: Node<'_>, source: &str, ) -> Option<CodeUnit>
Sourcepub fn resolve_project_local_constant(
&self,
file: &ProjectFile,
visible_files: &HashSet<ProjectFile>,
lexical_stack: &[String],
node: Node<'_>,
source: &str,
) -> Option<CodeUnit>
pub fn resolve_project_local_constant( &self, file: &ProjectFile, visible_files: &HashSet<ProjectFile>, lexical_stack: &[String], node: Node<'_>, source: &str, ) -> Option<CodeUnit>
Resolves only indexed declarations in the supplied project-local
visibility closure. This avoids initializing the workspace-wide
autoload index for conservative, latency-sensitive diagnostics.
Sourcepub fn declares_constant_anywhere(
&self,
lexical_stack: &[String],
node: Node<'_>,
source: &str,
) -> bool
pub fn declares_constant_anywhere( &self, lexical_stack: &[String], node: Node<'_>, source: &str, ) -> bool
Whether the workspace declares the constant path node spells anywhere
at all, ignoring which files the referencing file can reach.
Self::resolve_constant answers the navigation question – can this
file reach the declaration – and a cross-workspace boundary claim must
not be built on it. A project file that declares the constant without
being required is still a workspace declaration, and reporting the
reference as leaving the workspace would be false. This is the weaker,
visibility-blind question such a claim has to ask first.
pub fn resolve_constant_name( &self, file: &ProjectFile, visible_files: &HashSet<ProjectFile>, lexical_stack: &[String], name: &str, ) -> Option<CodeUnit>
pub fn target_matches_constant(&self, unit: &CodeUnit) -> bool
pub fn resolve_method_candidates( &self, support: &dyn BoundedDefinitionLookup, visible_files: &HashSet<ProjectFile>, receiver: &ReceiverType, member: &str, ) -> Vec<CodeUnit>
Sourcepub fn resolve_method_candidates_traced(
&self,
support: &dyn BoundedDefinitionLookup,
visible_files: &HashSet<ProjectFile>,
receiver: &ReceiverType,
member: &str,
find: &mut Option<RubyMethodFind>,
) -> Vec<CodeUnit>
pub fn resolve_method_candidates_traced( &self, support: &dyn BoundedDefinitionLookup, visible_files: &HashSet<ProjectFile>, receiver: &ReceiverType, member: &str, find: &mut Option<RubyMethodFind>, ) -> Vec<CodeUnit>
Self::resolve_method_candidates, reporting where the group it
returns was found (#1477).
The lookup returns the first non-empty group it reaches, so one owner and one edge describe every candidate in that group. A caller that does not ask keeps the plain entry point and pays nothing.
pub fn resolve_bare_method_candidates( &self, support: &dyn BoundedDefinitionLookup, visible_files: &HashSet<ProjectFile>, receiver: &ReceiverType, member: &str, ) -> Vec<CodeUnit>
Sourcepub fn resolve_bare_method_candidates_traced(
&self,
support: &dyn BoundedDefinitionLookup,
visible_files: &HashSet<ProjectFile>,
receiver: &ReceiverType,
member: &str,
find: &mut Option<RubyMethodFind>,
) -> Vec<CodeUnit>
pub fn resolve_bare_method_candidates_traced( &self, support: &dyn BoundedDefinitionLookup, visible_files: &HashSet<ProjectFile>, receiver: &ReceiverType, member: &str, find: &mut Option<RubyMethodFind>, ) -> Vec<CodeUnit>
Self::resolve_bare_method_candidates, reporting where the group it
returns was found (#1477).
A bare name that falls through to the top-level scope reports no find: a top-level method belongs to no owner, so there is nothing to attribute it to.
Sourcepub fn direct_ancestor_owners(
&self,
support: &dyn BoundedDefinitionLookup,
visible_files: &[ProjectFile],
owner: &str,
) -> Vec<String>
pub fn direct_ancestor_owners( &self, support: &dyn BoundedDefinitionLookup, visible_files: &[ProjectFile], owner: &str, ) -> Vec<String>
The direct ancestors of owner: the exact edges
Self::forward_ancestor_lookup_order walks, before it flattens them
into a lookup order that no longer says which owner reached which.
Sourcepub fn mixin_owners_of(
&self,
support: &dyn BoundedDefinitionLookup,
visible_files: &[ProjectFile],
owner: &str,
kind: TypeRelationKind,
) -> Vec<String>
pub fn mixin_owners_of( &self, support: &dyn BoundedDefinitionLookup, visible_files: &[ProjectFile], owner: &str, kind: TypeRelationKind, ) -> Vec<String>
The mixins owner composes in through kind, in the order the method
lookup considers them.
Sourcepub fn owner_unit(
&self,
support: &dyn BoundedDefinitionLookup,
visible_files: &[ProjectFile],
owner: &str,
) -> Option<CodeUnit>
pub fn owner_unit( &self, support: &dyn BoundedDefinitionLookup, visible_files: &[ProjectFile], owner: &str, ) -> Option<CodeUnit>
The class or module declaration owner names, as the lookup resolves
it: an indexed class or module of that exact fq name, visible from the
referencing file.
pub fn ancestor_lookup_order(&self, owner: &str) -> Vec<String>
pub fn forward_ancestor_lookup_order( &self, support: &dyn BoundedDefinitionLookup, visible_files: &[ProjectFile], owner: &str, ) -> Vec<String>
Auto Trait Implementations§
impl<'a> !Freeze for RubySemanticIndex<'a>
impl<'a> !RefUnwindSafe for RubySemanticIndex<'a>
impl<'a> !Sync for RubySemanticIndex<'a>
impl<'a> !UnwindSafe for RubySemanticIndex<'a>
impl<'a> Send for RubySemanticIndex<'a>
impl<'a> Unpin for RubySemanticIndex<'a>
impl<'a> UnsafeUnpin for RubySemanticIndex<'a>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more