1
0
mirror of https://github.com/json-iterator/go.git synced 2025-06-21 23:07:33 +02:00

move type declaration into separate files

This commit is contained in:
Tao Wen
2018-02-20 23:08:58 +08:00
parent b79587753b
commit 404d90796f
5 changed files with 61 additions and 110 deletions

View File

@ -8,6 +8,11 @@ import (
"reflect"
)
var marshalerType = reflect.TypeOf((*json.Marshaler)(nil)).Elem()
var unmarshalerType = reflect.TypeOf((*json.Unmarshaler)(nil)).Elem()
var textMarshalerType = reflect.TypeOf((*encoding.TextMarshaler)(nil)).Elem()
var textUnmarshalerType = reflect.TypeOf((*encoding.TextUnmarshaler)(nil)).Elem()
func createDecoderOfMarshaler(cfg *frozenConfig, prefix string, typ reflect.Type) ValDecoder {
ptrType := reflect.PtrTo(typ)
if ptrType.Implements(unmarshalerType) {