pub struct ScopeTracker { /* private fields */ }Expand description
Tracks variable bindings across nested scopes.
Unlike the interpreter’s Scope which holds values, this only tracks names for static validation purposes.
Implementations§
Source§impl ScopeTracker
impl ScopeTracker
Sourcepub fn push_frame(&mut self)
pub fn push_frame(&mut self)
Push a new scope frame.
Variables bound after this call are local to the new frame
until pop_frame is called.
Sourcepub fn pop_frame(&mut self)
pub fn pop_frame(&mut self)
Pop the current scope frame.
Variables bound in this frame are forgotten. Panics if trying to pop the global frame.
Sourcepub fn is_bound(&self, name: &str) -> bool
pub fn is_bound(&self, name: &str) -> bool
Check if a variable is bound in any scope.
Searches from innermost to outermost scope.
Sourcepub fn should_skip_undefined_check(name: &str) -> bool
pub fn should_skip_undefined_check(name: &str) -> bool
Check if a variable name should skip undefined warnings.
Variables starting with underscore are conventionally external or intentionally unchecked.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ScopeTracker
impl RefUnwindSafe for ScopeTracker
impl Send for ScopeTracker
impl Sync for ScopeTracker
impl Unpin for ScopeTracker
impl UnwindSafe for ScopeTracker
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