pub struct Scope(/* private fields */);
Implementations§
Source§impl Scope
impl Scope
pub fn new( symbol_generator: SymbolGenerator, parent: Option<Scope>, typ: ScopeType, ) -> Scope
pub fn data(&self) -> Ref<'_, ScopeData>
pub fn data_mut(&self) -> RefMut<'_, ScopeData>
pub fn create_child_scope(&self, typ: ScopeType) -> Scope
Sourcepub fn find_nearest_scope<F: Fn(ScopeType) -> bool>(
&self,
pred: F,
) -> Option<Scope>
pub fn find_nearest_scope<F: Fn(ScopeType) -> bool>( &self, pred: F, ) -> Option<Scope>
Returns the closest self-or-ancestor scope that matches the provided predicate. If no such match is found, None is returned.
Sourcepub fn find_furthest_scope<F: Fn(ScopeType) -> bool>(
&self,
pred: F,
) -> Option<Scope>
pub fn find_furthest_scope<F: Fn(ScopeType) -> bool>( &self, pred: F, ) -> Option<Scope>
Returns the most distant self-or-ancestor scope that matches the provided predicate. If no such match is found, None is returned.
Sourcepub fn find_symbol_up_to_with_scope(
&self,
identifier: Identifier,
scope_pred: impl Fn(ScopeType) -> bool,
) -> Option<(Scope, Symbol)>
pub fn find_symbol_up_to_with_scope( &self, identifier: Identifier, scope_pred: impl Fn(ScopeType) -> bool, ) -> Option<(Scope, Symbol)>
Returns the matching symbol and associated nearest scope that contains the provided identifier. Once a scope is reached that matches the provided predicate, the search stops after looking in that scope. If no such match is found, None is returned.
Sourcepub fn find_symbol_up_to<'b>(
&self,
identifier: Identifier,
scope_pred: impl Fn(ScopeType) -> bool,
) -> Option<Symbol>
pub fn find_symbol_up_to<'b>( &self, identifier: Identifier, scope_pred: impl Fn(ScopeType) -> bool, ) -> Option<Symbol>
Returns the matching symbol in the nearest scope for the provided identifier. Once a scope is reached that matches the provided predicate, the search stops after looking in that scope. If no such match is found, None is returned.
Sourcepub fn find_symbol_up_to_nearest_scope_of_type<'b>(
&self,
identifier: Identifier,
scope_type: ScopeType,
) -> Option<Symbol>
pub fn find_symbol_up_to_nearest_scope_of_type<'b>( &self, identifier: Identifier, scope_type: ScopeType, ) -> Option<Symbol>
Returns the matching symbol in the nearest scope for the provided identifier. Once a scope is reached that matches the provided type, the search stops after looking in that scope. If no such match is found, None is returned.
Sourcepub fn find_symbol(&self, identifier: Identifier) -> Option<Symbol>
pub fn find_symbol(&self, identifier: Identifier) -> Option<Symbol>
Returns the matching symbol in the nearest scope for the provided identifier. If no such match is found, None is returned.