Skip to content

Commit

Permalink
Use a visitor
Browse files Browse the repository at this point in the history
  • Loading branch information
charliermarsh committed Nov 13, 2023
1 parent 3654986 commit 1b75ee9
Show file tree
Hide file tree
Showing 5 changed files with 828 additions and 1,551 deletions.
5 changes: 4 additions & 1 deletion crates/ruff_python_ast/src/visitor.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
//! AST visitor trait and walk functions.

pub mod preorder;
pub mod transformer;

use crate::{
self as ast, Alias, Arguments, BoolOp, CmpOp, Comprehension, Decorator, ElifElseClause,
Expand All @@ -14,8 +15,10 @@ use crate::{
/// Prefer [`crate::statement_visitor::StatementVisitor`] for visitors that only need to visit
/// statements.
///
/// Use the [`PreorderVisitor`](self::preorder::PreorderVisitor) if you want to visit the nodes
/// Use the [`PreorderVisitor`](preorder::PreorderVisitor) if you want to visit the nodes
/// in pre-order rather than evaluation order.
///
/// Use the [`Transformer`](transformer::Transformer) if you want to modify the nodes.
pub trait Visitor<'a> {
fn visit_stmt(&mut self, stmt: &'a Stmt) {
walk_stmt(self, stmt);
Expand Down
Loading

0 comments on commit 1b75ee9

Please sign in to comment.