pub struct ScopeStack<'tcx> { /* private fields */ }Expand description
Manages a stack of nested scopes for symbol resolution and insertion.
Implementations§
Source§impl<'tcx> ScopeStack<'tcx>
impl<'tcx> ScopeStack<'tcx>
pub fn new(arena: &'tcx Arena<'tcx>, interner: &'tcx InternPool) -> Self
pub fn depth(&self) -> usize
pub fn push(&self, scope: &'tcx Scope<'tcx>)
pub fn globals(&self) -> &'tcx Scope<'tcx>
pub fn top(&self) -> Option<&'tcx Scope<'tcx>>
Sourcepub fn push_recursive(&self, scope: &'tcx Scope<'tcx>)
pub fn push_recursive(&self, scope: &'tcx Scope<'tcx>)
Recursively pushes a scope and all its base (parent) scopes onto the stack.
pub fn pop(&self) -> Option<&'tcx Scope<'tcx>>
pub fn pop_until(&self, depth: usize)
Sourcepub fn lookup_symbols(
&self,
name: &str,
options: LookupOptions,
) -> Option<Vec<&'tcx Symbol>>
pub fn lookup_symbols( &self, name: &str, options: LookupOptions, ) -> Option<Vec<&'tcx Symbol>>
This should be the only pure api to lookup symbols following the lexical scope backwards.
Sourcepub fn lookup_or_insert(
&self,
name: &str,
node: HirId,
options: LookupOptions,
) -> Option<Vec<&'tcx Symbol>>
pub fn lookup_or_insert( &self, name: &str, node: HirId, options: LookupOptions, ) -> Option<Vec<&'tcx Symbol>>
Internal implementation for lookup/insert logic. This is the only entry point to create a symbol
Sourcepub fn lookup_qualified(
&self,
qualified_name: &[&str],
options: LookupOptions,
) -> Option<Vec<&'tcx Symbol>>
pub fn lookup_qualified( &self, qualified_name: &[&str], options: LookupOptions, ) -> Option<Vec<&'tcx Symbol>>
Lookup a qualified name like crate::foo::bar by resolving each part sequentially.
Starts from the global (first) scope and follows the scope chain through the symbol hierarchy.
Trait Implementations§
Source§impl<'tcx> Clone for ScopeStack<'tcx>
impl<'tcx> Clone for ScopeStack<'tcx>
Auto Trait Implementations§
impl<'tcx> !Freeze for ScopeStack<'tcx>
impl<'tcx> !RefUnwindSafe for ScopeStack<'tcx>
impl<'tcx> Send for ScopeStack<'tcx>
impl<'tcx> Sync for ScopeStack<'tcx>
impl<'tcx> Unpin for ScopeStack<'tcx>
impl<'tcx> !UnwindSafe for ScopeStack<'tcx>
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