mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
improve some type switches now that multiple types per case are supported.
R=rsc CC=golang-dev https://golang.org/cl/181089
This commit is contained in:
parent
e01459f567
commit
a58b69e1d0
2 changed files with 6 additions and 50 deletions
|
|
@ -630,33 +630,11 @@ func (dec *Decoder) compatibleType(fr reflect.Type, fw typeId) bool {
|
|||
return false
|
||||
case *reflect.BoolType:
|
||||
return fw == tBool
|
||||
case *reflect.IntType:
|
||||
case *reflect.IntType, *reflect.Int8Type, *reflect.Int16Type, *reflect.Int32Type, *reflect.Int64Type:
|
||||
return fw == tInt
|
||||
case *reflect.Int8Type:
|
||||
return fw == tInt
|
||||
case *reflect.Int16Type:
|
||||
return fw == tInt
|
||||
case *reflect.Int32Type:
|
||||
return fw == tInt
|
||||
case *reflect.Int64Type:
|
||||
return fw == tInt
|
||||
case *reflect.UintType:
|
||||
case *reflect.UintType, *reflect.Uint8Type, *reflect.Uint16Type, *reflect.Uint32Type, *reflect.Uint64Type, *reflect.UintptrType:
|
||||
return fw == tUint
|
||||
case *reflect.Uint8Type:
|
||||
return fw == tUint
|
||||
case *reflect.Uint16Type:
|
||||
return fw == tUint
|
||||
case *reflect.Uint32Type:
|
||||
return fw == tUint
|
||||
case *reflect.Uint64Type:
|
||||
return fw == tUint
|
||||
case *reflect.UintptrType:
|
||||
return fw == tUint
|
||||
case *reflect.FloatType:
|
||||
return fw == tFloat
|
||||
case *reflect.Float32Type:
|
||||
return fw == tFloat
|
||||
case *reflect.Float64Type:
|
||||
case *reflect.FloatType, *reflect.Float32Type, *reflect.Float64Type:
|
||||
return fw == tFloat
|
||||
case *reflect.StringType:
|
||||
return fw == tString
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue