Skip to content

Commit

Permalink
Merge pull request #1624 from visualfc/ast_walk
Browse files Browse the repository at this point in the history
ast: fix Walk ast.File if NoPkgDecl
  • Loading branch information
xushiwei committed Jan 12, 2024
2 parents ec13c98 + 5e8f234 commit a9dd7e4
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion ast/walk.go
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,9 @@ func Walk(v Visitor, node Node) {
if n.Doc != nil {
Walk(v, n.Doc)
}
Walk(v, n.Name)
if !n.NoPkgDecl {
Walk(v, n.Name)
}
walkDeclList(v, n.Decls)
// don't walk n.Comments - they have been
// visited already through the individual
Expand Down

0 comments on commit a9dd7e4

Please sign in to comment.