pub struct FlattenedScopeCache { /* private fields */ }Expand description
Pre-computed visible scope for each file.
Scope = own symbols + public symbols from imported files transitively. Local symbols take priority over imported (shadowing).
Implementations§
Source§impl FlattenedScopeCache
impl FlattenedScopeCache
Sourcepub fn build(ctx: &ResolutionContext, diagnostics: &mut Vec<Diagnostic>) -> Self
pub fn build(ctx: &ResolutionContext, diagnostics: &mut Vec<Diagnostic>) -> Self
Build the scope cache from the file->symbols index and import adjacency.
For each file, BFS over import edges, collecting public symbols from reachable files. Confidence decays with distance:
- 1.0: own file or direct import, same language
- 0.8: transitive import, same language
- 0.6: cross-language imports
Sourcepub fn resolve(&self, file_id: FileId, name: &str) -> Option<&[(SymbolId, f32)]>
pub fn resolve(&self, file_id: FileId, name: &str) -> Option<&[(SymbolId, f32)]>
Look up a name in a file’s flattened scope.
Returns matching symbols with confidence scores, or None if not found.
Sourcepub fn scope(&self, file_id: FileId) -> Option<&ScopeMap>
pub fn scope(&self, file_id: FileId) -> Option<&ScopeMap>
Full scope for a file: name to candidates with confidence.
Sourcepub fn iter_scopes(&self) -> impl Iterator<Item = (FileId, &ScopeMap)>
pub fn iter_scopes(&self) -> impl Iterator<Item = (FileId, &ScopeMap)>
Iterate over every file scope.
Trait Implementations§
Source§impl Clone for FlattenedScopeCache
impl Clone for FlattenedScopeCache
Source§fn clone(&self) -> FlattenedScopeCache
fn clone(&self) -> FlattenedScopeCache
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for FlattenedScopeCache
impl Debug for FlattenedScopeCache
Source§impl Default for FlattenedScopeCache
impl Default for FlattenedScopeCache
Source§fn default() -> FlattenedScopeCache
fn default() -> FlattenedScopeCache
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for FlattenedScopeCache
impl RefUnwindSafe for FlattenedScopeCache
impl Send for FlattenedScopeCache
impl Sync for FlattenedScopeCache
impl Unpin for FlattenedScopeCache
impl UnsafeUnpin for FlattenedScopeCache
impl UnwindSafe for FlattenedScopeCache
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
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> ⓘ
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 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> ⓘ
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