Inspect traverses an AST in depth-first order using a simple function. Inspect is a convenience wrapper around Walk that allows AST traversal using a simple function instead of implementing the full Visitor interface. It's ideal for one-off traversals and simple node inspection tasks. Traversal Be
(node Node, f func(Node) bool)
| 308 | // |
| 309 | // See also: Walk(), Inspector, Visitor |
| 310 | func Inspect(node Node, f func(Node) bool) { |
| 311 | _ = Walk(Inspector(f), node) |
| 312 | } |
| 313 | |
| 314 | // VisitFunc is a function type that can be used to implement custom visitors |
| 315 | // without creating a new type. |