MCPcopy Create free account
hub / github.com/bracesdev/errtrace / Visit

Method Visit

cmd/errtrace/main.go:707–733  ·  view source on GitHub ↗
(n ast.Node)

Source from the content-addressed store, hash-verified

705}
706
707func (t *walker) Visit(n ast.Node) ast.Visitor {
708 switch n := n.(type) {
709 case *ast.FuncDecl:
710 return t.funcType(n, n.Type)
711
712 case *ast.BlockStmt:
713 newT := *t
714 newT.alreadyWrapped = make(map[*ast.Object]struct{})
715 return &newT
716
717 case *ast.AssignStmt:
718 t.assignStmt(n)
719
720 case *ast.DeferStmt:
721 // This is a bit inefficient;
722 // we'll recurse into the DeferStmt's function literal (if any) twice.
723 t.deferStmt(n)
724
725 case *ast.FuncLit:
726 return t.funcType(n, n.Type)
727
728 case *ast.ReturnStmt:
729 return t.returnStmt(n)
730 }
731
732 return t
733}
734
735func (t *walker) funcType(parent ast.Node, ft *ast.FuncType) ast.Visitor {
736 // Clear state in case we're recursing into a function literal

Callers

nothing calls this directly

Calls 4

funcTypeMethod · 0.95
assignStmtMethod · 0.95
deferStmtMethod · 0.95
returnStmtMethod · 0.95

Tested by

no test coverage detected