Struct lib_ruby_parser::StaticEnvironment [−][src]
Stack of local variables in nested scopes
Each scope represents a Ruby scope:
# 1
class A
# 1, 2
def m
# 1, 2, 3
end
# 1, 2
end
# 1
In the example above comments show what’s in the stack. Basically, it’s pushed when you enter a new scope and it’s popped when exit it.
Implementations
impl StaticEnvironment
[src][−]
pub fn new() -> Self
[src][−]
Constructor
pub fn extend_static(&self)
[src][−]
Performs a push, doesn’t inherit previously declared variables in the new scope
Handles class/module scopes
pub fn extend_dynamic(&self)
[src][−]
Performs a puch, inherits previously declared variables in the new scope
Handles block/lambda scopes
pub fn unextend(&self)
[src][−]
Performs pop
pub fn declare(&self, name: &str)
[src][−]
Declares a new variable in the current scope
pub fn is_declared(&self, name: &str) -> bool
[src][−]
Returns true
if variable with a given name
is declared in the current scope
Trait Implementations
impl Clone for StaticEnvironment
[src][+]
impl Debug for StaticEnvironment
[src][+]
impl Default for StaticEnvironment
[src][+]
Auto Trait Implementations
impl !RefUnwindSafe for StaticEnvironment
impl !Send for StaticEnvironment
impl !Sync for StaticEnvironment
impl Unpin for StaticEnvironment
impl !UnwindSafe for StaticEnvironment
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src][+]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src][+]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src][+]
T: ?Sized,
impl<T> From<T> for T
[src][+]
impl<T, U> Into<U> for T where
U: From<T>,
[src][+]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src][+]
T: Clone,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src][+]
U: Into<T>,
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src][+]
U: TryFrom<T>,