func roundFloat(v constant.Value, sz int64) constant.Value { … } // truncate float literal fv to 32-bit or 64-bit precision // according to type; return truncated value. func truncfltlit(v constant.Value, t *types.Type) constant.Value { … } // truncate Real and Imag parts of Mpcplx to 32-bit or 64-bit // precision, according to type; return truncated value. In case of // overflow, calls Errorf but does not truncate the input value. func trunccmplxlit(v constant.Value, t *types.Type) constant.Value { … } // TODO(mdempsky): Replace these with better APIs. func convlit(n ir.Node, t *types.Type) ir.Node { … } func DefaultLit(n ir.Node, t *types.Type) ir.Node { … } // convlit1 converts an untyped expression n to type t. If n already // has a type, convlit1 has no effect. // // For explicit conversions, t must be non-nil, and integer-to-string // conversions are allowed. // // For implicit conversions (e.g., assignments), t may be nil; if so, // n is converted to its default type. // // If there's an error converting n to t, context is used in the error // message. func convlit1(n ir.Node, t *types.Type, explicit bool, context func() string) ir.Node { … } func operandType(op ir.Op, t *types.Type) *types.Type { … } // ConvertVal converts v into a representation appropriate for t. If // no such representation exists, it returns constant.MakeUnknown() // instead. // // If explicit is true, then conversions from integer to string are // also allowed. func ConvertVal(v constant.Value, t *types.Type, explicit bool) constant.Value { … } func tocplx(v constant.Value) constant.Value { … } func toflt(v constant.Value) constant.Value { … } func toint(v constant.Value) constant.Value { … } func tostr(v constant.Value) constant.Value { … } func makeFloat64(f float64) constant.Value { … } func makeComplex(real, imag constant.Value) constant.Value { … } // DefaultLit on both nodes simultaneously; // if they're both ideal going in they better // get the same type going out. // force means must assign concrete (non-ideal) type. // The results of defaultlit2 MUST be assigned back to l and r, e.g. // // n.Left, n.Right = defaultlit2(n.Left, n.Right, force) func defaultlit2(l ir.Node, r ir.Node, force bool) (ir.Node, ir.Node) { … } func mixUntyped(t1, t2 *types.Type) *types.Type { … } func defaultType(t *types.Type) *types.Type { … } // IndexConst returns the index value of constant Node n. func IndexConst(n ir.Node) int64 { … } // callOrChan reports whether n is a call or channel operation. func callOrChan(n ir.Node) bool { … }