aboutsummaryrefslogtreecommitdiffstats
path: root/capturedrefrace.go
diff options
context:
space:
mode:
Diffstat (limited to 'capturedrefrace.go')
-rw-r--r--capturedrefrace.go13
1 files changed, 13 insertions, 0 deletions
diff --git a/capturedrefrace.go b/capturedrefrace.go
index 54c5c04..3d7dd3a 100644
--- a/capturedrefrace.go
+++ b/capturedrefrace.go
@@ -144,6 +144,19 @@ func run(pass *analysis.Pass) (interface{}, error) {
return nil, nil
}
+func funcLitFromIdent(ident *ast.Ident) *ast.FuncLit {
+ assignStmt, ok := funcIdent.Obj.Decl.(*ast.AssignStmt)
+ if ok {
+ // TODO: Get assignStmt.Rhs[position of ident name in assignStmt.Lhs]
+ for _, expr := range assignStmt.Rhs {
+ fl, ok := expr.(*ast.FuncLit)
+ if ok {
+ fmt.Printf("funclit: %#v\n", fl)
+ }
+ }
+ }
+}
+
// checkClosure reports variables used in funcLit that are captured from an
// outer scope.
func checkClosure(pass *analysis.Pass, funcLit *ast.FuncLit) {