MCPcopy
hub / github.com/bnb-chain/bsc / typeNilKind

Function typeNilKind

rlp/typecache.go:215–232  ·  view source on GitHub ↗

typeNilKind gives the RLP value kind for nil pointers to 'typ'.

(typ reflect.Type, tags rlpstruct.Tags)

Source from the content-addressed store, hash-verified

213
214// typeNilKind gives the RLP value kind for nil pointers to 'typ'.
215func typeNilKind(typ reflect.Type, tags rlpstruct.Tags) Kind {
216 styp := rtypeToStructType(typ, nil)
217
218 var nk rlpstruct.NilKind
219 if tags.NilOK {
220 nk = tags.NilKind
221 } else {
222 nk = styp.DefaultNilValue()
223 }
224 switch nk {
225 case rlpstruct.NilKindString:
226 return String
227 case rlpstruct.NilKindList:
228 return List
229 default:
230 panic("invalid nil kind value")
231 }
232}
233
234func isUint(k reflect.Kind) bool {
235 return k >= reflect.Uint && k <= reflect.Uintptr

Callers 2

makePtrWriterFunction · 0.85
makeNilPtrDecoderFunction · 0.85

Calls 2

rtypeToStructTypeFunction · 0.85
DefaultNilValueMethod · 0.80

Tested by

no test coverage detected