gcimporter

Imports

Imports #

"go/token"
"go/types"
"internal/godebug"
"internal/pkgbits"
"slices"
"strings"
"bufio"
"fmt"
"go/token"
"go/types"
"internal/exportdata"
"internal/pkgbits"
"io"
"os"
"fmt"
"go/token"
"internal/pkgbits"
"sync"

Constants & Variables

fakeLines var #

var fakeLines []int

fakeLinesOnce var #

var fakeLinesOnce sync.Once

maxlines const #

const maxlines = *ast.BinaryExpr

Structs

derivedInfo struct #

See cmd/compile/internal/noder.derivedInfo.

type derivedInfo struct {
idx pkgbits.Index
needed bool
}

fakeFileSet struct #

Synthesize a token.Pos

type fakeFileSet struct {
fset *token.FileSet
files map[string]*fileInfo
}

fileInfo struct #

type fileInfo struct {
file *token.File
lastline int
}

pkgReader struct #

A pkgReader holds the shared state for reading a unified IR package description.

type pkgReader struct {
pkgbits.PkgDecoder
fake fakeFileSet
ctxt *types.Context
imports map[string]*types.Package
posBases []string
pkgs []*types.Package
typs []types.Type
laterFns []func()
ifaces []*types.Interface
}

reader struct #

A reader holds the state for reading a single unified IR element within a package.

type reader struct {
pkgbits.Decoder
p *pkgReader
dict *readerDict
}

readerDict struct #

A readerDict holds the state for type parameters that parameterize the current unified IR element.

type readerDict struct {
bounds []typeInfo
tparams []*types.TypeParam
derived []derivedInfo
derivedTypes []types.Type
}

typeInfo struct #

See cmd/compile/internal/noder.typeInfo.

type typeInfo struct {
idx pkgbits.Index
derived bool
}

Functions

Import function #

Import imports a gc-generated package given its import path and srcDir, adds the corresponding package object to the packages map, and returns the object. The packages map must contain all packages already imported.

func Import(fset *token.FileSet, packages map[string]*types.Package, path string, srcDir string, lookup func(path string) (io.ReadCloser, error)) (pkg *types.Package, err error)

assert function #

func assert(b bool)

doPkg method #

func (r *reader) doPkg() *types.Package

doTyp method #

func (r *reader) doTyp() (res types.Type)

errorf function #

func errorf(format string, args ...any)

ident method #

func (r *reader) ident(marker pkgbits.SyncMarker) (*types.Package, string)

interfaceType method #

func (r *reader) interfaceType() *types.Interface

later method #

later adds a function to be invoked at the end of import reading.

func (pr *pkgReader) later(fn func())

localIdent method #

func (r *reader) localIdent() (*types.Package, string)

method method #

func (r *reader) method() *types.Func

newAliasTypeName function #

newAliasTypeName returns a new TypeName, with a materialized *types.Alias if supported.

func newAliasTypeName(pos token.Pos, pkg *types.Package, name string, rhs types.Type, tparams []*types.TypeParam) *types.TypeName

newReader method #

func (pr *pkgReader) newReader(k pkgbits.RelocKind, idx pkgbits.Index, marker pkgbits.SyncMarker) *reader

obj method #

func (r *reader) obj() (types.Object, []types.Type)

objDictIdx method #

func (pr *pkgReader) objDictIdx(idx pkgbits.Index) *readerDict

objIdx method #

func (pr *pkgReader) objIdx(idx pkgbits.Index) (*types.Package, string)

param method #

func (r *reader) param() *types.Var

params method #

func (r *reader) params() *types.Tuple

pkg method #

func (r *reader) pkg() *types.Package

pkgIdx method #

func (pr *pkgReader) pkgIdx(idx pkgbits.Index) *types.Package

pkgScope function #

pkgScope returns pkg.Scope(). If pkg is nil, it returns types.Universe instead. TODO(mdempsky): Remove after x/tools can depend on Go 1.19.

func pkgScope(pkg *types.Package) *types.Scope

pos method #

func (s *fakeFileSet) pos(file string, line int, column int) token.Pos

pos method #

func (r *reader) pos() token.Pos

posBase method #

func (r *reader) posBase() string

posBaseIdx method #

func (pr *pkgReader) posBaseIdx(idx pkgbits.Index) string

qualifiedIdent method #

func (r *reader) qualifiedIdent() (*types.Package, string)

readUnifiedPackage function #

readUnifiedPackage reads a package description from the given unified IR export data decoder.

func readUnifiedPackage(fset *token.FileSet, ctxt *types.Context, imports map[string]*types.Package, input pkgbits.PkgDecoder) *types.Package

retireReader method #

func (pr *pkgReader) retireReader(r *reader)

selector method #

func (r *reader) selector() (*types.Package, string)

setLines method #

func (s *fakeFileSet) setLines()

signature method #

func (r *reader) signature(recv *types.Var, rtparams []*types.TypeParam, tparams []*types.TypeParam) *types.Signature

splitVargenSuffix function #

See cmd/compile/internal/types.SplitVargenSuffix.

func splitVargenSuffix(name string) (base string, suffix string)

structType method #

func (r *reader) structType() *types.Struct

tempReader method #

func (pr *pkgReader) tempReader(k pkgbits.RelocKind, idx pkgbits.Index, marker pkgbits.SyncMarker) *reader

typ method #

func (r *reader) typ() types.Type

typIdx method #

func (pr *pkgReader) typIdx(info typeInfo, dict *readerDict) types.Type

typInfo method #

func (r *reader) typInfo() typeInfo

typeParamNames method #

func (r *reader) typeParamNames() []*types.TypeParam

unionType method #

func (r *reader) unionType() *types.Union

Generated with Arrow