Compare commits
1 Commits
feature/cb
...
push-pllyt
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1e5ed28b4f |
2
cache.go
2
cache.go
@ -69,7 +69,7 @@ func newTypeInfo(t reflect.Type) *typeInfo {
|
||||
tInfo.spclType = specialTypeTag
|
||||
} else if t == typeTime {
|
||||
tInfo.spclType = specialTypeTime
|
||||
} else if reflect.PtrTo(t).Implements(typeUnmarshaler) {
|
||||
} else if implements(reflect.PtrTo(t), typeUnmarshaler) {
|
||||
tInfo.spclType = specialTypeUnmarshalerIface
|
||||
}
|
||||
|
||||
|
||||
@ -3078,7 +3078,7 @@ func fillFloat(t cborType, val float64, v reflect.Value) error {
|
||||
}
|
||||
|
||||
func fillByteString(t cborType, val []byte, shared bool, v reflect.Value, bsts ByteStringToStringMode, bum BinaryUnmarshalerMode) error {
|
||||
if bum == BinaryUnmarshalerByteString && reflect.PtrTo(v.Type()).Implements(typeBinaryUnmarshaler) {
|
||||
if bum == BinaryUnmarshalerByteString && implements(reflect.PtrTo(v.Type()), typeBinaryUnmarshaler) {
|
||||
if v.CanAddr() {
|
||||
v = v.Addr()
|
||||
if u, ok := v.Interface().(encoding.BinaryUnmarshaler); ok {
|
||||
|
||||
@ -1799,10 +1799,10 @@ func getEncodeFuncInternal(t reflect.Type) (ef encodeFunc, ief isEmptyFunc) {
|
||||
case typeByteString:
|
||||
return encodeMarshalerType, isEmptyString
|
||||
}
|
||||
if reflect.PtrTo(t).Implements(typeMarshaler) {
|
||||
if implements(reflect.PtrTo(t), typeMarshaler) {
|
||||
return encodeMarshalerType, alwaysNotEmpty
|
||||
}
|
||||
if reflect.PtrTo(t).Implements(typeBinaryMarshaler) {
|
||||
if implements(reflect.PtrTo(t), typeBinaryMarshaler) {
|
||||
defer func() {
|
||||
// capture encoding method used for modes that disable BinaryMarshaler
|
||||
bme := binaryMarshalerEncoder{
|
||||
|
||||
Loading…
Reference in New Issue
Block a user