// NewConst returns a new constant of the specified value and type. // val must be valid according to the specification of Const.Value. func NewConst(val constant.Value, typ types.Type) *Const { … } // soleTypeKind returns a BasicInfo for which constant.Value can // represent all zero values for the types in the type set. // // types.IsBoolean for false is a representative. // types.IsInteger for 0 // types.IsString for "" // 0 otherwise. func soleTypeKind(typ types.Type) types.BasicInfo { … } // intConst returns an 'int' constant that evaluates to i. // (i is an int64 in case the host is narrower than the target.) func intConst(i int64) *Const { … } // stringConst returns a 'string' constant that evaluates to s. func stringConst(s string) *Const { … } // zeroConst returns a new "zero" constant of the specified type. func zeroConst(t types.Type) *Const { … } func (c *Const) RelString(from *types.Package) string { … } // zeroString returns the string representation of the "zero" value of the type t. func zeroString(t types.Type, from *types.Package) string { … } func (c *Const) Name() string { … } func (c *Const) String() string { … } func (c *Const) Type() types.Type { … } func (c *Const) Referrers() *[]Instruction { … } func (c *Const) Parent() *Function { … } func (c *Const) Pos() token.Pos { … } // IsNil returns true if this constant is a nil value of // a nillable reference type (pointer, slice, channel, map, or function), // a basic interface type, or // a type parameter all of whose possible instantiations are themselves nillable. func (c *Const) IsNil() bool { … } // nillable reports whether *new(T) == nil is legal for type T. func nillable(t types.Type) bool { … } // Int64 returns the numeric value of this constant truncated to fit // a signed 64-bit integer. func (c *Const) Int64() int64 { … } // Uint64 returns the numeric value of this constant truncated to fit // an unsigned 64-bit integer. func (c *Const) Uint64() uint64 { … } // Float64 returns the numeric value of this constant truncated to fit // a float64. func (c *Const) Float64() float64 { … } // Complex128 returns the complex value of this constant truncated to // fit a complex128. func (c *Const) Complex128() complex128 { … }