MCPcopy Create free account
hub / github.com/ajitpratap0/GoSQLX / Walk

Function Walk

pkg/sql/ast/visitor.go:161–183  ·  view source on GitHub ↗

Walk traverses an AST in depth-first order using the visitor pattern. Walk performs a depth-first traversal of the Abstract Syntax Tree starting from the given node. It uses the Visitor interface to allow custom processing at each node. Traversal Algorithm: 1. Call v.Visit(node) for the current no

(v Visitor, node Node)

Source from the content-addressed store, hash-verified

159//
160// See also: Inspect(), Visitor, Inspector
161func Walk(v Visitor, node Node) error {
162 if node == nil {
163 return nil
164 }
165
166 visitor, err := v.Visit(node)
167 if err != nil {
168 return err
169 }
170
171 if visitor == nil {
172 return nil
173 }
174
175 for _, child := range node.Children() {
176 if err := Walk(visitor, child); err != nil {
177 return err
178 }
179 }
180
181 _, err = visitor.Visit(nil)
182 return err
183}
184
185// Inspector represents a function-based AST visitor for simplified traversal.
186//

Callers 14

CheckMethod · 0.92
VisitMethod · 0.92
CheckMethod · 0.92
VisitMethod · 0.92
CheckMethod · 0.92
CheckMethod · 0.92
CheckMethod · 0.92
CheckMethod · 0.92
PgILikeToLowerFunction · 0.92
NormalizeFunction · 0.92
AnalyzeMethod · 0.92
InspectFunction · 0.85

Calls 2

VisitMethod · 0.65
ChildrenMethod · 0.65

Tested by 2

TestVisitorFunction · 0.68
TestVisitFuncFunction · 0.68