Skip to content

Commit 248b94e

Browse files
committed
go/ast/inspector: treat empty type filter like nil
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]>
1 parent 6016188 commit 248b94e

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

go/ast/inspector/typeof.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ func typeOf(n ast.Node) uint64 {
219219

220220
//go:linkname maskOf
221221
func maskOf(nodes []ast.Node) uint64 {
222-
if nodes == nil {
222+
if len(nodes) == 0 {
223223
return math.MaxUint64 // match all node types
224224
}
225225
var mask uint64

0 commit comments

Comments
 (0)