github.com/shogo82148/std@v1.22.1-0.20240327122250-4e474527810c/cmd/compile/internal/types/pkg.go (about) 1 // Copyright 2017 The Go Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style 3 // license that can be found in the LICENSE file. 4 5 package types 6 7 import ( 8 "github.com/shogo82148/std/cmd/internal/obj" 9 ) 10 11 type Pkg struct { 12 Path string 13 Name string 14 Prefix string 15 Syms map[string]*Sym 16 Pathsym *obj.LSym 17 18 Direct bool 19 } 20 21 // NewPkg returns a new Pkg for the given package path and name. 22 // Unless name is the empty string, if the package exists already, 23 // the existing package name and the provided name must match. 24 func NewPkg(path, name string) *Pkg 25 26 func PkgMap() map[string]*Pkg 27 28 func (pkg *Pkg) Lookup(name string) *Sym 29 30 // LookupOK looks up name in pkg and reports whether it previously existed. 31 func (pkg *Pkg) LookupOK(name string) (s *Sym, existed bool) 32 33 func (pkg *Pkg) LookupBytes(name []byte) *Sym 34 35 // LookupNum looks up the symbol starting with prefix and ending with 36 // the decimal n. If prefix is too long, LookupNum panics. 37 func (pkg *Pkg) LookupNum(prefix string, n int) *Sym 38 39 // Selector looks up a selector identifier. 40 func (pkg *Pkg) Selector(name string) *Sym 41 42 func InternString(b []byte) string