(root ast.Node, visit func(ast.Node))
| 81 | } |
| 82 | |
| 83 | func 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 | |
| 109 | func calledFuncLit(expr ast.Expr) *ast.FuncLit { |
| 110 | for { |
no test coverage detected