From: Robert Griesemer Date: Fri, 3 Apr 2009 05:39:52 +0000 (-0700) Subject: - don't show methods of non-exported types X-Git-Tag: weekly.2009-11-06~1896 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=bfea141ca847e00119a2d897288996dc09289563;p=gostls13.git - don't show methods of non-exported types (even if the methods are exported) R=rsc OCL=27056 CL=27056 --- diff --git a/usr/gri/pretty/docprinter.go b/usr/gri/pretty/docprinter.go index a901bdee08..94fe501193 100644 --- a/usr/gri/pretty/docprinter.go +++ b/usr/gri/pretty/docprinter.go @@ -129,11 +129,14 @@ func (doc *PackageDoc) addFunc(fun *ast.FuncDecl) { var typ *typeDoc; if fun.Recv != nil { // method + // (all receiver types must be declared before they are used) typ = doc.lookupTypeDoc(fun.Recv.Type); if typ != nil { + // type found (i.e., exported) typ.methods[name] = fdoc; - return; } + // if the type wasn't found, it wasn't exported + } else { // perhaps a factory function // determine result type, if any @@ -148,11 +151,10 @@ func (doc *PackageDoc) addFunc(fun *ast.FuncDecl) { } } } + + // ordinary function + doc.funcs[name] = fdoc; } - // TODO other heuristics (e.g. name is "NewTypename"?) - - // ordinary function - doc.funcs[name] = fdoc; }