Skip to content

Commit

Permalink
go/ast/inspector: treat empty type filter like nil
Browse files Browse the repository at this point in the history
The documentation for type filtering speaks only of the
length of the slice, but the logic checks for nil.
Fix the logic to match the documentation.

(This is an observable change but there is never any
reason to pass []ast.Node{}... as a type filter.)

Change-Id: Ifa8f72c0c2ff5a4c0fc2ee39e65641503a93c471
Reviewed-on: https://go-review.googlesource.com/c/tools/+/641436
LUCI-TryBot-Result: Go LUCI <[email protected]>
Reviewed-by: Robert Findley <[email protected]>
Auto-Submit: Alan Donovan <[email protected]>
  • Loading branch information
adonovan committed Jan 8, 2025
1 parent 6016188 commit 248b94e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion go/ast/inspector/typeof.go
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ func typeOf(n ast.Node) uint64 {

//go:linkname maskOf
func maskOf(nodes []ast.Node) uint64 {
if nodes == nil {
if len(nodes) == 0 {
return math.MaxUint64 // match all node types
}
var mask uint64
Expand Down

0 comments on commit 248b94e

Please sign in to comment.