MCPcopy Index your code
hub / github.com/uber/aresdb / Walk

Function Walk

query/expr/ast.go:531–566  ·  view source on GitHub ↗

Walk traverses an expression hierarchy in depth-first order.

(v Visitor, expr Expr)

Source from the content-addressed store, hash-verified

529
530// Walk traverses an expression hierarchy in depth-first order.
531func Walk(v Visitor, expr Expr) {
532 if expr == nil {
533 return
534 }
535
536 if v = v.Visit(expr); v == nil {
537 return
538 }
539
540 switch e := expr.(type) {
541 case *UnaryExpr:
542 Walk(v, e.Expr)
543
544 case *BinaryExpr:
545 Walk(v, e.LHS)
546 Walk(v, e.RHS)
547
548 case *Case:
549 for _, cond := range e.WhenThens {
550 Walk(v, cond.When)
551 Walk(v, cond.Then)
552 }
553 if e.Else != nil {
554 Walk(v, e.Else)
555 }
556
557 case *Call:
558 for _, expr := range e.Args {
559 Walk(v, expr)
560 }
561
562 case *ParenExpr:
563 Walk(v, e.Expr)
564
565 }
566}
567
568// WalkFunc traverses an expression hierarchy in depth-first order.
569func WalkFunc(e Expr, fn func(Expr)) {

Callers 6

matchGeoJoinMethod · 0.92
matchEqualJoinMethod · 0.92
processFiltersMethod · 0.92
processDimensionsMethod · 0.92
WalkFuncFunction · 0.85

Calls 1

VisitMethod · 0.65

Tested by

no test coverage detected