1
0
mirror of https://github.com/golang/go synced 2024-11-12 02:10:21 -07:00

- don't show methods of non-exported types

(even if the methods are exported)

R=rsc
OCL=27056
CL=27056
This commit is contained in:
Robert Griesemer 2009-04-02 22:39:52 -07:00
parent 184c623e6b
commit bfea141ca8

View File

@ -129,11 +129,14 @@ func (doc *PackageDoc) addFunc(fun *ast.FuncDecl) {
var typ *typeDoc; var typ *typeDoc;
if fun.Recv != nil { if fun.Recv != nil {
// method // method
// (all receiver types must be declared before they are used)
typ = doc.lookupTypeDoc(fun.Recv.Type); typ = doc.lookupTypeDoc(fun.Recv.Type);
if typ != nil { if typ != nil {
// type found (i.e., exported)
typ.methods[name] = fdoc; typ.methods[name] = fdoc;
return;
} }
// if the type wasn't found, it wasn't exported
} else { } else {
// perhaps a factory function // perhaps a factory function
// determine result type, if any // 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;
} }