pub struct AstWalker<'a> { /* private fields */ }Expand description
Walks the AST while tracking scope context via node_to_scope.
Implementations§
Source§impl<'a> AstWalker<'a>
impl<'a> AstWalker<'a>
pub fn new(scope_info: &'a ScopeInfo) -> Self
Sourcepub fn with_initial_scope(
scope_info: &'a ScopeInfo,
initial_scope: ScopeId,
) -> Self
pub fn with_initial_scope( scope_info: &'a ScopeInfo, initial_scope: ScopeId, ) -> Self
Create a walker with an initial scope already on the stack.
pub fn scope_stack(&self) -> &[ScopeId]
Sourcepub fn loop_expression_depth(&self) -> usize
pub fn loop_expression_depth(&self) -> usize
Returns the current loop-expression depth. Non-zero when the walker is inside a loop’s test/right expression (while.test, do-while.test, for-in.right, for-of.right). Visitors can use this to implement Babel-compatible scope checks in ‘all’ compilation mode.
pub fn walk_program<'ast>( &mut self, v: &mut impl Visitor<'ast>, node: &'ast Program, )
pub fn walk_block_statement<'ast>( &mut self, v: &mut impl Visitor<'ast>, node: &'ast BlockStatement, )
pub fn walk_statement<'ast>( &mut self, v: &mut impl Visitor<'ast>, stmt: &'ast Statement, )
pub fn walk_expression<'ast>( &mut self, v: &mut impl Visitor<'ast>, expr: &'ast Expression, )
pub fn walk_pattern<'ast>( &mut self, v: &mut impl Visitor<'ast>, pat: &'ast PatternLike, )
Auto Trait Implementations§
impl<'a> Freeze for AstWalker<'a>
impl<'a> RefUnwindSafe for AstWalker<'a>
impl<'a> Send for AstWalker<'a>
impl<'a> Sync for AstWalker<'a>
impl<'a> Unpin for AstWalker<'a>
impl<'a> UnsafeUnpin for AstWalker<'a>
impl<'a> UnwindSafe for AstWalker<'a>
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