Source File
reflect_dynamic.go
Belonging Package
github.com/json-iterator/go
package jsoniterimport ()type dynamicEncoder struct {valType reflect2.Type}func ( *dynamicEncoder) ( unsafe.Pointer, *Stream) {:= .valType.UnsafeIndirect().WriteVal()}func ( *dynamicEncoder) ( unsafe.Pointer) bool {return .valType.UnsafeIndirect() == nil}type efaceDecoder struct {}func ( *efaceDecoder) ( unsafe.Pointer, *Iterator) {:= (*interface{})():= *if == nil {* = .Read()return}:= reflect2.TypeOf()if .Kind() != reflect.Ptr {* = .Read()return}:= .(*reflect2.UnsafePtrType):= .Elem()if .WhatIsNext() == NilValue {if .Kind() != reflect.Ptr {.skipFourBytes('n', 'u', 'l', 'l')* = nilreturn}}if reflect2.IsNil() {:= .New().ReadVal()* =return}.ReadVal()}type ifaceDecoder struct {valType *reflect2.UnsafeIFaceType}func ( *ifaceDecoder) ( unsafe.Pointer, *Iterator) {if .ReadNil() {.valType.UnsafeSet(, .valType.UnsafeNew())return}:= .valType.UnsafeIndirect()if reflect2.IsNil() {.ReportError("decode non empty interface", "can not unmarshal into nil")return}.ReadVal()}
![]() |
The pages are generated with Golds v0.8.2. (GOOS=linux GOARCH=amd64) Golds is a Go 101 project developed by Tapir Liu. PR and bug reports are welcome and can be submitted to the issue list. Please follow @zigo_101 (reachable from the left QR code) to get the latest news of Golds. |