rlp: replace reflect.PtrTo with reflect.PointerTo (#29488)
reflect.PtrTo has been deprecated and superseded by reflect.PointerTo
This commit is contained in:
parent
70bf94c34e
commit
f447de936c
@ -158,17 +158,17 @@ func makeDecoder(typ reflect.Type, tags rlpstruct.Tags) (dec decoder, err error)
|
|||||||
switch {
|
switch {
|
||||||
case typ == rawValueType:
|
case typ == rawValueType:
|
||||||
return decodeRawValue, nil
|
return decodeRawValue, nil
|
||||||
case typ.AssignableTo(reflect.PtrTo(bigInt)):
|
case typ.AssignableTo(reflect.PointerTo(bigInt)):
|
||||||
return decodeBigInt, nil
|
return decodeBigInt, nil
|
||||||
case typ.AssignableTo(bigInt):
|
case typ.AssignableTo(bigInt):
|
||||||
return decodeBigIntNoPtr, nil
|
return decodeBigIntNoPtr, nil
|
||||||
case typ == reflect.PtrTo(u256Int):
|
case typ == reflect.PointerTo(u256Int):
|
||||||
return decodeU256, nil
|
return decodeU256, nil
|
||||||
case typ == u256Int:
|
case typ == u256Int:
|
||||||
return decodeU256NoPtr, nil
|
return decodeU256NoPtr, nil
|
||||||
case kind == reflect.Ptr:
|
case kind == reflect.Ptr:
|
||||||
return makePtrDecoder(typ, tags)
|
return makePtrDecoder(typ, tags)
|
||||||
case reflect.PtrTo(typ).Implements(decoderInterface):
|
case reflect.PointerTo(typ).Implements(decoderInterface):
|
||||||
return decodeDecoder, nil
|
return decodeDecoder, nil
|
||||||
case isUint(kind):
|
case isUint(kind):
|
||||||
return decodeUint, nil
|
return decodeUint, nil
|
||||||
@ -262,7 +262,7 @@ func decodeU256(s *Stream, val reflect.Value) error {
|
|||||||
|
|
||||||
func makeListDecoder(typ reflect.Type, tag rlpstruct.Tags) (decoder, error) {
|
func makeListDecoder(typ reflect.Type, tag rlpstruct.Tags) (decoder, error) {
|
||||||
etype := typ.Elem()
|
etype := typ.Elem()
|
||||||
if etype.Kind() == reflect.Uint8 && !reflect.PtrTo(etype).Implements(decoderInterface) {
|
if etype.Kind() == reflect.Uint8 && !reflect.PointerTo(etype).Implements(decoderInterface) {
|
||||||
if typ.Kind() == reflect.Array {
|
if typ.Kind() == reflect.Array {
|
||||||
return decodeByteArray, nil
|
return decodeByteArray, nil
|
||||||
}
|
}
|
||||||
@ -474,7 +474,7 @@ func makeSimplePtrDecoder(etype reflect.Type, etypeinfo *typeinfo) decoder {
|
|||||||
//
|
//
|
||||||
// This decoder is used for pointer-typed struct fields with struct tag "nil".
|
// This decoder is used for pointer-typed struct fields with struct tag "nil".
|
||||||
func makeNilPtrDecoder(etype reflect.Type, etypeinfo *typeinfo, ts rlpstruct.Tags) decoder {
|
func makeNilPtrDecoder(etype reflect.Type, etypeinfo *typeinfo, ts rlpstruct.Tags) decoder {
|
||||||
typ := reflect.PtrTo(etype)
|
typ := reflect.PointerTo(etype)
|
||||||
nilPtr := reflect.Zero(typ)
|
nilPtr := reflect.Zero(typ)
|
||||||
|
|
||||||
// Determine the value kind that results in nil pointer.
|
// Determine the value kind that results in nil pointer.
|
||||||
|
@ -141,17 +141,17 @@ func makeWriter(typ reflect.Type, ts rlpstruct.Tags) (writer, error) {
|
|||||||
switch {
|
switch {
|
||||||
case typ == rawValueType:
|
case typ == rawValueType:
|
||||||
return writeRawValue, nil
|
return writeRawValue, nil
|
||||||
case typ.AssignableTo(reflect.PtrTo(bigInt)):
|
case typ.AssignableTo(reflect.PointerTo(bigInt)):
|
||||||
return writeBigIntPtr, nil
|
return writeBigIntPtr, nil
|
||||||
case typ.AssignableTo(bigInt):
|
case typ.AssignableTo(bigInt):
|
||||||
return writeBigIntNoPtr, nil
|
return writeBigIntNoPtr, nil
|
||||||
case typ == reflect.PtrTo(u256Int):
|
case typ == reflect.PointerTo(u256Int):
|
||||||
return writeU256IntPtr, nil
|
return writeU256IntPtr, nil
|
||||||
case typ == u256Int:
|
case typ == u256Int:
|
||||||
return writeU256IntNoPtr, nil
|
return writeU256IntNoPtr, nil
|
||||||
case kind == reflect.Ptr:
|
case kind == reflect.Ptr:
|
||||||
return makePtrWriter(typ, ts)
|
return makePtrWriter(typ, ts)
|
||||||
case reflect.PtrTo(typ).Implements(encoderInterface):
|
case reflect.PointerTo(typ).Implements(encoderInterface):
|
||||||
return makeEncoderWriter(typ), nil
|
return makeEncoderWriter(typ), nil
|
||||||
case isUint(kind):
|
case isUint(kind):
|
||||||
return writeUint, nil
|
return writeUint, nil
|
||||||
|
Loading…
Reference in New Issue
Block a user