// Implementation returns a new sorted array of locations of // declarations of types that implement (or are implemented by) the // type referred to at the given position. // // If the position denotes a method, the computation is applied to its // receiver type and then its corresponding methods are returned. func Implementation(ctx context.Context, snapshot *cache.Snapshot, f file.Handle, pp protocol.Position) ([]protocol.Location, error) { … } func implementations(ctx context.Context, snapshot *cache.Snapshot, fh file.Handle, pp protocol.Position) ([]protocol.Location, error) { … } // offsetToLocation converts an offset-based position to a protocol.Location, // which requires reading the file. func offsetToLocation(ctx context.Context, snapshot *cache.Snapshot, filename string, start, end int) (protocol.Location, error) { … } // implementsObj returns the object to query for implementations, which is a // type name or method. // // The returned Package is the narrowest package containing ppos, which is the // package using the resulting obj but not necessarily the declaring package. func implementsObj(ctx context.Context, snapshot *cache.Snapshot, uri protocol.DocumentURI, ppos protocol.Position) (types.Object, *cache.Package, error) { … } // localImplementations searches within pkg for declarations of all // types that are assignable to/from the query type, and returns a new // unordered array of their locations. // // If methodID is non-empty, the function instead returns the location // of each type's method (if any) of that ID. // // ("Local" refers to the search within the same package, but this // function's results may include type declarations that are local to // a function body. The global search index excludes such types // because reliably naming such types is hard.) func localImplementations(ctx context.Context, snapshot *cache.Snapshot, pkg *cache.Package, queryType types.Type, methodID string) ([]protocol.Location, error) { … } var errorInterfaceType … // errorLocation returns the location of the 'error' type in builtin.go. func errorLocation(ctx context.Context, snapshot *cache.Snapshot) (protocol.Location, error) { … } // concreteImplementsIntf returns true if a is an interface type implemented by // concrete type b, or vice versa. func concreteImplementsIntf(a, b types.Type) bool { … } var errNoObjectFound … // pathEnclosingObjNode returns the AST path to the object-defining // node associated with pos. "Object-defining" means either an // *ast.Ident mapped directly to a types.Object or an ast.Node mapped // implicitly to a types.Object. func pathEnclosingObjNode(f *ast.File, pos token.Pos) []ast.Node { … }