From 3e4669995888bcea2d45e847ec896742d4532b6c Mon Sep 17 00:00:00 2001 From: Robert Griesemer Date: Thu, 6 Oct 2011 16:07:56 -0700 Subject: [PATCH] go/ast: don't remove function bodies when filtering exports This is a semantic but no API change. It is a cleaner implementation of pure filtering. Applications that need function bodies stripped can easily do this them- selves. R=rsc CC=golang-dev https://golang.org/cl/5206046 --- src/pkg/go/ast/filter.go | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/pkg/go/ast/filter.go b/src/pkg/go/ast/filter.go index 1bd8990f835..d7d4b4b6b6d 100644 --- a/src/pkg/go/ast/filter.go +++ b/src/pkg/go/ast/filter.go @@ -18,8 +18,7 @@ func exportFilter(name string) bool { // only exported nodes remain: all top-level identifiers which are not exported // and their associated information (such as type, initial value, or function // body) are removed. Non-exported fields and methods of exported types are -// stripped, and the function bodies of exported functions are set to nil. -// The File.Comments list is not changed. +// stripped. The File.Comments list is not changed. // // FileExports returns true if there are exported declarationa; // it returns false otherwise. @@ -206,9 +205,6 @@ func FilterDecl(decl Decl, f Filter) bool { d.Specs = filterSpecList(d.Specs, f) return len(d.Specs) > 0 case *FuncDecl: - if f == exportFilter { - d.Body = nil // strip body - } return f(d.Name.Name) } return false