MCPcopy Index your code
hub / github.com/docker/docker-agent / inspectConstructionNode

Function inspectConstructionNode

lint/constructor_purity.go:83–107  ·  view source on GitHub ↗
(root ast.Node, visit func(ast.Node))

Source from the content-addressed store, hash-verified

81}
82
83func inspectConstructionNode(root ast.Node, visit func(ast.Node)) {
84 ast.Inspect(root, func(n ast.Node) bool {
85 switch s := n.(type) {
86 case nil:
87 return true
88 case *ast.FuncLit:
89 return false
90 case *ast.GoStmt:
91 visit(s)
92 return false
93 case *ast.CallExpr:
94 visit(s)
95 if fl := calledFuncLit(s.Fun); fl != nil {
96 for _, arg := range s.Args {
97 inspectConstructionNode(arg, visit)
98 }
99 inspectConstructionNode(fl.Body, visit)
100 return false
101 }
102 default:
103 visit(s)
104 }
105 return true
106 })
107}
108
109func calledFuncLit(expr ast.Expr) *ast.FuncLit {
110 for {

Callers 1

inspectConstructionBodyFunction · 0.85

Calls 1

calledFuncLitFunction · 0.85

Tested by

no test coverage detected