pub struct PythonLexicalScopeInventory<'tree> { /* private fields */ }Expand description
Function-scope Python bindings discovered from tree-sitter structure.
The inventory models Python’s whole-function symbol-table behavior while
retaining the implicit scope of comprehension targets. Construction is
iterative and every inspected node is gated by scope_step; None means
the caller stopped discovery and must conservatively avoid module fallback.
Implementations§
Source§impl<'tree> PythonLexicalScopeInventory<'tree>
impl<'tree> PythonLexicalScopeInventory<'tree>
Sourcepub fn collect_bounded(
callable: Node<'tree>,
source: &str,
parameter_names: impl IntoIterator<Item = String>,
scope_step: impl FnMut() -> bool,
) -> Option<Self>
pub fn collect_bounded( callable: Node<'tree>, source: &str, parameter_names: impl IntoIterator<Item = String>, scope_step: impl FnMut() -> bool, ) -> Option<Self>
parameter_names is the callable’s formal-parameter name stream. The
layout it comes from is resolved by analyzer/lexical_definitions.rs,
which dispatches through the analysis-side language registry and so
cannot be named here; analyzer/python/lexical_scope.rs in
brokk-bifrost-analysis is the one caller that computes it, under the
same scope_step meter this walk uses.
pub fn name_resolution_at( &self, name: &str, reference: Node<'_>, ) -> PythonLexicalNameResolution
pub fn resolves_to_local_function( &self, name: &str, reference: Node<'_>, ) -> bool
pub fn local_function_declaration( &self, name: &str, reference: Node<'_>, ) -> Option<Node<'tree>>
pub fn local_bindings(&self) -> impl Iterator<Item = (&str, Node<'tree>)> + '_
Auto Trait Implementations§
impl<'tree> Freeze for PythonLexicalScopeInventory<'tree>
impl<'tree> RefUnwindSafe for PythonLexicalScopeInventory<'tree>
impl<'tree> Send for PythonLexicalScopeInventory<'tree>
impl<'tree> Sync for PythonLexicalScopeInventory<'tree>
impl<'tree> Unpin for PythonLexicalScopeInventory<'tree>
impl<'tree> UnsafeUnpin for PythonLexicalScopeInventory<'tree>
impl<'tree> UnwindSafe for PythonLexicalScopeInventory<'tree>
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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