pub enum Scope {
LambdaPattern(Pattern, SyntaxNode<NixLanguage>),
LambdaArg(Ident, SyntaxNode<NixLanguage>),
LetIn(LetIn),
RecAttrSet(AttrSet),
}
Expand description
AST subtree that declares variables
Variants§
LambdaPattern(Pattern, SyntaxNode<NixLanguage>)
{ ... }: ...
LambdaArg(Ident, SyntaxNode<NixLanguage>)
...: ...
LetIn(LetIn)
let ... in ...
RecAttrSet(AttrSet)
rec { ... }
Implementations§
source§impl Scope
impl Scope
sourcepub fn new(node: &SyntaxNode<NixLanguage>) -> Option<Self>
pub fn new(node: &SyntaxNode<NixLanguage>) -> Option<Self>
Construct a new Scope if this is an AST node that opens a new scope
sourcepub fn is_lambda_arg(&self) -> bool
pub fn is_lambda_arg(&self) -> bool
Is this a ...: ...
which can be ignored in
Settings
sourcepub fn is_lambda_pattern_name(&self, name: &Ident) -> bool
pub fn is_lambda_pattern_name(&self, name: &Ident) -> bool
Is this a { ... }: ...
which can be ignored in
Settings
sourcepub fn bodies(&self) -> Box<dyn Iterator<Item = SyntaxNode<NixLanguage>>>
pub fn bodies(&self) -> Box<dyn Iterator<Item = SyntaxNode<NixLanguage>>>
The code subtrees in which the introduced variables are available
sourcepub fn inherits_from(&self, name: &Ident) -> bool
pub fn inherits_from(&self, name: &Ident) -> bool
Check the inherit (var) ...
and inherit vars
clauses for a
given name
.
Although a scope may shadow existing variable bindings, it can
inherit
bindings from the outer scope.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for Scope
impl !Send for Scope
impl !Sync for Scope
impl Unpin for Scope
impl !UnwindSafe for Scope
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