reflect: add Type.Bits method, add tags to prohibit conversions

gob: substitute slice for map

R=r
CC=golang-dev
https://golang.org/cl/1699045
This commit is contained in:
Russ Cox 2010-06-21 13:19:29 -07:00
parent 2fc0b4f01b
commit fc090a3a54
9 changed files with 112 additions and 144 deletions

View file

@ -588,7 +588,7 @@ func (d *decodeState) literal(v reflect.Value) {
v.Set(n)
case *reflect.FloatValue:
n, err := strconv.AtofN(s, int(v.Type().Size()*8))
n, err := strconv.AtofN(s, v.Type().Bits())
if err != nil || v.Overflow(n) {
d.saveError(&UnmarshalTypeError{"number " + s, v.Type()})
break