type methodSet … // recvString returns a string representation of recv of the form "T", "*T", // "T[A, ...]", "*T[A, ...]" or "BADRECV" (if not a proper receiver type). func recvString(recv ast.Expr) string { … } func recvParam(p ast.Expr) string { … } // set creates the corresponding Func for f and adds it to mset. // If there are multiple f's with the same name, set keeps the first // one with documentation; conflicts are ignored. The boolean // specifies whether to leave the AST untouched. func (mset methodSet) set(f *ast.FuncDecl, preserveAST bool) { … } // add adds method m to the method set; m is ignored if the method set // already contains a method with the same name at the same or a higher // level than m. func (mset methodSet) add(m *Func) { … } // baseTypeName returns the name of the base type of x (or "") // and whether the type is imported or not. func baseTypeName(x ast.Expr) (name string, imported bool) { … } type embeddedSet … type namedType … type reader … func (r *reader) isVisible(name string) bool { … } // lookupType returns the base type with the given name. // If the base type has not been encountered yet, a new // type with the given name but no associated declaration // is added to the type map. func (r *reader) lookupType(name string) *namedType { … } // recordAnonymousField registers fieldType as the type of an // anonymous field in the parent type. If the field is imported // (qualified name) or the parent is nil, the field is ignored. // The function returns the field name. func (r *reader) recordAnonymousField(parent *namedType, fieldType ast.Expr) (fname string) { … } func (r *reader) readDoc(comment *ast.CommentGroup) { … } func (r *reader) remember(predecl string, typ *ast.InterfaceType) { … } func specNames(specs []ast.Spec) []string { … } // readValue processes a const or var declaration. func (r *reader) readValue(decl *ast.GenDecl) { … } // fields returns a struct's fields or an interface's methods. func fields(typ ast.Expr) (list []*ast.Field, isStruct bool) { … } // readType processes a type declaration. func (r *reader) readType(decl *ast.GenDecl, spec *ast.TypeSpec) { … } // isPredeclared reports whether n denotes a predeclared type. func (r *reader) isPredeclared(n string) bool { … } // readFunc processes a func or method declaration. func (r *reader) readFunc(fun *ast.FuncDecl) { … } // lookupTypeParam searches for type parameters named name within the tparams // field list, returning the relevant identifier if found, or nil if not. func lookupTypeParam(name string, tparams *ast.FieldList) *ast.Ident { … } var noteMarker … var noteMarkerRx … var noteCommentRx … // clean replaces each sequence of space, \r, or \t characters // with a single space and removes any trailing and leading spaces. func clean(s string) string { … } // readNote collects a single note from a sequence of comments. func (r *reader) readNote(list []*ast.Comment) { … } // readNotes extracts notes from comments. // A note must start at the beginning of a comment with "MARKER(uid):" // and is followed by the note body (e.g., "// BUG(gri): fix this"). // The note ends at the end of the comment group or at the start of // another note in the same comment group, whichever comes first. func (r *reader) readNotes(comments []*ast.CommentGroup) { … } // readFile adds the AST for a source file to the reader. func (r *reader) readFile(src *ast.File) { … } func (r *reader) readPackage(pkg *ast.Package, mode Mode) { … } func customizeRecv(f *Func, recvTypeName string, embeddedIsPtr bool, level int) *Func { … } // collectEmbeddedMethods collects the embedded methods of typ in mset. func (r *reader) collectEmbeddedMethods(mset methodSet, typ *namedType, recvTypeName string, embeddedIsPtr bool, level int, visited embeddedSet) { … } // computeMethodSets determines the actual method sets for each type encountered. func (r *reader) computeMethodSets() { … } // cleanupTypes removes the association of functions and methods with // types that have no declaration. Instead, these functions and methods // are shown at the package level. It also removes types with missing // declarations or which are not visible. func (r *reader) cleanupTypes() { … } func sortedKeys(m map[string]int) []string { … } // sortingName returns the name to use when sorting d into place. func sortingName(d *ast.GenDecl) string { … } func sortedValues(m []*Value, tok token.Token) []*Value { … } func sortedTypes(m map[string]*namedType, allMethods bool) []*Type { … } func removeStar(s string) string { … } func sortedFuncs(m methodSet, allMethods bool) []*Func { … } // noteBodies returns a list of note body strings given a list of notes. // This is only used to populate the deprecated Package.Bugs field. func noteBodies(notes []*Note) []string { … } // IsPredeclared reports whether s is a predeclared identifier. func IsPredeclared(s string) bool { … } var predeclaredTypes … var predeclaredFuncs … var predeclaredConstants … // assumedPackageName returns the assumed package name // for a given import path. This is a copy of // golang.org/x/tools/internal/imports.ImportPathToAssumedName. func assumedPackageName(importPath string) string { … }