From bb1668e72df3bccc7d82754bee717403b8900d07 Mon Sep 17 00:00:00 2001 From: Emad Elsaid Date: Sat, 14 Jan 2023 19:14:25 +0100 Subject: [PATCH] findallInAST bug --- renderer.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/renderer.go b/renderer.go index f890aca7..5f0a6e22 100644 --- a/renderer.go +++ b/renderer.go @@ -56,6 +56,10 @@ func FindInAST[t ast.Node](n ast.Node) (found t, ok bool) { // Extract all nodes of a specific type from the AST func FindAllInAST[t ast.Node](n ast.Node) (a []t) { ast.Walk(n, func(n ast.Node, entering bool) (ast.WalkStatus, error) { + if !entering { + return ast.WalkContinue, nil + } + if casted, ok := n.(t); ok { a = append(a, casted) }