Functions
AlgType
function
#
AlgType returns the AlgKind used for comparing and hashing Type t.
func AlgType(t *Type) AlgKind
Alignment
method
#
func (t *Type) Alignment() int64
AllMethods
method
#
AllMethods returns a pointer to all the methods (including embedding) for type t.
For an interface type, this is the set of methods that are typically iterated
over. For non-interface types, AllMethods() only returns a valid result after
CalcMethods() has been called at least once.
func (t *Type) AllMethods() []*Field
AllowsGoVersion
function
#
AllowsGoVersion reports whether local package is allowed
to use Go version major.minor.
func AllowsGoVersion(major int, minor int) bool
ArgWidth
method
#
ArgWidth returns the total aligned argument size for a function.
It includes the receiver, parameters, and results.
func (t *Type) ArgWidth() int64
Asm
method
#
func (sym *Sym) Asm() bool
CalcSize
function
#
CalcSize calculates and stores the size, alignment, eq/hash algorithm,
and ptrBytes for t.
If CalcSizeDisabled is set, and the size/alignment
have not already been calculated, it calls Fatal.
This is used to prevent data races in the back end.
func CalcSize(t *Type)
CalcStructSize
function
#
CalcStructSize calculates the size of t,
filling in t.width, t.align, t.intRegs, and t.floatRegs,
even if size calculation is otherwise disabled.
func CalcStructSize(t *Type)
CanBeAnSSAAux
method
#
func (*Type) CanBeAnSSAAux()
CanRecv
method
#
func (c ChanDir) CanRecv() bool
CanSend
method
#
func (c ChanDir) CanSend() bool
ChanArgs
method
#
ChanArgs returns the channel type for TCHANARGS type t.
func (t *Type) ChanArgs() *Type
ChanDir
method
#
ChanDir returns the direction of a channel type t.
The direction will be one of Crecv, Csend, or Cboth.
func (t *Type) ChanDir() ChanDir
CheckSize
function
#
func CheckSize(t *Type)
Compare
method
#
Compare compares types for purposes of the SSA back
end, returning a Cmp (one of CMPlt, CMPeq, CMPgt).
The answers are correct for an optimizer
or code generator, but not necessarily typechecking.
The order chosen is arbitrary, only consistency and division
into equivalence classes (Types that compare CMPeq) matters.
func (t *Type) Compare(x *Type) Cmp
CompareFields
function
#
CompareFields compares two Field values by name.
func CompareFields(a *Field, b *Field) int
CompareSyms
function
#
CompareSyms return the ordering of a and b, as for [cmp.Compare].
Symbols are ordered exported before non-exported, then by name, and
finally (for non-exported symbols) by package path.
func CompareSyms(a *Sym, b *Sym) int
ComplexForFloat
function
#
func ComplexForFloat(t *Type) *Type
Copy
method
#
func (f *Field) Copy() *Field
DeferCheckSize
function
#
func DeferCheckSize()
Deferwidth
method
#
func (t *Type) Deferwidth() bool
Elem
method
#
Elem returns the type of elements of t.
Usable with pointers, channels, arrays, slices, and maps.
func (t *Type) Elem() *Type
End
method
#
End returns the offset of the first byte immediately after this field.
func (f *Field) End() int64
FakeRecv
function
#
func FakeRecv() *Field
FakeRecvType
function
#
FakeRecvType returns the singleton type used for interface method receivers.
func FakeRecvType() *Type
Field
method
#
Field returns the i'th field of struct type t.
func (t *Type) Field(i int) *Field
FieldName
method
#
func (t *Type) FieldName(i int) string
FieldOff
method
#
func (t *Type) FieldOff(i int) int64
FieldType
method
#
func (t *Type) FieldType(i int) *Type
Fields
method
#
Fields returns a slice of containing all fields of
a struct type t.
func (t *Type) Fields() []*Field
FloatForComplex
function
#
func FloatForComplex(t *Type) *Type
Format
method
#
Format implements formatting for a Type.
The valid formats are:
%v Go syntax
%+v Debug syntax: Go syntax with a KIND- prefix for all but builtins.
%L Go syntax for underlying type if t is named
%S short Go syntax: drop leading "func" in function type
%-S special case for method receiver symbol
func (t *Type) Format(s fmt.State, verb rune)
Format
method
#
Format implements formatting for a Sym.
The valid formats are:
%v Go syntax: Name for symbols in the local package, PkgName.Name for imported symbols.
%+v Debug syntax: always include PkgName. prefix even for local names.
%S Short syntax: Name only, no matter what.
func (s *Sym) Format(f fmt.State, verb rune)
Func
method
#
func (sym *Sym) Func() bool
FuncArgs
method
#
FuncArgs returns the func type for TFUNCARGS type t.
func (t *Type) FuncArgs() *Type
HasNil
method
#
HasNil reports whether the set of values determined by t includes nil.
func (t *Type) HasNil() bool
HasPointers
method
#
HasPointers reports whether t contains a heap pointer.
Note that this function ignores pointers to not-in-heap types.
func (t *Type) HasPointers() bool
HasShape
method
#
func (t *Type) HasShape() bool
Identical
function
#
Identical reports whether t1 and t2 are identical types, following the spec rules.
Receiver parameter types are ignored. Named (defined) types are only equal if they
are pointer-equal - i.e. there must be a unique types.Type for each specific named
type. Also, a type containing a shape type is considered identical to another type
(shape or not) if their underlying types are the same, or they are both pointers.
func Identical(t1 *Type, t2 *Type) bool
IdenticalIgnoreTags
function
#
IdenticalIgnoreTags is like Identical, but it ignores struct tags
for struct identity.
func IdenticalIgnoreTags(t1 *Type, t2 *Type) bool
IdenticalStrict
function
#
IdenticalStrict is like Identical, but matches types exactly, without the
exception for shapes.
func IdenticalStrict(t1 *Type, t2 *Type) bool
IncomparableField
function
#
IncomparableField returns an incomparable Field of struct Type t, if any.
func IncomparableField(t *Type) *Field
InitTypes
function
#
func InitTypes(defTypeName func(sym *Sym, typ *Type) Object)
InternString
function
#
func InternString(b []byte) string
IsArray
method
#
func (t *Type) IsArray() bool
IsBlank
method
#
func (sym *Sym) IsBlank() bool
IsBoolean
method
#
func (t *Type) IsBoolean() bool
IsChan
method
#
func (t *Type) IsChan() bool
IsComparable
function
#
IsComparable reports whether t is a comparable type.
func IsComparable(t *Type) bool
IsComplex
method
#
func (t *Type) IsComplex() bool
IsDDD
method
#
func (f *Field) IsDDD() bool
IsDirectIface
function
#
Can this type be stored directly in an interface word?
Yes, if the representation is a single pointer.
func IsDirectIface(t *Type) bool
IsEmptyInterface
method
#
IsEmptyInterface reports whether t is an empty interface type.
func (t *Type) IsEmptyInterface() bool
IsExported
function
#
IsExported reports whether name is an exported Go symbol (that is,
whether it begins with an upper-case letter).
func IsExported(name string) bool
IsFlags
method
#
func (t *Type) IsFlags() bool
IsFloat
method
#
func (t *Type) IsFloat() bool
IsFullyInstantiated
method
#
func (t *Type) IsFullyInstantiated() bool
IsFuncArgStruct
method
#
IsFuncArgStruct reports whether t is a struct representing function parameters or results.
func (t *Type) IsFuncArgStruct() bool
IsInteger
method
#
func (t *Type) IsInteger() bool
IsInterface
method
#
func (t *Type) IsInterface() bool
IsInterfaceMethod
function
#
IsInterfaceMethod reports whether (field) m is
an interface method. Such methods have the
special receiver type types.FakeRecvType().
func IsInterfaceMethod(f *Type) bool
IsKind
method
#
IsKind reports whether t is a Type of the specified kind.
func (t *Type) IsKind(et Kind) bool
IsMap
method
#
func (t *Type) IsMap() bool
IsMemory
method
#
func (t *Type) IsMemory() bool
IsMethod
method
#
IsMethod reports whether f represents a method rather than a struct field.
func (f *Field) IsMethod() bool
IsMethodApplicable
function
#
IsMethodApplicable reports whether method m can be called on a
value of type t. This is necessary because we compute a single
method set for both T and *T, but some *T methods are not
applicable to T receivers.
func IsMethodApplicable(t *Type, m *Field) bool
IsNoInstrumentPkg
function
#
IsNoInstrumentPkg reports whether p is a package that
should not be instrumented.
func IsNoInstrumentPkg(p *Pkg) bool
IsNoRacePkg
function
#
IsNoRacePkg reports whether p is a package that
should not be race instrumented.
func IsNoRacePkg(p *Pkg) bool
IsPaddedField
function
#
IsPaddedField reports whether the i'th field of struct type t is followed
by padding.
func IsPaddedField(t *Type, i int) bool
IsPtr
method
#
IsPtr reports whether t is a regular Go pointer type.
This does not include unsafe.Pointer.
func (t *Type) IsPtr() bool
IsPtrElem
method
#
IsPtrElem reports whether t is the element of a pointer (to t).
func (t *Type) IsPtrElem() bool
IsPtrShaped
method
#
IsPtrShaped reports whether t is represented by a single machine pointer.
In addition to regular Go pointer types, this includes map, channel, and
function types and unsafe.Pointer. It does not include array or struct types
that consist of a single pointer shaped type.
TODO(mdempsky): Should it? See golang.org/issue/15028.
func (t *Type) IsPtrShaped() bool
IsReflexive
function
#
IsReflexive reports whether t has a reflexive equality operator.
That is, if x==x for all x of type t.
func IsReflexive(t *Type) bool
IsResults
method
#
func (t *Type) IsResults() bool
IsRuntimePkg
function
#
IsRuntimePkg reports whether p is a runtime package.
func IsRuntimePkg(p *Pkg) bool
IsScalar
method
#
IsScalar reports whether 't' is a scalar Go type, e.g.
bool/int/float/complex. Note that struct and array types consisting
of a single scalar element are not considered scalar, likewise
pointer types are also not considered scalar.
func (t *Type) IsScalar() bool
IsShape
method
#
func (t *Type) IsShape() bool
IsSigned
method
#
func (t *Type) IsSigned() bool
IsSlice
method
#
func (t *Type) IsSlice() bool
IsString
method
#
func (t *Type) IsString() bool
IsStruct
method
#
func (t *Type) IsStruct() bool
IsTuple
method
#
func (t *Type) IsTuple() bool
IsUintptr
method
#
IsUintptr reports whether t is a uintptr.
func (t *Type) IsUintptr() bool
IsUnsafePtr
method
#
IsUnsafePtr reports whether t is an unsafe pointer.
func (t *Type) IsUnsafePtr() bool
IsUnsigned
method
#
func (t *Type) IsUnsigned() bool
IsUntyped
method
#
IsUntyped reports whether t is an untyped type.
func (t *Type) IsUntyped() bool
IsVariadic
method
#
IsVariadic reports whether function type t is variadic.
func (t *Type) IsVariadic() bool
IsVoid
method
#
func (t *Type) IsVoid() bool
Key
method
#
Key returns the key type of map type t.
func (t *Type) Key() *Type
Kind
method
#
Kind returns the kind of type t.
func (t *Type) Kind() Kind
LinkString
method
#
LinkString returns a string description of t, suitable for use in
link symbols.
The description corresponds to type identity. That is, for any pair
of types t1 and t2, Identical(t1, t2) == (t1.LinkString() ==
t2.LinkString()) is true. Thus it's safe to use as a map key to
implement a type-identity-keyed map.
func (t *Type) LinkString() string
Linksym
method
#
Deprecated: This method should not be used directly. Instead, use a
higher-level abstraction that directly returns the linker symbol
for a named object. For example, reflectdata.TypeLinksym(t) instead
of reflectdata.TypeSym(t).Linksym().
func (sym *Sym) Linksym() *obj.LSym
LinksymABI
method
#
Deprecated: This method should not be used directly. Instead, use a
higher-level abstraction that directly returns the linker symbol
for a named object. For example, (*ir.Name).LinksymABI(abi) instead
of (*ir.Name).Sym().LinksymABI(abi).
func (sym *Sym) LinksymABI(abi obj.ABI) *obj.LSym
Lookup
method
#
func (pkg *Pkg) Lookup(name string) *Sym
LookupBytes
method
#
func (pkg *Pkg) LookupBytes(name []byte) *Sym
LookupNum
method
#
LookupNum looks up the symbol starting with prefix and ending with
the decimal n. If prefix is too long, LookupNum panics.
func (pkg *Pkg) LookupNum(prefix string, n int) *Sym
LookupOK
method
#
LookupOK looks up name in pkg and reports whether it previously existed.
func (pkg *Pkg) LookupOK(name string) (s *Sym, existed bool)
MapType
method
#
MapType returns t's extra map-specific fields.
func (t *Type) MapType() *Map
Methods
method
#
Methods returns a pointer to the base methods (excluding embedding) for type t.
These can either be concrete methods (for non-interface types) or interface
methods (for interface types).
func (t *Type) Methods() []*Field
NameString
method
#
NameString generates a user-readable, mostly unique string
description of t. NameString always returns the same description
for identical types, even across compilation units.
NameString qualifies identifiers by package name, so it has
collisions when different packages share the same names and
identifiers. It also does not distinguish function-scope defined
types from package-scoped defined types or from each other.
func (t *Type) NameString() string
NewArray
function
#
NewArray returns a new fixed-length array Type.
func NewArray(elem *Type, bound int64) *Type
NewChan
function
#
NewChan returns a new chan Type with direction dir.
func NewChan(elem *Type, dir ChanDir) *Type
NewChanArgs
function
#
NewChanArgs returns a new TCHANARGS type for channel type c.
func NewChanArgs(c *Type) *Type
NewField
function
#
func NewField(pos src.XPos, sym *Sym, typ *Type) *Field
NewFuncArgs
function
#
NewFuncArgs returns a new TFUNCARGS type for func type f.
func NewFuncArgs(f *Type) *Type
NewInterface
function
#
NewInterface returns a new interface for the given methods and
embedded types. Embedded types are specified as fields with no Sym.
func NewInterface(methods []*Field) *Type
NewMap
function
#
NewMap returns a new map Type with key type k and element (aka value) type v.
func NewMap(k *Type, v *Type) *Type
NewNamed
function
#
NewNamed returns a new named type for the given type name. obj should be an
ir.Name. The new type is incomplete (marked as TFORW kind), and the underlying
type should be set later via SetUnderlying(). References to the type are
maintained until the type is filled in, so those references can be updated when
the type is complete.
func NewNamed(obj Object) *Type
NewPkg
function
#
NewPkg returns a new Pkg for the given package path and name.
Unless name is the empty string, if the package exists already,
the existing package name and the provided name must match.
func NewPkg(path string, name string) *Pkg
NewPtr
function
#
NewPtr returns the pointer type pointing to t.
func NewPtr(elem *Type) *Type
NewResults
function
#
func NewResults(types []*Type) *Type
NewSignature
function
#
NewSignature returns a new function type for the given receiver,
parameters, and results, any of which may be nil.
func NewSignature(recv *Field, params []*Field, results []*Field) *Type
NewSlice
function
#
NewSlice returns the slice Type with element type elem.
func NewSlice(elem *Type) *Type
NewStruct
function
#
NewStruct returns a new struct with the given fields.
func NewStruct(fields []*Field) *Type
NewTuple
function
#
func NewTuple(t1 *Type, t2 *Type) *Type
Noalg
method
#
func (t *Type) Noalg() bool
Nointerface
method
#
func (f *Field) Nointerface() bool
NotInHeap
method
#
func (t *Type) NotInHeap() bool
NumComponents
method
#
NumComponents returns the number of primitive elements that compose t.
Struct and array types are flattened for the purpose of counting.
All other types (including string, slice, and interface types) count as one element.
If countBlank is IgnoreBlankFields, then blank struct fields
(and their comprised elements) are excluded from the count.
struct { x, y [3]int } has six components; [10]struct{ x, y string } has twenty.
func (t *Type) NumComponents(countBlank componentsIncludeBlankFields) int64
NumElem
method
#
func (t *Type) NumElem() int64
NumFields
method
#
func (t *Type) NumFields() int
NumParams
method
#
func (t *Type) NumParams() int
NumRecvs
method
#
func (t *Type) NumRecvs() int
NumResults
method
#
func (t *Type) NumResults() int
Obj
method
#
Obj returns the canonical type name node for a named type t, nil for an unnamed type.
func (t *Type) Obj() Object
OffsetOf
method
#
OffsetOf reports the offset of the field of a struct.
The field is looked up by name.
func (t *Type) OffsetOf(name string) int64
OnExportList
method
#
func (sym *Sym) OnExportList() bool
Param
method
#
Param returns the i'th parameter of signature type t.
func (t *Type) Param(i int) *Field
Params
method
#
Params returns a slice of regular parameters of signature type t.
func (t *Type) Params() []*Field
ParamsResults
method
#
ParamsResults returns a slice containing the signature's (normal)
parameters followed by its results.
func (t *Type) ParamsResults() []*Field
ParseLangFlag
function
#
ParseLangFlag verifies that the -lang flag holds a valid value, and
exits if not. It initializes data used by AllowsGoVersion.
func ParseLangFlag()
PkgMap
function
#
func PkgMap() map[string]*Pkg
Pos
method
#
Pos returns a position associated with t, if any.
This should only be used for diagnostics.
func (t *Type) Pos() src.XPos
PtrDataSize
function
#
PtrDataSize returns the length in bytes of the prefix of t
containing pointer data. Anything after this offset is scalar data.
PtrDataSize is only defined for actual Go types. It's an error to
use it on compiler-internal types (e.g., TSSA, TRESULTS).
func PtrDataSize(t *Type) int64
PtrTo
method
#
func (t *Type) PtrTo() *Type
ReceiverBaseType
function
#
ReceiverBaseType returns the underlying type, if any,
that owns methods with receiver parameter t.
The result is either a named type or an anonymous struct.
func ReceiverBaseType(t *Type) *Type
Recur
method
#
func (t *Type) Recur() bool
Recv
method
#
Recv returns the receiver of function type t, if any.
func (t *Type) Recv() *Field
RecvParams
method
#
RecvParams returns a slice containing the signature's receiver (if
any) followed by its (normal) parameters.
func (t *Type) RecvParams() []*Field
RecvParamsResults
method
#
RecvParamsResults returns a slice containing all of the
signature's parameters in receiver (if any), (normal) parameters,
and then results.
func (t *Type) RecvParamsResults() []*Field
Recvs
method
#
Recvs returns a slice of receiver parameters of signature type t.
The returned slice always has length 0 or 1.
func (t *Type) Recvs() []*Field
ReflectSymName
function
#
ReflectSymName returns the name of s if it's in package "reflect"; otherwise
it returns "".
func ReflectSymName(s *Sym) string
Registers
method
#
Registers returns the number of integer and floating-point
registers required to represent a parameter of this type under the
ABIInternal calling conventions.
If t must be passed by memory, Registers returns (math.MaxUint8,
math.MaxUint8).
func (t *Type) Registers() (uint8, uint8)
Result
method
#
Result returns the i'th result of signature type t.
func (t *Type) Result(i int) *Field
Results
method
#
Results returns a slice of result parameters of signature type t.
func (t *Type) Results() []*Field
ResultsTuple
method
#
ResultsTuple returns the result type of signature type t as a tuple.
This can be used as the type of multi-valued call expressions.
func (t *Type) ResultsTuple() *Type
ResumeCheckSize
function
#
func ResumeCheckSize()
RoundUp
function
#
RoundUp rounds o to a multiple of r, r is a power of 2.
func RoundUp(o int64, r int64) int64
RuntimeSymName
function
#
RuntimeSymName returns the name of s if it's in package "runtime"; otherwise
it returns "".
func RuntimeSymName(s *Sym) string
Selector
method
#
Selector looks up a selector identifier.
func (pkg *Pkg) Selector(name string) *Sym
Set
method
#
Set sets f to a slice.
This takes ownership of the slice.
func (f *fields) Set(s []*Field)
SetAllMethods
method
#
SetAllMethods sets the set of all methods for type t (i.e.,
including promoted methods from embedded types).
func (t *Type) SetAllMethods(fs []*Field)
SetAsm
method
#
func (sym *Sym) SetAsm(b bool)
SetDeferwidth
method
#
func (t *Type) SetDeferwidth(b bool)
SetFunc
method
#
func (sym *Sym) SetFunc(b bool)
SetHasShape
method
#
func (t *Type) SetHasShape(b bool)
SetInterface
method
#
SetInterface sets the base methods of an interface type t.
func (t *Type) SetInterface(methods []*Field)
SetIsDDD
method
#
func (f *Field) SetIsDDD(b bool)
SetIsFullyInstantiated
method
#
func (t *Type) SetIsFullyInstantiated(b bool)
SetIsShape
method
#
Should always do SetHasShape(true) when doing SetIsShape(true).
func (t *Type) SetIsShape(b bool)
SetMethods
method
#
SetMethods sets the direct method set for type t (i.e., *not*
including promoted methods from embedded types).
func (t *Type) SetMethods(fs []*Field)
SetNoalg
method
#
func (t *Type) SetNoalg(b bool)
SetNointerface
method
#
func (f *Field) SetNointerface(b bool)
SetNotInHeap
method
#
func (t *Type) SetNotInHeap(b bool)
SetOnExportList
method
#
func (sym *Sym) SetOnExportList(b bool)
SetRecur
method
#
func (t *Type) SetRecur(b bool)
SetSiggen
method
#
func (sym *Sym) SetSiggen(b bool)
SetUnderlying
method
#
SetUnderlying sets the underlying type of an incomplete type (i.e. type whose kind
is currently TFORW). SetUnderlying automatically updates any types that were waiting
for this type to be completed.
func (t *Type) SetUnderlying(underlying *Type)
SetUniq
method
#
func (sym *Sym) SetUniq(b bool)
Siggen
method
#
func (sym *Sym) Siggen() bool
SimpleString
method
#
func (t *Type) SimpleString() string
Size
method
#
func (t *Type) Size() int64
Slice
method
#
Slice returns the entries in f as a slice.
Changes to the slice entries will be reflected in f.
func (f *fields) Slice() []*Field
SoleComponent
method
#
SoleComponent returns the only primitive component in t,
if there is exactly one. Otherwise, it returns nil.
Components are counted as in NumComponents, including blank fields.
Keep in sync with cmd/compile/internal/walk/convert.go:soleComponent.
func (t *Type) SoleComponent() *Type
SplitVargenSuffix
function
#
SplitVargenSuffix returns name split into a base string and a ·N
suffix, if any.
func SplitVargenSuffix(name string) (base string, suffix string)
String
method
#
func (s *Sym) String() string
String
method
#
func (i AlgKind) String() string
String
method
#
func (i Kind) String() string
String
method
#
String returns the Go syntax for the type t.
func (t *Type) String() string
StructType
method
#
StructType returns t's extra struct-specific fields.
func (t *Type) StructType() *Struct
SubstAny
function
#
SubstAny walks t, replacing instances of "any" with successive
elements removed from types. It returns the substituted type.
func SubstAny(t *Type, types *[]*Type) *Type
Sym
method
#
Sym returns the name of type t.
func (t *Type) Sym() *Sym
ToUnsigned
method
#
ToUnsigned returns the unsigned equivalent of integer type t.
func (t *Type) ToUnsigned() *Type
TypeHasNoAlg
function
#
TypeHasNoAlg reports whether t does not have any associated hash/eq
algorithms because t, or some component of t, is marked Noalg.
func TypeHasNoAlg(t *Type) bool
TypeHash
function
#
TypeHash computes a hash value for type t to use in type switch statements.
func TypeHash(t *Type) uint32
TypeSym
function
#
func TypeSym(t *Type) *Sym
TypeSymLookup
function
#
func TypeSymLookup(name string) *Sym
TypeSymName
function
#
func TypeSymName(t *Type) string
Underlying
method
#
Underlying returns the underlying type of type t.
func (t *Type) Underlying() *Type
Uniq
method
#
func (sym *Sym) Uniq() bool
_
function
#
func _()
_
function
#
func _()
calcStructOffset
function
#
calcStructOffset computes the offsets of a sequence of fields,
starting at the given offset. It returns the resulting offset and
maximum field alignment.
func calcStructOffset(t *Type, fields []*Field, offset int64) int64
chanType
method
#
chanType returns t's extra channel-specific fields.
func (t *Type) chanType() *Chan
cmp
method
#
cmp compares two *Types t and x, returning CMPlt,
CMPeq, CMPgt as tx, for an arbitrary
and optimizer-centric notion of comparison.
TODO(josharian): make this safe for recursive interface types
and use in signatlist sorting. See issue 19869.
func (t *Type) cmp(x *Type) Cmp
cmpForNe
function
#
func cmpForNe(x bool) Cmp
cmpsym
method
#
func (r *Sym) cmpsym(s *Sym) Cmp
copy
method
#
copy returns a shallow copy of the Type.
func (t *Type) copy() *Type
currentLang
function
#
currentLang returns the current language version.
func currentLang() string
expandiface
function
#
expandiface computes the method set for interface type t by
expanding embedded interfaces.
func expandiface(t *Type)
fields
method
#
fields returns the fields of struct type t.
func (t *Type) fields() *fields
fieldsHasShape
function
#
func fieldsHasShape(fields []*Field) bool
fldconv
function
#
func fldconv(b *bytes.Buffer, f *Field, verb rune, mode fmtMode, visited map[*Type]int, isParam bool)
formatParams
function
#
func formatParams(b *bytes.Buffer, params []*Field, mode fmtMode, visited map[*Type]int)
forwardType
method
#
forwardType returns t's extra forward-type-specific fields.
func (t *Type) forwardType() *Forward
funcType
method
#
funcType returns t's extra func-specific fields.
func (t *Type) funcType() *Func
identical
function
#
func identical(t1 *Type, t2 *Type, flags int, assumedEqual map[typePair]struct{...}) bool
init
function
#
func init()
isAtomicStdPkg
function
#
func isAtomicStdPkg(p *Pkg) bool
makeComparableInterface
function
#
makeComparableInterface makes the predefined "comparable" interface in the
built-in package. It has a unique name, but no methods.
func makeComparableInterface() *Type
makeErrorInterface
function
#
func makeErrorInterface() *Type
newBasic
function
#
newBasic returns a new basic type of the given kind.
func newBasic(kind Kind, obj Object) *Type
newResults
function
#
func newResults(types []*Type) *Type
newSSA
function
#
func newSSA(name string) *Type
newType
function
#
newType returns a new Type of the specified kind.
func newType(et Kind) *Type
params
method
#
func (ft *Func) params() []*Field
paramsResults
method
#
func (ft *Func) paramsResults() []*Field
parseLang
function
#
parseLang parses a -lang option into a langVer.
func parseLang(s string) (lang, error)
pkgqual
function
#
pkgqual returns the qualifier that should be used for printing
symbols from the given package in the given mode.
If it returns the empty string, no qualification is needed.
func pkgqual(pkg *Pkg, verb rune, mode fmtMode) string
recvParams
method
#
func (ft *Func) recvParams() []*Field
recvs
method
#
func (ft *Func) recvs() []*Field
results
method
#
func (ft *Func) results() []*Field
sconv
function
#
See #16897 for details about performance implications
before changing the implementation of sconv.
func sconv(s *Sym, verb rune, mode fmtMode) string
sconv2
function
#
func sconv2(b *bytes.Buffer, s *Sym, verb rune, mode fmtMode)
set
method
#
func (f *bitset8) set(mask uint8, b bool)
setAlg
method
#
setAlg sets the algorithm type of t to a, if it is of higher
priority to the current algorithm type.
func (t *Type) setAlg(a AlgKind)
setFields
method
#
setFields sets struct type t's fields to fields.
func (t *Type) setFields(fields []*Field)
substFields
function
#
func substFields(fields []*Field, types *[]*Type) []*Field
symfmt
function
#
func symfmt(b *bytes.Buffer, s *Sym, verb rune, mode fmtMode)
tconv
function
#
func tconv(t *Type, verb rune, mode fmtMode) string
tconv2
function
#
tconv2 writes a string representation of t to b.
flag and mode control exactly what is printed.
Any types x that are already in the visited map get printed as @%d where %d=visited[x].
See #16897 before changing the implementation of tconv.
func tconv2(b *bytes.Buffer, t *Type, verb rune, mode fmtMode, visited map[*Type]int)
typePos
function
#
typePos returns the position associated with t.
This is where t was declared or where it appeared as a type expression.
func typePos(t *Type) src.XPos
wantEtype
method
#
func (t *Type) wantEtype(et Kind)
widthCalculated
method
#
func (t *Type) widthCalculated() bool