From 9ecd0493f945a154508a8fddb7136d7f3793348e Mon Sep 17 00:00:00 2001 From: "Iskander (Alex) Sharipov" Date: Tue, 28 Dec 2021 23:49:18 +0300 Subject: [PATCH] ruleguard: assign the current func decl (#328) --- ruleguard/ast_walker.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ruleguard/ast_walker.go b/ruleguard/ast_walker.go index c16f9436..2165dd74 100644 --- a/ruleguard/ast_walker.go +++ b/ruleguard/ast_walker.go @@ -303,10 +303,11 @@ func (w *astWalker) walk(n ast.Node) { } case *ast.FuncDecl: + prevFunc := w.filterParams.currentFunc + w.filterParams.currentFunc = n if n.Doc != nil { w.walk(n.Doc) } - prevFunc := w.filterParams.currentFunc if n.Recv != nil { w.walk(n.Recv) }