Skip to main content

Module visitor

Module visitor 

Source
Expand description

AST Visitor trait and walk functions for Shape.

This module provides a visitor pattern for traversing the AST. All variants are explicitly handled - no wildcards.

§Per-Variant Expression Methods

The Visitor trait provides fine-grained per-variant methods for expressions. Each method has a default implementation that returns true (continue into children). Override only the variants you care about.

The visit order for each expression is:

  1. visit_expr(expr) — coarse pre-visit hook; return false to skip entirely
  2. visit_<variant>(expr, span) — per-variant hook; return false to skip children
  3. Walk children recursively
  4. leave_expr(expr) — post-visit hook

Traits§

Visitor
A visitor trait for traversing Shape AST nodes.

Functions§

walk_expr
Walk an expression - ALL VARIANTS HANDLED EXPLICITLY
walk_function
Walk a function definition
walk_item
Walk an item
walk_program
Walk a program, visiting all items
walk_query
Walk a query
walk_stmt
Walk a statement