xrefs

package
v0.0.0-...-1255efc Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 18, 2026 License: BSD-3-Clause Imports: 11 Imported by: 0

Documentation

Overview

Package xrefs defines the serializable index of cross-package references that is computed during type checking.

See ../references.go for the 'references' query.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Index

type Index struct {
	// contains filtered or unexported fields
}

An Index is an index of outbound symbol references for one specific package.

func Decode added in v0.22.0

func Decode(data []byte) *Index

Decode decodes a serialized cross-reference index. It is suitable for use as a filecache.Get decoder.

func NewIndex added in v0.22.0

func NewIndex(enc *objectpath.Encoder, pkg *types.Package, info *types.Info, files []*parsego.File, asmFiles []*asm.File) *Index

NewIndex constructs an index of outbound cross-references for the specified type-checked package.

Callers indexing many packages should share one objectpath Encoder so that a heavily referenced package's object paths are encoded once rather than once per referencing package.

func (*Index) Encode added in v0.22.0

func (idx *Index) Encode() []byte

Encode encodes the index for storage.

func (*Index) Lookup added in v0.22.0

func (idx *Index) Lookup(mp *metadata.Package, targets map[metadata.PackagePath]map[objectpath.Path]struct{}) (locs []protocol.Location)

Lookup searches the index for references to any object in the target set, returning their locations within the package described by mp. Each target object is denoted by a pair of (package path, object path).

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL