frontcache

package
v1.0.10 Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2026 License: Apache-2.0 Imports: 8 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package frontcache describes the frontend information needed from an already compiled dependency, independently of its instruction bodies.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FunctionID

func FunctionID(fn *ssa.Function, typs *Types) string

func ImportPackage

func ImportPackage(data *PackageExport, importer *TypeImporter) (*types.Package, error)

ImportPackage populates an empty package using this invocation's dependency identities. Callers publish it only after the complete graph validates.

func Owner

func Owner(fn *ssa.Function) *types.Package

func Position

func Position(fset *token.FileSet, pos token.Pos) string

Position is stable across independent token.FileSets.

Types

type Object

type Object struct {
	Name, Package, Position string
	Type                    int
	Embedded                bool   `json:",omitempty"`
	Tag                     []byte `json:",omitempty"`
}

Object preserves package identity for private fields/methods as well as names. Type refers to a TypeGraph node; -1 is the only absent-type representation.

type PackageExport

type PackageExport struct {
	ID, Path, Name string
	Types          TypeGraph
	Objects        []PackageObject
}

func ExportPackage

func ExportPackage(pkg *types.Package, index *Types, fset *token.FileSet) *PackageExport

ExportPackage includes private declarations: code generation and layout metadata need more than the public API accepted by a source importer.

type PackageObject

type PackageObject struct {
	Object
	Kind             string
	Value, Imaginary string
}

type TypeGraph

type TypeGraph struct {
	Nodes []TypeNode
	// contains filtered or unexported fields
}

TypeGraph transports private and compiler-generated runtime types that are not necessarily reachable from gc's public export data. Cycles use node IDs; neither Go pointers nor LLVM-owned values cross a process boundary.

func NewTypeGraph

func NewTypeGraph(typs *Types, fset *token.FileSet) *TypeGraph

func (*TypeGraph) Add

func (g *TypeGraph) Add(typ types.Type) int

type TypeImporter

type TypeImporter struct {
	Graph    *TypeGraph
	Packages map[string]*types.Package
	Existing *Types
	Position func(string) token.Pos
	// contains filtered or unexported fields
}

func (*TypeImporter) Import

func (p *TypeImporter) Import(id int) (typ types.Type, err error)

type TypeNode

type TypeNode struct {
	Kind                          string
	Key                           string
	Object                        Object
	Elem, Base                    int
	Basic, Direction              int
	Length                        int64
	Variadic                      bool
	Implicit                      bool
	Universe                      bool
	Types, Params, Results        []int    `json:",omitempty"`
	TypeParams, RecvParams        []int    `json:",omitempty"`
	Receiver                      *Object  `json:",omitempty"`
	Parameters, Returns, Elements []Object `json:",omitempty"`
	Fields, Methods               []Object `json:",omitempty"`
	Tilde                         []bool   `json:",omitempty"`
}

type Types

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

Types binds exported type identities to this invocation's checked types. Package IDs, rather than import paths, distinguish test and alternate packages. Ambiguous identities fail closed instead of selecting a type.

func NewTypes

func NewTypes(packages map[*types.Package]string, sets ...*token.FileSet) *Types

func (*Types) Add

func (t *Types) Add(typ types.Type)

Add records all constituent types, including the receiver-free method-value signatures and pointer types that SSA may synthesize from declarations.

func (*Types) AddPackage

func (t *Types) AddPackage(pkg *types.Package, info *types.Info)

func (*Types) Bind

func (t *Types) Bind(key string, typ types.Type) bool

Bind retains the exported identity of a private type imported without its original lexical scope. Package fingerprints validate its defining source.

func (*Types) Key

func (t *Types) Key(typ types.Type) string

Key deliberately ignores parameter names and signature receivers, just as Go function-type identity does. Method receivers are exported separately. Named bodies are validated by the owning package's input fingerprint.

func (*Types) Lookup

func (t *Types) Lookup(key string) (types.Type, bool)

func (*Types) PackageID

func (t *Types) PackageID(pkg *types.Package) string

Jump to

Keyboard shortcuts

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