mirror of
https://github.com/astral-sh/ruff.git
synced 2025-10-10 02:12:09 +00:00
Add a specialized StatementVisitor
(#4349)
This commit is contained in:
parent
6532455672
commit
fd34797d0f
18 changed files with 167 additions and 121 deletions
|
@ -1,9 +1,15 @@
|
|||
//! AST visitor trait and walk functions.
|
||||
|
||||
use rustpython_parser::ast::{
|
||||
Alias, Arg, Arguments, Boolop, Cmpop, Comprehension, Constant, Excepthandler,
|
||||
ExcepthandlerKind, Expr, ExprContext, ExprKind, Keyword, MatchCase, Operator, Pattern,
|
||||
PatternKind, Stmt, StmtKind, Unaryop, Withitem,
|
||||
};
|
||||
|
||||
/// A trait for AST visitors. Visits all nodes in the AST recursively.
|
||||
///
|
||||
/// Prefer [`crate::statement_visitor::StatementVisitor`] for visitors that only need to visit
|
||||
/// statements.
|
||||
pub trait Visitor<'a> {
|
||||
fn visit_stmt(&mut self, stmt: &'a Stmt) {
|
||||
walk_stmt(self, stmt);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue