Skip to main content

RubySemanticIndex

Struct RubySemanticIndex 

Source
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>

Source

pub fn build( graph: RubyGraphSource<'a>, ruby: &'a dyn RubySource, spec: &RubyTargetSpec, ) -> Self

Source

pub fn build_for_lookup( graph: RubyGraphSource<'a>, ruby: &'a dyn RubySource, ) -> Self

Source

pub fn visible_files_from(&self, file: &ProjectFile) -> HashSet<ProjectFile>

Source

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.

Source

pub fn resolve_constant( &self, file: &ProjectFile, visible_files: &HashSet<ProjectFile>, lexical_stack: &[String], node: Node<'_>, source: &str, ) -> Option<CodeUnit>

Source

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.

Source

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.

Source

pub fn resolve_constant_name( &self, file: &ProjectFile, visible_files: &HashSet<ProjectFile>, lexical_stack: &[String], name: &str, ) -> Option<CodeUnit>

Source

pub fn target_matches_constant(&self, unit: &CodeUnit) -> bool

Source

pub fn resolve_method_candidates( &self, support: &dyn BoundedDefinitionLookup, visible_files: &HashSet<ProjectFile>, receiver: &ReceiverType, member: &str, ) -> Vec<CodeUnit>

Source

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.

Source

pub fn resolve_bare_method_candidates( &self, support: &dyn BoundedDefinitionLookup, visible_files: &HashSet<ProjectFile>, receiver: &ReceiverType, member: &str, ) -> Vec<CodeUnit>

Source

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.

Source

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.

Source

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.

Source

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.

Source

pub fn ancestor_lookup_order(&self, owner: &str) -> Vec<String>

Source

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CapabilityProvider for T
where T: Any,

Source§

fn as_any(&self) -> &(dyn Any + 'static)

Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.