From ffda9d4fbaa7bbfc7cec00b0dde60b223c70ad3c Mon Sep 17 00:00:00 2001 From: Ugorji Nwoke Date: Wed, 12 Jun 2019 13:02:11 -0400 Subject: [PATCH] codec: streamline nil decoding: nil means zero value consistently Previously, we had a TryDecodeAsNil that all formats implemented. However, the same formats did double duty by still checking if nil in stream when decoding a value. We introduce TryNil (replacing TryDecodeAsNil) which is used iff the type is a pointer and we need to set it to null if null was seen in the stream. Now, nil means zero value consistently, regardless of the context. In other words, a 'nil' in a stream means to reset the value to its zero state. A side effect of this is that the decode option 'DeleteOnNilMapValue` is a no-op. It is kept for compiling compatibility but has no effect during decoding. The main benefits are in the architecture - TryNil is only called if updating a pointer value - Nil is only handled at container boundaries: map, slice, null i.e. only when calling decDriver.ContainerType or decDriver.Read(Map|Array)Len ---- Also, reduce size of typeInfo by using a bitset flag instead of multiple bools. This gives us space (within 3*8 words) to store a reflect.Zero value in each typeInfo. This saves some allocation done when calling reflect.Zero(Type). ---- Add some code cleanup and re-organization. --- README.md | 2 +- codec/bench/shared_test.go | 32 +- codec/binc.go | 103 +- codec/cbor.go | 166 +- codec/codec_test.go | 12 +- codec/decode.go | 659 +-- codec/encode.go | 198 +- codec/fast-path.generated.go | 2187 +++++----- codec/fast-path.go.tmpl | 66 +- codec/gen-dec-array.go.tmpl | 14 +- codec/gen-dec-map.go.tmpl | 15 +- codec/gen-helper.generated.go | 4 +- codec/gen-helper.go.tmpl | 2 +- codec/gen.generated.go | 29 +- codec/gen.go | 169 +- codec/helper.go | 203 +- codec/helper_not_unsafe.go | 18 +- codec/helper_unsafe.go | 49 +- codec/json.go | 139 +- codec/mammoth-test.go.tmpl | 45 +- codec/mammoth2_codecgen_generated_test.go | 2002 +++------ codec/mammoth_generated_test.go | 3372 ++++++++------- codec/msgpack.go | 107 +- codec/shared_test.go | 32 +- codec/simple.go | 87 +- codec/values_codecgen_generated_test.go | 4598 ++++++--------------- 26 files changed, 6159 insertions(+), 8151 deletions(-) diff --git a/README.md b/README.md index 5b7bd4a1..b15c77a6 100644 --- a/README.md +++ b/README.md @@ -262,7 +262,7 @@ some caveats. See Encode documentation. ```go const CborStreamBytes byte = 0x5f ... -const GenVersion = 13 +const GenVersion = 14 var SelfExt = &extFailWrapper{} var GoRpc goRpc var MsgpackSpecRpc msgpackSpecRpc diff --git a/codec/bench/shared_test.go b/codec/bench/shared_test.go index acd56f83..847d8e12 100644 --- a/codec/bench/shared_test.go +++ b/codec/bench/shared_test.go @@ -276,12 +276,13 @@ func sTestCodecDecode(bs []byte, ts interface{}, h Handle, bh *BasicHandle) (err // These are for intormational messages that do not necessarily // help with diagnosing a failure, or which are too large. func logTv(x interface{}, format string, args ...interface{}) { - if testVerbose { - if t, ok := x.(testing.TB); ok { // only available from go 1.9 - t.Helper() - } - logT(x, format, args...) + if !testVerbose { + return + } + if t, ok := x.(testing.TB); ok { // only available from go 1.9 + t.Helper() } + logT(x, format, args...) } // logT logs messages when running as go test -v @@ -304,12 +305,22 @@ func logT(x interface{}, format string, args ...interface{}) { } } -func failT(x interface{}, args ...interface{}) { - t, ok := x.(testing.TB) // only available from go 1.9 - if ok { - t.Helper() +func failTv(x testing.TB, args ...interface{}) { + x.Helper() + if testVerbose { + failTMsg(x, args...) } + x.FailNow() +} +func failT(x testing.TB, args ...interface{}) { + x.Helper() + failTMsg(x, args...) + x.FailNow() +} + +func failTMsg(x testing.TB, args ...interface{}) { + x.Helper() if len(args) > 0 { if format, ok := args[0].(string); ok { logT(x, format, args[1:]...) @@ -319,9 +330,6 @@ func failT(x interface{}, args ...interface{}) { logT(x, "%v", args) } } - if ok { - t.FailNow() - } } // --- functions below are used only by benchmarks alone diff --git a/codec/binc.go b/codec/binc.go index 390fda79..e6f84bb6 100644 --- a/codec/binc.go +++ b/codec/binc.go @@ -394,6 +394,8 @@ type bincDecDriver struct { bd byte vd byte vs byte + + fnil bool // _ [3]byte // padding // linear searching on this slice is ok, // because we typically expect < 32 symbols in each stream. @@ -419,11 +421,36 @@ func (d *bincDecDriver) uncacheRead() { } } +func (d *bincDecDriver) advanceNil() (null bool) { + d.fnil = false + if !d.bdRead { + d.readNextBd() + } + if d.bd == bincVdSpecial<<4|bincSpNil { + d.bdRead = false + d.fnil = true + null = true + } + return +} + +func (d *bincDecDriver) Nil() bool { + return d.fnil +} + +func (d *bincDecDriver) TryNil() bool { + return d.advanceNil() +} + func (d *bincDecDriver) ContainerType() (vt valueType) { if !d.bdRead { d.readNextBd() } - if d.vd == bincVdSpecial && d.vs == bincSpNil { + d.fnil = false + // if d.vd == bincVdSpecial && d.vs == bincSpNil { + if d.bd == bincVdSpecial<<4|bincSpNil { + d.bdRead = false + d.fnil = true return valueTypeNil } else if d.vd == bincVdByteArray { return valueTypeBytes @@ -440,23 +467,8 @@ func (d *bincDecDriver) ContainerType() (vt valueType) { return valueTypeUnset } -func (d *bincDecDriver) TryDecodeAsNil() bool { - if !d.bdRead { - d.readNextBd() - } - if d.bd == bincVdSpecial<<4|bincSpNil { - d.bdRead = false - return true - } - return false -} - func (d *bincDecDriver) DecodeTime() (t time.Time) { - if !d.bdRead { - d.readNextBd() - } - if d.bd == bincVdSpecial<<4|bincSpNil { - d.bdRead = false + if d.advanceNil() { return } if d.vd != bincVdTimestamp { @@ -536,9 +548,6 @@ func (d *bincDecDriver) decUint() (v uint64) { } func (d *bincDecDriver) decCheckInteger() (ui uint64, neg bool) { - if !d.bdRead { - d.readNextBd() - } vd, vs := d.vd, d.vs if vd == bincVdPosInt { ui = d.decUint() @@ -566,6 +575,9 @@ func (d *bincDecDriver) decCheckInteger() (ui uint64, neg bool) { } func (d *bincDecDriver) DecodeInt64() (i int64) { + if d.advanceNil() { + return + } ui, neg := d.decCheckInteger() i = chkOvf.SignedIntV(ui) if neg { @@ -576,6 +588,9 @@ func (d *bincDecDriver) DecodeInt64() (i int64) { } func (d *bincDecDriver) DecodeUint64() (ui uint64) { + if d.advanceNil() { + return + } ui, neg := d.decCheckInteger() if neg { d.d.errorf("assigning negative signed value to unsigned integer type") @@ -586,8 +601,8 @@ func (d *bincDecDriver) DecodeUint64() (ui uint64) { } func (d *bincDecDriver) DecodeFloat64() (f float64) { - if !d.bdRead { - d.readNextBd() + if d.advanceNil() { + return } vd, vs := d.vd, d.vs if vd == bincVdSpecial { @@ -616,12 +631,12 @@ func (d *bincDecDriver) DecodeFloat64() (f float64) { // bool can be decoded from bool only (single byte). func (d *bincDecDriver) DecodeBool() (b bool) { - if !d.bdRead { - d.readNextBd() + if d.advanceNil() { + return } - if bd := d.bd; bd == (bincVdSpecial | bincSpFalse) { + if d.bd == (bincVdSpecial | bincSpFalse) { // b = false - } else if bd == (bincVdSpecial | bincSpTrue) { + } else if d.bd == (bincVdSpecial | bincSpTrue) { b = true } else { d.d.errorf("bool - %s %x-%x/%s", msgBadDesc, d.vd, d.vs, bincdesc(d.vd, d.vs)) @@ -632,8 +647,8 @@ func (d *bincDecDriver) DecodeBool() (b bool) { } func (d *bincDecDriver) ReadMapStart() (length int) { - if !d.bdRead { - d.readNextBd() + if d.advanceNil() { + return decContainerLenNil } if d.vd != bincVdMap { d.d.errorf("map - %s %x-%x/%s", msgBadDesc, d.vd, d.vs, bincdesc(d.vd, d.vs)) @@ -645,8 +660,8 @@ func (d *bincDecDriver) ReadMapStart() (length int) { } func (d *bincDecDriver) ReadArrayStart() (length int) { - if !d.bdRead { - d.readNextBd() + if d.advanceNil() { + return decContainerLenNil } if d.vd != bincVdArray { d.d.errorf("array - %s %x-%x/%s", msgBadDesc, d.vd, d.vs, bincdesc(d.vd, d.vs)) @@ -681,11 +696,7 @@ func (d *bincDecDriver) decLenNumber() (v uint64) { } func (d *bincDecDriver) decStringBytes(bs []byte, zerocopy bool) (bs2 []byte) { - if !d.bdRead { - d.readNextBd() - } - if d.bd == bincVdSpecial<<4|bincSpNil { - d.bdRead = false + if d.advanceNil() { return } var slen = -1 @@ -756,12 +767,8 @@ func (d *bincDecDriver) DecodeStringAsBytes() (s []byte) { } func (d *bincDecDriver) DecodeBytes(bs []byte, zerocopy bool) (bsOut []byte) { - if !d.bdRead { - d.readNextBd() - } - if d.bd == bincVdSpecial<<4|bincSpNil { - d.bdRead = false - return nil + if d.advanceNil() { + return } // check if an "array" of uint8's (see ContainerType for how to infer if an array) if d.vd == bincVdArray { @@ -794,13 +801,16 @@ func (d *bincDecDriver) DecodeBytes(bs []byte, zerocopy bool) (bsOut []byte) { return decByteSlice(d.r, clen, d.d.h.MaxInitLen, bs) } -func (d *bincDecDriver) DecodeExt(rv interface{}, xtag uint64, ext Ext) (realxtag uint64) { +func (d *bincDecDriver) DecodeExt(rv interface{}, xtag uint64, ext Ext) { if xtag > 0xff { d.d.errorf("ext: tag must be <= 0xff; got: %v", xtag) return } + if d.advanceNil() { + return + } realxtag1, xbs := d.decodeExtV(ext != nil, uint8(xtag)) - realxtag = uint64(realxtag1) + realxtag := uint64(realxtag1) if ext == nil { re := rv.(*RawExt) re.Tag = realxtag @@ -810,13 +820,9 @@ func (d *bincDecDriver) DecodeExt(rv interface{}, xtag uint64, ext Ext) (realxta } else { ext.ReadExt(rv, xbs) } - return } func (d *bincDecDriver) decodeExtV(verifyTag bool, tag byte) (xtag byte, xbs []byte) { - if !d.bdRead { - d.readNextBd() - } if d.vd == bincVdCustomExt { l := d.decLen() xtag = d.r.readn1() @@ -845,6 +851,7 @@ func (d *bincDecDriver) DecodeNaked() { d.readNextBd() } + d.fnil = false n := d.d.naked() var decodeFurther bool @@ -853,6 +860,7 @@ func (d *bincDecDriver) DecodeNaked() { switch d.vs { case bincSpNil: n.v = valueTypeNil + d.fnil = true case bincSpFalse: n.v = valueTypeBool n.b = false @@ -1014,6 +1022,7 @@ func (d *bincDecDriver) reset() { d.r, d.br = d.d.r(), d.d.bytes d.s = nil d.bd, d.bdRead, d.vd, d.vs = 0, false, 0, 0 + d.fnil = false } func (d *bincDecDriver) atEndOfDecode() { diff --git a/codec/cbor.go b/codec/cbor.go index db8032cf..e585caf4 100644 --- a/codec/cbor.go +++ b/codec/cbor.go @@ -304,6 +304,7 @@ type cborDecDriver struct { bdRead bool bd byte st bool // skip tags + fnil bool // found nil noBuiltInTypes // decNoSeparator decDriverNoopContainerReader @@ -340,6 +341,19 @@ func (d *cborDecDriver) readNextBd() { d.bdRead = true } +func (d *cborDecDriver) advanceNil() (null bool) { + d.fnil = false + if !d.bdRead { + d.readNextBd() + } + if d.bd == cborBdNil || d.bd == cborBdUndefined { + d.bdRead = false + d.fnil = true + null = true + } + return +} + // skipTags is called to skip any tags in the stream. // // Since any value can be tagged, then we should call skipTags @@ -362,6 +376,7 @@ func (d *cborDecDriver) uncacheRead() { } func (d *cborDecDriver) ContainerType() (vt valueType) { + d.fnil = false if !d.bdRead { d.readNextBd() } @@ -369,6 +384,8 @@ func (d *cborDecDriver) ContainerType() (vt valueType) { d.skipTags() } if d.bd == cborBdNil { + d.bdRead = false // always consume nil after seeing it in container type + d.fnil = true return valueTypeNil } else if d.bd == cborBdIndefiniteBytes || (d.bd>>5 == cborMajorBytes) { return valueTypeBytes @@ -385,16 +402,12 @@ func (d *cborDecDriver) ContainerType() (vt valueType) { return valueTypeUnset } -func (d *cborDecDriver) TryDecodeAsNil() bool { - if !d.bdRead { - d.readNextBd() - } - // treat Nil and Undefined as nil values - if d.bd == cborBdNil || d.bd == cborBdUndefined { - d.bdRead = false - return true - } - return false +func (d *cborDecDriver) Nil() bool { + return d.fnil +} + +func (d *cborDecDriver) TryNil() bool { + return d.advanceNil() } func (d *cborDecDriver) CheckBreak() (v bool) { @@ -430,9 +443,6 @@ func (d *cborDecDriver) decUint() (ui uint64) { } func (d *cborDecDriver) decCheckInteger() (neg bool) { - if !d.bdRead { - d.readNextBd() - } if d.st { d.skipTags() } @@ -447,13 +457,6 @@ func (d *cborDecDriver) decCheckInteger() (neg bool) { return } -func (d *cborDecDriver) DecodeInt64() (i int64) { - neg := d.decCheckInteger() - ui := d.decUint() - d.bdRead = false - return cborDecInt64(ui, neg) -} - func cborDecInt64(ui uint64, neg bool) (i int64) { // check if this number can be converted to an int without overflow if neg { @@ -464,7 +467,49 @@ func cborDecInt64(ui uint64, neg bool) (i int64) { return } +func (d *cborDecDriver) decLen() int { + return int(d.decUint()) +} + +func (d *cborDecDriver) decAppendIndefiniteBytes(bs []byte) []byte { + d.bdRead = false + for !d.CheckBreak() { + if major := d.bd >> 5; major != cborMajorBytes && major != cborMajorString { + d.d.errorf("invalid indefinite string/bytes; got major %v, expected %x/%s", + major, d.bd, cbordesc(d.bd)) + } + n := uint(d.decLen()) + oldLen := uint(len(bs)) + newLen := oldLen + n + if newLen > uint(cap(bs)) { + bs2 := make([]byte, newLen, 2*uint(cap(bs))+n) + copy(bs2, bs) + bs = bs2 + } else { + bs = bs[:newLen] + } + d.r.readb(bs[oldLen:newLen]) + // bs = append(bs, d.r.readn()...) + d.bdRead = false + } + d.bdRead = false + return bs +} + +func (d *cborDecDriver) DecodeInt64() (i int64) { + if d.advanceNil() { + return + } + neg := d.decCheckInteger() + ui := d.decUint() + d.bdRead = false + return cborDecInt64(ui, neg) +} + func (d *cborDecDriver) DecodeUint64() (ui uint64) { + if d.advanceNil() { + return + } if d.decCheckInteger() { d.d.errorf("cannot assign negative signed value to unsigned type") } @@ -474,8 +519,8 @@ func (d *cborDecDriver) DecodeUint64() (ui uint64) { } func (d *cborDecDriver) DecodeFloat64() (f float64) { - if !d.bdRead { - d.readNextBd() + if d.advanceNil() { + return } if d.st { d.skipTags() @@ -504,8 +549,8 @@ func (d *cborDecDriver) DecodeFloat64() (f float64) { // bool can be decoded from bool only (single byte). func (d *cborDecDriver) DecodeBool() (b bool) { - if !d.bdRead { - d.readNextBd() + if d.advanceNil() { + return } if d.st { d.skipTags() @@ -522,15 +567,15 @@ func (d *cborDecDriver) DecodeBool() (b bool) { } func (d *cborDecDriver) ReadMapStart() (length int) { - if !d.bdRead { - d.readNextBd() + if d.advanceNil() { + return decContainerLenNil } if d.st { d.skipTags() } d.bdRead = false if d.bd == cborBdIndefiniteMap { - return -1 + return decContainerLenUnknown } if d.bd>>5 != cborMajorMap { d.d.errorf("error reading map; got major type: %x, expected %x/%s", @@ -540,15 +585,15 @@ func (d *cborDecDriver) ReadMapStart() (length int) { } func (d *cborDecDriver) ReadArrayStart() (length int) { - if !d.bdRead { - d.readNextBd() + if d.advanceNil() { + return decContainerLenNil } if d.st { d.skipTags() } d.bdRead = false if d.bd == cborBdIndefiniteArray { - return -1 + return decContainerLenUnknown } if d.bd>>5 != cborMajorArray { d.d.errorf("invalid array; got major type: %x, expect: %x/%s", @@ -557,46 +602,13 @@ func (d *cborDecDriver) ReadArrayStart() (length int) { return d.decLen() } -func (d *cborDecDriver) decLen() int { - return int(d.decUint()) -} - -func (d *cborDecDriver) decAppendIndefiniteBytes(bs []byte) []byte { - d.bdRead = false - for !d.CheckBreak() { - if major := d.bd >> 5; major != cborMajorBytes && major != cborMajorString { - d.d.errorf("invalid indefinite string/bytes; got major %v, expected %x/%s", - major, d.bd, cbordesc(d.bd)) - } - n := uint(d.decLen()) - oldLen := uint(len(bs)) - newLen := oldLen + n - if newLen > uint(cap(bs)) { - bs2 := make([]byte, newLen, 2*uint(cap(bs))+n) - copy(bs2, bs) - bs = bs2 - } else { - bs = bs[:newLen] - } - d.r.readb(bs[oldLen:newLen]) - // bs = append(bs, d.r.readn()...) - d.bdRead = false - } - d.bdRead = false - return bs -} - func (d *cborDecDriver) DecodeBytes(bs []byte, zerocopy bool) (bsOut []byte) { - if !d.bdRead { - d.readNextBd() + if d.advanceNil() { + return } if d.st { d.skipTags() } - if d.bd == cborBdNil || d.bd == cborBdUndefined { - d.bdRead = false - return nil - } if d.bd == cborBdIndefiniteBytes || d.bd == cborBdIndefiniteString { d.bdRead = false if bs == nil { @@ -656,11 +668,7 @@ func (d *cborDecDriver) DecodeStringAsBytes() (s []byte) { } func (d *cborDecDriver) DecodeTime() (t time.Time) { - if !d.bdRead { - d.readNextBd() - } - if d.bd == cborBdNil || d.bd == cborBdUndefined { - d.bdRead = false + if d.advanceNil() { return } if d.bd>>5 != cborMajorTag { @@ -705,16 +713,15 @@ func (d *cborDecDriver) decodeTime(xtag uint64) (t time.Time) { return } -func (d *cborDecDriver) DecodeExt(rv interface{}, xtag uint64, ext Ext) (realxtag uint64) { - if !d.bdRead { - d.readNextBd() +func (d *cborDecDriver) DecodeExt(rv interface{}, xtag uint64, ext Ext) { + if d.advanceNil() { + return } if d.bd>>5 != cborMajorTag { d.d.errorf("error reading tag; expected major type: %x, got: %x", cborMajorTag, d.bd>>5) } - u := d.decUint() + realxtag := d.decUint() d.bdRead = false - realxtag = u if ext == nil { re := rv.(*RawExt) re.Tag = realxtag @@ -729,7 +736,6 @@ func (d *cborDecDriver) DecodeExt(rv interface{}, xtag uint64, ext Ext) (realxta d.d.interfaceExtConvertAndDecode(rv, ext) } d.bdRead = false - return } func (d *cborDecDriver) DecodeNaked() { @@ -737,6 +743,7 @@ func (d *cborDecDriver) DecodeNaked() { d.readNextBd() } + d.fnil = false n := d.d.naked() var decodeFurther bool @@ -782,8 +789,9 @@ func (d *cborDecDriver) DecodeNaked() { // decodeFurther = true case cborMajorSimpleOrFloat: switch d.bd { - case cborBdNil: + case cborBdNil, cborBdUndefined: n.v = valueTypeNil + d.fnil = true case cborBdFalse: n.v = valueTypeBool n.b = false @@ -875,7 +883,9 @@ func (e *cborEncDriver) reset() { func (d *cborDecDriver) reset() { d.r, d.br = d.d.r(), d.d.bytes - d.bd, d.bdRead = 0, false + d.bd = 0 + d.bdRead = false + d.fnil = false d.st = d.h.SkipUnexpectedTags } diff --git a/codec/codec_test.go b/codec/codec_test.go index 6d822e80..da606b9e 100644 --- a/codec/codec_test.go +++ b/codec/codec_test.go @@ -717,24 +717,30 @@ func testMarshal(v interface{}, h Handle) (bs []byte, err error) { } func testMarshalErr(v interface{}, h Handle, t *testing.T, name string) (bs []byte) { + t.Helper() bs, err := testMarshal(v, h) if err != nil { + logT("%s: marshal failed: %v", name, err) failT(t, "Error encoding %s: %v, Err: %v", name, v, err) } return } func testUnmarshalErr(v interface{}, data []byte, h Handle, t *testing.T, name string) { + t.Helper() if err := testUnmarshal(v, data, h); err != nil { - failT(t, "Error Decoding into %s: %v, Err: %v", name, v, err) + logT("%s: unmarshal failed: %v", name, err) + failTv(t, "Error Decoding into %s: %v, Err: %v", name, v, err) } } func testDeepEqualErr(v1, v2 interface{}, t *testing.T, name string) { + t.Helper() if err := deepEqual(v1, v2); err == nil { logTv(t, "%s: values equal", name) } else { - failT(t, "%s: values not equal: %v. 1: %#v, 2: %#v", name, err, v1, v2) + logT(t, "%s: values not equal: %v", name, err) + failTv(t, "%s: values not equal: %v. 1: %#v, 2: %#v", name, err, v1, v2) } } @@ -778,7 +784,7 @@ func doTestCodecTableOne(t *testing.T, testNil bool, h Handle, if h.isBinary() { logTv(t, " Encoded bytes: len: %v, %v\n", len(b0), b1) } else { - logTv(t, " Encoded string: len: %v, %v\n", len(b0), string(b1)) + logTv(t, " Encoded string: len: %v, %s\n", len(b0), b0) // println("########### encoded string: " + string(b0)) } var v1 interface{} diff --git a/codec/decode.go b/codec/decode.go index 1df3deb4..98f66ca5 100644 --- a/codec/decode.go +++ b/codec/decode.go @@ -8,6 +8,7 @@ import ( "errors" "fmt" "io" + "math" "reflect" "runtime" "strconv" @@ -25,6 +26,15 @@ const ( decDefSliceCap = 8 decDefChanCap = 64 // should be large, as cap cannot be expanded decScratchByteArrayLen = cacheLineSize // - 5 // + (8 * 2) // - (8 * 1) + + // decContainerLenUnknown is length returned from Read(Map|Array)Len + // when a format doesn't know apiori. + // For example, json doesn't pre-determine the length of a container (sequence/map). + decContainerLenUnknown = -1 + + // decContainerLenNil is length returned from Read(Map|Array)Len + // when a 'nil' was encountered in the stream. + decContainerLenNil = math.MinInt32 ) var ( @@ -47,13 +57,29 @@ var ( type decDriver interface { // this will check if the next token is a break. CheckBreak() bool - // TryDecodeAsNil tries to decode as nil. - // Note: TryDecodeAsNil should be careful not to share any temporary []byte with - // the rest of the decDriver. This is because sometimes, we optimize by holding onto - // a transient []byte, and ensuring the only other call we make to the decDriver - // during that time is maybe a TryDecodeAsNil() call. - TryDecodeAsNil() bool - // ContainerType returns one of: Bytes, String, Nil, Slice or Map. Return unSet if not known. + + // // TryDecodeAsNil tries to decode as nil. + // // + // // Note: TryDecodeAsNil should be careful not to share any temporary []byte with + // // the rest of the decDriver. This is because sometimes, we optimize by holding onto + // // a transient []byte, and ensuring the only other call we make to the decDriver + // // during that time is maybe a TryDecodeAsNil() call. + // TryDecodeAsNil() bool + + // // Nil says whether the last scalar value read from the stream was a nil value. + // // + // // This is sometimes inspected by the decoder if they need to determine whether + // // a pointer should be set to nil or the returned zero value. + // Nil() bool + + // TryNil tries to decode as nil. + TryNil() bool + + // ContainerType returns one of: Bytes, String, Nil, Slice or Map. + // + // Return unSet if not known. + // + // Note: Implementations MUST fully consume sentinel container types, specifically Nil. ContainerType() (vt valueType) // IsBuiltinType(rt uintptr) bool @@ -90,13 +116,20 @@ type decDriver interface { // DecodeBytes(bs []byte, isstring, zerocopy bool) (bsOut []byte) // DecodeExt will decode into a *RawExt or into an extension. - DecodeExt(v interface{}, xtag uint64, ext Ext) (realxtag uint64) + DecodeExt(v interface{}, xtag uint64, ext Ext) // decodeExt(verifyTag bool, tag byte) (xtag byte, xbs []byte) DecodeTime() (t time.Time) + // ReadArrayStart will return the length of the array. + // If the format doesn't prefix the length, it returns decContainerLenUnknown. + // If the expected array was a nil in the stream, it returns decContainerLenNil. ReadArrayStart() int ReadArrayEnd() + + // ReadMapStart will return the length of the array. + // If the format doesn't prefix the length, it returns decContainerLenUnknown. + // If the expected array was a nil in the stream, it returns decContainerLenNil. ReadMapStart() int ReadMapEnd() @@ -233,6 +266,10 @@ type DecodeOptions struct { // // If true, we will delete the mapping of the key. // Else, just set the mapping to the zero value of the type. + // + // Deprecated: This does NOTHING and is left behind for compiling compatibility. + // This change is necessitated because 'nil' in a stream now consistently + // means the zero value (ie reset the value to its zero state). DeleteOnNilMapValue bool // RawToString controls how raw bytes in a stream are decoded into a nil interface{}. @@ -296,9 +333,9 @@ func (d *Decoder) kInterfaceNaked(f *codecFnInfo) (rvn reflect.Value) { // based on the detected next value in the stream. n := d.naked() d.d.DecodeNaked() - if n.v == valueTypeNil { - return - } + // if n.v == valueTypeNil { + // return + // } // We cannot decode non-nil stream value into nil interface with methods (e.g. io.Reader). if f.ti.numMeth > 0 { d.errorf("cannot decode non-nil codec value into nil %v (%v methods)", f.ti.rt, f.ti.numMeth) @@ -367,11 +404,12 @@ func (d *Decoder) kInterfaceNaked(f *codecFnInfo) (rvn reflect.Value) { } else { rvn = reflect.New(bfn.rt) if bfn.ext == SelfExt { - d.decodeValue(rvn, d.h.fnNoExt(rvn.Type().Elem())) + rvn = rvn.Elem() + d.decodeValue(rvn, d.h.fnNoExt(rvn.Type())) } else { d.interfaceExtConvertAndDecode(rv2i(rvn), bfn.ext) + rvn = rvn.Elem() } - rvn = rvn.Elem() } } else { // one of the BytesExt ones: binc, msgpack, simple @@ -389,6 +427,7 @@ func (d *Decoder) kInterfaceNaked(f *codecFnInfo) (rvn reflect.Value) { } } case valueTypeNil: + // rvn = reflect.Zero(f.ti.rt) // TODO // no-op case valueTypeInt: rvn = n.ri() @@ -418,6 +457,7 @@ func (d *Decoder) kInterface(f *codecFnInfo, rv reflect.Value) { // We do not replace with a generic value (as got from decodeNaked). // every interface passed here MUST be settable. + // xdebugf("kInterface: 0") var rvn reflect.Value if rvisnil(rv) || d.h.InterfaceReset { // check if mapping to a type: if so, initialize it and move on @@ -426,11 +466,17 @@ func (d *Decoder) kInterface(f *codecFnInfo, rv reflect.Value) { rv.Set(rvn) } else { rvn = d.kInterfaceNaked(f) + // xdebugf("kInterface: %v", rvn) if rvn.IsValid() { rv.Set(rvn) } else if d.h.InterfaceReset { // reset to zero value based on current type in there. - rv.Set(reflect.Zero(rv.Elem().Type())) + if rvelem := rv.Elem(); rvelem.IsValid() { + rv.Set(reflect.Zero(rvelem.Type())) + } + // } else { + // rv.Set(reflect.Zero(rv.Type())) + // } } return } @@ -438,23 +484,23 @@ func (d *Decoder) kInterface(f *codecFnInfo, rv reflect.Value) { // now we have a non-nil interface value, meaning it contains a type rvn = rv.Elem() } - if d.d.TryDecodeAsNil() { - rv.Set(reflect.Zero(rvn.Type())) - return - } + + // if d.d.TryDecodeAsNil() { + // rv.Set(reflect.Zero(rvn.Type())) + // return + // } // Note: interface{} is settable, but underlying type may not be. // Consequently, we MAY have to create a decodable value out of the underlying value, // decode into it, and reset the interface itself. // fmt.Printf(">>>> kInterface: rvn type: %v, rv type: %v\n", rvn.Type(), rv.Type()) - rvn2, canDecode := isDecodeable(rvn) - if canDecode { - d.decodeValue(rvn2, nil) + if isDecodeable(rvn) { + d.decodeValue(rvn, nil) return } - rvn2 = reflect.New(rvn.Type()).Elem() + rvn2 := reflect.New(rvn.Type()).Elem() rvn2.Set(rvn) d.decodeValue(rvn2, nil) rv.Set(rvn2) @@ -475,18 +521,21 @@ func decStructFieldKey(dd decDriver, keyType valueType, b *[decScratchByteArrayL } else { rvkencname = dd.DecodeStringAsBytes() } - return rvkencname + return } func (d *Decoder) kStruct(f *codecFnInfo, rv reflect.Value) { - fti := f.ti - dd := d.d sfn := structFieldNode{v: rv, update: true} - ctyp := dd.ContainerType() + ctyp := d.d.ContainerType() + // xdebugf("kStruct: rv: %#v", rv) + if ctyp == valueTypeNil { + rv.Set(f.ti.rv0) + return + } var mf MissingFielder - if fti.mf { + if f.ti.isFlag(tiflagMissingFielder) { mf = rv2i(rv).(MissingFielder) - } else if fti.mfp { + } else if f.ti.isFlag(tiflagMissingFielderPtr) { mf = rv2i(rv.Addr()).(MissingFielder) } if ctyp == valueTypeMap { @@ -495,21 +544,24 @@ func (d *Decoder) kStruct(f *codecFnInfo, rv reflect.Value) { d.mapEnd() return } - tisfi := fti.sfiSort + tisfi := f.ti.sfiSort hasLen := containerLen >= 0 var rvkencname []byte - for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + for j := 0; (hasLen && j < containerLen) || !(hasLen || d.d.CheckBreak()); j++ { d.mapElemKey() - rvkencname = decStructFieldKey(dd, fti.keyType, &d.b) + rvkencname = decStructFieldKey(d.d, f.ti.keyType, &d.b) + // xdebugf("key: '%s'", rvkencname) d.mapElemValue() - if k := fti.indexForEncName(rvkencname); k > -1 { + if k := f.ti.indexForEncName(rvkencname); k > -1 { si := tisfi[k] - if dd.TryDecodeAsNil() { - si.setToZeroValue(rv) - } else { - d.decodeValue(sfn.field(si), nil) - } + // if d.d.TryDecodeAsNil() { + // si.setToZeroValue(rv) + // } else { + // d.decodeValue(sfn.field(si), nil) + // } + d.decodeValue(sfn.field(si), nil) + // xdebugf("value: '%#v'", sfn.field(si)) } else if mf != nil { // store rvkencname in new []byte, as it previously shares Decoder.b, which is used in decode name2 := rvkencname @@ -538,25 +590,26 @@ func (d *Decoder) kStruct(f *codecFnInfo, rv reflect.Value) { // Arrays are not used as much for structs. hasLen := containerLen >= 0 var checkbreak bool - for j, si := range fti.sfiSrc { + for j, si := range f.ti.sfiSrc { if hasLen && j == containerLen { break } - if !hasLen && dd.CheckBreak() { + if !hasLen && d.d.CheckBreak() { checkbreak = true break } d.arrayElem() - if dd.TryDecodeAsNil() { - si.setToZeroValue(rv) - } else { - d.decodeValue(sfn.field(si), nil) - } + // if d.d.TryDecodeAsNil() { + // si.setToZeroValue(rv) + // } else { + // d.decodeValue(sfn.field(si), nil) + // } + d.decodeValue(sfn.field(si), nil) } - if (hasLen && containerLen > len(fti.sfiSrc)) || (!hasLen && !checkbreak) { + if (hasLen && containerLen > len(f.ti.sfiSrc)) || (!hasLen && !checkbreak) { // read remaining values and throw away - for j := len(fti.sfiSrc); ; j++ { - if (hasLen && j == containerLen) || (!hasLen && dd.CheckBreak()) { + for j := len(f.ti.sfiSrc); ; j++ { + if (hasLen && j == containerLen) || (!hasLen && d.d.CheckBreak()) { break } d.arrayElem() @@ -574,38 +627,29 @@ func (d *Decoder) kSlice(f *codecFnInfo, rv reflect.Value) { // A slice can be set from a map or array in stream. // This way, the order can be kept (as order is lost with map). - frt := f.ti.rt - if f.seq == seqTypeChan && f.ti.chandir&uint8(reflect.SendDir) == 0 { - d.errorf("receive-only channel cannot be decoded") - } - dd := d.d rtelem0 := f.ti.elem - ctyp := dd.ContainerType() + ctyp := d.d.ContainerType() + if ctyp == valueTypeNil { + // xdebug2f("rv: %v, type: %v, canset: %v", rv, rv.Type(), rv.CanSet()) + // rv.Set(reflect.New(f.ti.rt).Elem()) + if rv.CanSet() { + rv.Set(f.ti.rv0) + } + return + } if ctyp == valueTypeBytes || ctyp == valueTypeString { // you can only decode bytes or string in the stream into a slice or array of bytes if !(f.ti.rtid == uint8SliceTypId || rtelem0.Kind() == reflect.Uint8) { - d.errorf("bytes/string in stream must decode into slice/array of bytes, not %v", frt) + d.errorf("bytes/string in stream must decode into slice/array of bytes, not %v", f.ti.rt) } - if f.seq == seqTypeChan { - bs2 := dd.DecodeBytes(nil, true) - irv := rv2i(rv) - ch, ok := irv.(chan<- byte) - if !ok { - ch = irv.(chan byte) - } - for _, b := range bs2 { - ch <- b - } - } else { - rvbs := rv.Bytes() - bs2 := dd.DecodeBytes(rvbs, false) - // if rvbs == nil && bs2 != nil || rvbs != nil && bs2 == nil || len(bs2) != len(rvbs) { - if !(len(bs2) > 0 && len(bs2) == len(rvbs) && &bs2[0] == &rvbs[0]) { - if rv.CanSet() { - rv.SetBytes(bs2) - } else if len(rvbs) > 0 && len(bs2) > 0 { - copy(rvbs, bs2) - } + rvbs := rv.Bytes() + bs2 := d.d.DecodeBytes(rvbs, false) + // if rvbs == nil && bs2 != nil || rvbs != nil && bs2 == nil || len(bs2) != len(rvbs) { + if !(len(bs2) > 0 && len(bs2) == len(rvbs) && &bs2[0] == &rvbs[0]) { + if rv.CanSet() { + rv.SetBytes(bs2) + } else if len(rvbs) > 0 && len(bs2) > 0 { + copy(rvbs, bs2) } } return @@ -615,19 +659,22 @@ func (d *Decoder) kSlice(f *codecFnInfo, rv reflect.Value) { slh, containerLenS := d.decSliceHelperStart() // only expects valueType(Array|Map) + // // handle if nil + // if slh.IsNil { + // if rv.CanSet() && !rvisnil(rv) { + // // rv.Set(reflect.New(f.ti.rt).Elem()) + // rv.Set(reflect.Zero(f.ti.rt)) + // } + // return + // } + // an array can never return a nil slice. so no need to check f.array here. if containerLenS == 0 { if rv.CanSet() { - if f.seq == seqTypeSlice { - if rvisnil(rv) { - rv.Set(reflect.MakeSlice(frt, 0, 0)) - } else { - rvssetlen(rv, 0) - } - } else if f.seq == seqTypeChan { - if rvisnil(rv) { - rv.Set(reflect.MakeChan(frt, 0)) - } + if rvisnil(rv) { + rv.Set(reflect.MakeSlice(f.ti.rt, 0, 0)) + } else { + rvssetlen(rv, 0) } } slh.End() @@ -654,7 +701,7 @@ func (d *Decoder) kSlice(f *codecFnInfo, rv reflect.Value) { rvlen := rv.Len() rvcap := rv.Cap() hasLen := containerLenS > 0 - if hasLen && f.seq == seqTypeSlice { + if hasLen { if containerLenS > rvcap { oldRvlenGtZero := rvlen > 0 rvlen = decInferLen(containerLenS, d.h.MaxInitLen, int(rtelem0.Size())) @@ -663,7 +710,7 @@ func (d *Decoder) kSlice(f *codecFnInfo, rv reflect.Value) { rvssetlen(rv, rvlen) } } else if rvCanset { - rv = reflect.MakeSlice(frt, rvlen, rvlen) + rv = reflect.MakeSlice(f.ti.rt, rvlen, rvlen) rvcap = rvlen rvChanged = true } else { @@ -688,107 +735,196 @@ func (d *Decoder) kSlice(f *codecFnInfo, rv reflect.Value) { // consider creating new element once, and just decoding into it. var rtelem0Zero reflect.Value var rtelem0ZeroValid bool - var decodeAsNil bool var j int - for ; (hasLen && j < containerLenS) || !(hasLen || dd.CheckBreak()); j++ { - if j == 0 && (f.seq == seqTypeSlice || f.seq == seqTypeChan) && rvisnil(rv) { + for ; (hasLen && j < containerLenS) || !(hasLen || d.d.CheckBreak()); j++ { + if j == 0 && f.seq == seqTypeSlice && rvisnil(rv) { if hasLen { rvlen = decInferLen(containerLenS, d.h.MaxInitLen, rtelem0Size) - } else if f.seq == seqTypeSlice { - rvlen = decDefSliceCap } else { - rvlen = decDefChanCap + rvlen = decDefSliceCap } if rvCanset { - if f.seq == seqTypeSlice { - rv = reflect.MakeSlice(frt, rvlen, rvlen) - rvChanged = true - } else { // chan - rv = reflect.MakeChan(frt, rvlen) - rvChanged = true - } + rv = reflect.MakeSlice(f.ti.rt, rvlen, rvlen) + rvChanged = true } else { d.errorf("cannot decode into non-settable slice") } } slh.ElemContainerState(j) - decodeAsNil = dd.TryDecodeAsNil() - if f.seq == seqTypeChan { - if decodeAsNil { - rv.Send(reflect.Zero(rtelem0)) - continue + // var decodeAsNil = d.d.TryDecodeAsNil() + // if indefinite, etc, then expand the slice if necessary + var decodeIntoBlank bool + if j >= rvlen { + if f.seq == seqTypeArray { + d.arrayCannotExpand(rvlen, j+1) + decodeIntoBlank = true + } else { // if f.seq == seqTypeSlice + // rv = reflect.Append(rv, reflect.Zero(rtelem0)) // append logic + varargs + var rvcap2 int + var rvErrmsg2 string + rv9, rvcap2, rvChanged, rvErrmsg2 = + expandSliceRV(rv, f.ti.rt, rvCanset, rtelem0Size, 1, rvlen, rvcap) + if rvErrmsg2 != "" { + d.errorf(rvErrmsg2) + } + rvlen++ + if rvChanged { + rv = rv9 + rvcap = rvcap2 + } } - if rtelem0Mut || !rv9.IsValid() { // || (rtElem0Kind == reflect.Ptr && rvisnil(rv9)) { - rv9 = reflect.New(rtelem0).Elem() + } + if decodeIntoBlank { + // if !decodeAsNil { + // d.swallow() + // } + d.swallow() + } else { + rv9 = rv.Index(j) + if d.h.SliceElementReset { // || decodeAsNil { + if !rtelem0ZeroValid { + rtelem0ZeroValid = true + rtelem0Zero = reflect.Zero(rtelem0) + } + rv9.Set(rtelem0Zero) + // if decodeAsNil { + // continue + // } } + if fn == nil { fn = d.h.fn(rtelem) } d.decodeValue(rv9, fn) - rv.Send(rv9) - } else { - // if indefinite, etc, then expand the slice if necessary - var decodeIntoBlank bool - if j >= rvlen { - if f.seq == seqTypeArray { - d.arrayCannotExpand(rvlen, j+1) - decodeIntoBlank = true - } else { // if f.seq == seqTypeSlice - // rv = reflect.Append(rv, reflect.Zero(rtelem0)) // append logic + varargs - var rvcap2 int - var rvErrmsg2 string - rv9, rvcap2, rvChanged, rvErrmsg2 = - expandSliceRV(rv, frt, rvCanset, rtelem0Size, 1, rvlen, rvcap) - if rvErrmsg2 != "" { - d.errorf(rvErrmsg2) - } - rvlen++ - if rvChanged { - rv = rv9 - rvcap = rvcap2 - } - } - } - if decodeIntoBlank { - if !decodeAsNil { - d.swallow() - } - } else { - rv9 = rv.Index(j) - if d.h.SliceElementReset || decodeAsNil { - if !rtelem0ZeroValid { - rtelem0ZeroValid = true - rtelem0Zero = reflect.Zero(rtelem0) - } - rv9.Set(rtelem0Zero) - if decodeAsNil { - continue - } - } + } + } + if j < rvlen { + if rv.CanSet() { + rvssetlen(rv, j) + } else if rvCanset { + rv = rv.Slice(0, j) + rvChanged = true + } // else { d.errorf("kSlice: cannot change non-settable slice") } + rvlen = j + } else if j == 0 && rvisnil(rv) { + if rvCanset { + rv = reflect.MakeSlice(f.ti.rt, 0, 0) + rvChanged = true + } // else { d.errorf("kSlice: cannot change non-settable slice") } + } + slh.End() - if fn == nil { - fn = d.h.fn(rtelem) - } - d.decodeValue(rv9, fn) - } + if rvChanged { // infers rvCanset=true, so it can be reset + rv0.Set(rv) + } + +} + +func (d *Decoder) kSliceForChan(f *codecFnInfo, rv reflect.Value) { + // A slice can be set from a map or array in stream. + // This way, the order can be kept (as order is lost with map). + + if f.ti.chandir&uint8(reflect.SendDir) == 0 { + d.errorf("receive-only channel cannot be decoded") + } + rtelem0 := f.ti.elem + ctyp := d.d.ContainerType() + if ctyp == valueTypeNil { + rv.Set(f.ti.rv0) + return + } + if ctyp == valueTypeBytes || ctyp == valueTypeString { + // you can only decode bytes or string in the stream into a slice or array of bytes + if !(f.ti.rtid == uint8SliceTypId || rtelem0.Kind() == reflect.Uint8) { + d.errorf("bytes/string in stream must decode into slice/array of bytes, not %v", f.ti.rt) + } + bs2 := d.d.DecodeBytes(nil, true) + irv := rv2i(rv) + ch, ok := irv.(chan<- byte) + if !ok { + ch = irv.(chan byte) + } + for _, b := range bs2 { + ch <- b } + return } - if f.seq == seqTypeSlice { - if j < rvlen { - if rv.CanSet() { - rvssetlen(rv, j) - } else if rvCanset { - rv = rv.Slice(0, j) - rvChanged = true - } // else { d.errorf("kSlice: cannot change non-settable slice") } - rvlen = j - } else if j == 0 && rvisnil(rv) { + + // array := f.seq == seqTypeChan + + // only expects valueType(Array|Map - nil handled above) + slh, containerLenS := d.decSliceHelperStart() + // // handle if nil + // if slh.IsNil { + // if rv.CanSet() && !rvisnil(rv) { + // rv.Set(reflect.Zero(f.ti.rt)) + // } + // return + // } + + // an array can never return a nil slice. so no need to check f.array here. + if containerLenS == 0 { + if rv.CanSet() && rvisnil(rv) { + rv.Set(reflect.MakeChan(f.ti.rt, 0)) + } + slh.End() + return + } + + rtelem0Size := int(rtelem0.Size()) + rtElem0Kind := rtelem0.Kind() + rtelem0Mut := !isImmutableKind(rtElem0Kind) + rtelem := rtelem0 + rtelemkind := rtelem.Kind() + for rtelemkind == reflect.Ptr { + rtelem = rtelem.Elem() + rtelemkind = rtelem.Kind() + } + + var fn *codecFn + + var rvCanset = rv.CanSet() + var rvChanged bool + var rv0 = rv + var rv9 reflect.Value + + var rvlen int // := rv.Len() + // rvcap := rv.Cap() + hasLen := containerLenS > 0 + + // consider creating new element once, and just decoding into it. + // var rtelem0Zero reflect.Value + // var rtelem0ZeroValid bool + var j int + + for ; (hasLen && j < containerLenS) || !(hasLen || d.d.CheckBreak()); j++ { + if j == 0 && rvisnil(rv) { + if hasLen { + rvlen = decInferLen(containerLenS, d.h.MaxInitLen, rtelem0Size) + } else { + rvlen = decDefChanCap + } if rvCanset { - rv = reflect.MakeSlice(frt, 0, 0) + rv = reflect.MakeChan(f.ti.rt, rvlen) rvChanged = true - } // else { d.errorf("kSlice: cannot change non-settable slice") } + } else { + d.errorf("cannot decode into non-settable chan") + } } + slh.ElemContainerState(j) + // if d.d.TryDecodeAsNil() { + // // rv.Send(reflect.Zero(rtelem0)) + // continue + // } + if rtelem0Mut || !rv9.IsValid() { // || (rtElem0Kind == reflect.Ptr && rvisnil(rv9)) { + rv9 = reflect.New(rtelem0).Elem() + } + if fn == nil { + fn = d.h.fn(rtelem) + } + d.decodeValue(rv9, fn) + rv.Send(rv9) } slh.End() @@ -804,8 +940,11 @@ func (d *Decoder) kSlice(f *codecFnInfo, rv reflect.Value) { // } func (d *Decoder) kMap(f *codecFnInfo, rv reflect.Value) { - dd := d.d containerLen := d.mapStart() + if containerLen == decContainerLenNil { + rv.Set(f.ti.rv0) + return + } ti := f.ti if rvisnil(rv) { rvlen := decInferLen(containerLen, d.h.MaxInitLen, int(ti.key.Size()+ti.elem.Size())) @@ -846,7 +985,7 @@ func (d *Decoder) kMap(f *codecFnInfo, rv reflect.Value) { } } - var rvk, rvkn, rvv, rvvn, rvva, rvvz reflect.Value + var rvk, rvkn, rvv, rvvn, rvva reflect.Value var rvvaSet bool rvkMut := !isImmutableKind(ktype.Kind()) // if ktype is immutable, then re-use the same rvk. ktypeIsString := ktypeId == stringTypId @@ -854,7 +993,7 @@ func (d *Decoder) kMap(f *codecFnInfo, rv reflect.Value) { hasLen := containerLen > 0 var kstrbs []byte - for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + for j := 0; (hasLen && j < containerLen) || !(hasLen || d.d.CheckBreak()); j++ { if j == 0 { // rvvz = reflect.Zero(vtype) // rvkz = reflect.Zero(ktype) @@ -875,7 +1014,7 @@ func (d *Decoder) kMap(f *codecFnInfo, rv reflect.Value) { d.mapElemKey() if ktypeIsString { - kstrbs = dd.DecodeStringAsBytes() + kstrbs = d.d.DecodeStringAsBytes() rvk.SetString(stringView(kstrbs)) // NOTE: if doing an insert, use real string (not stringview) } else { if keyFn == nil { @@ -894,22 +1033,22 @@ func (d *Decoder) kMap(f *codecFnInfo, rv reflect.Value) { d.mapElemValue() - // Brittle, but OK per TryDecodeAsNil() contract. - // i.e. TryDecodeAsNil never shares slices with other decDriver procedures - if dd.TryDecodeAsNil() { - if d.h.DeleteOnNilMapValue { - mapDelete(rv, rvk) - } else { - if ktypeIsString { // set to a real string (not string view) - rvk.SetString(d.string(kstrbs)) - } - if !rvvz.IsValid() { - rvvz = reflect.Zero(vtype) - } - mapSet(rv, rvk, rvvz) - } - continue - } + // // Brittle, but OK per TryDecodeAsNil() contract. + // // i.e. TryDecodeAsNil never shares slices with other decDriver procedures + // if d.d.TryDecodeAsNil() { + // if d.h.DeleteOnNilMapValue { + // mapDelete(rv, rvk) + // } else { + // if ktypeIsString { // set to a real string (not string view) + // rvk.SetString(d.string(kstrbs)) + // } + // if !rvvz.IsValid() { + // rvvz = reflect.Zero(vtype) + // } + // mapSet(rv, rvk, rvvz) + // } + // continue + // } doMapSet = true // set to false if u do a get, and its a non-nil pointer if doMapGet { @@ -1315,6 +1454,8 @@ func (d *Decoder) Decode(v interface{}) (err error) { // MustDecode is like Decode, but panics if unable to Decode. // This provides insight to the code location that triggered the error. func (d *Decoder) MustDecode(v interface{}) { + // xdebugf("MustDecode: v: %#v", v) + // debug.PrintStack() if d.err != nil { panic(d.err) } @@ -1324,25 +1465,30 @@ func (d *Decoder) MustDecode(v interface{}) { // MustDecode is like Decode, but panics if unable to Decode. // This provides insight to the code location that triggered the error. func (d *Decoder) mustDecode(v interface{}) { + // xdebug2f(".... mustDecode: v: %#v", v) // TODO: Top-level: ensure that v is a pointer and not nil. if d.bi == nil { - if d.d.TryDecodeAsNil() { - setZero(v) - } else { - d.decode(v) - } + // if d.d.TryDecodeAsNil() { + // setZero(v) + // } else { + // d.decode(v) + // } + d.decode(v) d.d.atEndOfDecode() return } - if d.d.TryDecodeAsNil() { - setZero(v) - } else { - d.bi.calls++ - d.decode(v) - d.bi.calls-- - } + // if d.d.TryDecodeAsNil() { + // setZero(v) + // } else { + // d.bi.calls++ + // d.decode(v) + // d.bi.calls-- + // } + d.bi.calls++ + d.decode(v) + d.bi.calls-- if d.bi.calls == 0 { d.d.atEndOfDecode() if !d.h.ExplicitRelease { @@ -1386,16 +1532,16 @@ func (d *Decoder) Release() { func (d *Decoder) swallow() { // smarter decode that just swallows the content - dd := d.d - if dd.TryDecodeAsNil() { - return - } - switch dd.ContainerType() { + // if d.d.TryDecodeAsNil() { + // return + // } + switch d.d.ContainerType() { + case valueTypeNil: case valueTypeMap: containerLen := d.mapStart() hasLen := containerLen >= 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { - // if clenGtEqualZero {if j >= containerLen {break} } else if dd.CheckBreak() {break} + for j := 0; (hasLen && j < containerLen) || !(hasLen || d.d.CheckBreak()); j++ { + // if clenGtEqualZero {if j >= containerLen {break} } else if d.d.CheckBreak() {break} d.mapElemKey() d.swallow() d.mapElemValue() @@ -1405,20 +1551,20 @@ func (d *Decoder) swallow() { case valueTypeArray: containerLen := d.arrayStart() hasLen := containerLen >= 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + for j := 0; (hasLen && j < containerLen) || !(hasLen || d.d.CheckBreak()); j++ { d.arrayElem() d.swallow() } d.arrayEnd() case valueTypeBytes: - dd.DecodeBytes(d.b[:], true) + d.d.DecodeBytes(d.b[:], true) case valueTypeString: - dd.DecodeStringAsBytes() + d.d.DecodeStringAsBytes() default: // these are all primitives, which we can get from decodeNaked // if RawExt using Value, complete the processing. n := d.naked() - dd.DecodeNaked() + d.d.DecodeNaked() if n.v == valueTypeExt && n.l == nil { var v2 interface{} d.decode(&v2) @@ -1430,10 +1576,10 @@ func setZero(iv interface{}) { if iv == nil { return } - if _, ok := isNilRef(iv); ok { + if _, ok := isNil(iv); ok { return } - var canDecode bool + // var canDecode bool switch v := iv.(type) { case *string: *v = "" @@ -1470,19 +1616,25 @@ func setZero(iv interface{}) { case *time.Time: *v = time.Time{} case reflect.Value: - if v, canDecode = isDecodeable(v); canDecode && v.CanSet() { - v.Set(reflect.Zero(v.Type())) - } // TODO: else drain if chan, clear if map, set all to nil if slice??? + setZeroRV(v) default: if !fastpathDecodeSetZeroTypeSwitch(iv) { - v := reflect.ValueOf(iv) - if v, canDecode = isDecodeable(v); canDecode && v.CanSet() { - v.Set(reflect.Zero(v.Type())) - } // TODO: else drain if chan, clear if map, set all to nil if slice??? + setZeroRV(reflect.ValueOf(iv)) } } } +func setZeroRV(v reflect.Value) { + if isDecodeable(v) { + if v.Kind() == reflect.Ptr { + v = v.Elem() + } + if v.CanSet() { + v.Set(reflect.Zero(v.Type())) + } + } // TODO: else drain if chan, clear if map, set all to nil if slice??? +} + func (d *Decoder) decode(iv interface{}) { // a switch with only concrete types can be optimized. // consequently, we deal with nil and interfaces outside the switch. @@ -1496,7 +1648,7 @@ func (d *Decoder) decode(iv interface{}) { // case nil: // case Selfer: case reflect.Value: - v = d.ensureDecodeable(v) + d.ensureDecodeable(v) d.decodeValue(v, nil) case *string: @@ -1540,7 +1692,8 @@ func (d *Decoder) decode(iv interface{}) { *v = d.rawBytes() case *interface{}: - d.decodeValue(reflect.ValueOf(iv).Elem(), nil) + d.decodeValue(reflect.ValueOf(iv), nil) + // d.decodeValue(reflect.ValueOf(iv).Elem(), nil) // d.decodeValueNotNil(reflect.ValueOf(iv).Elem()) default: @@ -1548,29 +1701,37 @@ func (d *Decoder) decode(iv interface{}) { v.CodecDecodeSelf(d) } else if !fastpathDecodeTypeSwitch(iv, d) { v := reflect.ValueOf(iv) - v = d.ensureDecodeable(v) + d.ensureDecodeable(v) d.decodeValue(v, nil) // TODO: find a way to say: no fast path??? Not necessary??? // d.decodeValueFallback(v) } } } +// decodeValue MUST be called by the actual value we want to decode into, +// not its addr or a reference to it. +// +// This way, we know if it is itself a pointer, and can handle nil in +// the stream effectively. func (d *Decoder) decodeValue(rv reflect.Value, fn *codecFn) { // If stream is not containing a nil value, then we can deref to the base // non-pointer value, and decode into that. var rvp reflect.Value var rvpValid bool if rv.Kind() == reflect.Ptr { + if d.d.TryNil() { + if rvelem := rv.Elem(); rvelem.CanSet() { + rvelem.Set(reflect.Zero(rvelem.Type())) + } + return + } rvpValid = true - for { + for rv.Kind() == reflect.Ptr { if rvisnil(rv) { rv.Set(reflect.New(rv.Type().Elem())) } rvp = rv rv = rv.Elem() - if rv.Kind() != reflect.Ptr { - break - } } } @@ -1590,6 +1751,13 @@ func (d *Decoder) decodeValue(rv reflect.Value, fn *codecFn) { } else { fn.fd(d, &fn.i, rv) } + + // const check = true + // if check && rvpValid && scalarBitset.isset(byte(rv.Kind())) && d.d.Nil() { + // xdebug2f("setting %v (canset: %v) to %v, after updating %v to %v", + // rv0.Type(), rv0.CanSet(), reflect.Zero(rv0.Type()), rv.Type(), rv) + // rv0.Set(reflect.Zero(rv0.Type())) + // } // return rv } @@ -1613,31 +1781,30 @@ func (d *Decoder) arrayCannotExpand(sliceLen, streamLen int) { } } -func isDecodeable(rv reflect.Value) (rv2 reflect.Value, canDecode bool) { +func isDecodeable(rv reflect.Value) (canDecode bool) { switch rv.Kind() { case reflect.Array: - return rv, rv.CanAddr() + return rv.CanAddr() case reflect.Ptr: if !rvisnil(rv) { - return rv.Elem(), true + return true } case reflect.Slice, reflect.Chan, reflect.Map: if !rvisnil(rv) { - return rv, true + return true } } return } -func (d *Decoder) ensureDecodeable(rv reflect.Value) (rv2 reflect.Value) { +func (d *Decoder) ensureDecodeable(rv reflect.Value) { // decode can take any reflect.Value that is a inherently addressable i.e. // - array // - non-nil chan (we will SEND to it) // - non-nil slice (we will set its elements) // - non-nil map (we will put into it) // - non-nil pointer (we can "update" it) - rv2, canDecode := isDecodeable(rv) - if canDecode { + if isDecodeable(rv) { return } if !rv.IsValid() { @@ -1650,8 +1817,7 @@ func (d *Decoder) ensureDecodeable(rv reflect.Value) (rv2 reflect.Value) { } rvi := rv2i(rv) rvk := rv.Kind() - d.errorf("cannot decode into value of kind: %v, type: %T, %v", rvk, rvi, rvi) - return + d.errorf("cannot decode into value of kind: %v, type: %T, %#v", rvk, rvi, rvi) } func (d *Decoder) depthIncr() { @@ -1670,6 +1836,9 @@ func (d *Decoder) depthDecr() { // This should mostly be used for map keys, where the key type is string. // This is because keys of a map/struct are typically reused across many objects. func (d *Decoder) string(v []byte) (s string) { + if v == nil { + return + } if d.is == nil { return string(v) // don't return stringView, as we need a real string here. } @@ -1678,7 +1847,7 @@ func (d *Decoder) string(v []byte) (s string) { s = string(v) // new allocation here d.is[s] = s } - return s + return } // nextValueBytes returns the next value in the stream as a set of bytes. @@ -1723,10 +1892,15 @@ func (d *Decoder) decodeFloat32() float32 { // Note: We update the .c after calling the callback. // This way, the callback can know what the last status was. +// Note: if you call mapStart and it returns decContainerLenNil, +// then do NOT call mapEnd. + func (d *Decoder) mapStart() (v int) { v = d.d.ReadMapStart() - d.depthIncr() - d.c = containerMapStart + if v != decContainerLenNil { + d.depthIncr() + d.c = containerMapStart + } return } @@ -1820,15 +1994,18 @@ func (d *Decoder) sideDecode(v interface{}, bs []byte) { type decSliceHelper struct { d *Decoder ct valueType - array bool + Array bool + IsNil bool } func (d *Decoder) decSliceHelperStart() (x decSliceHelper, clen int) { x.ct = d.d.ContainerType() x.d = d switch x.ct { + case valueTypeNil: + x.IsNil = true case valueTypeArray: - x.array = true + x.Array = true clen = d.arrayStart() case valueTypeMap: clen = d.mapStart() * 2 @@ -1839,7 +2016,8 @@ func (d *Decoder) decSliceHelperStart() (x decSliceHelper, clen int) { } func (x decSliceHelper) End() { - if x.array { + if x.IsNil { + } else if x.Array { x.d.arrayEnd() } else { x.d.mapEnd() @@ -1847,7 +2025,9 @@ func (x decSliceHelper) End() { } func (x decSliceHelper) ElemContainerState(index int) { - if x.array { + // Note: if isnil, clen=0, so we never call into ElemContainerState + if x.IsNil { //TODO: take out this check + } else if x.Array { x.d.arrayElem() } else if index%2 == 0 { x.d.mapElemKey() @@ -1924,6 +2104,9 @@ func decInferLen(clen, maxlen, unit int) (rvlen int) { return } if clen < 0 { + if clen == decContainerLenNil { + return 0 + } return maxLenIfUnset } if unit == 0 { diff --git a/codec/encode.go b/codec/encode.go index 05f5cd96..3b9f303d 100644 --- a/codec/encode.go +++ b/codec/encode.go @@ -216,11 +216,43 @@ func (e *Encoder) kErr(f *codecFnInfo, rv reflect.Value) { e.errorf("unsupported kind %s, for %#v", rv.Kind(), rv) } +func chanToSlice(rv reflect.Value, rtelem reflect.Type, timeout time.Duration) (rvcs reflect.Value) { + // TODO: ensure this doesn't mess up anywhere that rv of kind chan is expected + rvcs = reflect.Zero(reflect.SliceOf(rtelem)) + if timeout < 0 { // consume until close + for { + recv, recvOk := rv.Recv() + if !recvOk { + break + } + rvcs = reflect.Append(rvcs, recv) + } + } else { + cases := make([]reflect.SelectCase, 2) + cases[0] = reflect.SelectCase{Dir: reflect.SelectRecv, Chan: rv} + if timeout == 0 { + cases[1] = reflect.SelectCase{Dir: reflect.SelectDefault} + } else { + tt := time.NewTimer(timeout) + cases[1] = reflect.SelectCase{Dir: reflect.SelectRecv, Chan: reflect.ValueOf(tt.C)} + } + for { + chosen, recv, recvOk := reflect.Select(cases) + if chosen == 1 || !recvOk { + break + } + rvcs = reflect.Append(rvcs, recv) + } + } + return +} + func (e *Encoder) kSlice(f *codecFnInfo, rv reflect.Value) { // array may be non-addressable, so we have to manage with care // (don't call rv.Bytes, rv.Slice, etc). // E.g. type struct S{B [2]byte}; // Encode(S{}) will bomb on "panic: slice of unaddressable array". + mbs := f.ti.mbs if f.seq != seqTypeArray { if rvisnil(rv) { e.e.EncodeNil() @@ -228,7 +260,7 @@ func (e *Encoder) kSlice(f *codecFnInfo, rv reflect.Value) { } // If in this method, then there was no extension function defined. // So it's okay to treat as []byte. - if f.ti.rtid == uint8SliceTypId { + if !mbs && f.ti.rtid == uint8SliceTypId { e.e.EncodeStringBytesRaw(rv.Bytes()) return } @@ -236,48 +268,40 @@ func (e *Encoder) kSlice(f *codecFnInfo, rv reflect.Value) { if f.seq == seqTypeChan && f.ti.chandir&uint8(reflect.RecvDir) == 0 { e.errorf("send-only channel cannot be encoded") } - mbs := f.ti.mbs rtelem := f.ti.elem + var l int // if a slice, array or chan of bytes, treat specially if !mbs && uint8TypId == rt2id(rtelem) { // NOT rtelem.Kind() == reflect.Uint8 - e.kSliceBytes(rv, f.seq) + switch f.seq { + case seqTypeSlice: + e.e.EncodeStringBytesRaw(rv.Bytes()) + case seqTypeArray: + l = rv.Len() + if rv.CanAddr() { + e.e.EncodeStringBytesRaw(rv.Slice(0, l).Bytes()) + } else { + var bs []byte + if l <= cap(e.b) { + bs = e.b[:l] + } else { + bs = make([]byte, l) + } + reflect.Copy(reflect.ValueOf(bs), rv) + e.e.EncodeStringBytesRaw(bs) + } + case seqTypeChan: + e.kSliceBytesChan(rv) + } return } // if chan, consume chan into a slice, and work off that slice. if f.seq == seqTypeChan { - rvcs := reflect.Zero(reflect.SliceOf(rtelem)) - timeout := e.h.ChanRecvTimeout - if timeout < 0 { // consume until close - for { - recv, recvOk := rv.Recv() - if !recvOk { - break - } - rvcs = reflect.Append(rvcs, recv) - } - } else { - cases := make([]reflect.SelectCase, 2) - cases[0] = reflect.SelectCase{Dir: reflect.SelectRecv, Chan: rv} - if timeout == 0 { - cases[1] = reflect.SelectCase{Dir: reflect.SelectDefault} - } else { - tt := time.NewTimer(timeout) - cases[1] = reflect.SelectCase{Dir: reflect.SelectRecv, Chan: reflect.ValueOf(tt.C)} - } - for { - chosen, recv, recvOk := reflect.Select(cases) - if chosen == 1 || !recvOk { - break - } - rvcs = reflect.Append(rvcs, recv) - } - } - rv = rvcs // TODO: ensure this doesn't mess up anywhere that rv of kind chan is expected + rv = chanToSlice(rv, rtelem, e.h.ChanRecvTimeout) } - var l = rv.Len() // rv may be slice or array + l = rv.Len() // rv may be slice or array if mbs { if l%2 == 1 { e.errorf("mapBySlice requires even slice length, but got %v", l) @@ -320,71 +344,53 @@ func (e *Encoder) kSlice(f *codecFnInfo, rv reflect.Value) { } } -func (e *Encoder) kSliceBytes(rv reflect.Value, seq seqType) { - switch seq { - case seqTypeSlice: - e.e.EncodeStringBytesRaw(rv.Bytes()) - case seqTypeArray: - var l = rv.Len() - if rv.CanAddr() { - e.e.EncodeStringBytesRaw(rv.Slice(0, l).Bytes()) - } else { - var bs []byte - if l <= cap(e.b) { - bs = e.b[:l] - } else { - bs = make([]byte, l) - } - reflect.Copy(reflect.ValueOf(bs), rv) - e.e.EncodeStringBytesRaw(bs) - } - case seqTypeChan: - // do not use range, so that the number of elements encoded - // does not change, and encoding does not hang waiting on someone to close chan. - // for b := range rv2i(rv).(<-chan byte) { bs = append(bs, b) } - // ch := rv2i(rv).(<-chan byte) // fix error - that this is a chan byte, not a <-chan byte. +func (e *Encoder) kSliceBytesChan(rv reflect.Value) { + // do not use range, so that the number of elements encoded + // does not change, and encoding does not hang waiting on someone to close chan. + // for b := range rv2i(rv).(<-chan byte) { bs = append(bs, b) } + // ch := rv2i(rv).(<-chan byte) // fix error - that this is a chan byte, not a <-chan byte. - if rvisnil(rv) { - e.e.EncodeNil() - break - } - bs := e.b[:0] - irv := rv2i(rv) - ch, ok := irv.(<-chan byte) - if !ok { - ch = irv.(chan byte) - } + // if rvisnil(rv) { + // e.e.EncodeNil() + // return + // } - L1: - switch timeout := e.h.ChanRecvTimeout; { - case timeout == 0: // only consume available - for { - select { - case b := <-ch: - bs = append(bs, b) - default: - break L1 - } - } - case timeout > 0: // consume until timeout - tt := time.NewTimer(timeout) - for { - select { - case b := <-ch: - bs = append(bs, b) - case <-tt.C: - // close(tt.C) - break L1 - } + bs := e.b[:0] + irv := rv2i(rv) + ch, ok := irv.(<-chan byte) + if !ok { + ch = irv.(chan byte) + } + +L1: + switch timeout := e.h.ChanRecvTimeout; { + case timeout == 0: // only consume available + for { + select { + case b := <-ch: + bs = append(bs, b) + default: + break L1 } - default: // consume until close - for b := range ch { + } + case timeout > 0: // consume until timeout + tt := time.NewTimer(timeout) + for { + select { + case b := <-ch: bs = append(bs, b) + case <-tt.C: + // close(tt.C) + break L1 } } - - e.e.EncodeStringBytesRaw(bs) + default: // consume until close + for b := range ch { + bs = append(bs, b) + } } + + e.e.EncodeStringBytesRaw(bs) } func (e *Encoder) kStructNoOmitempty(f *codecFnInfo, rv reflect.Value) { @@ -416,11 +422,11 @@ func (e *Encoder) kStruct(f *codecFnInfo, rv reflect.Value) { var newlen int toMap := !(f.ti.toArray || e.h.StructToArray) var mf map[string]interface{} - if f.ti.mf { + if f.ti.isFlag(tiflagMissingFielder) { mf = rv2i(rv).(MissingFielder).CodecMissingFields() toMap = true newlen += len(mf) - } else if f.ti.mfp { + } else if f.ti.isFlag(tiflagMissingFielderPtr) { if rv.CanAddr() { mf = rv2i(rv.Addr()).(MissingFielder).CodecMissingFields() } else { @@ -1080,7 +1086,7 @@ func (e *Encoder) encode(iv interface{}) { return } - rv, ok := isNilRef(iv) + rv, ok := isNil(iv) if ok { e.e.EncodeNil() return @@ -1133,11 +1139,7 @@ func (e *Encoder) encode(iv interface{}) { case time.Time: e.e.EncodeTime(v) case []uint8: - if v == nil { - e.e.EncodeNil() - } else { - e.e.EncodeStringBytesRaw(v) - } + e.e.EncodeStringBytesRaw(v) case *Raw: e.rawBytes(*v) case *string: diff --git a/codec/fast-path.generated.go b/codec/fast-path.generated.go index 4fcce9a7..1d8717d3 100644 --- a/codec/fast-path.generated.go +++ b/codec/fast-path.generated.go @@ -187,11 +187,7 @@ func init() { func fastpathEncodeTypeSwitch(iv interface{}, e *Encoder) bool { switch v := iv.(type) { case []interface{}: - if v == nil { - e.e.EncodeNil() - } else { - fastpathTV.EncSliceIntfV(v, e) - } + fastpathTV.EncSliceIntfV(v, e) case *[]interface{}: if *v == nil { e.e.EncodeNil() @@ -199,11 +195,7 @@ func fastpathEncodeTypeSwitch(iv interface{}, e *Encoder) bool { fastpathTV.EncSliceIntfV(*v, e) } case []string: - if v == nil { - e.e.EncodeNil() - } else { - fastpathTV.EncSliceStringV(v, e) - } + fastpathTV.EncSliceStringV(v, e) case *[]string: if *v == nil { e.e.EncodeNil() @@ -211,11 +203,7 @@ func fastpathEncodeTypeSwitch(iv interface{}, e *Encoder) bool { fastpathTV.EncSliceStringV(*v, e) } case [][]byte: - if v == nil { - e.e.EncodeNil() - } else { - fastpathTV.EncSliceBytesV(v, e) - } + fastpathTV.EncSliceBytesV(v, e) case *[][]byte: if *v == nil { e.e.EncodeNil() @@ -223,11 +211,7 @@ func fastpathEncodeTypeSwitch(iv interface{}, e *Encoder) bool { fastpathTV.EncSliceBytesV(*v, e) } case []float32: - if v == nil { - e.e.EncodeNil() - } else { - fastpathTV.EncSliceFloat32V(v, e) - } + fastpathTV.EncSliceFloat32V(v, e) case *[]float32: if *v == nil { e.e.EncodeNil() @@ -235,11 +219,7 @@ func fastpathEncodeTypeSwitch(iv interface{}, e *Encoder) bool { fastpathTV.EncSliceFloat32V(*v, e) } case []float64: - if v == nil { - e.e.EncodeNil() - } else { - fastpathTV.EncSliceFloat64V(v, e) - } + fastpathTV.EncSliceFloat64V(v, e) case *[]float64: if *v == nil { e.e.EncodeNil() @@ -247,11 +227,7 @@ func fastpathEncodeTypeSwitch(iv interface{}, e *Encoder) bool { fastpathTV.EncSliceFloat64V(*v, e) } case []uint: - if v == nil { - e.e.EncodeNil() - } else { - fastpathTV.EncSliceUintV(v, e) - } + fastpathTV.EncSliceUintV(v, e) case *[]uint: if *v == nil { e.e.EncodeNil() @@ -259,11 +235,7 @@ func fastpathEncodeTypeSwitch(iv interface{}, e *Encoder) bool { fastpathTV.EncSliceUintV(*v, e) } case []uint16: - if v == nil { - e.e.EncodeNil() - } else { - fastpathTV.EncSliceUint16V(v, e) - } + fastpathTV.EncSliceUint16V(v, e) case *[]uint16: if *v == nil { e.e.EncodeNil() @@ -271,11 +243,7 @@ func fastpathEncodeTypeSwitch(iv interface{}, e *Encoder) bool { fastpathTV.EncSliceUint16V(*v, e) } case []uint32: - if v == nil { - e.e.EncodeNil() - } else { - fastpathTV.EncSliceUint32V(v, e) - } + fastpathTV.EncSliceUint32V(v, e) case *[]uint32: if *v == nil { e.e.EncodeNil() @@ -283,11 +251,7 @@ func fastpathEncodeTypeSwitch(iv interface{}, e *Encoder) bool { fastpathTV.EncSliceUint32V(*v, e) } case []uint64: - if v == nil { - e.e.EncodeNil() - } else { - fastpathTV.EncSliceUint64V(v, e) - } + fastpathTV.EncSliceUint64V(v, e) case *[]uint64: if *v == nil { e.e.EncodeNil() @@ -295,11 +259,7 @@ func fastpathEncodeTypeSwitch(iv interface{}, e *Encoder) bool { fastpathTV.EncSliceUint64V(*v, e) } case []int: - if v == nil { - e.e.EncodeNil() - } else { - fastpathTV.EncSliceIntV(v, e) - } + fastpathTV.EncSliceIntV(v, e) case *[]int: if *v == nil { e.e.EncodeNil() @@ -307,11 +267,7 @@ func fastpathEncodeTypeSwitch(iv interface{}, e *Encoder) bool { fastpathTV.EncSliceIntV(*v, e) } case []int8: - if v == nil { - e.e.EncodeNil() - } else { - fastpathTV.EncSliceInt8V(v, e) - } + fastpathTV.EncSliceInt8V(v, e) case *[]int8: if *v == nil { e.e.EncodeNil() @@ -319,11 +275,7 @@ func fastpathEncodeTypeSwitch(iv interface{}, e *Encoder) bool { fastpathTV.EncSliceInt8V(*v, e) } case []int16: - if v == nil { - e.e.EncodeNil() - } else { - fastpathTV.EncSliceInt16V(v, e) - } + fastpathTV.EncSliceInt16V(v, e) case *[]int16: if *v == nil { e.e.EncodeNil() @@ -331,11 +283,7 @@ func fastpathEncodeTypeSwitch(iv interface{}, e *Encoder) bool { fastpathTV.EncSliceInt16V(*v, e) } case []int32: - if v == nil { - e.e.EncodeNil() - } else { - fastpathTV.EncSliceInt32V(v, e) - } + fastpathTV.EncSliceInt32V(v, e) case *[]int32: if *v == nil { e.e.EncodeNil() @@ -343,11 +291,7 @@ func fastpathEncodeTypeSwitch(iv interface{}, e *Encoder) bool { fastpathTV.EncSliceInt32V(*v, e) } case []int64: - if v == nil { - e.e.EncodeNil() - } else { - fastpathTV.EncSliceInt64V(v, e) - } + fastpathTV.EncSliceInt64V(v, e) case *[]int64: if *v == nil { e.e.EncodeNil() @@ -355,11 +299,7 @@ func fastpathEncodeTypeSwitch(iv interface{}, e *Encoder) bool { fastpathTV.EncSliceInt64V(*v, e) } case []bool: - if v == nil { - e.e.EncodeNil() - } else { - fastpathTV.EncSliceBoolV(v, e) - } + fastpathTV.EncSliceBoolV(v, e) case *[]bool: if *v == nil { e.e.EncodeNil() @@ -3539,529 +3479,925 @@ func fastpathDecodeTypeSwitch(iv interface{}, d *Decoder) bool { *v = v2 } case map[string]interface{}: - fastpathTV.DecMapStringIntfL(v, d.mapStart(), d) + if containerLen = d.mapStart(); containerLen != decContainerLenNil { + fastpathTV.DecMapStringIntfL(v, containerLen, d) + } case *map[string]interface{}: containerLen = d.mapStart() + if containerLen == decContainerLenNil { + *v = nil + break + } if *v == nil { *v = make(map[string]interface{}, decInferLen(containerLen, d.h.MaxInitLen, 32)) } fastpathTV.DecMapStringIntfL(*v, containerLen, d) case map[string]string: - fastpathTV.DecMapStringStringL(v, d.mapStart(), d) + if containerLen = d.mapStart(); containerLen != decContainerLenNil { + fastpathTV.DecMapStringStringL(v, containerLen, d) + } case *map[string]string: containerLen = d.mapStart() + if containerLen == decContainerLenNil { + *v = nil + break + } if *v == nil { *v = make(map[string]string, decInferLen(containerLen, d.h.MaxInitLen, 32)) } fastpathTV.DecMapStringStringL(*v, containerLen, d) case map[string][]byte: - fastpathTV.DecMapStringBytesL(v, d.mapStart(), d) + if containerLen = d.mapStart(); containerLen != decContainerLenNil { + fastpathTV.DecMapStringBytesL(v, containerLen, d) + } case *map[string][]byte: containerLen = d.mapStart() + if containerLen == decContainerLenNil { + *v = nil + break + } if *v == nil { *v = make(map[string][]byte, decInferLen(containerLen, d.h.MaxInitLen, 40)) } fastpathTV.DecMapStringBytesL(*v, containerLen, d) case map[string]uint: - fastpathTV.DecMapStringUintL(v, d.mapStart(), d) + if containerLen = d.mapStart(); containerLen != decContainerLenNil { + fastpathTV.DecMapStringUintL(v, containerLen, d) + } case *map[string]uint: containerLen = d.mapStart() + if containerLen == decContainerLenNil { + *v = nil + break + } if *v == nil { *v = make(map[string]uint, decInferLen(containerLen, d.h.MaxInitLen, 24)) } fastpathTV.DecMapStringUintL(*v, containerLen, d) case map[string]uint8: - fastpathTV.DecMapStringUint8L(v, d.mapStart(), d) + if containerLen = d.mapStart(); containerLen != decContainerLenNil { + fastpathTV.DecMapStringUint8L(v, containerLen, d) + } case *map[string]uint8: containerLen = d.mapStart() + if containerLen == decContainerLenNil { + *v = nil + break + } if *v == nil { *v = make(map[string]uint8, decInferLen(containerLen, d.h.MaxInitLen, 17)) } fastpathTV.DecMapStringUint8L(*v, containerLen, d) case map[string]uint64: - fastpathTV.DecMapStringUint64L(v, d.mapStart(), d) + if containerLen = d.mapStart(); containerLen != decContainerLenNil { + fastpathTV.DecMapStringUint64L(v, containerLen, d) + } case *map[string]uint64: containerLen = d.mapStart() + if containerLen == decContainerLenNil { + *v = nil + break + } if *v == nil { *v = make(map[string]uint64, decInferLen(containerLen, d.h.MaxInitLen, 24)) } fastpathTV.DecMapStringUint64L(*v, containerLen, d) case map[string]int: - fastpathTV.DecMapStringIntL(v, d.mapStart(), d) + if containerLen = d.mapStart(); containerLen != decContainerLenNil { + fastpathTV.DecMapStringIntL(v, containerLen, d) + } case *map[string]int: containerLen = d.mapStart() + if containerLen == decContainerLenNil { + *v = nil + break + } if *v == nil { *v = make(map[string]int, decInferLen(containerLen, d.h.MaxInitLen, 24)) } fastpathTV.DecMapStringIntL(*v, containerLen, d) case map[string]int64: - fastpathTV.DecMapStringInt64L(v, d.mapStart(), d) + if containerLen = d.mapStart(); containerLen != decContainerLenNil { + fastpathTV.DecMapStringInt64L(v, containerLen, d) + } case *map[string]int64: containerLen = d.mapStart() + if containerLen == decContainerLenNil { + *v = nil + break + } if *v == nil { *v = make(map[string]int64, decInferLen(containerLen, d.h.MaxInitLen, 24)) } fastpathTV.DecMapStringInt64L(*v, containerLen, d) case map[string]float32: - fastpathTV.DecMapStringFloat32L(v, d.mapStart(), d) + if containerLen = d.mapStart(); containerLen != decContainerLenNil { + fastpathTV.DecMapStringFloat32L(v, containerLen, d) + } case *map[string]float32: containerLen = d.mapStart() + if containerLen == decContainerLenNil { + *v = nil + break + } if *v == nil { *v = make(map[string]float32, decInferLen(containerLen, d.h.MaxInitLen, 20)) } fastpathTV.DecMapStringFloat32L(*v, containerLen, d) case map[string]float64: - fastpathTV.DecMapStringFloat64L(v, d.mapStart(), d) + if containerLen = d.mapStart(); containerLen != decContainerLenNil { + fastpathTV.DecMapStringFloat64L(v, containerLen, d) + } case *map[string]float64: containerLen = d.mapStart() + if containerLen == decContainerLenNil { + *v = nil + break + } if *v == nil { *v = make(map[string]float64, decInferLen(containerLen, d.h.MaxInitLen, 24)) } fastpathTV.DecMapStringFloat64L(*v, containerLen, d) case map[string]bool: - fastpathTV.DecMapStringBoolL(v, d.mapStart(), d) + if containerLen = d.mapStart(); containerLen != decContainerLenNil { + fastpathTV.DecMapStringBoolL(v, containerLen, d) + } case *map[string]bool: containerLen = d.mapStart() + if containerLen == decContainerLenNil { + *v = nil + break + } if *v == nil { *v = make(map[string]bool, decInferLen(containerLen, d.h.MaxInitLen, 17)) } fastpathTV.DecMapStringBoolL(*v, containerLen, d) case map[uint]interface{}: - fastpathTV.DecMapUintIntfL(v, d.mapStart(), d) + if containerLen = d.mapStart(); containerLen != decContainerLenNil { + fastpathTV.DecMapUintIntfL(v, containerLen, d) + } case *map[uint]interface{}: containerLen = d.mapStart() + if containerLen == decContainerLenNil { + *v = nil + break + } if *v == nil { *v = make(map[uint]interface{}, decInferLen(containerLen, d.h.MaxInitLen, 24)) } fastpathTV.DecMapUintIntfL(*v, containerLen, d) case map[uint]string: - fastpathTV.DecMapUintStringL(v, d.mapStart(), d) + if containerLen = d.mapStart(); containerLen != decContainerLenNil { + fastpathTV.DecMapUintStringL(v, containerLen, d) + } case *map[uint]string: containerLen = d.mapStart() + if containerLen == decContainerLenNil { + *v = nil + break + } if *v == nil { *v = make(map[uint]string, decInferLen(containerLen, d.h.MaxInitLen, 24)) } fastpathTV.DecMapUintStringL(*v, containerLen, d) case map[uint][]byte: - fastpathTV.DecMapUintBytesL(v, d.mapStart(), d) + if containerLen = d.mapStart(); containerLen != decContainerLenNil { + fastpathTV.DecMapUintBytesL(v, containerLen, d) + } case *map[uint][]byte: containerLen = d.mapStart() + if containerLen == decContainerLenNil { + *v = nil + break + } if *v == nil { *v = make(map[uint][]byte, decInferLen(containerLen, d.h.MaxInitLen, 32)) } fastpathTV.DecMapUintBytesL(*v, containerLen, d) case map[uint]uint: - fastpathTV.DecMapUintUintL(v, d.mapStart(), d) + if containerLen = d.mapStart(); containerLen != decContainerLenNil { + fastpathTV.DecMapUintUintL(v, containerLen, d) + } case *map[uint]uint: containerLen = d.mapStart() + if containerLen == decContainerLenNil { + *v = nil + break + } if *v == nil { *v = make(map[uint]uint, decInferLen(containerLen, d.h.MaxInitLen, 16)) } fastpathTV.DecMapUintUintL(*v, containerLen, d) case map[uint]uint8: - fastpathTV.DecMapUintUint8L(v, d.mapStart(), d) + if containerLen = d.mapStart(); containerLen != decContainerLenNil { + fastpathTV.DecMapUintUint8L(v, containerLen, d) + } case *map[uint]uint8: containerLen = d.mapStart() + if containerLen == decContainerLenNil { + *v = nil + break + } if *v == nil { *v = make(map[uint]uint8, decInferLen(containerLen, d.h.MaxInitLen, 9)) } fastpathTV.DecMapUintUint8L(*v, containerLen, d) case map[uint]uint64: - fastpathTV.DecMapUintUint64L(v, d.mapStart(), d) + if containerLen = d.mapStart(); containerLen != decContainerLenNil { + fastpathTV.DecMapUintUint64L(v, containerLen, d) + } case *map[uint]uint64: containerLen = d.mapStart() + if containerLen == decContainerLenNil { + *v = nil + break + } if *v == nil { *v = make(map[uint]uint64, decInferLen(containerLen, d.h.MaxInitLen, 16)) } fastpathTV.DecMapUintUint64L(*v, containerLen, d) case map[uint]int: - fastpathTV.DecMapUintIntL(v, d.mapStart(), d) + if containerLen = d.mapStart(); containerLen != decContainerLenNil { + fastpathTV.DecMapUintIntL(v, containerLen, d) + } case *map[uint]int: containerLen = d.mapStart() + if containerLen == decContainerLenNil { + *v = nil + break + } if *v == nil { *v = make(map[uint]int, decInferLen(containerLen, d.h.MaxInitLen, 16)) } fastpathTV.DecMapUintIntL(*v, containerLen, d) case map[uint]int64: - fastpathTV.DecMapUintInt64L(v, d.mapStart(), d) + if containerLen = d.mapStart(); containerLen != decContainerLenNil { + fastpathTV.DecMapUintInt64L(v, containerLen, d) + } case *map[uint]int64: containerLen = d.mapStart() + if containerLen == decContainerLenNil { + *v = nil + break + } if *v == nil { *v = make(map[uint]int64, decInferLen(containerLen, d.h.MaxInitLen, 16)) } fastpathTV.DecMapUintInt64L(*v, containerLen, d) case map[uint]float32: - fastpathTV.DecMapUintFloat32L(v, d.mapStart(), d) + if containerLen = d.mapStart(); containerLen != decContainerLenNil { + fastpathTV.DecMapUintFloat32L(v, containerLen, d) + } case *map[uint]float32: containerLen = d.mapStart() + if containerLen == decContainerLenNil { + *v = nil + break + } if *v == nil { *v = make(map[uint]float32, decInferLen(containerLen, d.h.MaxInitLen, 12)) } fastpathTV.DecMapUintFloat32L(*v, containerLen, d) case map[uint]float64: - fastpathTV.DecMapUintFloat64L(v, d.mapStart(), d) + if containerLen = d.mapStart(); containerLen != decContainerLenNil { + fastpathTV.DecMapUintFloat64L(v, containerLen, d) + } case *map[uint]float64: containerLen = d.mapStart() + if containerLen == decContainerLenNil { + *v = nil + break + } if *v == nil { *v = make(map[uint]float64, decInferLen(containerLen, d.h.MaxInitLen, 16)) } fastpathTV.DecMapUintFloat64L(*v, containerLen, d) case map[uint]bool: - fastpathTV.DecMapUintBoolL(v, d.mapStart(), d) + if containerLen = d.mapStart(); containerLen != decContainerLenNil { + fastpathTV.DecMapUintBoolL(v, containerLen, d) + } case *map[uint]bool: containerLen = d.mapStart() + if containerLen == decContainerLenNil { + *v = nil + break + } if *v == nil { *v = make(map[uint]bool, decInferLen(containerLen, d.h.MaxInitLen, 9)) } fastpathTV.DecMapUintBoolL(*v, containerLen, d) case map[uint8]interface{}: - fastpathTV.DecMapUint8IntfL(v, d.mapStart(), d) + if containerLen = d.mapStart(); containerLen != decContainerLenNil { + fastpathTV.DecMapUint8IntfL(v, containerLen, d) + } case *map[uint8]interface{}: containerLen = d.mapStart() + if containerLen == decContainerLenNil { + *v = nil + break + } if *v == nil { *v = make(map[uint8]interface{}, decInferLen(containerLen, d.h.MaxInitLen, 17)) } fastpathTV.DecMapUint8IntfL(*v, containerLen, d) case map[uint8]string: - fastpathTV.DecMapUint8StringL(v, d.mapStart(), d) + if containerLen = d.mapStart(); containerLen != decContainerLenNil { + fastpathTV.DecMapUint8StringL(v, containerLen, d) + } case *map[uint8]string: containerLen = d.mapStart() + if containerLen == decContainerLenNil { + *v = nil + break + } if *v == nil { *v = make(map[uint8]string, decInferLen(containerLen, d.h.MaxInitLen, 17)) } fastpathTV.DecMapUint8StringL(*v, containerLen, d) case map[uint8][]byte: - fastpathTV.DecMapUint8BytesL(v, d.mapStart(), d) + if containerLen = d.mapStart(); containerLen != decContainerLenNil { + fastpathTV.DecMapUint8BytesL(v, containerLen, d) + } case *map[uint8][]byte: containerLen = d.mapStart() + if containerLen == decContainerLenNil { + *v = nil + break + } if *v == nil { *v = make(map[uint8][]byte, decInferLen(containerLen, d.h.MaxInitLen, 25)) } fastpathTV.DecMapUint8BytesL(*v, containerLen, d) case map[uint8]uint: - fastpathTV.DecMapUint8UintL(v, d.mapStart(), d) + if containerLen = d.mapStart(); containerLen != decContainerLenNil { + fastpathTV.DecMapUint8UintL(v, containerLen, d) + } case *map[uint8]uint: containerLen = d.mapStart() + if containerLen == decContainerLenNil { + *v = nil + break + } if *v == nil { *v = make(map[uint8]uint, decInferLen(containerLen, d.h.MaxInitLen, 9)) } fastpathTV.DecMapUint8UintL(*v, containerLen, d) case map[uint8]uint8: - fastpathTV.DecMapUint8Uint8L(v, d.mapStart(), d) + if containerLen = d.mapStart(); containerLen != decContainerLenNil { + fastpathTV.DecMapUint8Uint8L(v, containerLen, d) + } case *map[uint8]uint8: containerLen = d.mapStart() + if containerLen == decContainerLenNil { + *v = nil + break + } if *v == nil { *v = make(map[uint8]uint8, decInferLen(containerLen, d.h.MaxInitLen, 2)) } fastpathTV.DecMapUint8Uint8L(*v, containerLen, d) case map[uint8]uint64: - fastpathTV.DecMapUint8Uint64L(v, d.mapStart(), d) + if containerLen = d.mapStart(); containerLen != decContainerLenNil { + fastpathTV.DecMapUint8Uint64L(v, containerLen, d) + } case *map[uint8]uint64: containerLen = d.mapStart() + if containerLen == decContainerLenNil { + *v = nil + break + } if *v == nil { *v = make(map[uint8]uint64, decInferLen(containerLen, d.h.MaxInitLen, 9)) } fastpathTV.DecMapUint8Uint64L(*v, containerLen, d) case map[uint8]int: - fastpathTV.DecMapUint8IntL(v, d.mapStart(), d) + if containerLen = d.mapStart(); containerLen != decContainerLenNil { + fastpathTV.DecMapUint8IntL(v, containerLen, d) + } case *map[uint8]int: containerLen = d.mapStart() + if containerLen == decContainerLenNil { + *v = nil + break + } if *v == nil { *v = make(map[uint8]int, decInferLen(containerLen, d.h.MaxInitLen, 9)) } fastpathTV.DecMapUint8IntL(*v, containerLen, d) case map[uint8]int64: - fastpathTV.DecMapUint8Int64L(v, d.mapStart(), d) + if containerLen = d.mapStart(); containerLen != decContainerLenNil { + fastpathTV.DecMapUint8Int64L(v, containerLen, d) + } case *map[uint8]int64: containerLen = d.mapStart() + if containerLen == decContainerLenNil { + *v = nil + break + } if *v == nil { *v = make(map[uint8]int64, decInferLen(containerLen, d.h.MaxInitLen, 9)) } fastpathTV.DecMapUint8Int64L(*v, containerLen, d) case map[uint8]float32: - fastpathTV.DecMapUint8Float32L(v, d.mapStart(), d) + if containerLen = d.mapStart(); containerLen != decContainerLenNil { + fastpathTV.DecMapUint8Float32L(v, containerLen, d) + } case *map[uint8]float32: containerLen = d.mapStart() + if containerLen == decContainerLenNil { + *v = nil + break + } if *v == nil { *v = make(map[uint8]float32, decInferLen(containerLen, d.h.MaxInitLen, 5)) } fastpathTV.DecMapUint8Float32L(*v, containerLen, d) case map[uint8]float64: - fastpathTV.DecMapUint8Float64L(v, d.mapStart(), d) + if containerLen = d.mapStart(); containerLen != decContainerLenNil { + fastpathTV.DecMapUint8Float64L(v, containerLen, d) + } case *map[uint8]float64: containerLen = d.mapStart() + if containerLen == decContainerLenNil { + *v = nil + break + } if *v == nil { *v = make(map[uint8]float64, decInferLen(containerLen, d.h.MaxInitLen, 9)) } fastpathTV.DecMapUint8Float64L(*v, containerLen, d) case map[uint8]bool: - fastpathTV.DecMapUint8BoolL(v, d.mapStart(), d) + if containerLen = d.mapStart(); containerLen != decContainerLenNil { + fastpathTV.DecMapUint8BoolL(v, containerLen, d) + } case *map[uint8]bool: containerLen = d.mapStart() + if containerLen == decContainerLenNil { + *v = nil + break + } if *v == nil { *v = make(map[uint8]bool, decInferLen(containerLen, d.h.MaxInitLen, 2)) } fastpathTV.DecMapUint8BoolL(*v, containerLen, d) case map[uint64]interface{}: - fastpathTV.DecMapUint64IntfL(v, d.mapStart(), d) + if containerLen = d.mapStart(); containerLen != decContainerLenNil { + fastpathTV.DecMapUint64IntfL(v, containerLen, d) + } case *map[uint64]interface{}: containerLen = d.mapStart() + if containerLen == decContainerLenNil { + *v = nil + break + } if *v == nil { *v = make(map[uint64]interface{}, decInferLen(containerLen, d.h.MaxInitLen, 24)) } fastpathTV.DecMapUint64IntfL(*v, containerLen, d) case map[uint64]string: - fastpathTV.DecMapUint64StringL(v, d.mapStart(), d) + if containerLen = d.mapStart(); containerLen != decContainerLenNil { + fastpathTV.DecMapUint64StringL(v, containerLen, d) + } case *map[uint64]string: containerLen = d.mapStart() + if containerLen == decContainerLenNil { + *v = nil + break + } if *v == nil { *v = make(map[uint64]string, decInferLen(containerLen, d.h.MaxInitLen, 24)) } fastpathTV.DecMapUint64StringL(*v, containerLen, d) case map[uint64][]byte: - fastpathTV.DecMapUint64BytesL(v, d.mapStart(), d) + if containerLen = d.mapStart(); containerLen != decContainerLenNil { + fastpathTV.DecMapUint64BytesL(v, containerLen, d) + } case *map[uint64][]byte: containerLen = d.mapStart() + if containerLen == decContainerLenNil { + *v = nil + break + } if *v == nil { *v = make(map[uint64][]byte, decInferLen(containerLen, d.h.MaxInitLen, 32)) } fastpathTV.DecMapUint64BytesL(*v, containerLen, d) case map[uint64]uint: - fastpathTV.DecMapUint64UintL(v, d.mapStart(), d) + if containerLen = d.mapStart(); containerLen != decContainerLenNil { + fastpathTV.DecMapUint64UintL(v, containerLen, d) + } case *map[uint64]uint: containerLen = d.mapStart() + if containerLen == decContainerLenNil { + *v = nil + break + } if *v == nil { *v = make(map[uint64]uint, decInferLen(containerLen, d.h.MaxInitLen, 16)) } fastpathTV.DecMapUint64UintL(*v, containerLen, d) case map[uint64]uint8: - fastpathTV.DecMapUint64Uint8L(v, d.mapStart(), d) + if containerLen = d.mapStart(); containerLen != decContainerLenNil { + fastpathTV.DecMapUint64Uint8L(v, containerLen, d) + } case *map[uint64]uint8: containerLen = d.mapStart() + if containerLen == decContainerLenNil { + *v = nil + break + } if *v == nil { *v = make(map[uint64]uint8, decInferLen(containerLen, d.h.MaxInitLen, 9)) } fastpathTV.DecMapUint64Uint8L(*v, containerLen, d) case map[uint64]uint64: - fastpathTV.DecMapUint64Uint64L(v, d.mapStart(), d) + if containerLen = d.mapStart(); containerLen != decContainerLenNil { + fastpathTV.DecMapUint64Uint64L(v, containerLen, d) + } case *map[uint64]uint64: containerLen = d.mapStart() + if containerLen == decContainerLenNil { + *v = nil + break + } if *v == nil { *v = make(map[uint64]uint64, decInferLen(containerLen, d.h.MaxInitLen, 16)) } fastpathTV.DecMapUint64Uint64L(*v, containerLen, d) case map[uint64]int: - fastpathTV.DecMapUint64IntL(v, d.mapStart(), d) + if containerLen = d.mapStart(); containerLen != decContainerLenNil { + fastpathTV.DecMapUint64IntL(v, containerLen, d) + } case *map[uint64]int: containerLen = d.mapStart() + if containerLen == decContainerLenNil { + *v = nil + break + } if *v == nil { *v = make(map[uint64]int, decInferLen(containerLen, d.h.MaxInitLen, 16)) } fastpathTV.DecMapUint64IntL(*v, containerLen, d) case map[uint64]int64: - fastpathTV.DecMapUint64Int64L(v, d.mapStart(), d) + if containerLen = d.mapStart(); containerLen != decContainerLenNil { + fastpathTV.DecMapUint64Int64L(v, containerLen, d) + } case *map[uint64]int64: containerLen = d.mapStart() + if containerLen == decContainerLenNil { + *v = nil + break + } if *v == nil { *v = make(map[uint64]int64, decInferLen(containerLen, d.h.MaxInitLen, 16)) } fastpathTV.DecMapUint64Int64L(*v, containerLen, d) case map[uint64]float32: - fastpathTV.DecMapUint64Float32L(v, d.mapStart(), d) + if containerLen = d.mapStart(); containerLen != decContainerLenNil { + fastpathTV.DecMapUint64Float32L(v, containerLen, d) + } case *map[uint64]float32: containerLen = d.mapStart() + if containerLen == decContainerLenNil { + *v = nil + break + } if *v == nil { *v = make(map[uint64]float32, decInferLen(containerLen, d.h.MaxInitLen, 12)) } fastpathTV.DecMapUint64Float32L(*v, containerLen, d) case map[uint64]float64: - fastpathTV.DecMapUint64Float64L(v, d.mapStart(), d) + if containerLen = d.mapStart(); containerLen != decContainerLenNil { + fastpathTV.DecMapUint64Float64L(v, containerLen, d) + } case *map[uint64]float64: containerLen = d.mapStart() + if containerLen == decContainerLenNil { + *v = nil + break + } if *v == nil { *v = make(map[uint64]float64, decInferLen(containerLen, d.h.MaxInitLen, 16)) } fastpathTV.DecMapUint64Float64L(*v, containerLen, d) case map[uint64]bool: - fastpathTV.DecMapUint64BoolL(v, d.mapStart(), d) + if containerLen = d.mapStart(); containerLen != decContainerLenNil { + fastpathTV.DecMapUint64BoolL(v, containerLen, d) + } case *map[uint64]bool: containerLen = d.mapStart() + if containerLen == decContainerLenNil { + *v = nil + break + } if *v == nil { *v = make(map[uint64]bool, decInferLen(containerLen, d.h.MaxInitLen, 9)) } fastpathTV.DecMapUint64BoolL(*v, containerLen, d) case map[int]interface{}: - fastpathTV.DecMapIntIntfL(v, d.mapStart(), d) + if containerLen = d.mapStart(); containerLen != decContainerLenNil { + fastpathTV.DecMapIntIntfL(v, containerLen, d) + } case *map[int]interface{}: containerLen = d.mapStart() + if containerLen == decContainerLenNil { + *v = nil + break + } if *v == nil { *v = make(map[int]interface{}, decInferLen(containerLen, d.h.MaxInitLen, 24)) } fastpathTV.DecMapIntIntfL(*v, containerLen, d) case map[int]string: - fastpathTV.DecMapIntStringL(v, d.mapStart(), d) + if containerLen = d.mapStart(); containerLen != decContainerLenNil { + fastpathTV.DecMapIntStringL(v, containerLen, d) + } case *map[int]string: containerLen = d.mapStart() + if containerLen == decContainerLenNil { + *v = nil + break + } if *v == nil { *v = make(map[int]string, decInferLen(containerLen, d.h.MaxInitLen, 24)) } fastpathTV.DecMapIntStringL(*v, containerLen, d) case map[int][]byte: - fastpathTV.DecMapIntBytesL(v, d.mapStart(), d) + if containerLen = d.mapStart(); containerLen != decContainerLenNil { + fastpathTV.DecMapIntBytesL(v, containerLen, d) + } case *map[int][]byte: containerLen = d.mapStart() + if containerLen == decContainerLenNil { + *v = nil + break + } if *v == nil { *v = make(map[int][]byte, decInferLen(containerLen, d.h.MaxInitLen, 32)) } fastpathTV.DecMapIntBytesL(*v, containerLen, d) case map[int]uint: - fastpathTV.DecMapIntUintL(v, d.mapStart(), d) + if containerLen = d.mapStart(); containerLen != decContainerLenNil { + fastpathTV.DecMapIntUintL(v, containerLen, d) + } case *map[int]uint: containerLen = d.mapStart() + if containerLen == decContainerLenNil { + *v = nil + break + } if *v == nil { *v = make(map[int]uint, decInferLen(containerLen, d.h.MaxInitLen, 16)) } fastpathTV.DecMapIntUintL(*v, containerLen, d) case map[int]uint8: - fastpathTV.DecMapIntUint8L(v, d.mapStart(), d) + if containerLen = d.mapStart(); containerLen != decContainerLenNil { + fastpathTV.DecMapIntUint8L(v, containerLen, d) + } case *map[int]uint8: containerLen = d.mapStart() + if containerLen == decContainerLenNil { + *v = nil + break + } if *v == nil { *v = make(map[int]uint8, decInferLen(containerLen, d.h.MaxInitLen, 9)) } fastpathTV.DecMapIntUint8L(*v, containerLen, d) case map[int]uint64: - fastpathTV.DecMapIntUint64L(v, d.mapStart(), d) + if containerLen = d.mapStart(); containerLen != decContainerLenNil { + fastpathTV.DecMapIntUint64L(v, containerLen, d) + } case *map[int]uint64: containerLen = d.mapStart() + if containerLen == decContainerLenNil { + *v = nil + break + } if *v == nil { *v = make(map[int]uint64, decInferLen(containerLen, d.h.MaxInitLen, 16)) } fastpathTV.DecMapIntUint64L(*v, containerLen, d) case map[int]int: - fastpathTV.DecMapIntIntL(v, d.mapStart(), d) + if containerLen = d.mapStart(); containerLen != decContainerLenNil { + fastpathTV.DecMapIntIntL(v, containerLen, d) + } case *map[int]int: containerLen = d.mapStart() + if containerLen == decContainerLenNil { + *v = nil + break + } if *v == nil { *v = make(map[int]int, decInferLen(containerLen, d.h.MaxInitLen, 16)) } fastpathTV.DecMapIntIntL(*v, containerLen, d) case map[int]int64: - fastpathTV.DecMapIntInt64L(v, d.mapStart(), d) + if containerLen = d.mapStart(); containerLen != decContainerLenNil { + fastpathTV.DecMapIntInt64L(v, containerLen, d) + } case *map[int]int64: containerLen = d.mapStart() + if containerLen == decContainerLenNil { + *v = nil + break + } if *v == nil { *v = make(map[int]int64, decInferLen(containerLen, d.h.MaxInitLen, 16)) } fastpathTV.DecMapIntInt64L(*v, containerLen, d) case map[int]float32: - fastpathTV.DecMapIntFloat32L(v, d.mapStart(), d) + if containerLen = d.mapStart(); containerLen != decContainerLenNil { + fastpathTV.DecMapIntFloat32L(v, containerLen, d) + } case *map[int]float32: containerLen = d.mapStart() + if containerLen == decContainerLenNil { + *v = nil + break + } if *v == nil { *v = make(map[int]float32, decInferLen(containerLen, d.h.MaxInitLen, 12)) } fastpathTV.DecMapIntFloat32L(*v, containerLen, d) case map[int]float64: - fastpathTV.DecMapIntFloat64L(v, d.mapStart(), d) + if containerLen = d.mapStart(); containerLen != decContainerLenNil { + fastpathTV.DecMapIntFloat64L(v, containerLen, d) + } case *map[int]float64: containerLen = d.mapStart() + if containerLen == decContainerLenNil { + *v = nil + break + } if *v == nil { *v = make(map[int]float64, decInferLen(containerLen, d.h.MaxInitLen, 16)) } fastpathTV.DecMapIntFloat64L(*v, containerLen, d) case map[int]bool: - fastpathTV.DecMapIntBoolL(v, d.mapStart(), d) + if containerLen = d.mapStart(); containerLen != decContainerLenNil { + fastpathTV.DecMapIntBoolL(v, containerLen, d) + } case *map[int]bool: containerLen = d.mapStart() + if containerLen == decContainerLenNil { + *v = nil + break + } if *v == nil { *v = make(map[int]bool, decInferLen(containerLen, d.h.MaxInitLen, 9)) } fastpathTV.DecMapIntBoolL(*v, containerLen, d) case map[int64]interface{}: - fastpathTV.DecMapInt64IntfL(v, d.mapStart(), d) + if containerLen = d.mapStart(); containerLen != decContainerLenNil { + fastpathTV.DecMapInt64IntfL(v, containerLen, d) + } case *map[int64]interface{}: containerLen = d.mapStart() + if containerLen == decContainerLenNil { + *v = nil + break + } if *v == nil { *v = make(map[int64]interface{}, decInferLen(containerLen, d.h.MaxInitLen, 24)) } fastpathTV.DecMapInt64IntfL(*v, containerLen, d) case map[int64]string: - fastpathTV.DecMapInt64StringL(v, d.mapStart(), d) + if containerLen = d.mapStart(); containerLen != decContainerLenNil { + fastpathTV.DecMapInt64StringL(v, containerLen, d) + } case *map[int64]string: containerLen = d.mapStart() + if containerLen == decContainerLenNil { + *v = nil + break + } if *v == nil { *v = make(map[int64]string, decInferLen(containerLen, d.h.MaxInitLen, 24)) } fastpathTV.DecMapInt64StringL(*v, containerLen, d) case map[int64][]byte: - fastpathTV.DecMapInt64BytesL(v, d.mapStart(), d) + if containerLen = d.mapStart(); containerLen != decContainerLenNil { + fastpathTV.DecMapInt64BytesL(v, containerLen, d) + } case *map[int64][]byte: containerLen = d.mapStart() + if containerLen == decContainerLenNil { + *v = nil + break + } if *v == nil { *v = make(map[int64][]byte, decInferLen(containerLen, d.h.MaxInitLen, 32)) } fastpathTV.DecMapInt64BytesL(*v, containerLen, d) case map[int64]uint: - fastpathTV.DecMapInt64UintL(v, d.mapStart(), d) + if containerLen = d.mapStart(); containerLen != decContainerLenNil { + fastpathTV.DecMapInt64UintL(v, containerLen, d) + } case *map[int64]uint: containerLen = d.mapStart() + if containerLen == decContainerLenNil { + *v = nil + break + } if *v == nil { *v = make(map[int64]uint, decInferLen(containerLen, d.h.MaxInitLen, 16)) } fastpathTV.DecMapInt64UintL(*v, containerLen, d) case map[int64]uint8: - fastpathTV.DecMapInt64Uint8L(v, d.mapStart(), d) + if containerLen = d.mapStart(); containerLen != decContainerLenNil { + fastpathTV.DecMapInt64Uint8L(v, containerLen, d) + } case *map[int64]uint8: containerLen = d.mapStart() + if containerLen == decContainerLenNil { + *v = nil + break + } if *v == nil { *v = make(map[int64]uint8, decInferLen(containerLen, d.h.MaxInitLen, 9)) } fastpathTV.DecMapInt64Uint8L(*v, containerLen, d) case map[int64]uint64: - fastpathTV.DecMapInt64Uint64L(v, d.mapStart(), d) + if containerLen = d.mapStart(); containerLen != decContainerLenNil { + fastpathTV.DecMapInt64Uint64L(v, containerLen, d) + } case *map[int64]uint64: containerLen = d.mapStart() + if containerLen == decContainerLenNil { + *v = nil + break + } if *v == nil { *v = make(map[int64]uint64, decInferLen(containerLen, d.h.MaxInitLen, 16)) } fastpathTV.DecMapInt64Uint64L(*v, containerLen, d) case map[int64]int: - fastpathTV.DecMapInt64IntL(v, d.mapStart(), d) + if containerLen = d.mapStart(); containerLen != decContainerLenNil { + fastpathTV.DecMapInt64IntL(v, containerLen, d) + } case *map[int64]int: containerLen = d.mapStart() + if containerLen == decContainerLenNil { + *v = nil + break + } if *v == nil { *v = make(map[int64]int, decInferLen(containerLen, d.h.MaxInitLen, 16)) } fastpathTV.DecMapInt64IntL(*v, containerLen, d) case map[int64]int64: - fastpathTV.DecMapInt64Int64L(v, d.mapStart(), d) + if containerLen = d.mapStart(); containerLen != decContainerLenNil { + fastpathTV.DecMapInt64Int64L(v, containerLen, d) + } case *map[int64]int64: containerLen = d.mapStart() + if containerLen == decContainerLenNil { + *v = nil + break + } if *v == nil { *v = make(map[int64]int64, decInferLen(containerLen, d.h.MaxInitLen, 16)) } fastpathTV.DecMapInt64Int64L(*v, containerLen, d) case map[int64]float32: - fastpathTV.DecMapInt64Float32L(v, d.mapStart(), d) + if containerLen = d.mapStart(); containerLen != decContainerLenNil { + fastpathTV.DecMapInt64Float32L(v, containerLen, d) + } case *map[int64]float32: containerLen = d.mapStart() + if containerLen == decContainerLenNil { + *v = nil + break + } if *v == nil { *v = make(map[int64]float32, decInferLen(containerLen, d.h.MaxInitLen, 12)) } fastpathTV.DecMapInt64Float32L(*v, containerLen, d) case map[int64]float64: - fastpathTV.DecMapInt64Float64L(v, d.mapStart(), d) + if containerLen = d.mapStart(); containerLen != decContainerLenNil { + fastpathTV.DecMapInt64Float64L(v, containerLen, d) + } case *map[int64]float64: containerLen = d.mapStart() + if containerLen == decContainerLenNil { + *v = nil + break + } if *v == nil { *v = make(map[int64]float64, decInferLen(containerLen, d.h.MaxInitLen, 16)) } fastpathTV.DecMapInt64Float64L(*v, containerLen, d) case map[int64]bool: - fastpathTV.DecMapInt64BoolL(v, d.mapStart(), d) + if containerLen = d.mapStart(); containerLen != decContainerLenNil { + fastpathTV.DecMapInt64BoolL(v, containerLen, d) + } case *map[int64]bool: containerLen = d.mapStart() + if containerLen == decContainerLenNil { + *v = nil + break + } if *v == nil { *v = make(map[int64]bool, decInferLen(containerLen, d.h.MaxInitLen, 9)) } @@ -4265,6 +4601,12 @@ func (f fastpathT) DecSliceIntfX(vp *[]interface{}, d *Decoder) { } func (fastpathT) DecSliceIntfY(v []interface{}, d *Decoder) (_ []interface{}, changed bool) { slh, containerLenS := d.decSliceHelperStart() + if slh.IsNil { + if v == nil { + return + } + return nil, true + } if containerLenS == 0 { if v == nil { v = []interface{}{} @@ -4306,11 +4648,7 @@ func (fastpathT) DecSliceIntfY(v []interface{}, d *Decoder) (_ []interface{}, ch changed = true } slh.ElemContainerState(j) - if d.d.TryDecodeAsNil() { - v[uint(j)] = nil - } else { - d.decode(&v[uint(j)]) - } + d.decode(&v[uint(j)]) } if j < len(v) { v = v[:uint(j)] @@ -4324,6 +4662,9 @@ func (fastpathT) DecSliceIntfY(v []interface{}, d *Decoder) (_ []interface{}, ch } func (fastpathT) DecSliceIntfN(v []interface{}, d *Decoder) { slh, containerLenS := d.decSliceHelperStart() + if slh.IsNil { + return + } if containerLenS == 0 { slh.End() return @@ -4341,11 +4682,7 @@ func (fastpathT) DecSliceIntfN(v []interface{}, d *Decoder) { break } slh.ElemContainerState(j) - if d.d.TryDecodeAsNil() { - v[uint(j)] = nil - } else { - d.decode(&v[uint(j)]) - } + d.decode(&v[uint(j)]) } slh.End() } @@ -4367,6 +4704,12 @@ func (f fastpathT) DecSliceStringX(vp *[]string, d *Decoder) { } func (fastpathT) DecSliceStringY(v []string, d *Decoder) (_ []string, changed bool) { slh, containerLenS := d.decSliceHelperStart() + if slh.IsNil { + if v == nil { + return + } + return nil, true + } if containerLenS == 0 { if v == nil { v = []string{} @@ -4408,11 +4751,7 @@ func (fastpathT) DecSliceStringY(v []string, d *Decoder) (_ []string, changed bo changed = true } slh.ElemContainerState(j) - if d.d.TryDecodeAsNil() { - v[uint(j)] = "" - } else { - v[uint(j)] = string(d.d.DecodeStringAsBytes()) - } + v[uint(j)] = string(d.d.DecodeStringAsBytes()) } if j < len(v) { v = v[:uint(j)] @@ -4426,6 +4765,9 @@ func (fastpathT) DecSliceStringY(v []string, d *Decoder) (_ []string, changed bo } func (fastpathT) DecSliceStringN(v []string, d *Decoder) { slh, containerLenS := d.decSliceHelperStart() + if slh.IsNil { + return + } if containerLenS == 0 { slh.End() return @@ -4443,11 +4785,7 @@ func (fastpathT) DecSliceStringN(v []string, d *Decoder) { break } slh.ElemContainerState(j) - if d.d.TryDecodeAsNil() { - v[uint(j)] = "" - } else { - v[uint(j)] = string(d.d.DecodeStringAsBytes()) - } + v[uint(j)] = string(d.d.DecodeStringAsBytes()) } slh.End() } @@ -4469,6 +4807,12 @@ func (f fastpathT) DecSliceBytesX(vp *[][]byte, d *Decoder) { } func (fastpathT) DecSliceBytesY(v [][]byte, d *Decoder) (_ [][]byte, changed bool) { slh, containerLenS := d.decSliceHelperStart() + if slh.IsNil { + if v == nil { + return + } + return nil, true + } if containerLenS == 0 { if v == nil { v = [][]byte{} @@ -4510,11 +4854,7 @@ func (fastpathT) DecSliceBytesY(v [][]byte, d *Decoder) (_ [][]byte, changed boo changed = true } slh.ElemContainerState(j) - if d.d.TryDecodeAsNil() { - v[uint(j)] = nil - } else { - v[uint(j)] = d.d.DecodeBytes(nil, false) - } + v[uint(j)] = d.d.DecodeBytes(nil, false) } if j < len(v) { v = v[:uint(j)] @@ -4528,6 +4868,9 @@ func (fastpathT) DecSliceBytesY(v [][]byte, d *Decoder) (_ [][]byte, changed boo } func (fastpathT) DecSliceBytesN(v [][]byte, d *Decoder) { slh, containerLenS := d.decSliceHelperStart() + if slh.IsNil { + return + } if containerLenS == 0 { slh.End() return @@ -4545,11 +4888,7 @@ func (fastpathT) DecSliceBytesN(v [][]byte, d *Decoder) { break } slh.ElemContainerState(j) - if d.d.TryDecodeAsNil() { - v[uint(j)] = nil - } else { - v[uint(j)] = d.d.DecodeBytes(nil, false) - } + v[uint(j)] = d.d.DecodeBytes(nil, false) } slh.End() } @@ -4571,6 +4910,12 @@ func (f fastpathT) DecSliceFloat32X(vp *[]float32, d *Decoder) { } func (fastpathT) DecSliceFloat32Y(v []float32, d *Decoder) (_ []float32, changed bool) { slh, containerLenS := d.decSliceHelperStart() + if slh.IsNil { + if v == nil { + return + } + return nil, true + } if containerLenS == 0 { if v == nil { v = []float32{} @@ -4612,11 +4957,7 @@ func (fastpathT) DecSliceFloat32Y(v []float32, d *Decoder) (_ []float32, changed changed = true } slh.ElemContainerState(j) - if d.d.TryDecodeAsNil() { - v[uint(j)] = 0 - } else { - v[uint(j)] = float32(d.decodeFloat32()) - } + v[uint(j)] = float32(d.decodeFloat32()) } if j < len(v) { v = v[:uint(j)] @@ -4630,6 +4971,9 @@ func (fastpathT) DecSliceFloat32Y(v []float32, d *Decoder) (_ []float32, changed } func (fastpathT) DecSliceFloat32N(v []float32, d *Decoder) { slh, containerLenS := d.decSliceHelperStart() + if slh.IsNil { + return + } if containerLenS == 0 { slh.End() return @@ -4647,11 +4991,7 @@ func (fastpathT) DecSliceFloat32N(v []float32, d *Decoder) { break } slh.ElemContainerState(j) - if d.d.TryDecodeAsNil() { - v[uint(j)] = 0 - } else { - v[uint(j)] = float32(d.decodeFloat32()) - } + v[uint(j)] = float32(d.decodeFloat32()) } slh.End() } @@ -4673,6 +5013,12 @@ func (f fastpathT) DecSliceFloat64X(vp *[]float64, d *Decoder) { } func (fastpathT) DecSliceFloat64Y(v []float64, d *Decoder) (_ []float64, changed bool) { slh, containerLenS := d.decSliceHelperStart() + if slh.IsNil { + if v == nil { + return + } + return nil, true + } if containerLenS == 0 { if v == nil { v = []float64{} @@ -4714,11 +5060,7 @@ func (fastpathT) DecSliceFloat64Y(v []float64, d *Decoder) (_ []float64, changed changed = true } slh.ElemContainerState(j) - if d.d.TryDecodeAsNil() { - v[uint(j)] = 0 - } else { - v[uint(j)] = d.d.DecodeFloat64() - } + v[uint(j)] = d.d.DecodeFloat64() } if j < len(v) { v = v[:uint(j)] @@ -4732,6 +5074,9 @@ func (fastpathT) DecSliceFloat64Y(v []float64, d *Decoder) (_ []float64, changed } func (fastpathT) DecSliceFloat64N(v []float64, d *Decoder) { slh, containerLenS := d.decSliceHelperStart() + if slh.IsNil { + return + } if containerLenS == 0 { slh.End() return @@ -4749,11 +5094,7 @@ func (fastpathT) DecSliceFloat64N(v []float64, d *Decoder) { break } slh.ElemContainerState(j) - if d.d.TryDecodeAsNil() { - v[uint(j)] = 0 - } else { - v[uint(j)] = d.d.DecodeFloat64() - } + v[uint(j)] = d.d.DecodeFloat64() } slh.End() } @@ -4775,6 +5116,12 @@ func (f fastpathT) DecSliceUintX(vp *[]uint, d *Decoder) { } func (fastpathT) DecSliceUintY(v []uint, d *Decoder) (_ []uint, changed bool) { slh, containerLenS := d.decSliceHelperStart() + if slh.IsNil { + if v == nil { + return + } + return nil, true + } if containerLenS == 0 { if v == nil { v = []uint{} @@ -4816,11 +5163,7 @@ func (fastpathT) DecSliceUintY(v []uint, d *Decoder) (_ []uint, changed bool) { changed = true } slh.ElemContainerState(j) - if d.d.TryDecodeAsNil() { - v[uint(j)] = 0 - } else { - v[uint(j)] = uint(chkOvf.UintV(d.d.DecodeUint64(), uintBitsize)) - } + v[uint(j)] = uint(chkOvf.UintV(d.d.DecodeUint64(), uintBitsize)) } if j < len(v) { v = v[:uint(j)] @@ -4834,6 +5177,9 @@ func (fastpathT) DecSliceUintY(v []uint, d *Decoder) (_ []uint, changed bool) { } func (fastpathT) DecSliceUintN(v []uint, d *Decoder) { slh, containerLenS := d.decSliceHelperStart() + if slh.IsNil { + return + } if containerLenS == 0 { slh.End() return @@ -4851,11 +5197,7 @@ func (fastpathT) DecSliceUintN(v []uint, d *Decoder) { break } slh.ElemContainerState(j) - if d.d.TryDecodeAsNil() { - v[uint(j)] = 0 - } else { - v[uint(j)] = uint(chkOvf.UintV(d.d.DecodeUint64(), uintBitsize)) - } + v[uint(j)] = uint(chkOvf.UintV(d.d.DecodeUint64(), uintBitsize)) } slh.End() } @@ -4877,6 +5219,12 @@ func (f fastpathT) DecSliceUint16X(vp *[]uint16, d *Decoder) { } func (fastpathT) DecSliceUint16Y(v []uint16, d *Decoder) (_ []uint16, changed bool) { slh, containerLenS := d.decSliceHelperStart() + if slh.IsNil { + if v == nil { + return + } + return nil, true + } if containerLenS == 0 { if v == nil { v = []uint16{} @@ -4918,11 +5266,7 @@ func (fastpathT) DecSliceUint16Y(v []uint16, d *Decoder) (_ []uint16, changed bo changed = true } slh.ElemContainerState(j) - if d.d.TryDecodeAsNil() { - v[uint(j)] = 0 - } else { - v[uint(j)] = uint16(chkOvf.UintV(d.d.DecodeUint64(), 16)) - } + v[uint(j)] = uint16(chkOvf.UintV(d.d.DecodeUint64(), 16)) } if j < len(v) { v = v[:uint(j)] @@ -4936,6 +5280,9 @@ func (fastpathT) DecSliceUint16Y(v []uint16, d *Decoder) (_ []uint16, changed bo } func (fastpathT) DecSliceUint16N(v []uint16, d *Decoder) { slh, containerLenS := d.decSliceHelperStart() + if slh.IsNil { + return + } if containerLenS == 0 { slh.End() return @@ -4953,11 +5300,7 @@ func (fastpathT) DecSliceUint16N(v []uint16, d *Decoder) { break } slh.ElemContainerState(j) - if d.d.TryDecodeAsNil() { - v[uint(j)] = 0 - } else { - v[uint(j)] = uint16(chkOvf.UintV(d.d.DecodeUint64(), 16)) - } + v[uint(j)] = uint16(chkOvf.UintV(d.d.DecodeUint64(), 16)) } slh.End() } @@ -4979,6 +5322,12 @@ func (f fastpathT) DecSliceUint32X(vp *[]uint32, d *Decoder) { } func (fastpathT) DecSliceUint32Y(v []uint32, d *Decoder) (_ []uint32, changed bool) { slh, containerLenS := d.decSliceHelperStart() + if slh.IsNil { + if v == nil { + return + } + return nil, true + } if containerLenS == 0 { if v == nil { v = []uint32{} @@ -5020,11 +5369,7 @@ func (fastpathT) DecSliceUint32Y(v []uint32, d *Decoder) (_ []uint32, changed bo changed = true } slh.ElemContainerState(j) - if d.d.TryDecodeAsNil() { - v[uint(j)] = 0 - } else { - v[uint(j)] = uint32(chkOvf.UintV(d.d.DecodeUint64(), 32)) - } + v[uint(j)] = uint32(chkOvf.UintV(d.d.DecodeUint64(), 32)) } if j < len(v) { v = v[:uint(j)] @@ -5038,6 +5383,9 @@ func (fastpathT) DecSliceUint32Y(v []uint32, d *Decoder) (_ []uint32, changed bo } func (fastpathT) DecSliceUint32N(v []uint32, d *Decoder) { slh, containerLenS := d.decSliceHelperStart() + if slh.IsNil { + return + } if containerLenS == 0 { slh.End() return @@ -5055,11 +5403,7 @@ func (fastpathT) DecSliceUint32N(v []uint32, d *Decoder) { break } slh.ElemContainerState(j) - if d.d.TryDecodeAsNil() { - v[uint(j)] = 0 - } else { - v[uint(j)] = uint32(chkOvf.UintV(d.d.DecodeUint64(), 32)) - } + v[uint(j)] = uint32(chkOvf.UintV(d.d.DecodeUint64(), 32)) } slh.End() } @@ -5081,6 +5425,12 @@ func (f fastpathT) DecSliceUint64X(vp *[]uint64, d *Decoder) { } func (fastpathT) DecSliceUint64Y(v []uint64, d *Decoder) (_ []uint64, changed bool) { slh, containerLenS := d.decSliceHelperStart() + if slh.IsNil { + if v == nil { + return + } + return nil, true + } if containerLenS == 0 { if v == nil { v = []uint64{} @@ -5122,11 +5472,7 @@ func (fastpathT) DecSliceUint64Y(v []uint64, d *Decoder) (_ []uint64, changed bo changed = true } slh.ElemContainerState(j) - if d.d.TryDecodeAsNil() { - v[uint(j)] = 0 - } else { - v[uint(j)] = d.d.DecodeUint64() - } + v[uint(j)] = d.d.DecodeUint64() } if j < len(v) { v = v[:uint(j)] @@ -5140,6 +5486,9 @@ func (fastpathT) DecSliceUint64Y(v []uint64, d *Decoder) (_ []uint64, changed bo } func (fastpathT) DecSliceUint64N(v []uint64, d *Decoder) { slh, containerLenS := d.decSliceHelperStart() + if slh.IsNil { + return + } if containerLenS == 0 { slh.End() return @@ -5157,11 +5506,7 @@ func (fastpathT) DecSliceUint64N(v []uint64, d *Decoder) { break } slh.ElemContainerState(j) - if d.d.TryDecodeAsNil() { - v[uint(j)] = 0 - } else { - v[uint(j)] = d.d.DecodeUint64() - } + v[uint(j)] = d.d.DecodeUint64() } slh.End() } @@ -5183,6 +5528,12 @@ func (f fastpathT) DecSliceIntX(vp *[]int, d *Decoder) { } func (fastpathT) DecSliceIntY(v []int, d *Decoder) (_ []int, changed bool) { slh, containerLenS := d.decSliceHelperStart() + if slh.IsNil { + if v == nil { + return + } + return nil, true + } if containerLenS == 0 { if v == nil { v = []int{} @@ -5224,11 +5575,7 @@ func (fastpathT) DecSliceIntY(v []int, d *Decoder) (_ []int, changed bool) { changed = true } slh.ElemContainerState(j) - if d.d.TryDecodeAsNil() { - v[uint(j)] = 0 - } else { - v[uint(j)] = int(chkOvf.IntV(d.d.DecodeInt64(), intBitsize)) - } + v[uint(j)] = int(chkOvf.IntV(d.d.DecodeInt64(), intBitsize)) } if j < len(v) { v = v[:uint(j)] @@ -5242,6 +5589,9 @@ func (fastpathT) DecSliceIntY(v []int, d *Decoder) (_ []int, changed bool) { } func (fastpathT) DecSliceIntN(v []int, d *Decoder) { slh, containerLenS := d.decSliceHelperStart() + if slh.IsNil { + return + } if containerLenS == 0 { slh.End() return @@ -5259,11 +5609,7 @@ func (fastpathT) DecSliceIntN(v []int, d *Decoder) { break } slh.ElemContainerState(j) - if d.d.TryDecodeAsNil() { - v[uint(j)] = 0 - } else { - v[uint(j)] = int(chkOvf.IntV(d.d.DecodeInt64(), intBitsize)) - } + v[uint(j)] = int(chkOvf.IntV(d.d.DecodeInt64(), intBitsize)) } slh.End() } @@ -5285,6 +5631,12 @@ func (f fastpathT) DecSliceInt8X(vp *[]int8, d *Decoder) { } func (fastpathT) DecSliceInt8Y(v []int8, d *Decoder) (_ []int8, changed bool) { slh, containerLenS := d.decSliceHelperStart() + if slh.IsNil { + if v == nil { + return + } + return nil, true + } if containerLenS == 0 { if v == nil { v = []int8{} @@ -5326,11 +5678,7 @@ func (fastpathT) DecSliceInt8Y(v []int8, d *Decoder) (_ []int8, changed bool) { changed = true } slh.ElemContainerState(j) - if d.d.TryDecodeAsNil() { - v[uint(j)] = 0 - } else { - v[uint(j)] = int8(chkOvf.IntV(d.d.DecodeInt64(), 8)) - } + v[uint(j)] = int8(chkOvf.IntV(d.d.DecodeInt64(), 8)) } if j < len(v) { v = v[:uint(j)] @@ -5344,6 +5692,9 @@ func (fastpathT) DecSliceInt8Y(v []int8, d *Decoder) (_ []int8, changed bool) { } func (fastpathT) DecSliceInt8N(v []int8, d *Decoder) { slh, containerLenS := d.decSliceHelperStart() + if slh.IsNil { + return + } if containerLenS == 0 { slh.End() return @@ -5361,11 +5712,7 @@ func (fastpathT) DecSliceInt8N(v []int8, d *Decoder) { break } slh.ElemContainerState(j) - if d.d.TryDecodeAsNil() { - v[uint(j)] = 0 - } else { - v[uint(j)] = int8(chkOvf.IntV(d.d.DecodeInt64(), 8)) - } + v[uint(j)] = int8(chkOvf.IntV(d.d.DecodeInt64(), 8)) } slh.End() } @@ -5387,6 +5734,12 @@ func (f fastpathT) DecSliceInt16X(vp *[]int16, d *Decoder) { } func (fastpathT) DecSliceInt16Y(v []int16, d *Decoder) (_ []int16, changed bool) { slh, containerLenS := d.decSliceHelperStart() + if slh.IsNil { + if v == nil { + return + } + return nil, true + } if containerLenS == 0 { if v == nil { v = []int16{} @@ -5428,11 +5781,7 @@ func (fastpathT) DecSliceInt16Y(v []int16, d *Decoder) (_ []int16, changed bool) changed = true } slh.ElemContainerState(j) - if d.d.TryDecodeAsNil() { - v[uint(j)] = 0 - } else { - v[uint(j)] = int16(chkOvf.IntV(d.d.DecodeInt64(), 16)) - } + v[uint(j)] = int16(chkOvf.IntV(d.d.DecodeInt64(), 16)) } if j < len(v) { v = v[:uint(j)] @@ -5446,6 +5795,9 @@ func (fastpathT) DecSliceInt16Y(v []int16, d *Decoder) (_ []int16, changed bool) } func (fastpathT) DecSliceInt16N(v []int16, d *Decoder) { slh, containerLenS := d.decSliceHelperStart() + if slh.IsNil { + return + } if containerLenS == 0 { slh.End() return @@ -5463,11 +5815,7 @@ func (fastpathT) DecSliceInt16N(v []int16, d *Decoder) { break } slh.ElemContainerState(j) - if d.d.TryDecodeAsNil() { - v[uint(j)] = 0 - } else { - v[uint(j)] = int16(chkOvf.IntV(d.d.DecodeInt64(), 16)) - } + v[uint(j)] = int16(chkOvf.IntV(d.d.DecodeInt64(), 16)) } slh.End() } @@ -5489,6 +5837,12 @@ func (f fastpathT) DecSliceInt32X(vp *[]int32, d *Decoder) { } func (fastpathT) DecSliceInt32Y(v []int32, d *Decoder) (_ []int32, changed bool) { slh, containerLenS := d.decSliceHelperStart() + if slh.IsNil { + if v == nil { + return + } + return nil, true + } if containerLenS == 0 { if v == nil { v = []int32{} @@ -5530,11 +5884,7 @@ func (fastpathT) DecSliceInt32Y(v []int32, d *Decoder) (_ []int32, changed bool) changed = true } slh.ElemContainerState(j) - if d.d.TryDecodeAsNil() { - v[uint(j)] = 0 - } else { - v[uint(j)] = int32(chkOvf.IntV(d.d.DecodeInt64(), 32)) - } + v[uint(j)] = int32(chkOvf.IntV(d.d.DecodeInt64(), 32)) } if j < len(v) { v = v[:uint(j)] @@ -5548,6 +5898,9 @@ func (fastpathT) DecSliceInt32Y(v []int32, d *Decoder) (_ []int32, changed bool) } func (fastpathT) DecSliceInt32N(v []int32, d *Decoder) { slh, containerLenS := d.decSliceHelperStart() + if slh.IsNil { + return + } if containerLenS == 0 { slh.End() return @@ -5565,11 +5918,7 @@ func (fastpathT) DecSliceInt32N(v []int32, d *Decoder) { break } slh.ElemContainerState(j) - if d.d.TryDecodeAsNil() { - v[uint(j)] = 0 - } else { - v[uint(j)] = int32(chkOvf.IntV(d.d.DecodeInt64(), 32)) - } + v[uint(j)] = int32(chkOvf.IntV(d.d.DecodeInt64(), 32)) } slh.End() } @@ -5591,6 +5940,12 @@ func (f fastpathT) DecSliceInt64X(vp *[]int64, d *Decoder) { } func (fastpathT) DecSliceInt64Y(v []int64, d *Decoder) (_ []int64, changed bool) { slh, containerLenS := d.decSliceHelperStart() + if slh.IsNil { + if v == nil { + return + } + return nil, true + } if containerLenS == 0 { if v == nil { v = []int64{} @@ -5632,11 +5987,7 @@ func (fastpathT) DecSliceInt64Y(v []int64, d *Decoder) (_ []int64, changed bool) changed = true } slh.ElemContainerState(j) - if d.d.TryDecodeAsNil() { - v[uint(j)] = 0 - } else { - v[uint(j)] = d.d.DecodeInt64() - } + v[uint(j)] = d.d.DecodeInt64() } if j < len(v) { v = v[:uint(j)] @@ -5650,6 +6001,9 @@ func (fastpathT) DecSliceInt64Y(v []int64, d *Decoder) (_ []int64, changed bool) } func (fastpathT) DecSliceInt64N(v []int64, d *Decoder) { slh, containerLenS := d.decSliceHelperStart() + if slh.IsNil { + return + } if containerLenS == 0 { slh.End() return @@ -5667,11 +6021,7 @@ func (fastpathT) DecSliceInt64N(v []int64, d *Decoder) { break } slh.ElemContainerState(j) - if d.d.TryDecodeAsNil() { - v[uint(j)] = 0 - } else { - v[uint(j)] = d.d.DecodeInt64() - } + v[uint(j)] = d.d.DecodeInt64() } slh.End() } @@ -5693,6 +6043,12 @@ func (f fastpathT) DecSliceBoolX(vp *[]bool, d *Decoder) { } func (fastpathT) DecSliceBoolY(v []bool, d *Decoder) (_ []bool, changed bool) { slh, containerLenS := d.decSliceHelperStart() + if slh.IsNil { + if v == nil { + return + } + return nil, true + } if containerLenS == 0 { if v == nil { v = []bool{} @@ -5734,11 +6090,7 @@ func (fastpathT) DecSliceBoolY(v []bool, d *Decoder) (_ []bool, changed bool) { changed = true } slh.ElemContainerState(j) - if d.d.TryDecodeAsNil() { - v[uint(j)] = false - } else { - v[uint(j)] = d.d.DecodeBool() - } + v[uint(j)] = d.d.DecodeBool() } if j < len(v) { v = v[:uint(j)] @@ -5752,6 +6104,9 @@ func (fastpathT) DecSliceBoolY(v []bool, d *Decoder) (_ []bool, changed bool) { } func (fastpathT) DecSliceBoolN(v []bool, d *Decoder) { slh, containerLenS := d.decSliceHelperStart() + if slh.IsNil { + return + } if containerLenS == 0 { slh.End() return @@ -5769,11 +6124,7 @@ func (fastpathT) DecSliceBoolN(v []bool, d *Decoder) { break } slh.ElemContainerState(j) - if d.d.TryDecodeAsNil() { - v[uint(j)] = false - } else { - v[uint(j)] = d.d.DecodeBool() - } + v[uint(j)] = d.d.DecodeBool() } slh.End() } @@ -5781,16 +6132,24 @@ func (d *Decoder) fastpathDecMapStringIntfR(f *codecFnInfo, rv reflect.Value) { containerLen := d.mapStart() if rv.Kind() == reflect.Ptr { vp := rv2i(rv).(*map[string]interface{}) + if containerLen == decContainerLenNil { + *vp = nil + return + } if *vp == nil { *vp = make(map[string]interface{}, decInferLen(containerLen, d.h.MaxInitLen, 32)) } fastpathTV.DecMapStringIntfL(*vp, containerLen, d) - } else { + } else if containerLen != decContainerLenNil { fastpathTV.DecMapStringIntfL(rv2i(rv).(map[string]interface{}), containerLen, d) } } func (f fastpathT) DecMapStringIntfX(vp *map[string]interface{}, d *Decoder) { containerLen := d.mapStart() + if containerLen == decContainerLenNil { + *vp = nil + return + } if *vp == nil { *vp = make(map[string]interface{}, decInferLen(containerLen, d.h.MaxInitLen, 32)) } @@ -5809,15 +6168,6 @@ func (fastpathT) DecMapStringIntfL(v map[string]interface{}, containerLen int, d d.mapElemKey() mk = string(d.d.DecodeStringAsBytes()) d.mapElemValue() - if d.d.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { - delete(v, mk) - } else { - v[mk] = nil - } - continue - } if mapGet { mv = v[mk] } else { @@ -5834,16 +6184,24 @@ func (d *Decoder) fastpathDecMapStringStringR(f *codecFnInfo, rv reflect.Value) containerLen := d.mapStart() if rv.Kind() == reflect.Ptr { vp := rv2i(rv).(*map[string]string) + if containerLen == decContainerLenNil { + *vp = nil + return + } if *vp == nil { *vp = make(map[string]string, decInferLen(containerLen, d.h.MaxInitLen, 32)) } fastpathTV.DecMapStringStringL(*vp, containerLen, d) - } else { + } else if containerLen != decContainerLenNil { fastpathTV.DecMapStringStringL(rv2i(rv).(map[string]string), containerLen, d) } } func (f fastpathT) DecMapStringStringX(vp *map[string]string, d *Decoder) { containerLen := d.mapStart() + if containerLen == decContainerLenNil { + *vp = nil + return + } if *vp == nil { *vp = make(map[string]string, decInferLen(containerLen, d.h.MaxInitLen, 32)) } @@ -5861,15 +6219,6 @@ func (fastpathT) DecMapStringStringL(v map[string]string, containerLen int, d *D d.mapElemKey() mk = string(d.d.DecodeStringAsBytes()) d.mapElemValue() - if d.d.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { - delete(v, mk) - } else { - v[mk] = "" - } - continue - } mv = string(d.d.DecodeStringAsBytes()) if v != nil { v[mk] = mv @@ -5881,16 +6230,24 @@ func (d *Decoder) fastpathDecMapStringBytesR(f *codecFnInfo, rv reflect.Value) { containerLen := d.mapStart() if rv.Kind() == reflect.Ptr { vp := rv2i(rv).(*map[string][]byte) + if containerLen == decContainerLenNil { + *vp = nil + return + } if *vp == nil { *vp = make(map[string][]byte, decInferLen(containerLen, d.h.MaxInitLen, 40)) } fastpathTV.DecMapStringBytesL(*vp, containerLen, d) - } else { + } else if containerLen != decContainerLenNil { fastpathTV.DecMapStringBytesL(rv2i(rv).(map[string][]byte), containerLen, d) } } func (f fastpathT) DecMapStringBytesX(vp *map[string][]byte, d *Decoder) { containerLen := d.mapStart() + if containerLen == decContainerLenNil { + *vp = nil + return + } if *vp == nil { *vp = make(map[string][]byte, decInferLen(containerLen, d.h.MaxInitLen, 40)) } @@ -5909,15 +6266,6 @@ func (fastpathT) DecMapStringBytesL(v map[string][]byte, containerLen int, d *De d.mapElemKey() mk = string(d.d.DecodeStringAsBytes()) d.mapElemValue() - if d.d.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { - delete(v, mk) - } else { - v[mk] = nil - } - continue - } if mapGet { mv = v[mk] } else { @@ -5934,16 +6282,24 @@ func (d *Decoder) fastpathDecMapStringUintR(f *codecFnInfo, rv reflect.Value) { containerLen := d.mapStart() if rv.Kind() == reflect.Ptr { vp := rv2i(rv).(*map[string]uint) + if containerLen == decContainerLenNil { + *vp = nil + return + } if *vp == nil { *vp = make(map[string]uint, decInferLen(containerLen, d.h.MaxInitLen, 24)) } fastpathTV.DecMapStringUintL(*vp, containerLen, d) - } else { + } else if containerLen != decContainerLenNil { fastpathTV.DecMapStringUintL(rv2i(rv).(map[string]uint), containerLen, d) } } func (f fastpathT) DecMapStringUintX(vp *map[string]uint, d *Decoder) { containerLen := d.mapStart() + if containerLen == decContainerLenNil { + *vp = nil + return + } if *vp == nil { *vp = make(map[string]uint, decInferLen(containerLen, d.h.MaxInitLen, 24)) } @@ -5961,15 +6317,6 @@ func (fastpathT) DecMapStringUintL(v map[string]uint, containerLen int, d *Decod d.mapElemKey() mk = string(d.d.DecodeStringAsBytes()) d.mapElemValue() - if d.d.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { - delete(v, mk) - } else { - v[mk] = 0 - } - continue - } mv = uint(chkOvf.UintV(d.d.DecodeUint64(), uintBitsize)) if v != nil { v[mk] = mv @@ -5981,16 +6328,24 @@ func (d *Decoder) fastpathDecMapStringUint8R(f *codecFnInfo, rv reflect.Value) { containerLen := d.mapStart() if rv.Kind() == reflect.Ptr { vp := rv2i(rv).(*map[string]uint8) + if containerLen == decContainerLenNil { + *vp = nil + return + } if *vp == nil { *vp = make(map[string]uint8, decInferLen(containerLen, d.h.MaxInitLen, 17)) } fastpathTV.DecMapStringUint8L(*vp, containerLen, d) - } else { + } else if containerLen != decContainerLenNil { fastpathTV.DecMapStringUint8L(rv2i(rv).(map[string]uint8), containerLen, d) } } func (f fastpathT) DecMapStringUint8X(vp *map[string]uint8, d *Decoder) { containerLen := d.mapStart() + if containerLen == decContainerLenNil { + *vp = nil + return + } if *vp == nil { *vp = make(map[string]uint8, decInferLen(containerLen, d.h.MaxInitLen, 17)) } @@ -6008,15 +6363,6 @@ func (fastpathT) DecMapStringUint8L(v map[string]uint8, containerLen int, d *Dec d.mapElemKey() mk = string(d.d.DecodeStringAsBytes()) d.mapElemValue() - if d.d.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { - delete(v, mk) - } else { - v[mk] = 0 - } - continue - } mv = uint8(chkOvf.UintV(d.d.DecodeUint64(), 8)) if v != nil { v[mk] = mv @@ -6028,16 +6374,24 @@ func (d *Decoder) fastpathDecMapStringUint64R(f *codecFnInfo, rv reflect.Value) containerLen := d.mapStart() if rv.Kind() == reflect.Ptr { vp := rv2i(rv).(*map[string]uint64) + if containerLen == decContainerLenNil { + *vp = nil + return + } if *vp == nil { *vp = make(map[string]uint64, decInferLen(containerLen, d.h.MaxInitLen, 24)) } fastpathTV.DecMapStringUint64L(*vp, containerLen, d) - } else { + } else if containerLen != decContainerLenNil { fastpathTV.DecMapStringUint64L(rv2i(rv).(map[string]uint64), containerLen, d) } } func (f fastpathT) DecMapStringUint64X(vp *map[string]uint64, d *Decoder) { containerLen := d.mapStart() + if containerLen == decContainerLenNil { + *vp = nil + return + } if *vp == nil { *vp = make(map[string]uint64, decInferLen(containerLen, d.h.MaxInitLen, 24)) } @@ -6055,15 +6409,6 @@ func (fastpathT) DecMapStringUint64L(v map[string]uint64, containerLen int, d *D d.mapElemKey() mk = string(d.d.DecodeStringAsBytes()) d.mapElemValue() - if d.d.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { - delete(v, mk) - } else { - v[mk] = 0 - } - continue - } mv = d.d.DecodeUint64() if v != nil { v[mk] = mv @@ -6075,16 +6420,24 @@ func (d *Decoder) fastpathDecMapStringIntR(f *codecFnInfo, rv reflect.Value) { containerLen := d.mapStart() if rv.Kind() == reflect.Ptr { vp := rv2i(rv).(*map[string]int) + if containerLen == decContainerLenNil { + *vp = nil + return + } if *vp == nil { *vp = make(map[string]int, decInferLen(containerLen, d.h.MaxInitLen, 24)) } fastpathTV.DecMapStringIntL(*vp, containerLen, d) - } else { + } else if containerLen != decContainerLenNil { fastpathTV.DecMapStringIntL(rv2i(rv).(map[string]int), containerLen, d) } } func (f fastpathT) DecMapStringIntX(vp *map[string]int, d *Decoder) { containerLen := d.mapStart() + if containerLen == decContainerLenNil { + *vp = nil + return + } if *vp == nil { *vp = make(map[string]int, decInferLen(containerLen, d.h.MaxInitLen, 24)) } @@ -6102,15 +6455,6 @@ func (fastpathT) DecMapStringIntL(v map[string]int, containerLen int, d *Decoder d.mapElemKey() mk = string(d.d.DecodeStringAsBytes()) d.mapElemValue() - if d.d.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { - delete(v, mk) - } else { - v[mk] = 0 - } - continue - } mv = int(chkOvf.IntV(d.d.DecodeInt64(), intBitsize)) if v != nil { v[mk] = mv @@ -6122,16 +6466,24 @@ func (d *Decoder) fastpathDecMapStringInt64R(f *codecFnInfo, rv reflect.Value) { containerLen := d.mapStart() if rv.Kind() == reflect.Ptr { vp := rv2i(rv).(*map[string]int64) + if containerLen == decContainerLenNil { + *vp = nil + return + } if *vp == nil { *vp = make(map[string]int64, decInferLen(containerLen, d.h.MaxInitLen, 24)) } fastpathTV.DecMapStringInt64L(*vp, containerLen, d) - } else { + } else if containerLen != decContainerLenNil { fastpathTV.DecMapStringInt64L(rv2i(rv).(map[string]int64), containerLen, d) } } func (f fastpathT) DecMapStringInt64X(vp *map[string]int64, d *Decoder) { containerLen := d.mapStart() + if containerLen == decContainerLenNil { + *vp = nil + return + } if *vp == nil { *vp = make(map[string]int64, decInferLen(containerLen, d.h.MaxInitLen, 24)) } @@ -6149,15 +6501,6 @@ func (fastpathT) DecMapStringInt64L(v map[string]int64, containerLen int, d *Dec d.mapElemKey() mk = string(d.d.DecodeStringAsBytes()) d.mapElemValue() - if d.d.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { - delete(v, mk) - } else { - v[mk] = 0 - } - continue - } mv = d.d.DecodeInt64() if v != nil { v[mk] = mv @@ -6169,16 +6512,24 @@ func (d *Decoder) fastpathDecMapStringFloat32R(f *codecFnInfo, rv reflect.Value) containerLen := d.mapStart() if rv.Kind() == reflect.Ptr { vp := rv2i(rv).(*map[string]float32) + if containerLen == decContainerLenNil { + *vp = nil + return + } if *vp == nil { *vp = make(map[string]float32, decInferLen(containerLen, d.h.MaxInitLen, 20)) } fastpathTV.DecMapStringFloat32L(*vp, containerLen, d) - } else { + } else if containerLen != decContainerLenNil { fastpathTV.DecMapStringFloat32L(rv2i(rv).(map[string]float32), containerLen, d) } } func (f fastpathT) DecMapStringFloat32X(vp *map[string]float32, d *Decoder) { containerLen := d.mapStart() + if containerLen == decContainerLenNil { + *vp = nil + return + } if *vp == nil { *vp = make(map[string]float32, decInferLen(containerLen, d.h.MaxInitLen, 20)) } @@ -6196,15 +6547,6 @@ func (fastpathT) DecMapStringFloat32L(v map[string]float32, containerLen int, d d.mapElemKey() mk = string(d.d.DecodeStringAsBytes()) d.mapElemValue() - if d.d.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { - delete(v, mk) - } else { - v[mk] = 0 - } - continue - } mv = float32(d.decodeFloat32()) if v != nil { v[mk] = mv @@ -6216,16 +6558,24 @@ func (d *Decoder) fastpathDecMapStringFloat64R(f *codecFnInfo, rv reflect.Value) containerLen := d.mapStart() if rv.Kind() == reflect.Ptr { vp := rv2i(rv).(*map[string]float64) + if containerLen == decContainerLenNil { + *vp = nil + return + } if *vp == nil { *vp = make(map[string]float64, decInferLen(containerLen, d.h.MaxInitLen, 24)) } fastpathTV.DecMapStringFloat64L(*vp, containerLen, d) - } else { + } else if containerLen != decContainerLenNil { fastpathTV.DecMapStringFloat64L(rv2i(rv).(map[string]float64), containerLen, d) } } func (f fastpathT) DecMapStringFloat64X(vp *map[string]float64, d *Decoder) { containerLen := d.mapStart() + if containerLen == decContainerLenNil { + *vp = nil + return + } if *vp == nil { *vp = make(map[string]float64, decInferLen(containerLen, d.h.MaxInitLen, 24)) } @@ -6243,15 +6593,6 @@ func (fastpathT) DecMapStringFloat64L(v map[string]float64, containerLen int, d d.mapElemKey() mk = string(d.d.DecodeStringAsBytes()) d.mapElemValue() - if d.d.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { - delete(v, mk) - } else { - v[mk] = 0 - } - continue - } mv = d.d.DecodeFloat64() if v != nil { v[mk] = mv @@ -6263,16 +6604,24 @@ func (d *Decoder) fastpathDecMapStringBoolR(f *codecFnInfo, rv reflect.Value) { containerLen := d.mapStart() if rv.Kind() == reflect.Ptr { vp := rv2i(rv).(*map[string]bool) + if containerLen == decContainerLenNil { + *vp = nil + return + } if *vp == nil { *vp = make(map[string]bool, decInferLen(containerLen, d.h.MaxInitLen, 17)) } fastpathTV.DecMapStringBoolL(*vp, containerLen, d) - } else { + } else if containerLen != decContainerLenNil { fastpathTV.DecMapStringBoolL(rv2i(rv).(map[string]bool), containerLen, d) } } func (f fastpathT) DecMapStringBoolX(vp *map[string]bool, d *Decoder) { containerLen := d.mapStart() + if containerLen == decContainerLenNil { + *vp = nil + return + } if *vp == nil { *vp = make(map[string]bool, decInferLen(containerLen, d.h.MaxInitLen, 17)) } @@ -6290,15 +6639,6 @@ func (fastpathT) DecMapStringBoolL(v map[string]bool, containerLen int, d *Decod d.mapElemKey() mk = string(d.d.DecodeStringAsBytes()) d.mapElemValue() - if d.d.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { - delete(v, mk) - } else { - v[mk] = false - } - continue - } mv = d.d.DecodeBool() if v != nil { v[mk] = mv @@ -6310,16 +6650,24 @@ func (d *Decoder) fastpathDecMapUintIntfR(f *codecFnInfo, rv reflect.Value) { containerLen := d.mapStart() if rv.Kind() == reflect.Ptr { vp := rv2i(rv).(*map[uint]interface{}) + if containerLen == decContainerLenNil { + *vp = nil + return + } if *vp == nil { *vp = make(map[uint]interface{}, decInferLen(containerLen, d.h.MaxInitLen, 24)) } fastpathTV.DecMapUintIntfL(*vp, containerLen, d) - } else { + } else if containerLen != decContainerLenNil { fastpathTV.DecMapUintIntfL(rv2i(rv).(map[uint]interface{}), containerLen, d) } } func (f fastpathT) DecMapUintIntfX(vp *map[uint]interface{}, d *Decoder) { containerLen := d.mapStart() + if containerLen == decContainerLenNil { + *vp = nil + return + } if *vp == nil { *vp = make(map[uint]interface{}, decInferLen(containerLen, d.h.MaxInitLen, 24)) } @@ -6338,15 +6686,6 @@ func (fastpathT) DecMapUintIntfL(v map[uint]interface{}, containerLen int, d *De d.mapElemKey() mk = uint(chkOvf.UintV(d.d.DecodeUint64(), uintBitsize)) d.mapElemValue() - if d.d.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { - delete(v, mk) - } else { - v[mk] = nil - } - continue - } if mapGet { mv = v[mk] } else { @@ -6363,16 +6702,24 @@ func (d *Decoder) fastpathDecMapUintStringR(f *codecFnInfo, rv reflect.Value) { containerLen := d.mapStart() if rv.Kind() == reflect.Ptr { vp := rv2i(rv).(*map[uint]string) + if containerLen == decContainerLenNil { + *vp = nil + return + } if *vp == nil { *vp = make(map[uint]string, decInferLen(containerLen, d.h.MaxInitLen, 24)) } fastpathTV.DecMapUintStringL(*vp, containerLen, d) - } else { + } else if containerLen != decContainerLenNil { fastpathTV.DecMapUintStringL(rv2i(rv).(map[uint]string), containerLen, d) } } func (f fastpathT) DecMapUintStringX(vp *map[uint]string, d *Decoder) { containerLen := d.mapStart() + if containerLen == decContainerLenNil { + *vp = nil + return + } if *vp == nil { *vp = make(map[uint]string, decInferLen(containerLen, d.h.MaxInitLen, 24)) } @@ -6390,15 +6737,6 @@ func (fastpathT) DecMapUintStringL(v map[uint]string, containerLen int, d *Decod d.mapElemKey() mk = uint(chkOvf.UintV(d.d.DecodeUint64(), uintBitsize)) d.mapElemValue() - if d.d.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { - delete(v, mk) - } else { - v[mk] = "" - } - continue - } mv = string(d.d.DecodeStringAsBytes()) if v != nil { v[mk] = mv @@ -6410,16 +6748,24 @@ func (d *Decoder) fastpathDecMapUintBytesR(f *codecFnInfo, rv reflect.Value) { containerLen := d.mapStart() if rv.Kind() == reflect.Ptr { vp := rv2i(rv).(*map[uint][]byte) + if containerLen == decContainerLenNil { + *vp = nil + return + } if *vp == nil { *vp = make(map[uint][]byte, decInferLen(containerLen, d.h.MaxInitLen, 32)) } fastpathTV.DecMapUintBytesL(*vp, containerLen, d) - } else { + } else if containerLen != decContainerLenNil { fastpathTV.DecMapUintBytesL(rv2i(rv).(map[uint][]byte), containerLen, d) } } func (f fastpathT) DecMapUintBytesX(vp *map[uint][]byte, d *Decoder) { containerLen := d.mapStart() + if containerLen == decContainerLenNil { + *vp = nil + return + } if *vp == nil { *vp = make(map[uint][]byte, decInferLen(containerLen, d.h.MaxInitLen, 32)) } @@ -6438,15 +6784,6 @@ func (fastpathT) DecMapUintBytesL(v map[uint][]byte, containerLen int, d *Decode d.mapElemKey() mk = uint(chkOvf.UintV(d.d.DecodeUint64(), uintBitsize)) d.mapElemValue() - if d.d.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { - delete(v, mk) - } else { - v[mk] = nil - } - continue - } if mapGet { mv = v[mk] } else { @@ -6463,16 +6800,24 @@ func (d *Decoder) fastpathDecMapUintUintR(f *codecFnInfo, rv reflect.Value) { containerLen := d.mapStart() if rv.Kind() == reflect.Ptr { vp := rv2i(rv).(*map[uint]uint) + if containerLen == decContainerLenNil { + *vp = nil + return + } if *vp == nil { *vp = make(map[uint]uint, decInferLen(containerLen, d.h.MaxInitLen, 16)) } fastpathTV.DecMapUintUintL(*vp, containerLen, d) - } else { + } else if containerLen != decContainerLenNil { fastpathTV.DecMapUintUintL(rv2i(rv).(map[uint]uint), containerLen, d) } } func (f fastpathT) DecMapUintUintX(vp *map[uint]uint, d *Decoder) { containerLen := d.mapStart() + if containerLen == decContainerLenNil { + *vp = nil + return + } if *vp == nil { *vp = make(map[uint]uint, decInferLen(containerLen, d.h.MaxInitLen, 16)) } @@ -6490,15 +6835,6 @@ func (fastpathT) DecMapUintUintL(v map[uint]uint, containerLen int, d *Decoder) d.mapElemKey() mk = uint(chkOvf.UintV(d.d.DecodeUint64(), uintBitsize)) d.mapElemValue() - if d.d.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { - delete(v, mk) - } else { - v[mk] = 0 - } - continue - } mv = uint(chkOvf.UintV(d.d.DecodeUint64(), uintBitsize)) if v != nil { v[mk] = mv @@ -6510,16 +6846,24 @@ func (d *Decoder) fastpathDecMapUintUint8R(f *codecFnInfo, rv reflect.Value) { containerLen := d.mapStart() if rv.Kind() == reflect.Ptr { vp := rv2i(rv).(*map[uint]uint8) + if containerLen == decContainerLenNil { + *vp = nil + return + } if *vp == nil { *vp = make(map[uint]uint8, decInferLen(containerLen, d.h.MaxInitLen, 9)) } fastpathTV.DecMapUintUint8L(*vp, containerLen, d) - } else { + } else if containerLen != decContainerLenNil { fastpathTV.DecMapUintUint8L(rv2i(rv).(map[uint]uint8), containerLen, d) } } func (f fastpathT) DecMapUintUint8X(vp *map[uint]uint8, d *Decoder) { containerLen := d.mapStart() + if containerLen == decContainerLenNil { + *vp = nil + return + } if *vp == nil { *vp = make(map[uint]uint8, decInferLen(containerLen, d.h.MaxInitLen, 9)) } @@ -6537,15 +6881,6 @@ func (fastpathT) DecMapUintUint8L(v map[uint]uint8, containerLen int, d *Decoder d.mapElemKey() mk = uint(chkOvf.UintV(d.d.DecodeUint64(), uintBitsize)) d.mapElemValue() - if d.d.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { - delete(v, mk) - } else { - v[mk] = 0 - } - continue - } mv = uint8(chkOvf.UintV(d.d.DecodeUint64(), 8)) if v != nil { v[mk] = mv @@ -6557,16 +6892,24 @@ func (d *Decoder) fastpathDecMapUintUint64R(f *codecFnInfo, rv reflect.Value) { containerLen := d.mapStart() if rv.Kind() == reflect.Ptr { vp := rv2i(rv).(*map[uint]uint64) + if containerLen == decContainerLenNil { + *vp = nil + return + } if *vp == nil { *vp = make(map[uint]uint64, decInferLen(containerLen, d.h.MaxInitLen, 16)) } fastpathTV.DecMapUintUint64L(*vp, containerLen, d) - } else { + } else if containerLen != decContainerLenNil { fastpathTV.DecMapUintUint64L(rv2i(rv).(map[uint]uint64), containerLen, d) } } func (f fastpathT) DecMapUintUint64X(vp *map[uint]uint64, d *Decoder) { containerLen := d.mapStart() + if containerLen == decContainerLenNil { + *vp = nil + return + } if *vp == nil { *vp = make(map[uint]uint64, decInferLen(containerLen, d.h.MaxInitLen, 16)) } @@ -6584,15 +6927,6 @@ func (fastpathT) DecMapUintUint64L(v map[uint]uint64, containerLen int, d *Decod d.mapElemKey() mk = uint(chkOvf.UintV(d.d.DecodeUint64(), uintBitsize)) d.mapElemValue() - if d.d.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { - delete(v, mk) - } else { - v[mk] = 0 - } - continue - } mv = d.d.DecodeUint64() if v != nil { v[mk] = mv @@ -6604,16 +6938,24 @@ func (d *Decoder) fastpathDecMapUintIntR(f *codecFnInfo, rv reflect.Value) { containerLen := d.mapStart() if rv.Kind() == reflect.Ptr { vp := rv2i(rv).(*map[uint]int) + if containerLen == decContainerLenNil { + *vp = nil + return + } if *vp == nil { *vp = make(map[uint]int, decInferLen(containerLen, d.h.MaxInitLen, 16)) } fastpathTV.DecMapUintIntL(*vp, containerLen, d) - } else { + } else if containerLen != decContainerLenNil { fastpathTV.DecMapUintIntL(rv2i(rv).(map[uint]int), containerLen, d) } } func (f fastpathT) DecMapUintIntX(vp *map[uint]int, d *Decoder) { containerLen := d.mapStart() + if containerLen == decContainerLenNil { + *vp = nil + return + } if *vp == nil { *vp = make(map[uint]int, decInferLen(containerLen, d.h.MaxInitLen, 16)) } @@ -6631,15 +6973,6 @@ func (fastpathT) DecMapUintIntL(v map[uint]int, containerLen int, d *Decoder) { d.mapElemKey() mk = uint(chkOvf.UintV(d.d.DecodeUint64(), uintBitsize)) d.mapElemValue() - if d.d.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { - delete(v, mk) - } else { - v[mk] = 0 - } - continue - } mv = int(chkOvf.IntV(d.d.DecodeInt64(), intBitsize)) if v != nil { v[mk] = mv @@ -6651,16 +6984,24 @@ func (d *Decoder) fastpathDecMapUintInt64R(f *codecFnInfo, rv reflect.Value) { containerLen := d.mapStart() if rv.Kind() == reflect.Ptr { vp := rv2i(rv).(*map[uint]int64) + if containerLen == decContainerLenNil { + *vp = nil + return + } if *vp == nil { *vp = make(map[uint]int64, decInferLen(containerLen, d.h.MaxInitLen, 16)) } fastpathTV.DecMapUintInt64L(*vp, containerLen, d) - } else { + } else if containerLen != decContainerLenNil { fastpathTV.DecMapUintInt64L(rv2i(rv).(map[uint]int64), containerLen, d) } } func (f fastpathT) DecMapUintInt64X(vp *map[uint]int64, d *Decoder) { containerLen := d.mapStart() + if containerLen == decContainerLenNil { + *vp = nil + return + } if *vp == nil { *vp = make(map[uint]int64, decInferLen(containerLen, d.h.MaxInitLen, 16)) } @@ -6678,15 +7019,6 @@ func (fastpathT) DecMapUintInt64L(v map[uint]int64, containerLen int, d *Decoder d.mapElemKey() mk = uint(chkOvf.UintV(d.d.DecodeUint64(), uintBitsize)) d.mapElemValue() - if d.d.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { - delete(v, mk) - } else { - v[mk] = 0 - } - continue - } mv = d.d.DecodeInt64() if v != nil { v[mk] = mv @@ -6698,16 +7030,24 @@ func (d *Decoder) fastpathDecMapUintFloat32R(f *codecFnInfo, rv reflect.Value) { containerLen := d.mapStart() if rv.Kind() == reflect.Ptr { vp := rv2i(rv).(*map[uint]float32) + if containerLen == decContainerLenNil { + *vp = nil + return + } if *vp == nil { *vp = make(map[uint]float32, decInferLen(containerLen, d.h.MaxInitLen, 12)) } fastpathTV.DecMapUintFloat32L(*vp, containerLen, d) - } else { + } else if containerLen != decContainerLenNil { fastpathTV.DecMapUintFloat32L(rv2i(rv).(map[uint]float32), containerLen, d) } } func (f fastpathT) DecMapUintFloat32X(vp *map[uint]float32, d *Decoder) { containerLen := d.mapStart() + if containerLen == decContainerLenNil { + *vp = nil + return + } if *vp == nil { *vp = make(map[uint]float32, decInferLen(containerLen, d.h.MaxInitLen, 12)) } @@ -6725,15 +7065,6 @@ func (fastpathT) DecMapUintFloat32L(v map[uint]float32, containerLen int, d *Dec d.mapElemKey() mk = uint(chkOvf.UintV(d.d.DecodeUint64(), uintBitsize)) d.mapElemValue() - if d.d.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { - delete(v, mk) - } else { - v[mk] = 0 - } - continue - } mv = float32(d.decodeFloat32()) if v != nil { v[mk] = mv @@ -6745,16 +7076,24 @@ func (d *Decoder) fastpathDecMapUintFloat64R(f *codecFnInfo, rv reflect.Value) { containerLen := d.mapStart() if rv.Kind() == reflect.Ptr { vp := rv2i(rv).(*map[uint]float64) + if containerLen == decContainerLenNil { + *vp = nil + return + } if *vp == nil { *vp = make(map[uint]float64, decInferLen(containerLen, d.h.MaxInitLen, 16)) } fastpathTV.DecMapUintFloat64L(*vp, containerLen, d) - } else { + } else if containerLen != decContainerLenNil { fastpathTV.DecMapUintFloat64L(rv2i(rv).(map[uint]float64), containerLen, d) } } func (f fastpathT) DecMapUintFloat64X(vp *map[uint]float64, d *Decoder) { containerLen := d.mapStart() + if containerLen == decContainerLenNil { + *vp = nil + return + } if *vp == nil { *vp = make(map[uint]float64, decInferLen(containerLen, d.h.MaxInitLen, 16)) } @@ -6772,15 +7111,6 @@ func (fastpathT) DecMapUintFloat64L(v map[uint]float64, containerLen int, d *Dec d.mapElemKey() mk = uint(chkOvf.UintV(d.d.DecodeUint64(), uintBitsize)) d.mapElemValue() - if d.d.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { - delete(v, mk) - } else { - v[mk] = 0 - } - continue - } mv = d.d.DecodeFloat64() if v != nil { v[mk] = mv @@ -6792,16 +7122,24 @@ func (d *Decoder) fastpathDecMapUintBoolR(f *codecFnInfo, rv reflect.Value) { containerLen := d.mapStart() if rv.Kind() == reflect.Ptr { vp := rv2i(rv).(*map[uint]bool) + if containerLen == decContainerLenNil { + *vp = nil + return + } if *vp == nil { *vp = make(map[uint]bool, decInferLen(containerLen, d.h.MaxInitLen, 9)) } fastpathTV.DecMapUintBoolL(*vp, containerLen, d) - } else { + } else if containerLen != decContainerLenNil { fastpathTV.DecMapUintBoolL(rv2i(rv).(map[uint]bool), containerLen, d) } } func (f fastpathT) DecMapUintBoolX(vp *map[uint]bool, d *Decoder) { containerLen := d.mapStart() + if containerLen == decContainerLenNil { + *vp = nil + return + } if *vp == nil { *vp = make(map[uint]bool, decInferLen(containerLen, d.h.MaxInitLen, 9)) } @@ -6819,15 +7157,6 @@ func (fastpathT) DecMapUintBoolL(v map[uint]bool, containerLen int, d *Decoder) d.mapElemKey() mk = uint(chkOvf.UintV(d.d.DecodeUint64(), uintBitsize)) d.mapElemValue() - if d.d.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { - delete(v, mk) - } else { - v[mk] = false - } - continue - } mv = d.d.DecodeBool() if v != nil { v[mk] = mv @@ -6839,16 +7168,24 @@ func (d *Decoder) fastpathDecMapUint8IntfR(f *codecFnInfo, rv reflect.Value) { containerLen := d.mapStart() if rv.Kind() == reflect.Ptr { vp := rv2i(rv).(*map[uint8]interface{}) + if containerLen == decContainerLenNil { + *vp = nil + return + } if *vp == nil { *vp = make(map[uint8]interface{}, decInferLen(containerLen, d.h.MaxInitLen, 17)) } fastpathTV.DecMapUint8IntfL(*vp, containerLen, d) - } else { + } else if containerLen != decContainerLenNil { fastpathTV.DecMapUint8IntfL(rv2i(rv).(map[uint8]interface{}), containerLen, d) } } func (f fastpathT) DecMapUint8IntfX(vp *map[uint8]interface{}, d *Decoder) { containerLen := d.mapStart() + if containerLen == decContainerLenNil { + *vp = nil + return + } if *vp == nil { *vp = make(map[uint8]interface{}, decInferLen(containerLen, d.h.MaxInitLen, 17)) } @@ -6867,15 +7204,6 @@ func (fastpathT) DecMapUint8IntfL(v map[uint8]interface{}, containerLen int, d * d.mapElemKey() mk = uint8(chkOvf.UintV(d.d.DecodeUint64(), 8)) d.mapElemValue() - if d.d.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { - delete(v, mk) - } else { - v[mk] = nil - } - continue - } if mapGet { mv = v[mk] } else { @@ -6892,16 +7220,24 @@ func (d *Decoder) fastpathDecMapUint8StringR(f *codecFnInfo, rv reflect.Value) { containerLen := d.mapStart() if rv.Kind() == reflect.Ptr { vp := rv2i(rv).(*map[uint8]string) + if containerLen == decContainerLenNil { + *vp = nil + return + } if *vp == nil { *vp = make(map[uint8]string, decInferLen(containerLen, d.h.MaxInitLen, 17)) } fastpathTV.DecMapUint8StringL(*vp, containerLen, d) - } else { + } else if containerLen != decContainerLenNil { fastpathTV.DecMapUint8StringL(rv2i(rv).(map[uint8]string), containerLen, d) } } func (f fastpathT) DecMapUint8StringX(vp *map[uint8]string, d *Decoder) { containerLen := d.mapStart() + if containerLen == decContainerLenNil { + *vp = nil + return + } if *vp == nil { *vp = make(map[uint8]string, decInferLen(containerLen, d.h.MaxInitLen, 17)) } @@ -6919,15 +7255,6 @@ func (fastpathT) DecMapUint8StringL(v map[uint8]string, containerLen int, d *Dec d.mapElemKey() mk = uint8(chkOvf.UintV(d.d.DecodeUint64(), 8)) d.mapElemValue() - if d.d.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { - delete(v, mk) - } else { - v[mk] = "" - } - continue - } mv = string(d.d.DecodeStringAsBytes()) if v != nil { v[mk] = mv @@ -6939,16 +7266,24 @@ func (d *Decoder) fastpathDecMapUint8BytesR(f *codecFnInfo, rv reflect.Value) { containerLen := d.mapStart() if rv.Kind() == reflect.Ptr { vp := rv2i(rv).(*map[uint8][]byte) + if containerLen == decContainerLenNil { + *vp = nil + return + } if *vp == nil { *vp = make(map[uint8][]byte, decInferLen(containerLen, d.h.MaxInitLen, 25)) } fastpathTV.DecMapUint8BytesL(*vp, containerLen, d) - } else { + } else if containerLen != decContainerLenNil { fastpathTV.DecMapUint8BytesL(rv2i(rv).(map[uint8][]byte), containerLen, d) } } func (f fastpathT) DecMapUint8BytesX(vp *map[uint8][]byte, d *Decoder) { containerLen := d.mapStart() + if containerLen == decContainerLenNil { + *vp = nil + return + } if *vp == nil { *vp = make(map[uint8][]byte, decInferLen(containerLen, d.h.MaxInitLen, 25)) } @@ -6967,15 +7302,6 @@ func (fastpathT) DecMapUint8BytesL(v map[uint8][]byte, containerLen int, d *Deco d.mapElemKey() mk = uint8(chkOvf.UintV(d.d.DecodeUint64(), 8)) d.mapElemValue() - if d.d.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { - delete(v, mk) - } else { - v[mk] = nil - } - continue - } if mapGet { mv = v[mk] } else { @@ -6992,16 +7318,24 @@ func (d *Decoder) fastpathDecMapUint8UintR(f *codecFnInfo, rv reflect.Value) { containerLen := d.mapStart() if rv.Kind() == reflect.Ptr { vp := rv2i(rv).(*map[uint8]uint) + if containerLen == decContainerLenNil { + *vp = nil + return + } if *vp == nil { *vp = make(map[uint8]uint, decInferLen(containerLen, d.h.MaxInitLen, 9)) } fastpathTV.DecMapUint8UintL(*vp, containerLen, d) - } else { + } else if containerLen != decContainerLenNil { fastpathTV.DecMapUint8UintL(rv2i(rv).(map[uint8]uint), containerLen, d) } } func (f fastpathT) DecMapUint8UintX(vp *map[uint8]uint, d *Decoder) { containerLen := d.mapStart() + if containerLen == decContainerLenNil { + *vp = nil + return + } if *vp == nil { *vp = make(map[uint8]uint, decInferLen(containerLen, d.h.MaxInitLen, 9)) } @@ -7019,15 +7353,6 @@ func (fastpathT) DecMapUint8UintL(v map[uint8]uint, containerLen int, d *Decoder d.mapElemKey() mk = uint8(chkOvf.UintV(d.d.DecodeUint64(), 8)) d.mapElemValue() - if d.d.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { - delete(v, mk) - } else { - v[mk] = 0 - } - continue - } mv = uint(chkOvf.UintV(d.d.DecodeUint64(), uintBitsize)) if v != nil { v[mk] = mv @@ -7039,16 +7364,24 @@ func (d *Decoder) fastpathDecMapUint8Uint8R(f *codecFnInfo, rv reflect.Value) { containerLen := d.mapStart() if rv.Kind() == reflect.Ptr { vp := rv2i(rv).(*map[uint8]uint8) + if containerLen == decContainerLenNil { + *vp = nil + return + } if *vp == nil { *vp = make(map[uint8]uint8, decInferLen(containerLen, d.h.MaxInitLen, 2)) } fastpathTV.DecMapUint8Uint8L(*vp, containerLen, d) - } else { + } else if containerLen != decContainerLenNil { fastpathTV.DecMapUint8Uint8L(rv2i(rv).(map[uint8]uint8), containerLen, d) } } func (f fastpathT) DecMapUint8Uint8X(vp *map[uint8]uint8, d *Decoder) { containerLen := d.mapStart() + if containerLen == decContainerLenNil { + *vp = nil + return + } if *vp == nil { *vp = make(map[uint8]uint8, decInferLen(containerLen, d.h.MaxInitLen, 2)) } @@ -7066,15 +7399,6 @@ func (fastpathT) DecMapUint8Uint8L(v map[uint8]uint8, containerLen int, d *Decod d.mapElemKey() mk = uint8(chkOvf.UintV(d.d.DecodeUint64(), 8)) d.mapElemValue() - if d.d.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { - delete(v, mk) - } else { - v[mk] = 0 - } - continue - } mv = uint8(chkOvf.UintV(d.d.DecodeUint64(), 8)) if v != nil { v[mk] = mv @@ -7086,16 +7410,24 @@ func (d *Decoder) fastpathDecMapUint8Uint64R(f *codecFnInfo, rv reflect.Value) { containerLen := d.mapStart() if rv.Kind() == reflect.Ptr { vp := rv2i(rv).(*map[uint8]uint64) + if containerLen == decContainerLenNil { + *vp = nil + return + } if *vp == nil { *vp = make(map[uint8]uint64, decInferLen(containerLen, d.h.MaxInitLen, 9)) } fastpathTV.DecMapUint8Uint64L(*vp, containerLen, d) - } else { + } else if containerLen != decContainerLenNil { fastpathTV.DecMapUint8Uint64L(rv2i(rv).(map[uint8]uint64), containerLen, d) } } func (f fastpathT) DecMapUint8Uint64X(vp *map[uint8]uint64, d *Decoder) { containerLen := d.mapStart() + if containerLen == decContainerLenNil { + *vp = nil + return + } if *vp == nil { *vp = make(map[uint8]uint64, decInferLen(containerLen, d.h.MaxInitLen, 9)) } @@ -7113,15 +7445,6 @@ func (fastpathT) DecMapUint8Uint64L(v map[uint8]uint64, containerLen int, d *Dec d.mapElemKey() mk = uint8(chkOvf.UintV(d.d.DecodeUint64(), 8)) d.mapElemValue() - if d.d.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { - delete(v, mk) - } else { - v[mk] = 0 - } - continue - } mv = d.d.DecodeUint64() if v != nil { v[mk] = mv @@ -7133,16 +7456,24 @@ func (d *Decoder) fastpathDecMapUint8IntR(f *codecFnInfo, rv reflect.Value) { containerLen := d.mapStart() if rv.Kind() == reflect.Ptr { vp := rv2i(rv).(*map[uint8]int) + if containerLen == decContainerLenNil { + *vp = nil + return + } if *vp == nil { *vp = make(map[uint8]int, decInferLen(containerLen, d.h.MaxInitLen, 9)) } fastpathTV.DecMapUint8IntL(*vp, containerLen, d) - } else { + } else if containerLen != decContainerLenNil { fastpathTV.DecMapUint8IntL(rv2i(rv).(map[uint8]int), containerLen, d) } } func (f fastpathT) DecMapUint8IntX(vp *map[uint8]int, d *Decoder) { containerLen := d.mapStart() + if containerLen == decContainerLenNil { + *vp = nil + return + } if *vp == nil { *vp = make(map[uint8]int, decInferLen(containerLen, d.h.MaxInitLen, 9)) } @@ -7160,15 +7491,6 @@ func (fastpathT) DecMapUint8IntL(v map[uint8]int, containerLen int, d *Decoder) d.mapElemKey() mk = uint8(chkOvf.UintV(d.d.DecodeUint64(), 8)) d.mapElemValue() - if d.d.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { - delete(v, mk) - } else { - v[mk] = 0 - } - continue - } mv = int(chkOvf.IntV(d.d.DecodeInt64(), intBitsize)) if v != nil { v[mk] = mv @@ -7180,16 +7502,24 @@ func (d *Decoder) fastpathDecMapUint8Int64R(f *codecFnInfo, rv reflect.Value) { containerLen := d.mapStart() if rv.Kind() == reflect.Ptr { vp := rv2i(rv).(*map[uint8]int64) + if containerLen == decContainerLenNil { + *vp = nil + return + } if *vp == nil { *vp = make(map[uint8]int64, decInferLen(containerLen, d.h.MaxInitLen, 9)) } fastpathTV.DecMapUint8Int64L(*vp, containerLen, d) - } else { + } else if containerLen != decContainerLenNil { fastpathTV.DecMapUint8Int64L(rv2i(rv).(map[uint8]int64), containerLen, d) } } func (f fastpathT) DecMapUint8Int64X(vp *map[uint8]int64, d *Decoder) { containerLen := d.mapStart() + if containerLen == decContainerLenNil { + *vp = nil + return + } if *vp == nil { *vp = make(map[uint8]int64, decInferLen(containerLen, d.h.MaxInitLen, 9)) } @@ -7207,15 +7537,6 @@ func (fastpathT) DecMapUint8Int64L(v map[uint8]int64, containerLen int, d *Decod d.mapElemKey() mk = uint8(chkOvf.UintV(d.d.DecodeUint64(), 8)) d.mapElemValue() - if d.d.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { - delete(v, mk) - } else { - v[mk] = 0 - } - continue - } mv = d.d.DecodeInt64() if v != nil { v[mk] = mv @@ -7227,16 +7548,24 @@ func (d *Decoder) fastpathDecMapUint8Float32R(f *codecFnInfo, rv reflect.Value) containerLen := d.mapStart() if rv.Kind() == reflect.Ptr { vp := rv2i(rv).(*map[uint8]float32) + if containerLen == decContainerLenNil { + *vp = nil + return + } if *vp == nil { *vp = make(map[uint8]float32, decInferLen(containerLen, d.h.MaxInitLen, 5)) } fastpathTV.DecMapUint8Float32L(*vp, containerLen, d) - } else { + } else if containerLen != decContainerLenNil { fastpathTV.DecMapUint8Float32L(rv2i(rv).(map[uint8]float32), containerLen, d) } } func (f fastpathT) DecMapUint8Float32X(vp *map[uint8]float32, d *Decoder) { containerLen := d.mapStart() + if containerLen == decContainerLenNil { + *vp = nil + return + } if *vp == nil { *vp = make(map[uint8]float32, decInferLen(containerLen, d.h.MaxInitLen, 5)) } @@ -7254,15 +7583,6 @@ func (fastpathT) DecMapUint8Float32L(v map[uint8]float32, containerLen int, d *D d.mapElemKey() mk = uint8(chkOvf.UintV(d.d.DecodeUint64(), 8)) d.mapElemValue() - if d.d.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { - delete(v, mk) - } else { - v[mk] = 0 - } - continue - } mv = float32(d.decodeFloat32()) if v != nil { v[mk] = mv @@ -7274,16 +7594,24 @@ func (d *Decoder) fastpathDecMapUint8Float64R(f *codecFnInfo, rv reflect.Value) containerLen := d.mapStart() if rv.Kind() == reflect.Ptr { vp := rv2i(rv).(*map[uint8]float64) + if containerLen == decContainerLenNil { + *vp = nil + return + } if *vp == nil { *vp = make(map[uint8]float64, decInferLen(containerLen, d.h.MaxInitLen, 9)) } fastpathTV.DecMapUint8Float64L(*vp, containerLen, d) - } else { + } else if containerLen != decContainerLenNil { fastpathTV.DecMapUint8Float64L(rv2i(rv).(map[uint8]float64), containerLen, d) } } func (f fastpathT) DecMapUint8Float64X(vp *map[uint8]float64, d *Decoder) { containerLen := d.mapStart() + if containerLen == decContainerLenNil { + *vp = nil + return + } if *vp == nil { *vp = make(map[uint8]float64, decInferLen(containerLen, d.h.MaxInitLen, 9)) } @@ -7301,15 +7629,6 @@ func (fastpathT) DecMapUint8Float64L(v map[uint8]float64, containerLen int, d *D d.mapElemKey() mk = uint8(chkOvf.UintV(d.d.DecodeUint64(), 8)) d.mapElemValue() - if d.d.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { - delete(v, mk) - } else { - v[mk] = 0 - } - continue - } mv = d.d.DecodeFloat64() if v != nil { v[mk] = mv @@ -7321,16 +7640,24 @@ func (d *Decoder) fastpathDecMapUint8BoolR(f *codecFnInfo, rv reflect.Value) { containerLen := d.mapStart() if rv.Kind() == reflect.Ptr { vp := rv2i(rv).(*map[uint8]bool) + if containerLen == decContainerLenNil { + *vp = nil + return + } if *vp == nil { *vp = make(map[uint8]bool, decInferLen(containerLen, d.h.MaxInitLen, 2)) } fastpathTV.DecMapUint8BoolL(*vp, containerLen, d) - } else { + } else if containerLen != decContainerLenNil { fastpathTV.DecMapUint8BoolL(rv2i(rv).(map[uint8]bool), containerLen, d) } } func (f fastpathT) DecMapUint8BoolX(vp *map[uint8]bool, d *Decoder) { containerLen := d.mapStart() + if containerLen == decContainerLenNil { + *vp = nil + return + } if *vp == nil { *vp = make(map[uint8]bool, decInferLen(containerLen, d.h.MaxInitLen, 2)) } @@ -7348,15 +7675,6 @@ func (fastpathT) DecMapUint8BoolL(v map[uint8]bool, containerLen int, d *Decoder d.mapElemKey() mk = uint8(chkOvf.UintV(d.d.DecodeUint64(), 8)) d.mapElemValue() - if d.d.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { - delete(v, mk) - } else { - v[mk] = false - } - continue - } mv = d.d.DecodeBool() if v != nil { v[mk] = mv @@ -7368,16 +7686,24 @@ func (d *Decoder) fastpathDecMapUint64IntfR(f *codecFnInfo, rv reflect.Value) { containerLen := d.mapStart() if rv.Kind() == reflect.Ptr { vp := rv2i(rv).(*map[uint64]interface{}) + if containerLen == decContainerLenNil { + *vp = nil + return + } if *vp == nil { *vp = make(map[uint64]interface{}, decInferLen(containerLen, d.h.MaxInitLen, 24)) } fastpathTV.DecMapUint64IntfL(*vp, containerLen, d) - } else { + } else if containerLen != decContainerLenNil { fastpathTV.DecMapUint64IntfL(rv2i(rv).(map[uint64]interface{}), containerLen, d) } } func (f fastpathT) DecMapUint64IntfX(vp *map[uint64]interface{}, d *Decoder) { containerLen := d.mapStart() + if containerLen == decContainerLenNil { + *vp = nil + return + } if *vp == nil { *vp = make(map[uint64]interface{}, decInferLen(containerLen, d.h.MaxInitLen, 24)) } @@ -7396,15 +7722,6 @@ func (fastpathT) DecMapUint64IntfL(v map[uint64]interface{}, containerLen int, d d.mapElemKey() mk = d.d.DecodeUint64() d.mapElemValue() - if d.d.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { - delete(v, mk) - } else { - v[mk] = nil - } - continue - } if mapGet { mv = v[mk] } else { @@ -7421,16 +7738,24 @@ func (d *Decoder) fastpathDecMapUint64StringR(f *codecFnInfo, rv reflect.Value) containerLen := d.mapStart() if rv.Kind() == reflect.Ptr { vp := rv2i(rv).(*map[uint64]string) + if containerLen == decContainerLenNil { + *vp = nil + return + } if *vp == nil { *vp = make(map[uint64]string, decInferLen(containerLen, d.h.MaxInitLen, 24)) } fastpathTV.DecMapUint64StringL(*vp, containerLen, d) - } else { + } else if containerLen != decContainerLenNil { fastpathTV.DecMapUint64StringL(rv2i(rv).(map[uint64]string), containerLen, d) } } func (f fastpathT) DecMapUint64StringX(vp *map[uint64]string, d *Decoder) { containerLen := d.mapStart() + if containerLen == decContainerLenNil { + *vp = nil + return + } if *vp == nil { *vp = make(map[uint64]string, decInferLen(containerLen, d.h.MaxInitLen, 24)) } @@ -7448,15 +7773,6 @@ func (fastpathT) DecMapUint64StringL(v map[uint64]string, containerLen int, d *D d.mapElemKey() mk = d.d.DecodeUint64() d.mapElemValue() - if d.d.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { - delete(v, mk) - } else { - v[mk] = "" - } - continue - } mv = string(d.d.DecodeStringAsBytes()) if v != nil { v[mk] = mv @@ -7468,16 +7784,24 @@ func (d *Decoder) fastpathDecMapUint64BytesR(f *codecFnInfo, rv reflect.Value) { containerLen := d.mapStart() if rv.Kind() == reflect.Ptr { vp := rv2i(rv).(*map[uint64][]byte) + if containerLen == decContainerLenNil { + *vp = nil + return + } if *vp == nil { *vp = make(map[uint64][]byte, decInferLen(containerLen, d.h.MaxInitLen, 32)) } fastpathTV.DecMapUint64BytesL(*vp, containerLen, d) - } else { + } else if containerLen != decContainerLenNil { fastpathTV.DecMapUint64BytesL(rv2i(rv).(map[uint64][]byte), containerLen, d) } } func (f fastpathT) DecMapUint64BytesX(vp *map[uint64][]byte, d *Decoder) { containerLen := d.mapStart() + if containerLen == decContainerLenNil { + *vp = nil + return + } if *vp == nil { *vp = make(map[uint64][]byte, decInferLen(containerLen, d.h.MaxInitLen, 32)) } @@ -7496,15 +7820,6 @@ func (fastpathT) DecMapUint64BytesL(v map[uint64][]byte, containerLen int, d *De d.mapElemKey() mk = d.d.DecodeUint64() d.mapElemValue() - if d.d.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { - delete(v, mk) - } else { - v[mk] = nil - } - continue - } if mapGet { mv = v[mk] } else { @@ -7521,16 +7836,24 @@ func (d *Decoder) fastpathDecMapUint64UintR(f *codecFnInfo, rv reflect.Value) { containerLen := d.mapStart() if rv.Kind() == reflect.Ptr { vp := rv2i(rv).(*map[uint64]uint) + if containerLen == decContainerLenNil { + *vp = nil + return + } if *vp == nil { *vp = make(map[uint64]uint, decInferLen(containerLen, d.h.MaxInitLen, 16)) } fastpathTV.DecMapUint64UintL(*vp, containerLen, d) - } else { + } else if containerLen != decContainerLenNil { fastpathTV.DecMapUint64UintL(rv2i(rv).(map[uint64]uint), containerLen, d) } } func (f fastpathT) DecMapUint64UintX(vp *map[uint64]uint, d *Decoder) { containerLen := d.mapStart() + if containerLen == decContainerLenNil { + *vp = nil + return + } if *vp == nil { *vp = make(map[uint64]uint, decInferLen(containerLen, d.h.MaxInitLen, 16)) } @@ -7548,15 +7871,6 @@ func (fastpathT) DecMapUint64UintL(v map[uint64]uint, containerLen int, d *Decod d.mapElemKey() mk = d.d.DecodeUint64() d.mapElemValue() - if d.d.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { - delete(v, mk) - } else { - v[mk] = 0 - } - continue - } mv = uint(chkOvf.UintV(d.d.DecodeUint64(), uintBitsize)) if v != nil { v[mk] = mv @@ -7568,16 +7882,24 @@ func (d *Decoder) fastpathDecMapUint64Uint8R(f *codecFnInfo, rv reflect.Value) { containerLen := d.mapStart() if rv.Kind() == reflect.Ptr { vp := rv2i(rv).(*map[uint64]uint8) + if containerLen == decContainerLenNil { + *vp = nil + return + } if *vp == nil { *vp = make(map[uint64]uint8, decInferLen(containerLen, d.h.MaxInitLen, 9)) } fastpathTV.DecMapUint64Uint8L(*vp, containerLen, d) - } else { + } else if containerLen != decContainerLenNil { fastpathTV.DecMapUint64Uint8L(rv2i(rv).(map[uint64]uint8), containerLen, d) } } func (f fastpathT) DecMapUint64Uint8X(vp *map[uint64]uint8, d *Decoder) { containerLen := d.mapStart() + if containerLen == decContainerLenNil { + *vp = nil + return + } if *vp == nil { *vp = make(map[uint64]uint8, decInferLen(containerLen, d.h.MaxInitLen, 9)) } @@ -7595,15 +7917,6 @@ func (fastpathT) DecMapUint64Uint8L(v map[uint64]uint8, containerLen int, d *Dec d.mapElemKey() mk = d.d.DecodeUint64() d.mapElemValue() - if d.d.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { - delete(v, mk) - } else { - v[mk] = 0 - } - continue - } mv = uint8(chkOvf.UintV(d.d.DecodeUint64(), 8)) if v != nil { v[mk] = mv @@ -7615,16 +7928,24 @@ func (d *Decoder) fastpathDecMapUint64Uint64R(f *codecFnInfo, rv reflect.Value) containerLen := d.mapStart() if rv.Kind() == reflect.Ptr { vp := rv2i(rv).(*map[uint64]uint64) + if containerLen == decContainerLenNil { + *vp = nil + return + } if *vp == nil { *vp = make(map[uint64]uint64, decInferLen(containerLen, d.h.MaxInitLen, 16)) } fastpathTV.DecMapUint64Uint64L(*vp, containerLen, d) - } else { + } else if containerLen != decContainerLenNil { fastpathTV.DecMapUint64Uint64L(rv2i(rv).(map[uint64]uint64), containerLen, d) } } func (f fastpathT) DecMapUint64Uint64X(vp *map[uint64]uint64, d *Decoder) { containerLen := d.mapStart() + if containerLen == decContainerLenNil { + *vp = nil + return + } if *vp == nil { *vp = make(map[uint64]uint64, decInferLen(containerLen, d.h.MaxInitLen, 16)) } @@ -7642,15 +7963,6 @@ func (fastpathT) DecMapUint64Uint64L(v map[uint64]uint64, containerLen int, d *D d.mapElemKey() mk = d.d.DecodeUint64() d.mapElemValue() - if d.d.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { - delete(v, mk) - } else { - v[mk] = 0 - } - continue - } mv = d.d.DecodeUint64() if v != nil { v[mk] = mv @@ -7662,16 +7974,24 @@ func (d *Decoder) fastpathDecMapUint64IntR(f *codecFnInfo, rv reflect.Value) { containerLen := d.mapStart() if rv.Kind() == reflect.Ptr { vp := rv2i(rv).(*map[uint64]int) + if containerLen == decContainerLenNil { + *vp = nil + return + } if *vp == nil { *vp = make(map[uint64]int, decInferLen(containerLen, d.h.MaxInitLen, 16)) } fastpathTV.DecMapUint64IntL(*vp, containerLen, d) - } else { + } else if containerLen != decContainerLenNil { fastpathTV.DecMapUint64IntL(rv2i(rv).(map[uint64]int), containerLen, d) } } func (f fastpathT) DecMapUint64IntX(vp *map[uint64]int, d *Decoder) { containerLen := d.mapStart() + if containerLen == decContainerLenNil { + *vp = nil + return + } if *vp == nil { *vp = make(map[uint64]int, decInferLen(containerLen, d.h.MaxInitLen, 16)) } @@ -7689,15 +8009,6 @@ func (fastpathT) DecMapUint64IntL(v map[uint64]int, containerLen int, d *Decoder d.mapElemKey() mk = d.d.DecodeUint64() d.mapElemValue() - if d.d.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { - delete(v, mk) - } else { - v[mk] = 0 - } - continue - } mv = int(chkOvf.IntV(d.d.DecodeInt64(), intBitsize)) if v != nil { v[mk] = mv @@ -7709,16 +8020,24 @@ func (d *Decoder) fastpathDecMapUint64Int64R(f *codecFnInfo, rv reflect.Value) { containerLen := d.mapStart() if rv.Kind() == reflect.Ptr { vp := rv2i(rv).(*map[uint64]int64) + if containerLen == decContainerLenNil { + *vp = nil + return + } if *vp == nil { *vp = make(map[uint64]int64, decInferLen(containerLen, d.h.MaxInitLen, 16)) } fastpathTV.DecMapUint64Int64L(*vp, containerLen, d) - } else { + } else if containerLen != decContainerLenNil { fastpathTV.DecMapUint64Int64L(rv2i(rv).(map[uint64]int64), containerLen, d) } } func (f fastpathT) DecMapUint64Int64X(vp *map[uint64]int64, d *Decoder) { containerLen := d.mapStart() + if containerLen == decContainerLenNil { + *vp = nil + return + } if *vp == nil { *vp = make(map[uint64]int64, decInferLen(containerLen, d.h.MaxInitLen, 16)) } @@ -7736,15 +8055,6 @@ func (fastpathT) DecMapUint64Int64L(v map[uint64]int64, containerLen int, d *Dec d.mapElemKey() mk = d.d.DecodeUint64() d.mapElemValue() - if d.d.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { - delete(v, mk) - } else { - v[mk] = 0 - } - continue - } mv = d.d.DecodeInt64() if v != nil { v[mk] = mv @@ -7756,16 +8066,24 @@ func (d *Decoder) fastpathDecMapUint64Float32R(f *codecFnInfo, rv reflect.Value) containerLen := d.mapStart() if rv.Kind() == reflect.Ptr { vp := rv2i(rv).(*map[uint64]float32) + if containerLen == decContainerLenNil { + *vp = nil + return + } if *vp == nil { *vp = make(map[uint64]float32, decInferLen(containerLen, d.h.MaxInitLen, 12)) } fastpathTV.DecMapUint64Float32L(*vp, containerLen, d) - } else { + } else if containerLen != decContainerLenNil { fastpathTV.DecMapUint64Float32L(rv2i(rv).(map[uint64]float32), containerLen, d) } } func (f fastpathT) DecMapUint64Float32X(vp *map[uint64]float32, d *Decoder) { containerLen := d.mapStart() + if containerLen == decContainerLenNil { + *vp = nil + return + } if *vp == nil { *vp = make(map[uint64]float32, decInferLen(containerLen, d.h.MaxInitLen, 12)) } @@ -7783,15 +8101,6 @@ func (fastpathT) DecMapUint64Float32L(v map[uint64]float32, containerLen int, d d.mapElemKey() mk = d.d.DecodeUint64() d.mapElemValue() - if d.d.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { - delete(v, mk) - } else { - v[mk] = 0 - } - continue - } mv = float32(d.decodeFloat32()) if v != nil { v[mk] = mv @@ -7803,16 +8112,24 @@ func (d *Decoder) fastpathDecMapUint64Float64R(f *codecFnInfo, rv reflect.Value) containerLen := d.mapStart() if rv.Kind() == reflect.Ptr { vp := rv2i(rv).(*map[uint64]float64) + if containerLen == decContainerLenNil { + *vp = nil + return + } if *vp == nil { *vp = make(map[uint64]float64, decInferLen(containerLen, d.h.MaxInitLen, 16)) } fastpathTV.DecMapUint64Float64L(*vp, containerLen, d) - } else { + } else if containerLen != decContainerLenNil { fastpathTV.DecMapUint64Float64L(rv2i(rv).(map[uint64]float64), containerLen, d) } } func (f fastpathT) DecMapUint64Float64X(vp *map[uint64]float64, d *Decoder) { containerLen := d.mapStart() + if containerLen == decContainerLenNil { + *vp = nil + return + } if *vp == nil { *vp = make(map[uint64]float64, decInferLen(containerLen, d.h.MaxInitLen, 16)) } @@ -7830,15 +8147,6 @@ func (fastpathT) DecMapUint64Float64L(v map[uint64]float64, containerLen int, d d.mapElemKey() mk = d.d.DecodeUint64() d.mapElemValue() - if d.d.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { - delete(v, mk) - } else { - v[mk] = 0 - } - continue - } mv = d.d.DecodeFloat64() if v != nil { v[mk] = mv @@ -7850,16 +8158,24 @@ func (d *Decoder) fastpathDecMapUint64BoolR(f *codecFnInfo, rv reflect.Value) { containerLen := d.mapStart() if rv.Kind() == reflect.Ptr { vp := rv2i(rv).(*map[uint64]bool) + if containerLen == decContainerLenNil { + *vp = nil + return + } if *vp == nil { *vp = make(map[uint64]bool, decInferLen(containerLen, d.h.MaxInitLen, 9)) } fastpathTV.DecMapUint64BoolL(*vp, containerLen, d) - } else { + } else if containerLen != decContainerLenNil { fastpathTV.DecMapUint64BoolL(rv2i(rv).(map[uint64]bool), containerLen, d) } } func (f fastpathT) DecMapUint64BoolX(vp *map[uint64]bool, d *Decoder) { containerLen := d.mapStart() + if containerLen == decContainerLenNil { + *vp = nil + return + } if *vp == nil { *vp = make(map[uint64]bool, decInferLen(containerLen, d.h.MaxInitLen, 9)) } @@ -7877,15 +8193,6 @@ func (fastpathT) DecMapUint64BoolL(v map[uint64]bool, containerLen int, d *Decod d.mapElemKey() mk = d.d.DecodeUint64() d.mapElemValue() - if d.d.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { - delete(v, mk) - } else { - v[mk] = false - } - continue - } mv = d.d.DecodeBool() if v != nil { v[mk] = mv @@ -7897,16 +8204,24 @@ func (d *Decoder) fastpathDecMapIntIntfR(f *codecFnInfo, rv reflect.Value) { containerLen := d.mapStart() if rv.Kind() == reflect.Ptr { vp := rv2i(rv).(*map[int]interface{}) + if containerLen == decContainerLenNil { + *vp = nil + return + } if *vp == nil { *vp = make(map[int]interface{}, decInferLen(containerLen, d.h.MaxInitLen, 24)) } fastpathTV.DecMapIntIntfL(*vp, containerLen, d) - } else { + } else if containerLen != decContainerLenNil { fastpathTV.DecMapIntIntfL(rv2i(rv).(map[int]interface{}), containerLen, d) } } func (f fastpathT) DecMapIntIntfX(vp *map[int]interface{}, d *Decoder) { containerLen := d.mapStart() + if containerLen == decContainerLenNil { + *vp = nil + return + } if *vp == nil { *vp = make(map[int]interface{}, decInferLen(containerLen, d.h.MaxInitLen, 24)) } @@ -7925,15 +8240,6 @@ func (fastpathT) DecMapIntIntfL(v map[int]interface{}, containerLen int, d *Deco d.mapElemKey() mk = int(chkOvf.IntV(d.d.DecodeInt64(), intBitsize)) d.mapElemValue() - if d.d.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { - delete(v, mk) - } else { - v[mk] = nil - } - continue - } if mapGet { mv = v[mk] } else { @@ -7950,16 +8256,24 @@ func (d *Decoder) fastpathDecMapIntStringR(f *codecFnInfo, rv reflect.Value) { containerLen := d.mapStart() if rv.Kind() == reflect.Ptr { vp := rv2i(rv).(*map[int]string) + if containerLen == decContainerLenNil { + *vp = nil + return + } if *vp == nil { *vp = make(map[int]string, decInferLen(containerLen, d.h.MaxInitLen, 24)) } fastpathTV.DecMapIntStringL(*vp, containerLen, d) - } else { + } else if containerLen != decContainerLenNil { fastpathTV.DecMapIntStringL(rv2i(rv).(map[int]string), containerLen, d) } } func (f fastpathT) DecMapIntStringX(vp *map[int]string, d *Decoder) { containerLen := d.mapStart() + if containerLen == decContainerLenNil { + *vp = nil + return + } if *vp == nil { *vp = make(map[int]string, decInferLen(containerLen, d.h.MaxInitLen, 24)) } @@ -7977,15 +8291,6 @@ func (fastpathT) DecMapIntStringL(v map[int]string, containerLen int, d *Decoder d.mapElemKey() mk = int(chkOvf.IntV(d.d.DecodeInt64(), intBitsize)) d.mapElemValue() - if d.d.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { - delete(v, mk) - } else { - v[mk] = "" - } - continue - } mv = string(d.d.DecodeStringAsBytes()) if v != nil { v[mk] = mv @@ -7997,16 +8302,24 @@ func (d *Decoder) fastpathDecMapIntBytesR(f *codecFnInfo, rv reflect.Value) { containerLen := d.mapStart() if rv.Kind() == reflect.Ptr { vp := rv2i(rv).(*map[int][]byte) + if containerLen == decContainerLenNil { + *vp = nil + return + } if *vp == nil { *vp = make(map[int][]byte, decInferLen(containerLen, d.h.MaxInitLen, 32)) } fastpathTV.DecMapIntBytesL(*vp, containerLen, d) - } else { + } else if containerLen != decContainerLenNil { fastpathTV.DecMapIntBytesL(rv2i(rv).(map[int][]byte), containerLen, d) } } func (f fastpathT) DecMapIntBytesX(vp *map[int][]byte, d *Decoder) { containerLen := d.mapStart() + if containerLen == decContainerLenNil { + *vp = nil + return + } if *vp == nil { *vp = make(map[int][]byte, decInferLen(containerLen, d.h.MaxInitLen, 32)) } @@ -8025,15 +8338,6 @@ func (fastpathT) DecMapIntBytesL(v map[int][]byte, containerLen int, d *Decoder) d.mapElemKey() mk = int(chkOvf.IntV(d.d.DecodeInt64(), intBitsize)) d.mapElemValue() - if d.d.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { - delete(v, mk) - } else { - v[mk] = nil - } - continue - } if mapGet { mv = v[mk] } else { @@ -8050,16 +8354,24 @@ func (d *Decoder) fastpathDecMapIntUintR(f *codecFnInfo, rv reflect.Value) { containerLen := d.mapStart() if rv.Kind() == reflect.Ptr { vp := rv2i(rv).(*map[int]uint) + if containerLen == decContainerLenNil { + *vp = nil + return + } if *vp == nil { *vp = make(map[int]uint, decInferLen(containerLen, d.h.MaxInitLen, 16)) } fastpathTV.DecMapIntUintL(*vp, containerLen, d) - } else { + } else if containerLen != decContainerLenNil { fastpathTV.DecMapIntUintL(rv2i(rv).(map[int]uint), containerLen, d) } } func (f fastpathT) DecMapIntUintX(vp *map[int]uint, d *Decoder) { containerLen := d.mapStart() + if containerLen == decContainerLenNil { + *vp = nil + return + } if *vp == nil { *vp = make(map[int]uint, decInferLen(containerLen, d.h.MaxInitLen, 16)) } @@ -8077,15 +8389,6 @@ func (fastpathT) DecMapIntUintL(v map[int]uint, containerLen int, d *Decoder) { d.mapElemKey() mk = int(chkOvf.IntV(d.d.DecodeInt64(), intBitsize)) d.mapElemValue() - if d.d.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { - delete(v, mk) - } else { - v[mk] = 0 - } - continue - } mv = uint(chkOvf.UintV(d.d.DecodeUint64(), uintBitsize)) if v != nil { v[mk] = mv @@ -8097,16 +8400,24 @@ func (d *Decoder) fastpathDecMapIntUint8R(f *codecFnInfo, rv reflect.Value) { containerLen := d.mapStart() if rv.Kind() == reflect.Ptr { vp := rv2i(rv).(*map[int]uint8) + if containerLen == decContainerLenNil { + *vp = nil + return + } if *vp == nil { *vp = make(map[int]uint8, decInferLen(containerLen, d.h.MaxInitLen, 9)) } fastpathTV.DecMapIntUint8L(*vp, containerLen, d) - } else { + } else if containerLen != decContainerLenNil { fastpathTV.DecMapIntUint8L(rv2i(rv).(map[int]uint8), containerLen, d) } } func (f fastpathT) DecMapIntUint8X(vp *map[int]uint8, d *Decoder) { containerLen := d.mapStart() + if containerLen == decContainerLenNil { + *vp = nil + return + } if *vp == nil { *vp = make(map[int]uint8, decInferLen(containerLen, d.h.MaxInitLen, 9)) } @@ -8124,15 +8435,6 @@ func (fastpathT) DecMapIntUint8L(v map[int]uint8, containerLen int, d *Decoder) d.mapElemKey() mk = int(chkOvf.IntV(d.d.DecodeInt64(), intBitsize)) d.mapElemValue() - if d.d.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { - delete(v, mk) - } else { - v[mk] = 0 - } - continue - } mv = uint8(chkOvf.UintV(d.d.DecodeUint64(), 8)) if v != nil { v[mk] = mv @@ -8144,16 +8446,24 @@ func (d *Decoder) fastpathDecMapIntUint64R(f *codecFnInfo, rv reflect.Value) { containerLen := d.mapStart() if rv.Kind() == reflect.Ptr { vp := rv2i(rv).(*map[int]uint64) + if containerLen == decContainerLenNil { + *vp = nil + return + } if *vp == nil { *vp = make(map[int]uint64, decInferLen(containerLen, d.h.MaxInitLen, 16)) } fastpathTV.DecMapIntUint64L(*vp, containerLen, d) - } else { + } else if containerLen != decContainerLenNil { fastpathTV.DecMapIntUint64L(rv2i(rv).(map[int]uint64), containerLen, d) } } func (f fastpathT) DecMapIntUint64X(vp *map[int]uint64, d *Decoder) { containerLen := d.mapStart() + if containerLen == decContainerLenNil { + *vp = nil + return + } if *vp == nil { *vp = make(map[int]uint64, decInferLen(containerLen, d.h.MaxInitLen, 16)) } @@ -8171,15 +8481,6 @@ func (fastpathT) DecMapIntUint64L(v map[int]uint64, containerLen int, d *Decoder d.mapElemKey() mk = int(chkOvf.IntV(d.d.DecodeInt64(), intBitsize)) d.mapElemValue() - if d.d.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { - delete(v, mk) - } else { - v[mk] = 0 - } - continue - } mv = d.d.DecodeUint64() if v != nil { v[mk] = mv @@ -8191,16 +8492,24 @@ func (d *Decoder) fastpathDecMapIntIntR(f *codecFnInfo, rv reflect.Value) { containerLen := d.mapStart() if rv.Kind() == reflect.Ptr { vp := rv2i(rv).(*map[int]int) + if containerLen == decContainerLenNil { + *vp = nil + return + } if *vp == nil { *vp = make(map[int]int, decInferLen(containerLen, d.h.MaxInitLen, 16)) } fastpathTV.DecMapIntIntL(*vp, containerLen, d) - } else { + } else if containerLen != decContainerLenNil { fastpathTV.DecMapIntIntL(rv2i(rv).(map[int]int), containerLen, d) } } func (f fastpathT) DecMapIntIntX(vp *map[int]int, d *Decoder) { containerLen := d.mapStart() + if containerLen == decContainerLenNil { + *vp = nil + return + } if *vp == nil { *vp = make(map[int]int, decInferLen(containerLen, d.h.MaxInitLen, 16)) } @@ -8218,15 +8527,6 @@ func (fastpathT) DecMapIntIntL(v map[int]int, containerLen int, d *Decoder) { d.mapElemKey() mk = int(chkOvf.IntV(d.d.DecodeInt64(), intBitsize)) d.mapElemValue() - if d.d.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { - delete(v, mk) - } else { - v[mk] = 0 - } - continue - } mv = int(chkOvf.IntV(d.d.DecodeInt64(), intBitsize)) if v != nil { v[mk] = mv @@ -8238,16 +8538,24 @@ func (d *Decoder) fastpathDecMapIntInt64R(f *codecFnInfo, rv reflect.Value) { containerLen := d.mapStart() if rv.Kind() == reflect.Ptr { vp := rv2i(rv).(*map[int]int64) + if containerLen == decContainerLenNil { + *vp = nil + return + } if *vp == nil { *vp = make(map[int]int64, decInferLen(containerLen, d.h.MaxInitLen, 16)) } fastpathTV.DecMapIntInt64L(*vp, containerLen, d) - } else { + } else if containerLen != decContainerLenNil { fastpathTV.DecMapIntInt64L(rv2i(rv).(map[int]int64), containerLen, d) } } func (f fastpathT) DecMapIntInt64X(vp *map[int]int64, d *Decoder) { containerLen := d.mapStart() + if containerLen == decContainerLenNil { + *vp = nil + return + } if *vp == nil { *vp = make(map[int]int64, decInferLen(containerLen, d.h.MaxInitLen, 16)) } @@ -8265,15 +8573,6 @@ func (fastpathT) DecMapIntInt64L(v map[int]int64, containerLen int, d *Decoder) d.mapElemKey() mk = int(chkOvf.IntV(d.d.DecodeInt64(), intBitsize)) d.mapElemValue() - if d.d.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { - delete(v, mk) - } else { - v[mk] = 0 - } - continue - } mv = d.d.DecodeInt64() if v != nil { v[mk] = mv @@ -8285,16 +8584,24 @@ func (d *Decoder) fastpathDecMapIntFloat32R(f *codecFnInfo, rv reflect.Value) { containerLen := d.mapStart() if rv.Kind() == reflect.Ptr { vp := rv2i(rv).(*map[int]float32) + if containerLen == decContainerLenNil { + *vp = nil + return + } if *vp == nil { *vp = make(map[int]float32, decInferLen(containerLen, d.h.MaxInitLen, 12)) } fastpathTV.DecMapIntFloat32L(*vp, containerLen, d) - } else { + } else if containerLen != decContainerLenNil { fastpathTV.DecMapIntFloat32L(rv2i(rv).(map[int]float32), containerLen, d) } } func (f fastpathT) DecMapIntFloat32X(vp *map[int]float32, d *Decoder) { containerLen := d.mapStart() + if containerLen == decContainerLenNil { + *vp = nil + return + } if *vp == nil { *vp = make(map[int]float32, decInferLen(containerLen, d.h.MaxInitLen, 12)) } @@ -8312,15 +8619,6 @@ func (fastpathT) DecMapIntFloat32L(v map[int]float32, containerLen int, d *Decod d.mapElemKey() mk = int(chkOvf.IntV(d.d.DecodeInt64(), intBitsize)) d.mapElemValue() - if d.d.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { - delete(v, mk) - } else { - v[mk] = 0 - } - continue - } mv = float32(d.decodeFloat32()) if v != nil { v[mk] = mv @@ -8332,16 +8630,24 @@ func (d *Decoder) fastpathDecMapIntFloat64R(f *codecFnInfo, rv reflect.Value) { containerLen := d.mapStart() if rv.Kind() == reflect.Ptr { vp := rv2i(rv).(*map[int]float64) + if containerLen == decContainerLenNil { + *vp = nil + return + } if *vp == nil { *vp = make(map[int]float64, decInferLen(containerLen, d.h.MaxInitLen, 16)) } fastpathTV.DecMapIntFloat64L(*vp, containerLen, d) - } else { + } else if containerLen != decContainerLenNil { fastpathTV.DecMapIntFloat64L(rv2i(rv).(map[int]float64), containerLen, d) } } func (f fastpathT) DecMapIntFloat64X(vp *map[int]float64, d *Decoder) { containerLen := d.mapStart() + if containerLen == decContainerLenNil { + *vp = nil + return + } if *vp == nil { *vp = make(map[int]float64, decInferLen(containerLen, d.h.MaxInitLen, 16)) } @@ -8359,15 +8665,6 @@ func (fastpathT) DecMapIntFloat64L(v map[int]float64, containerLen int, d *Decod d.mapElemKey() mk = int(chkOvf.IntV(d.d.DecodeInt64(), intBitsize)) d.mapElemValue() - if d.d.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { - delete(v, mk) - } else { - v[mk] = 0 - } - continue - } mv = d.d.DecodeFloat64() if v != nil { v[mk] = mv @@ -8379,16 +8676,24 @@ func (d *Decoder) fastpathDecMapIntBoolR(f *codecFnInfo, rv reflect.Value) { containerLen := d.mapStart() if rv.Kind() == reflect.Ptr { vp := rv2i(rv).(*map[int]bool) + if containerLen == decContainerLenNil { + *vp = nil + return + } if *vp == nil { *vp = make(map[int]bool, decInferLen(containerLen, d.h.MaxInitLen, 9)) } fastpathTV.DecMapIntBoolL(*vp, containerLen, d) - } else { + } else if containerLen != decContainerLenNil { fastpathTV.DecMapIntBoolL(rv2i(rv).(map[int]bool), containerLen, d) } } func (f fastpathT) DecMapIntBoolX(vp *map[int]bool, d *Decoder) { containerLen := d.mapStart() + if containerLen == decContainerLenNil { + *vp = nil + return + } if *vp == nil { *vp = make(map[int]bool, decInferLen(containerLen, d.h.MaxInitLen, 9)) } @@ -8406,15 +8711,6 @@ func (fastpathT) DecMapIntBoolL(v map[int]bool, containerLen int, d *Decoder) { d.mapElemKey() mk = int(chkOvf.IntV(d.d.DecodeInt64(), intBitsize)) d.mapElemValue() - if d.d.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { - delete(v, mk) - } else { - v[mk] = false - } - continue - } mv = d.d.DecodeBool() if v != nil { v[mk] = mv @@ -8426,16 +8722,24 @@ func (d *Decoder) fastpathDecMapInt64IntfR(f *codecFnInfo, rv reflect.Value) { containerLen := d.mapStart() if rv.Kind() == reflect.Ptr { vp := rv2i(rv).(*map[int64]interface{}) + if containerLen == decContainerLenNil { + *vp = nil + return + } if *vp == nil { *vp = make(map[int64]interface{}, decInferLen(containerLen, d.h.MaxInitLen, 24)) } fastpathTV.DecMapInt64IntfL(*vp, containerLen, d) - } else { + } else if containerLen != decContainerLenNil { fastpathTV.DecMapInt64IntfL(rv2i(rv).(map[int64]interface{}), containerLen, d) } } func (f fastpathT) DecMapInt64IntfX(vp *map[int64]interface{}, d *Decoder) { containerLen := d.mapStart() + if containerLen == decContainerLenNil { + *vp = nil + return + } if *vp == nil { *vp = make(map[int64]interface{}, decInferLen(containerLen, d.h.MaxInitLen, 24)) } @@ -8454,15 +8758,6 @@ func (fastpathT) DecMapInt64IntfL(v map[int64]interface{}, containerLen int, d * d.mapElemKey() mk = d.d.DecodeInt64() d.mapElemValue() - if d.d.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { - delete(v, mk) - } else { - v[mk] = nil - } - continue - } if mapGet { mv = v[mk] } else { @@ -8479,16 +8774,24 @@ func (d *Decoder) fastpathDecMapInt64StringR(f *codecFnInfo, rv reflect.Value) { containerLen := d.mapStart() if rv.Kind() == reflect.Ptr { vp := rv2i(rv).(*map[int64]string) + if containerLen == decContainerLenNil { + *vp = nil + return + } if *vp == nil { *vp = make(map[int64]string, decInferLen(containerLen, d.h.MaxInitLen, 24)) } fastpathTV.DecMapInt64StringL(*vp, containerLen, d) - } else { + } else if containerLen != decContainerLenNil { fastpathTV.DecMapInt64StringL(rv2i(rv).(map[int64]string), containerLen, d) } } func (f fastpathT) DecMapInt64StringX(vp *map[int64]string, d *Decoder) { containerLen := d.mapStart() + if containerLen == decContainerLenNil { + *vp = nil + return + } if *vp == nil { *vp = make(map[int64]string, decInferLen(containerLen, d.h.MaxInitLen, 24)) } @@ -8506,15 +8809,6 @@ func (fastpathT) DecMapInt64StringL(v map[int64]string, containerLen int, d *Dec d.mapElemKey() mk = d.d.DecodeInt64() d.mapElemValue() - if d.d.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { - delete(v, mk) - } else { - v[mk] = "" - } - continue - } mv = string(d.d.DecodeStringAsBytes()) if v != nil { v[mk] = mv @@ -8526,16 +8820,24 @@ func (d *Decoder) fastpathDecMapInt64BytesR(f *codecFnInfo, rv reflect.Value) { containerLen := d.mapStart() if rv.Kind() == reflect.Ptr { vp := rv2i(rv).(*map[int64][]byte) + if containerLen == decContainerLenNil { + *vp = nil + return + } if *vp == nil { *vp = make(map[int64][]byte, decInferLen(containerLen, d.h.MaxInitLen, 32)) } fastpathTV.DecMapInt64BytesL(*vp, containerLen, d) - } else { + } else if containerLen != decContainerLenNil { fastpathTV.DecMapInt64BytesL(rv2i(rv).(map[int64][]byte), containerLen, d) } } func (f fastpathT) DecMapInt64BytesX(vp *map[int64][]byte, d *Decoder) { containerLen := d.mapStart() + if containerLen == decContainerLenNil { + *vp = nil + return + } if *vp == nil { *vp = make(map[int64][]byte, decInferLen(containerLen, d.h.MaxInitLen, 32)) } @@ -8554,15 +8856,6 @@ func (fastpathT) DecMapInt64BytesL(v map[int64][]byte, containerLen int, d *Deco d.mapElemKey() mk = d.d.DecodeInt64() d.mapElemValue() - if d.d.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { - delete(v, mk) - } else { - v[mk] = nil - } - continue - } if mapGet { mv = v[mk] } else { @@ -8579,16 +8872,24 @@ func (d *Decoder) fastpathDecMapInt64UintR(f *codecFnInfo, rv reflect.Value) { containerLen := d.mapStart() if rv.Kind() == reflect.Ptr { vp := rv2i(rv).(*map[int64]uint) + if containerLen == decContainerLenNil { + *vp = nil + return + } if *vp == nil { *vp = make(map[int64]uint, decInferLen(containerLen, d.h.MaxInitLen, 16)) } fastpathTV.DecMapInt64UintL(*vp, containerLen, d) - } else { + } else if containerLen != decContainerLenNil { fastpathTV.DecMapInt64UintL(rv2i(rv).(map[int64]uint), containerLen, d) } } func (f fastpathT) DecMapInt64UintX(vp *map[int64]uint, d *Decoder) { containerLen := d.mapStart() + if containerLen == decContainerLenNil { + *vp = nil + return + } if *vp == nil { *vp = make(map[int64]uint, decInferLen(containerLen, d.h.MaxInitLen, 16)) } @@ -8606,15 +8907,6 @@ func (fastpathT) DecMapInt64UintL(v map[int64]uint, containerLen int, d *Decoder d.mapElemKey() mk = d.d.DecodeInt64() d.mapElemValue() - if d.d.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { - delete(v, mk) - } else { - v[mk] = 0 - } - continue - } mv = uint(chkOvf.UintV(d.d.DecodeUint64(), uintBitsize)) if v != nil { v[mk] = mv @@ -8626,16 +8918,24 @@ func (d *Decoder) fastpathDecMapInt64Uint8R(f *codecFnInfo, rv reflect.Value) { containerLen := d.mapStart() if rv.Kind() == reflect.Ptr { vp := rv2i(rv).(*map[int64]uint8) + if containerLen == decContainerLenNil { + *vp = nil + return + } if *vp == nil { *vp = make(map[int64]uint8, decInferLen(containerLen, d.h.MaxInitLen, 9)) } fastpathTV.DecMapInt64Uint8L(*vp, containerLen, d) - } else { + } else if containerLen != decContainerLenNil { fastpathTV.DecMapInt64Uint8L(rv2i(rv).(map[int64]uint8), containerLen, d) } } func (f fastpathT) DecMapInt64Uint8X(vp *map[int64]uint8, d *Decoder) { containerLen := d.mapStart() + if containerLen == decContainerLenNil { + *vp = nil + return + } if *vp == nil { *vp = make(map[int64]uint8, decInferLen(containerLen, d.h.MaxInitLen, 9)) } @@ -8653,15 +8953,6 @@ func (fastpathT) DecMapInt64Uint8L(v map[int64]uint8, containerLen int, d *Decod d.mapElemKey() mk = d.d.DecodeInt64() d.mapElemValue() - if d.d.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { - delete(v, mk) - } else { - v[mk] = 0 - } - continue - } mv = uint8(chkOvf.UintV(d.d.DecodeUint64(), 8)) if v != nil { v[mk] = mv @@ -8673,16 +8964,24 @@ func (d *Decoder) fastpathDecMapInt64Uint64R(f *codecFnInfo, rv reflect.Value) { containerLen := d.mapStart() if rv.Kind() == reflect.Ptr { vp := rv2i(rv).(*map[int64]uint64) + if containerLen == decContainerLenNil { + *vp = nil + return + } if *vp == nil { *vp = make(map[int64]uint64, decInferLen(containerLen, d.h.MaxInitLen, 16)) } fastpathTV.DecMapInt64Uint64L(*vp, containerLen, d) - } else { + } else if containerLen != decContainerLenNil { fastpathTV.DecMapInt64Uint64L(rv2i(rv).(map[int64]uint64), containerLen, d) } } func (f fastpathT) DecMapInt64Uint64X(vp *map[int64]uint64, d *Decoder) { containerLen := d.mapStart() + if containerLen == decContainerLenNil { + *vp = nil + return + } if *vp == nil { *vp = make(map[int64]uint64, decInferLen(containerLen, d.h.MaxInitLen, 16)) } @@ -8700,15 +8999,6 @@ func (fastpathT) DecMapInt64Uint64L(v map[int64]uint64, containerLen int, d *Dec d.mapElemKey() mk = d.d.DecodeInt64() d.mapElemValue() - if d.d.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { - delete(v, mk) - } else { - v[mk] = 0 - } - continue - } mv = d.d.DecodeUint64() if v != nil { v[mk] = mv @@ -8720,16 +9010,24 @@ func (d *Decoder) fastpathDecMapInt64IntR(f *codecFnInfo, rv reflect.Value) { containerLen := d.mapStart() if rv.Kind() == reflect.Ptr { vp := rv2i(rv).(*map[int64]int) + if containerLen == decContainerLenNil { + *vp = nil + return + } if *vp == nil { *vp = make(map[int64]int, decInferLen(containerLen, d.h.MaxInitLen, 16)) } fastpathTV.DecMapInt64IntL(*vp, containerLen, d) - } else { + } else if containerLen != decContainerLenNil { fastpathTV.DecMapInt64IntL(rv2i(rv).(map[int64]int), containerLen, d) } } func (f fastpathT) DecMapInt64IntX(vp *map[int64]int, d *Decoder) { containerLen := d.mapStart() + if containerLen == decContainerLenNil { + *vp = nil + return + } if *vp == nil { *vp = make(map[int64]int, decInferLen(containerLen, d.h.MaxInitLen, 16)) } @@ -8747,15 +9045,6 @@ func (fastpathT) DecMapInt64IntL(v map[int64]int, containerLen int, d *Decoder) d.mapElemKey() mk = d.d.DecodeInt64() d.mapElemValue() - if d.d.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { - delete(v, mk) - } else { - v[mk] = 0 - } - continue - } mv = int(chkOvf.IntV(d.d.DecodeInt64(), intBitsize)) if v != nil { v[mk] = mv @@ -8767,16 +9056,24 @@ func (d *Decoder) fastpathDecMapInt64Int64R(f *codecFnInfo, rv reflect.Value) { containerLen := d.mapStart() if rv.Kind() == reflect.Ptr { vp := rv2i(rv).(*map[int64]int64) + if containerLen == decContainerLenNil { + *vp = nil + return + } if *vp == nil { *vp = make(map[int64]int64, decInferLen(containerLen, d.h.MaxInitLen, 16)) } fastpathTV.DecMapInt64Int64L(*vp, containerLen, d) - } else { + } else if containerLen != decContainerLenNil { fastpathTV.DecMapInt64Int64L(rv2i(rv).(map[int64]int64), containerLen, d) } } func (f fastpathT) DecMapInt64Int64X(vp *map[int64]int64, d *Decoder) { containerLen := d.mapStart() + if containerLen == decContainerLenNil { + *vp = nil + return + } if *vp == nil { *vp = make(map[int64]int64, decInferLen(containerLen, d.h.MaxInitLen, 16)) } @@ -8794,15 +9091,6 @@ func (fastpathT) DecMapInt64Int64L(v map[int64]int64, containerLen int, d *Decod d.mapElemKey() mk = d.d.DecodeInt64() d.mapElemValue() - if d.d.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { - delete(v, mk) - } else { - v[mk] = 0 - } - continue - } mv = d.d.DecodeInt64() if v != nil { v[mk] = mv @@ -8814,16 +9102,24 @@ func (d *Decoder) fastpathDecMapInt64Float32R(f *codecFnInfo, rv reflect.Value) containerLen := d.mapStart() if rv.Kind() == reflect.Ptr { vp := rv2i(rv).(*map[int64]float32) + if containerLen == decContainerLenNil { + *vp = nil + return + } if *vp == nil { *vp = make(map[int64]float32, decInferLen(containerLen, d.h.MaxInitLen, 12)) } fastpathTV.DecMapInt64Float32L(*vp, containerLen, d) - } else { + } else if containerLen != decContainerLenNil { fastpathTV.DecMapInt64Float32L(rv2i(rv).(map[int64]float32), containerLen, d) } } func (f fastpathT) DecMapInt64Float32X(vp *map[int64]float32, d *Decoder) { containerLen := d.mapStart() + if containerLen == decContainerLenNil { + *vp = nil + return + } if *vp == nil { *vp = make(map[int64]float32, decInferLen(containerLen, d.h.MaxInitLen, 12)) } @@ -8841,15 +9137,6 @@ func (fastpathT) DecMapInt64Float32L(v map[int64]float32, containerLen int, d *D d.mapElemKey() mk = d.d.DecodeInt64() d.mapElemValue() - if d.d.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { - delete(v, mk) - } else { - v[mk] = 0 - } - continue - } mv = float32(d.decodeFloat32()) if v != nil { v[mk] = mv @@ -8861,16 +9148,24 @@ func (d *Decoder) fastpathDecMapInt64Float64R(f *codecFnInfo, rv reflect.Value) containerLen := d.mapStart() if rv.Kind() == reflect.Ptr { vp := rv2i(rv).(*map[int64]float64) + if containerLen == decContainerLenNil { + *vp = nil + return + } if *vp == nil { *vp = make(map[int64]float64, decInferLen(containerLen, d.h.MaxInitLen, 16)) } fastpathTV.DecMapInt64Float64L(*vp, containerLen, d) - } else { + } else if containerLen != decContainerLenNil { fastpathTV.DecMapInt64Float64L(rv2i(rv).(map[int64]float64), containerLen, d) } } func (f fastpathT) DecMapInt64Float64X(vp *map[int64]float64, d *Decoder) { containerLen := d.mapStart() + if containerLen == decContainerLenNil { + *vp = nil + return + } if *vp == nil { *vp = make(map[int64]float64, decInferLen(containerLen, d.h.MaxInitLen, 16)) } @@ -8888,15 +9183,6 @@ func (fastpathT) DecMapInt64Float64L(v map[int64]float64, containerLen int, d *D d.mapElemKey() mk = d.d.DecodeInt64() d.mapElemValue() - if d.d.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { - delete(v, mk) - } else { - v[mk] = 0 - } - continue - } mv = d.d.DecodeFloat64() if v != nil { v[mk] = mv @@ -8908,16 +9194,24 @@ func (d *Decoder) fastpathDecMapInt64BoolR(f *codecFnInfo, rv reflect.Value) { containerLen := d.mapStart() if rv.Kind() == reflect.Ptr { vp := rv2i(rv).(*map[int64]bool) + if containerLen == decContainerLenNil { + *vp = nil + return + } if *vp == nil { *vp = make(map[int64]bool, decInferLen(containerLen, d.h.MaxInitLen, 9)) } fastpathTV.DecMapInt64BoolL(*vp, containerLen, d) - } else { + } else if containerLen != decContainerLenNil { fastpathTV.DecMapInt64BoolL(rv2i(rv).(map[int64]bool), containerLen, d) } } func (f fastpathT) DecMapInt64BoolX(vp *map[int64]bool, d *Decoder) { containerLen := d.mapStart() + if containerLen == decContainerLenNil { + *vp = nil + return + } if *vp == nil { *vp = make(map[int64]bool, decInferLen(containerLen, d.h.MaxInitLen, 9)) } @@ -8935,15 +9229,6 @@ func (fastpathT) DecMapInt64BoolL(v map[int64]bool, containerLen int, d *Decoder d.mapElemKey() mk = d.d.DecodeInt64() d.mapElemValue() - if d.d.TryDecodeAsNil() { - if v == nil { - } else if d.h.DeleteOnNilMapValue { - delete(v, mk) - } else { - v[mk] = false - } - continue - } mv = d.d.DecodeBool() if v != nil { v[mk] = mv diff --git a/codec/fast-path.go.tmpl b/codec/fast-path.go.tmpl index 4975e3f0..4efe07c9 100644 --- a/codec/fast-path.go.tmpl +++ b/codec/fast-path.go.tmpl @@ -31,6 +31,26 @@ package codec // // decoding into p2 will bomb if fast track functions do not treat like unaddressable. // +{{/* +fastpathEncMapStringUint64R (called by fastpath...switch) +EncMapStringUint64V (called by codecgen) + +fastpathEncSliceBoolR: (called by fastpath...switch) (checks f.ti.mbs and calls one of them below) +EncSliceBoolV (also called by codecgen) +EncAsMapSliceBoolV (delegate when mapbyslice=true) + +fastpathDecSliceIntfR (called by fastpath...switch) (calls Y or N below depending on if it can be updated) +DecSliceIntfX (called by codecgen) (calls Y below) +DecSliceIntfY (delegate when slice CAN be updated) +DecSliceIntfN (delegate when slice CANNOT be updated e.g. from array or non-addressable slice) + +fastpathDecMap...R (called by fastpath...switch) (calls L below) +DecMap...X (called by codecgen) +DecMap...L (delegated to by both above) + (update: let both handle when containerLen == 0 or decContainerLenNil) + (L doesn't do mapStart or mapEnd - just the meat) +*/ -}} + import ( "reflect" "sort" @@ -113,11 +133,7 @@ func fastpathEncodeTypeSwitch(iv interface{}, e *Encoder) bool { switch v := iv.(type) { {{range .Values}}{{if not .Primitive}}{{if not .MapKey }}{{if ne .Elem "uint8" -}} case []{{ .Elem }}: - if v == nil { - e.e.EncodeNil() - } else { - fastpathTV.{{ .MethodNamePfx "Enc" false }}V(v, e) - } + fastpathTV.{{ .MethodNamePfx "Enc" false }}V(v, e) case *[]{{ .Elem }}: if *v == nil { e.e.EncodeNil() @@ -257,9 +273,15 @@ func fastpathDecodeTypeSwitch(iv interface{}, d *Decoder) bool { // maps only change if nil, and in that case, there's no point copying */ -}} case map[{{ .MapKey }}]{{ .Elem }}: - fastpathTV.{{ .MethodNamePfx "Dec" false }}L(v, d.mapStart(), d) + if containerLen = d.mapStart(); containerLen != decContainerLenNil { + fastpathTV.{{ .MethodNamePfx "Dec" false }}L(v, containerLen, d) + } case *map[{{ .MapKey }}]{{ .Elem }}: containerLen = d.mapStart() + if containerLen == decContainerLenNil { + *v = nil + break + } if *v == nil { *v = make(map[{{ .MapKey }}]{{ .Elem }}, decInferLen(containerLen, d.h.MaxInitLen, {{ .Size }})) } @@ -310,6 +332,10 @@ func (f fastpathT) {{ .MethodNamePfx "Dec" false }}X(vp *[]{{ .Elem }}, d *Decod } func (fastpathT) {{ .MethodNamePfx "Dec" false }}Y(v []{{ .Elem }}, d *Decoder) (_ []{{ .Elem }}, changed bool) { slh, containerLenS := d.decSliceHelperStart() + if slh.IsNil { + if v == nil { return } + return nil, true + } if containerLenS == 0 { if v == nil { v = []{{ .Elem }}{} } else if len(v) != 0 { v = v[:0] } slh.End() @@ -348,11 +374,13 @@ func (fastpathT) {{ .MethodNamePfx "Dec" false }}Y(v []{{ .Elem }}, d *Decoder) changed = true } slh.ElemContainerState(j) + {{/* if d.d.TryDecodeAsNil() { v[uint(j)] = {{ zerocmd .Elem }} } else { {{ if eq .Elem "interface{}" }}d.decode(&v[uint(j)]){{ else }}v[uint(j)] = {{ decmd .Elem }}{{ end }} - } + } */ -}} + {{ if eq .Elem "interface{}" }}d.decode(&v[uint(j)]){{ else }}v[uint(j)] = {{ decmd .Elem }}{{ end }} } if j < len(v) { v = v[:uint(j)] @@ -366,6 +394,9 @@ func (fastpathT) {{ .MethodNamePfx "Dec" false }}Y(v []{{ .Elem }}, d *Decoder) } func (fastpathT) {{ .MethodNamePfx "Dec" false }}N(v []{{ .Elem }}, d *Decoder) { slh, containerLenS := d.decSliceHelperStart() + if slh.IsNil { + return + } if containerLenS == 0 { slh.End() return @@ -384,11 +415,13 @@ func (fastpathT) {{ .MethodNamePfx "Dec" false }}N(v []{{ .Elem }}, d *Decoder) break } slh.ElemContainerState(j) + {{/* if d.d.TryDecodeAsNil() { v[uint(j)] = {{ zerocmd .Elem }} } else { {{ if eq .Elem "interface{}" }}d.decode(&v[uint(j)]){{ else }}v[uint(j)] = {{ decmd .Elem }}{{ end }} - } + } */ -}} + {{ if eq .Elem "interface{}" }}d.decode(&v[uint(j)]){{ else }}v[uint(j)] = {{ decmd .Elem }}{{ end }} } slh.End() } @@ -404,16 +437,24 @@ func (d *Decoder) {{ .MethodNamePfx "fastpathDec" false }}R(f *codecFnInfo, rv r containerLen := d.mapStart() if rv.Kind() == reflect.Ptr { vp := rv2i(rv).(*map[{{ .MapKey }}]{{ .Elem }}) + if containerLen == decContainerLenNil { + *vp = nil + return + } if *vp == nil { *vp = make(map[{{ .MapKey }}]{{ .Elem }}, decInferLen(containerLen, d.h.MaxInitLen, {{ .Size }})) } fastpathTV.{{ .MethodNamePfx "Dec" false }}L(*vp, containerLen, d) - } else { + } else if containerLen != decContainerLenNil { fastpathTV.{{ .MethodNamePfx "Dec" false }}L(rv2i(rv).(map[{{ .MapKey }}]{{ .Elem }}), containerLen, d) } } func (f fastpathT) {{ .MethodNamePfx "Dec" false }}X(vp *map[{{ .MapKey }}]{{ .Elem }}, d *Decoder) { containerLen := d.mapStart() + if containerLen == decContainerLenNil { + *vp = nil + return + } if *vp == nil { *vp = make(map[{{ .MapKey }}]{{ .Elem }}, decInferLen(containerLen, d.h.MaxInitLen, {{ .Size }})) } @@ -434,6 +475,11 @@ func (f fastpathT) {{ .MethodNamePfx "Dec" false }}N(v map[{{ .MapKey }}]{{ .Ele } */ -}} func (fastpathT) {{ .MethodNamePfx "Dec" false }}L(v map[{{ .MapKey }}]{{ .Elem }}, containerLen int, d *Decoder) { + {{/* No need to check if containerLen == decContainerLenNil, as that is checked by R and L above + if containerLen == decContainerLenNil { + return + } + */ -}} if containerLen == 0 { d.mapEnd() return @@ -452,10 +498,12 @@ func (fastpathT) {{ .MethodNamePfx "Dec" false }}L(v map[{{ .MapKey }}]{{ .Elem mk = d.string(bv) {{/* // maps cannot have []byte as key. switch to string. */}} }{{ else }}mk = {{ decmd .MapKey }}{{ end }} d.mapElemValue() + {{/* if d.d.TryDecodeAsNil() { if v == nil {} else if d.h.DeleteOnNilMapValue { delete(v, mk) } else { v[mk] = {{ zerocmd .Elem }} } continue } + */ -}} {{ if eq .Elem "interface{}" "[]byte" "bytes" -}} if mapGet { mv = v[mk] } else { mv = nil } {{ end -}} diff --git a/codec/gen-dec-array.go.tmpl b/codec/gen-dec-array.go.tmpl index 8d182760..0a0ed7f1 100644 --- a/codec/gen-dec-array.go.tmpl +++ b/codec/gen-dec-array.go.tmpl @@ -1,9 +1,17 @@ {{var "v"}} := {{if not isArray}}*{{end}}{{ .Varname }} -{{var "h"}}, {{var "l"}} := z.DecSliceHelperStart() {{/* // helper, containerLenS */}}{{if not isArray}} +{{var "h"}}, {{var "l"}} := z.DecSliceHelperStart() {{/* // helper, containerLenS */}} +{{if not isArray -}} var {{var "c"}} bool {{/* // changed */}} -_ = {{var "c"}}{{end}} +_ = {{var "c"}} +if {{var "h"}}.IsNil { + if {{var "v"}} != nil { + {{var "v"}} = nil + {{var "c"}} = true + } +} else {{end -}} if {{var "l"}} == 0 { - {{if isSlice }}if {{var "v"}} == nil { + {{if isSlice -}} + if {{var "v"}} == nil { {{var "v"}} = []{{ .Typ }}{} {{var "c"}} = true } else if len({{var "v"}}) != 0 { diff --git a/codec/gen-dec-map.go.tmpl b/codec/gen-dec-map.go.tmpl index 2df0103c..3670474e 100644 --- a/codec/gen-dec-map.go.tmpl +++ b/codec/gen-dec-map.go.tmpl @@ -1,21 +1,23 @@ {{var "v"}} := *{{ .Varname }} {{var "l"}} := z.DecReadMapStart() -{{var "bh"}} := z.DecBasicHandle() +if {{var "l"}} == codecSelferDecContainerLenNil{{xs}} { + *{{ .Varname }} = nil +} else { if {{var "v"}} == nil { - {{var "rl"}} := z.DecInferLen({{var "l"}}, {{var "bh"}}.MaxInitLen, {{ .Size }}) + {{var "rl"}} := z.DecInferLen({{var "l"}}, z.DecBasicHandle().MaxInitLen, {{ .Size }}) {{var "v"}} = make(map[{{ .KTyp }}]{{ .Typ }}, {{var "rl"}}) *{{ .Varname }} = {{var "v"}} } var {{var "mk"}} {{ .KTyp }} var {{var "mv"}} {{ .Typ }} var {{var "mg"}}, {{var "mdn"}} {{if decElemKindPtr}}, {{var "ms"}}, {{var "mok"}}{{end}} bool -if {{var "bh"}}.MapValueReset { +if z.DecBasicHandle().MapValueReset { {{if decElemKindPtr}}{{var "mg"}} = true - {{else if decElemKindIntf}}if !{{var "bh"}}.InterfaceReset { {{var "mg"}} = true } + {{else if decElemKindIntf}}if !z.DecBasicHandle().InterfaceReset { {{var "mg"}} = true } {{else if not decElemKindImmutable}}{{var "mg"}} = true {{end}} } if {{var "l"}} != 0 { -{{var "hl"}} := {{var "l"}} > 0 + {{var "hl"}} := {{var "l"}} > 0 for {{var "j"}} := 0; ({{var "hl"}} && {{var "j"}} < {{var "l"}}) || !({{var "hl"}} || r.CheckBreak()); {{var "j"}}++ { z.DecReadMapElemKey() {{/* z.DecSendContainerState(codecSelfer_containerMapKey{{ .Sfx }}) */}} {{ $x := printf "%vmk%v" .TempVar .Rand }}{{ decLineVarK $x -}} @@ -41,10 +43,11 @@ if {{var "l"}} != 0 { {{var "mdn"}} = false {{ $x := printf "%vmv%v" .TempVar .Rand }}{{ $y := printf "%vmdn%v" .TempVar .Rand }}{{ decLineVar $x $y -}} if {{var "mdn"}} { - if {{ var "bh" }}.DeleteOnNilMapValue { delete({{var "v"}}, {{var "mk"}}) } else { {{var "v"}}[{{var "mk"}}] = {{decElemZero}} } + if z.DecBasicHandle().DeleteOnNilMapValue { delete({{var "v"}}, {{var "mk"}}) } else { {{var "v"}}[{{var "mk"}}] = {{decElemZero}} } } else if {{if decElemKindPtr}} {{var "ms"}} && {{end}} {{var "v"}} != nil { {{var "v"}}[{{var "mk"}}] = {{var "mv"}} } } } // else len==0: TODO: Should we clear map entries? z.DecReadMapEnd() {{/* z.DecSendContainerState(codecSelfer_containerMapEnd{{ .Sfx }}) */}} +} diff --git a/codec/gen-helper.generated.go b/codec/gen-helper.generated.go index 1ce74727..01d91a5a 100644 --- a/codec/gen-helper.generated.go +++ b/codec/gen-helper.generated.go @@ -13,7 +13,7 @@ import ( ) // GenVersion is the current version of codecgen. -const GenVersion = 13 +const GenVersion = 14 // This file is used to generate helper code for codecgen. // The values here i.e. genHelper(En|De)coder are not to be used directly by @@ -174,7 +174,7 @@ func (f genHelperDecoder) DecScratchArrayBuffer() *[decScratchByteArrayLen]byte func (f genHelperDecoder) DecFallback(iv interface{}, chkPtr bool) { rv := reflect.ValueOf(iv) if chkPtr { - rv = f.d.ensureDecodeable(rv) + f.d.ensureDecodeable(rv) } f.d.decodeValue(rv, nil) } diff --git a/codec/gen-helper.go.tmpl b/codec/gen-helper.go.tmpl index 389bf4c8..41082e6f 100644 --- a/codec/gen-helper.go.tmpl +++ b/codec/gen-helper.go.tmpl @@ -172,7 +172,7 @@ func (f genHelperDecoder) DecScratchArrayBuffer() *[decScratchByteArrayLen]byte func (f genHelperDecoder) DecFallback(iv interface{}, chkPtr bool) { rv := reflect.ValueOf(iv) if chkPtr { - rv = f.d.ensureDecodeable(rv) + f.d.ensureDecodeable(rv) } f.d.decodeValue(rv, nil) } diff --git a/codec/gen.generated.go b/codec/gen.generated.go index b88998b0..baa046b5 100644 --- a/codec/gen.generated.go +++ b/codec/gen.generated.go @@ -10,22 +10,24 @@ package codec const genDecMapTmpl = ` {{var "v"}} := *{{ .Varname }} {{var "l"}} := z.DecReadMapStart() -{{var "bh"}} := z.DecBasicHandle() +if {{var "l"}} == codecSelferDecContainerLenNil{{xs}} { + *{{ .Varname }} = nil +} else { if {{var "v"}} == nil { - {{var "rl"}} := z.DecInferLen({{var "l"}}, {{var "bh"}}.MaxInitLen, {{ .Size }}) + {{var "rl"}} := z.DecInferLen({{var "l"}}, z.DecBasicHandle().MaxInitLen, {{ .Size }}) {{var "v"}} = make(map[{{ .KTyp }}]{{ .Typ }}, {{var "rl"}}) *{{ .Varname }} = {{var "v"}} } var {{var "mk"}} {{ .KTyp }} var {{var "mv"}} {{ .Typ }} var {{var "mg"}}, {{var "mdn"}} {{if decElemKindPtr}}, {{var "ms"}}, {{var "mok"}}{{end}} bool -if {{var "bh"}}.MapValueReset { +if z.DecBasicHandle().MapValueReset { {{if decElemKindPtr}}{{var "mg"}} = true - {{else if decElemKindIntf}}if !{{var "bh"}}.InterfaceReset { {{var "mg"}} = true } + {{else if decElemKindIntf}}if !z.DecBasicHandle().InterfaceReset { {{var "mg"}} = true } {{else if not decElemKindImmutable}}{{var "mg"}} = true {{end}} } if {{var "l"}} != 0 { -{{var "hl"}} := {{var "l"}} > 0 + {{var "hl"}} := {{var "l"}} > 0 for {{var "j"}} := 0; ({{var "hl"}} && {{var "j"}} < {{var "l"}}) || !({{var "hl"}} || r.CheckBreak()); {{var "j"}}++ { z.DecReadMapElemKey() {{/* z.DecSendContainerState(codecSelfer_containerMapKey{{ .Sfx }}) */}} {{ $x := printf "%vmk%v" .TempVar .Rand }}{{ decLineVarK $x -}} @@ -51,22 +53,31 @@ if {{var "l"}} != 0 { {{var "mdn"}} = false {{ $x := printf "%vmv%v" .TempVar .Rand }}{{ $y := printf "%vmdn%v" .TempVar .Rand }}{{ decLineVar $x $y -}} if {{var "mdn"}} { - if {{ var "bh" }}.DeleteOnNilMapValue { delete({{var "v"}}, {{var "mk"}}) } else { {{var "v"}}[{{var "mk"}}] = {{decElemZero}} } + if z.DecBasicHandle().DeleteOnNilMapValue { delete({{var "v"}}, {{var "mk"}}) } else { {{var "v"}}[{{var "mk"}}] = {{decElemZero}} } } else if {{if decElemKindPtr}} {{var "ms"}} && {{end}} {{var "v"}} != nil { {{var "v"}}[{{var "mk"}}] = {{var "mv"}} } } } // else len==0: TODO: Should we clear map entries? z.DecReadMapEnd() {{/* z.DecSendContainerState(codecSelfer_containerMapEnd{{ .Sfx }}) */}} +} ` const genDecListTmpl = ` {{var "v"}} := {{if not isArray}}*{{end}}{{ .Varname }} -{{var "h"}}, {{var "l"}} := z.DecSliceHelperStart() {{/* // helper, containerLenS */}}{{if not isArray}} +{{var "h"}}, {{var "l"}} := z.DecSliceHelperStart() {{/* // helper, containerLenS */}} +{{if not isArray -}} var {{var "c"}} bool {{/* // changed */}} -_ = {{var "c"}}{{end}} +_ = {{var "c"}} +if {{var "h"}}.IsNil { + if {{var "v"}} != nil { + {{var "v"}} = nil + {{var "c"}} = true + } +} else {{end -}} if {{var "l"}} == 0 { - {{if isSlice }}if {{var "v"}} == nil { + {{if isSlice -}} + if {{var "v"}} == nil { {{var "v"}} = []{{ .Typ }}{} {{var "c"}} = true } else if len({{var "v"}}) != 0 { diff --git a/codec/gen.go b/codec/gen.go index e9e9a345..75e4f092 100644 --- a/codec/gen.go +++ b/codec/gen.go @@ -109,7 +109,8 @@ import ( // v11: remove deprecated methods of encDriver and decDriver. // v12: removed deprecated methods from genHelper and changed container tracking logic // v13: 20190603 removed DecodeString - use DecodeStringAsBytes instead -const genVersion = 13 +// v14: 20190611 refactored nil handling: TryDecodeAsNil -> selective TryNil, etc +const genVersion = 14 const ( genCodecPkg = "codec1978" @@ -135,6 +136,12 @@ const ( // genFastpathTrimTypes configures whether we trim uncommon fastpath types. genFastpathTrimTypes = true + + // genDecStructArrayInlineLoopCheck configures whether we create a next function + // for each iteration in the loop and call it, or just inline it. + // + // with inlining, we get better performance but about 10% larger files. + genDecStructArrayInlineLoopCheck = true ) type genStructMapStyle uint8 @@ -315,11 +322,14 @@ func Gen(w io.Writer, buildTags, pkgName, uid string, noExtensions bool, x.linef("// ----- value types used ----") for _, vt := range [...]valueType{ valueTypeArray, valueTypeMap, valueTypeString, - valueTypeInt, valueTypeUint, valueTypeFloat} { + valueTypeInt, valueTypeUint, valueTypeFloat, + valueTypeNil, + } { x.linef("codecSelferValueType%s%s = %v", vt.String(), x.xs, int64(vt)) } x.linef("codecSelferBitsize%s = uint8(32 << (^uint(0) >> 63))", x.xs) + x.linef("codecSelferDecContainerLenNil%s = %d", x.xs, int64(decContainerLenNil)) x.line(")") x.line("var (") x.line("errCodecSelferOnlyMapOrArrayEncodeToStruct" + x.xs + " = " + "\nerrors.New(`only encoded map or array can be decoded into a struct`)") @@ -342,7 +352,7 @@ func Gen(w io.Writer, buildTags, pkgName, uid string, noExtensions bool, x.linef("}") if len(imKeys) > 0 { x.line("if false { // reference the types, but skip this branch at build/run time") - x.line("var _ byte") + // x.line("var _ byte") // x.line("_ = strconv.ParseInt") // var n int // for k, t := range x.im { @@ -490,6 +500,13 @@ func (x *genRunner) out(s string) { } } +// func (x *genRunner) outb(s []byte) { +// _, err := x.w.Write(s) +// if err != nil { +// panic(err) +// } +// } + func (x *genRunner) outf(s string, params ...interface{}) { _, err := fmt.Fprintf(x.w, s, params...) if err != nil { @@ -497,6 +514,13 @@ func (x *genRunner) outf(s string, params ...interface{}) { } } +// func (x *genRunner) lineb(s []byte) { +// x.outb(s) +// if len(s) == 0 || s[len(s)-1] != '\n' { +// x.out("\n") +// } +// } + func (x *genRunner) line(s string) { x.out(s) if len(s) == 0 || s[len(s)-1] != '\n' { @@ -518,7 +542,7 @@ func (x *genRunner) linef(s string, params ...interface{}) { } func (x *genRunner) genTypeName(t reflect.Type) (n string) { - // defer func() { fmt.Printf(">>>> ####: genTypeName: t: %v, name: '%s'\n", t, n) }() + // defer func() { xdebugf(">>>> ####: genTypeName: t: %v, name: '%s'\n", t, n) }() // if the type has a PkgPath, which doesn't match the current package, // then include it. @@ -755,17 +779,18 @@ func (x *genRunner) enc(varname string, t reflect.Type) { // tptr := reflect.PtrTo(t) tk := t.Kind() if x.checkForSelfer(t, varname) { - if tk == reflect.Array || (tk == reflect.Struct && rtid != timeTypId) { // varname is of type *T + if tk == reflect.Array || + (tk == reflect.Struct && rtid != timeTypId) { // varname is of type *T // if tptr.Implements(selferTyp) || t.Implements(selferTyp) { - if ti2.isFlag(typeInfoFlagIsZeroerPtr) || ti2.isFlag(typeInfoFlagIsZeroer) { + if ti2.isFlag(tiflagSelfer) || ti2.isFlag(tiflagSelferPtr) { x.line(varname + ".CodecEncodeSelf(e)") return } } else { // varname is of type T - if ti2.cs { // t.Implements(selferTyp) { + if ti2.isFlag(tiflagSelfer) { x.line(varname + ".CodecEncodeSelf(e)") return - } else if ti2.csp { // tptr.Implements(selferTyp) { + } else if ti2.isFlag(tiflagSelferPtr) { x.linef("%ssf%s := &%s", genTempVarPfx, mi, varname) x.linef("%ssf%s.CodecEncodeSelf(e)", genTempVarPfx, mi) return @@ -825,27 +850,27 @@ func (x *genRunner) enc(varname string, t reflect.Type) { hasIf.c(false), yy, varname, yy, varname, yy) } if arrayOrStruct { // varname is of type *T - if ti2.bm || ti2.bmp { // t.Implements(binaryMarshalerTyp) || tptr.Implements(binaryMarshalerTyp) { + if ti2.isFlag(tiflagBinaryMarshaler) || ti2.isFlag(tiflagBinaryMarshalerPtr) { x.linef("%s z.EncBinary() { z.EncBinaryMarshal(%v) ", hasIf.c(false), varname) } - if ti2.jm || ti2.jmp { // t.Implements(jsonMarshalerTyp) || tptr.Implements(jsonMarshalerTyp) { + if ti2.isFlag(tiflagJsonMarshaler) || ti2.isFlag(tiflagJsonMarshalerPtr) { x.linef("%s !z.EncBinary() && z.IsJSONHandle() { z.EncJSONMarshal(%v) ", hasIf.c(false), varname) - } else if ti2.tm || ti2.tmp { // t.Implements(textMarshalerTyp) || tptr.Implements(textMarshalerTyp) { + } else if ti2.isFlag(tiflagTextUnmarshaler) || ti2.isFlag(tiflagTextUnmarshalerPtr) { x.linef("%s !z.EncBinary() { z.EncTextMarshal(%v) ", hasIf.c(false), varname) } } else { // varname is of type T - if ti2.bm { // t.Implements(binaryMarshalerTyp) { + if ti2.isFlag(tiflagBinaryMarshaler) { x.linef("%s z.EncBinary() { z.EncBinaryMarshal(%v) ", hasIf.c(false), varname) - } else if ti2.bmp { // tptr.Implements(binaryMarshalerTyp) { + } else if ti2.isFlag(tiflagBinaryMarshalerPtr) { x.linef("%s z.EncBinary() { z.EncBinaryMarshal(&%v) ", hasIf.c(false), varname) } - if ti2.jm { // t.Implements(jsonMarshalerTyp) { + if ti2.isFlag(tiflagJsonMarshaler) { x.linef("%s !z.EncBinary() && z.IsJSONHandle() { z.EncJSONMarshal(%v) ", hasIf.c(false), varname) - } else if ti2.jmp { // tptr.Implements(jsonMarshalerTyp) { + } else if ti2.isFlag(tiflagJsonMarshalerPtr) { x.linef("%s !z.EncBinary() && z.IsJSONHandle() { z.EncJSONMarshal(&%v) ", hasIf.c(false), varname) - } else if ti2.tm { // t.Implements(textMarshalerTyp) { + } else if ti2.isFlag(tiflagTextMarshaler) { x.linef("%s !z.EncBinary() { z.EncTextMarshal(%v) ", hasIf.c(false), varname) - } else if ti2.tmp { // tptr.Implements(textMarshalerTyp) { + } else if ti2.isFlag(tiflagTextMarshalerPtr) { x.linef("%s !z.EncBinary() { z.EncTextMarshal(&%v) ", hasIf.c(false), varname) } } @@ -954,11 +979,11 @@ func (x *genRunner) encOmitEmptyLine(t2 reflect.StructField, varname string, buf buf.s("!(").s(varname2).s(".IsZero())") break } - if ti2.isFlag(typeInfoFlagIsZeroerPtr) || ti2.isFlag(typeInfoFlagIsZeroer) { + if ti2.isFlag(tiflagIsZeroerPtr) || ti2.isFlag(tiflagIsZeroer) { buf.s("!(").s(varname2).s(".IsZero())") break } - if ti2.isFlag(typeInfoFlagComparable) { + if ti2.isFlag(tiflagComparable) { buf.s(varname2).s(" != ").s(x.genZeroValueR(t2.Type)) break } @@ -1256,7 +1281,8 @@ func (x *genRunner) decVarInitPtr(varname, nilvar string, t reflect.Type, si *st if uint8(ij) == si.nis { break } - for t2typ.Kind() == reflect.Ptr { + // only one-level pointers can be seen in a type + if t2typ.Kind() == reflect.Ptr { t2typ = t2typ.Elem() } t2 = t2typ.Field(int(ix)) @@ -1267,7 +1293,10 @@ func (x *genRunner) decVarInitPtr(varname, nilvar string, t reflect.Type, si *st continue } if newbuf != nil { - newbuf.f("if %s == nil { %s = new(%s) }\n", varname3, varname3, x.genTypeName(t2typ.Elem())) + if len(newbuf.buf) > 0 { + newbuf.s("\n") + } + newbuf.f("if %s == nil { %s = new(%s) }", varname3, varname3, x.genTypeName(t2typ.Elem())) } if nilbuf != nil { if !nilbufed { @@ -1327,8 +1356,7 @@ func (x *genRunner) decVarMain(varname, rand string, t reflect.Type, checkNotNil for t = t.Elem(); t.Kind() == reflect.Ptr; t = t.Elem() { ptrPfx += "*" if checkNotNil { - x.linef("if %s%s == nil { %s%s = new(%s)}", - ptrPfx, varname, ptrPfx, varname, x.genTypeName(t)) + x.linef("if %s%s == nil { %s%s = new(%s)}", ptrPfx, varname, ptrPfx, varname, x.genTypeName(t)) } } // Should we create temp var if a slice/map indexing? No. dec(...) can now handle it. @@ -1345,7 +1373,6 @@ func (x *genRunner) decVarMain(varname, rand string, t reflect.Type, checkNotNil // decVar takes a variable called varname, of type t func (x *genRunner) decVar(varname, nilvar string, t reflect.Type, canBeNil, checkNotNil bool) { - i := x.varsfx() // We only encode as nil if a nillable value. // This removes some of the wasted checks for TryDecodeAsNil. @@ -1354,22 +1381,34 @@ func (x *genRunner) decVar(varname, nilvar string, t reflect.Type, canBeNil, che // This could happen when decoding from a struct encoded as an array. // For that, decVar should be called with canNil=true, to force true as its value. - if !canBeNil { - canBeNil = genAnythingCanBeNil || !genIsImmutable(t) - } + // i := x.varsfx() + // if !canBeNil { + // canBeNil = genAnythingCanBeNil || !genIsImmutable(t) + // } + // + // if canBeNil { + // var buf genBuf + // x.decVarInitPtr(varname, nilvar, t, nil, nil, &buf) + // x.linef("if r.TryDecodeAsNil() { %s } else {", buf.buf) + // } else { + // x.line("// cannot be nil") + // } + // x.decVarMain(varname, i, t, checkNotNil) + // if canBeNil { + // x.line("} ") + // } - if canBeNil { + // x.decVarMain(varname, i, t, checkNotNil) + + i := x.varsfx() + if t.Kind() == reflect.Ptr { var buf genBuf x.decVarInitPtr(varname, nilvar, t, nil, nil, &buf) - x.linef("if r.TryDecodeAsNil() { %s } else {", buf.buf) - } else { - x.line("// cannot be nil") - } - - x.decVarMain(varname, i, t, checkNotNil) - - if canBeNil { + x.linef("if r.TryNil() { %s } else {", buf.buf) + x.decVarMain(varname, i, t, checkNotNil) x.line("} ") + } else { + x.decVarMain(varname, i, t, checkNotNil) } } @@ -1383,7 +1422,7 @@ func (x *genRunner) dec(varname string, t reflect.Type, isptr bool) { ti2 := x.ti.get(rtid, t) // tptr := reflect.PtrTo(t) if x.checkForSelfer(t, varname) { - if ti2.cs || ti2.csp { // t.Implements(selferTyp) || tptr.Implements(selferTyp) { + if ti2.isFlag(tiflagSelfer) || ti2.isFlag(tiflagSelferPtr) { x.line(varname + ".CodecDecodeSelf(d)") return } @@ -1452,12 +1491,12 @@ func (x *genRunner) dec(varname string, t reflect.Type, isptr bool) { x.linef("%s %s := z.Extension(z.I2Rtid(%s)); %s != nil { z.DecExtension(%s, %s) ", hasIf.c(false), yy, varname, yy, varname, yy) } - if ti2.bu || ti2.bup { // t.Implements(binaryUnmarshalerTyp) || tptr.Implements(binaryUnmarshalerTyp) { + if ti2.isFlag(tiflagBinaryUnmarshaler) || ti2.isFlag(tiflagBinaryUnmarshalerPtr) { x.linef("%s z.DecBinary() { z.DecBinaryUnmarshal(%s%v) ", hasIf.c(false), addrPfx, varname) } - if ti2.ju || ti2.jup { // t.Implements(jsonUnmarshalerTyp) || tptr.Implements(jsonUnmarshalerTyp) { + if ti2.isFlag(tiflagJsonUnmarshaler) || ti2.isFlag(tiflagJsonUnmarshalerPtr) { x.linef("%s !z.DecBinary() && z.IsJSONHandle() { z.DecJSONUnmarshal(%s%v)", hasIf.c(false), addrPfx, varname) - } else if ti2.tu || ti2.tup { // t.Implements(textUnmarshalerTyp) || tptr.Implements(textUnmarshalerTyp) { + } else if ti2.isFlag(tiflagTextUnmarshaler) || ti2.isFlag(tiflagTextUnmarshalerPtr) { x.linef("%s !z.DecBinary() { z.DecTextUnmarshal(%s%v)", hasIf.c(false), addrPfx, varname) } @@ -1580,6 +1619,7 @@ func (x *genRunner) decListFallback(varname string, rtid uintptr, t reflect.Type } type tstruc struct { TempVar string + Sfx string Rand string Varname string CTyp string @@ -1588,7 +1628,7 @@ func (x *genRunner) decListFallback(varname string, rtid uintptr, t reflect.Type Size int } telem := t.Elem() - ts := tstruc{genTempVarPfx, x.varsfx(), varname, x.genTypeName(t), x.genTypeName(telem), genIsImmutable(telem), int(telem.Size())} + ts := tstruc{genTempVarPfx, x.xs, x.varsfx(), varname, x.genTypeName(t), x.genTypeName(telem), genIsImmutable(telem), int(telem.Size())} funcs := make(template.FuncMap) @@ -1599,6 +1639,9 @@ func (x *genRunner) decListFallback(varname string, rtid uintptr, t reflect.Type funcs["var"] = func(s string) string { return ts.TempVar + s + ts.Rand } + funcs["xs"] = func() string { + return ts.Sfx + } funcs["zero"] = func() string { return x.genZeroValueR(telem) } @@ -1661,6 +1704,9 @@ func (x *genRunner) decMapFallback(varname string, rtid uintptr, t reflect.Type) funcs["var"] = func(s string) string { return ts.TempVar + s + ts.Rand } + funcs["xs"] = func() string { + return ts.Sfx + } tm, err := template.New("").Funcs(funcs).Parse(genDecMapTmpl) if err != nil { @@ -1681,9 +1727,13 @@ func (x *genRunner) decStructMapSwitch(kName string, varname string, rtid uintpt newbuf.reset() nilbuf.reset() varname3, t2 := x.decVarInitPtr(varname, "", t, si, &newbuf, &nilbuf) - x.linef("if r.TryDecodeAsNil() { %s } else { %s", nilbuf.buf, newbuf.buf) + if len(newbuf.buf) > 0 { + x.linef("if r.TryNil() { %s } else { %s", nilbuf.buf, newbuf.buf) + } x.decVarMain(varname3, x.varsfx(), t2.Type, false) - x.line("}") + if len(newbuf.buf) > 0 { + x.line("}") + } } x.line("default:") // pass the slice here, so that the string will not escape, and maybe save allocation @@ -1738,19 +1788,35 @@ func (x *genRunner) decStructArray(varname, lenvarname, breakString string, rtid x.linef("var %sj%s int", tpfx, i) x.linef("var %sb%s bool", tpfx, i) // break x.linef("var %shl%s bool = %s >= 0", tpfx, i, lenvarname) // has length - var newbuf, nilbuf genBuf - for _, si := range tisfi { - x.linef("%sj%s++; if %shl%s { %sb%s = %sj%s > %s } else { %sb%s = r.CheckBreak() }", + if !genDecStructArrayInlineLoopCheck { + x.linef("var %sfn%s = func() bool { ", tpfx, i) + x.linef("%sj%s++; if %shl%s { %sb%s = %sj%s > %s } else { %sb%s = r.CheckBreak() };", tpfx, i, tpfx, i, tpfx, i, tpfx, i, lenvarname, tpfx, i) - x.linef("if %sb%s { z.DecReadArrayEnd(); %s }", tpfx, i, breakString) + x.linef("if %sb%s { z.DecReadArrayEnd(); return true }; return false", tpfx, i) + x.linef("} // end func %sfn%s", tpfx, i) + } + var newbuf, nilbuf genBuf + for _, si := range tisfi { + if genDecStructArrayInlineLoopCheck { + x.linef("%sj%s++; if %shl%s { %sb%s = %sj%s > %s } else { %sb%s = r.CheckBreak() }", + tpfx, i, tpfx, i, tpfx, i, + tpfx, i, lenvarname, tpfx, i) + x.linef("if %sb%s { z.DecReadArrayEnd(); %s }", tpfx, i, breakString) + } else { + x.linef("if %sfn%s() { %s }", tpfx, i, breakString) + } x.line("z.DecReadArrayElem()") newbuf.reset() nilbuf.reset() varname3, t2 := x.decVarInitPtr(varname, "", t, si, &newbuf, &nilbuf) - x.linef("if r.TryDecodeAsNil() { %s } else { %s", nilbuf.buf, newbuf.buf) + if len(newbuf.buf) > 0 { + x.linef("if r.TryNil() { %s } else { %s", nilbuf.buf, newbuf.buf) + } x.decVarMain(varname3, x.varsfx(), t2.Type, false) - x.line("}") + if len(newbuf.buf) > 0 { + x.line("}") + } } // read remaining values and throw away. x.line("for {") @@ -1765,10 +1831,13 @@ func (x *genRunner) decStructArray(varname, lenvarname, breakString string, rtid } func (x *genRunner) decStruct(varname string, rtid uintptr, t reflect.Type) { + // xdebugf("decStruct: t: %v", t) // varname MUST be a ptr, or a struct field or a slice element. i := x.varsfx() x.linef("%sct%s := r.ContainerType()", genTempVarPfx, i) - x.linef("if %sct%s == codecSelferValueTypeMap%s {", genTempVarPfx, i, x.xs) + x.linef("if %sct%s == codecSelferValueTypeNil%s {", genTempVarPfx, i, x.xs) + x.linef("*(%s) = %s{}", varname, x.genTypeName(t)) + x.linef("} else if %sct%s == codecSelferValueTypeMap%s {", genTempVarPfx, i, x.xs) x.line(genTempVarPfx + "l" + i + " := z.DecReadMapStart()") x.linef("if %sl%s == 0 {", genTempVarPfx, i) if genUseOneFunctionForDecStructMap { diff --git a/codec/helper.go b/codec/helper.go index 12ce0182..24a37cd0 100644 --- a/codec/helper.go +++ b/codec/helper.go @@ -152,7 +152,7 @@ const ( useFinalizers = false // xdebug controls whether xdebugf prints any output - xdebug = false + xdebug = true ) var oneByteArr [1]byte @@ -162,6 +162,7 @@ var codecgen bool var refBitset bitset256 var isnilBitset bitset256 +var scalarBitset bitset256 var pool pooler var panicv panicHdl @@ -181,6 +182,25 @@ func init() { isnilBitset.set(byte(reflect.UnsafePointer)) isnilBitset.set(byte(reflect.Interface)) isnilBitset.set(byte(reflect.Slice)) + + scalarBitset.set(byte(reflect.Bool)) + scalarBitset.set(byte(reflect.Int)) + scalarBitset.set(byte(reflect.Int8)) + scalarBitset.set(byte(reflect.Int16)) + scalarBitset.set(byte(reflect.Int32)) + scalarBitset.set(byte(reflect.Int64)) + scalarBitset.set(byte(reflect.Uint)) + scalarBitset.set(byte(reflect.Uint8)) + scalarBitset.set(byte(reflect.Uint16)) + scalarBitset.set(byte(reflect.Uint32)) + scalarBitset.set(byte(reflect.Uint64)) + scalarBitset.set(byte(reflect.Uintptr)) + scalarBitset.set(byte(reflect.Float32)) + scalarBitset.set(byte(reflect.Float64)) + scalarBitset.set(byte(reflect.Complex64)) + scalarBitset.set(byte(reflect.Complex128)) + scalarBitset.set(byte(reflect.String)) + } type handleFlag uint8 @@ -770,32 +790,37 @@ func (x *BasicHandle) fnLoad(rt reflect.Type, rtid uintptr, checkExt bool) (fn * if rk == reflect.Struct || rk == reflect.Array { fi.addrE = true } - } else if ti.cs || ti.csp { + } else if ti.isFlag(tiflagSelfer) || ti.isFlag(tiflagSelferPtr) { fn.fe = (*Encoder).selferMarshal fn.fd = (*Decoder).selferUnmarshal fi.addrF = true - fi.addrD = ti.csp - fi.addrE = ti.csp - } else if supportMarshalInterfaces && x.isBe() && (ti.bm || ti.bmp) && (ti.bu || ti.bup) { + fi.addrD = ti.isFlag(tiflagSelferPtr) + fi.addrE = ti.isFlag(tiflagSelferPtr) + } else if supportMarshalInterfaces && x.isBe() && + (ti.isFlag(tiflagBinaryMarshaler) || ti.isFlag(tiflagBinaryMarshalerPtr)) && + (ti.isFlag(tiflagBinaryUnmarshaler) || ti.isFlag(tiflagBinaryUnmarshalerPtr)) { fn.fe = (*Encoder).binaryMarshal fn.fd = (*Decoder).binaryUnmarshal fi.addrF = true - fi.addrD = ti.bup - fi.addrE = ti.bmp + fi.addrD = ti.isFlag(tiflagBinaryUnmarshalerPtr) + fi.addrE = ti.isFlag(tiflagBinaryMarshalerPtr) } else if supportMarshalInterfaces && !x.isBe() && x.isJs() && - (ti.jm || ti.jmp) && (ti.ju || ti.jup) { + (ti.isFlag(tiflagJsonMarshaler) || ti.isFlag(tiflagJsonMarshalerPtr)) && + (ti.isFlag(tiflagJsonUnmarshaler) || ti.isFlag(tiflagJsonUnmarshalerPtr)) { //If JSON, we should check JSONMarshal before textMarshal fn.fe = (*Encoder).jsonMarshal fn.fd = (*Decoder).jsonUnmarshal fi.addrF = true - fi.addrD = ti.jup - fi.addrE = ti.jmp - } else if supportMarshalInterfaces && !x.isBe() && (ti.tm || ti.tmp) && (ti.tu || ti.tup) { + fi.addrD = ti.isFlag(tiflagJsonUnmarshalerPtr) + fi.addrE = ti.isFlag(tiflagJsonMarshalerPtr) + } else if supportMarshalInterfaces && !x.isBe() && + (ti.isFlag(tiflagTextMarshaler) || ti.isFlag(tiflagTextMarshalerPtr)) && + (ti.isFlag(tiflagTextUnmarshaler) || ti.isFlag(tiflagTextUnmarshalerPtr)) { fn.fe = (*Encoder).textMarshal fn.fd = (*Decoder).textUnmarshal fi.addrF = true - fi.addrD = ti.tup - fi.addrE = ti.tmp + fi.addrD = ti.isFlag(tiflagTextUnmarshalerPtr) + fi.addrE = ti.isFlag(tiflagTextMarshalerPtr) } else { if fastpathEnabled && (rk == reflect.Map || rk == reflect.Slice) { if ti.pkgpath == "" { // un-named slice or map @@ -890,7 +915,7 @@ func (x *BasicHandle) fnLoad(rt reflect.Type, rtid uintptr, checkExt bool) (fn * case reflect.Chan: fi.seq = seqTypeChan fn.fe = (*Encoder).kSlice - fn.fd = (*Decoder).kSlice + fn.fd = (*Decoder).kSliceForChan case reflect.Slice: fi.seq = seqTypeSlice fn.fe = (*Encoder).kSlice @@ -906,7 +931,9 @@ func (x *BasicHandle) fnLoad(rt reflect.Type, rtid uintptr, checkExt bool) (fn * } // fn.fd = (*Decoder).kArray case reflect.Struct: - if ti.anyOmitEmpty || ti.mf || ti.mfp { + if ti.anyOmitEmpty || + ti.isFlag(tiflagMissingFielder) || + ti.isFlag(tiflagMissingFielderPtr) { fn.fe = (*Encoder).kStruct } else { fn.fe = (*Encoder).kStructNoOmitempty @@ -1489,12 +1516,46 @@ func baseStructRv(v reflect.Value, update bool) (v2 reflect.Value, valid bool) { return v, true } -type typeInfoFlag uint8 +type tiflag uint32 const ( - typeInfoFlagComparable = 1 << iota - typeInfoFlagIsZeroer - typeInfoFlagIsZeroerPtr + _ tiflag = 1 << iota + + tiflagComparable + + tiflagIsZeroer + tiflagIsZeroerPtr + + tiflagBinaryMarshaler + tiflagBinaryMarshalerPtr + + tiflagBinaryUnmarshaler + tiflagBinaryUnmarshalerPtr + + tiflagTextMarshaler + tiflagTextMarshalerPtr + + tiflagTextUnmarshaler + tiflagTextUnmarshalerPtr + + tiflagJsonMarshaler + tiflagJsonMarshalerPtr + + tiflagJsonUnmarshaler + tiflagJsonUnmarshalerPtr + + tiflagSelfer + tiflagSelferPtr + + tiflagMissingFielder + tiflagMissingFielderPtr + + // tiflag + // tiflag + // tiflag + // tiflag + // tiflag + // tiflag ) // typeInfo keeps static (non-changing readonly)information @@ -1533,38 +1594,52 @@ type typeInfo struct { // sfis []structFieldInfo // all sfi, in src order, as created. sfiNamesSort []byte // all names, with indexes into the sfiSort + // rv0 is the zero value for the type. + // It is mostly beneficial for all non-reference kinds + // i.e. all but map/chan/func/ptr/unsafe.pointer + // so beneficial for intXX, bool, slices, structs, etc + rv0 reflect.Value + // format of marshal type fields below: [btj][mu]p? OR csp? - bm bool // T is a binaryMarshaler - bmp bool // *T is a binaryMarshaler - bu bool // T is a binaryUnmarshaler - bup bool // *T is a binaryUnmarshaler - tm bool // T is a textMarshaler - tmp bool // *T is a textMarshaler - tu bool // T is a textUnmarshaler - tup bool // *T is a textUnmarshaler - - jm bool // T is a jsonMarshaler - jmp bool // *T is a jsonMarshaler - ju bool // T is a jsonUnmarshaler - jup bool // *T is a jsonUnmarshaler - cs bool // T is a Selfer - csp bool // *T is a Selfer - mf bool // T is a MissingFielder - mfp bool // *T is a MissingFielder + // bm bool // T is a binaryMarshaler + // bmp bool // *T is a binaryMarshaler + // bu bool // T is a binaryUnmarshaler + // bup bool // *T is a binaryUnmarshaler + // tm bool // T is a textMarshaler + // tmp bool // *T is a textMarshaler + // tu bool // T is a textUnmarshaler + // tup bool // *T is a textUnmarshaler + + // jm bool // T is a jsonMarshaler + // jmp bool // *T is a jsonMarshaler + // ju bool // T is a jsonUnmarshaler + // jup bool // *T is a jsonUnmarshaler + // cs bool // T is a Selfer + // csp bool // *T is a Selfer + // mf bool // T is a MissingFielder + // mfp bool // *T is a MissingFielder // other flags, with individual bits representing if set. - flags typeInfoFlag + flags tiflag + infoFieldOmitempty bool - // _ [6]byte // padding - // _ [2]uint64 // padding + _ [3]byte // padding + _ [1]uint64 // padding } -func (ti *typeInfo) isFlag(f typeInfoFlag) bool { +func (ti *typeInfo) isFlag(f tiflag) bool { return ti.flags&f != 0 } +func (ti *typeInfo) flag(when bool, f tiflag) *typeInfo { + if when { + ti.flags |= f + } + return ti +} + func (ti *typeInfo) indexForEncName(name []byte) (index int16) { var sn []byte if len(name)+2 <= 32 { @@ -1673,30 +1748,32 @@ func (x *TypeInfos) get(rtid uintptr, rt reflect.Type) (pti *typeInfo) { pkgpath: rt.PkgPath(), keyType: valueTypeString, // default it - so it's never 0 } - // ti.rv0 = reflect.Zero(rt) + ti.rv0 = reflect.Zero(rt) // ti.comparable = rt.Comparable() ti.numMeth = uint16(rt.NumMethod()) - ti.bm, ti.bmp = implIntf(rt, binaryMarshalerTyp) - ti.bu, ti.bup = implIntf(rt, binaryUnmarshalerTyp) - ti.tm, ti.tmp = implIntf(rt, textMarshalerTyp) - ti.tu, ti.tup = implIntf(rt, textUnmarshalerTyp) - ti.jm, ti.jmp = implIntf(rt, jsonMarshalerTyp) - ti.ju, ti.jup = implIntf(rt, jsonUnmarshalerTyp) - ti.cs, ti.csp = implIntf(rt, selferTyp) - ti.mf, ti.mfp = implIntf(rt, missingFielderTyp) - - b1, b2 := implIntf(rt, iszeroTyp) - if b1 { - ti.flags |= typeInfoFlagIsZeroer - } - if b2 { - ti.flags |= typeInfoFlagIsZeroerPtr - } - if rt.Comparable() { - ti.flags |= typeInfoFlagComparable - } + var b1, b2 bool + b1, b2 = implIntf(rt, binaryMarshalerTyp) + ti.flag(b1, tiflagBinaryMarshaler).flag(b2, tiflagBinaryMarshalerPtr) + b1, b2 = implIntf(rt, binaryUnmarshalerTyp) + ti.flag(b1, tiflagBinaryUnmarshaler).flag(b2, tiflagBinaryUnmarshalerPtr) + b1, b2 = implIntf(rt, textMarshalerTyp) + ti.flag(b1, tiflagTextMarshaler).flag(b2, tiflagTextMarshalerPtr) + b1, b2 = implIntf(rt, textUnmarshalerTyp) + ti.flag(b1, tiflagTextUnmarshaler).flag(b2, tiflagTextUnmarshalerPtr) + b1, b2 = implIntf(rt, jsonMarshalerTyp) + ti.flag(b1, tiflagJsonMarshaler).flag(b2, tiflagJsonMarshalerPtr) + b1, b2 = implIntf(rt, jsonUnmarshalerTyp) + ti.flag(b1, tiflagJsonUnmarshaler).flag(b2, tiflagJsonUnmarshalerPtr) + b1, b2 = implIntf(rt, selferTyp) + ti.flag(b1, tiflagSelfer).flag(b2, tiflagSelferPtr) + b1, b2 = implIntf(rt, missingFielderTyp) + ti.flag(b1, tiflagMissingFielder).flag(b2, tiflagMissingFielderPtr) + b1, b2 = implIntf(rt, iszeroTyp) + ti.flag(b1, tiflagIsZeroer).flag(b2, tiflagIsZeroerPtr) + b1 = rt.Comparable() + ti.flag(b1, tiflagComparable) switch rk { case reflect.Struct: @@ -2029,13 +2106,13 @@ func isEmptyStruct(v reflect.Value, tinfos *TypeInfos, deref, checkStruct bool) if ti.rtid == timeTypId { return rv2i(v).(time.Time).IsZero() } - if ti.isFlag(typeInfoFlagIsZeroerPtr) && v.CanAddr() { + if ti.isFlag(tiflagIsZeroerPtr) && v.CanAddr() { return rv2i(v.Addr()).(isZeroer).IsZero() } - if ti.isFlag(typeInfoFlagIsZeroer) { + if ti.isFlag(tiflagIsZeroer) { return rv2i(v).(isZeroer).IsZero() } - if ti.isFlag(typeInfoFlagComparable) { + if ti.isFlag(tiflagComparable) { return rv2i(v) == rv2i(reflect.Zero(vt)) } if !checkStruct { diff --git a/codec/helper_not_unsafe.go b/codec/helper_not_unsafe.go index 0ef0af4d..e33727a9 100644 --- a/codec/helper_not_unsafe.go +++ b/codec/helper_not_unsafe.go @@ -33,25 +33,15 @@ func bytesView(v string) []byte { return []byte(v) } -// isNilRef says whether the interface is a nil reference or not. -// -// A reference here is a pointer-sized reference i.e. map, ptr, chan, func, unsafepointer. -// It is optional to extend this to also check if slices or interfaces are nil also. -func isNilRef(v interface{}) (rv reflect.Value, isnil bool) { - // this is a best-effort option - you should not pay any cost for this. - // It is ok to return false, so we don't unnecessarily pay for reflection this early. - +// isNil says whether the value v is nil. +// This applies to references like map/ptr/unsafepointer/chan/func, +// and non-reference values like interface/slice. +func isNil(v interface{}) (rv reflect.Value, isnil bool) { rv = reflect.ValueOf(v) if isnilBitset.isset(byte(rv.Kind())) { isnil = rv.IsNil() } return - - // switch rv.Kind() { - // case reflect.Invalid, reflect.Ptr, reflect.Interface, reflect.Slice, reflect.Map, reflect.Func, reflect.Chan: - // return rv.IsNil() - // } - // return false } func rv2i(rv reflect.Value) interface{} { diff --git a/codec/helper_unsafe.go b/codec/helper_unsafe.go index ac1b0525..e7c29036 100644 --- a/codec/helper_unsafe.go +++ b/codec/helper_unsafe.go @@ -76,19 +76,33 @@ func bytesView(v string) []byte { return *(*[]byte)(unsafe.Pointer(&unsafeSlice{sx.Data, sx.Len, sx.Len})) } -// isNilRef says whether the interface is a nil reference or not. -// -// A reference here is a pointer-sized reference i.e. map, ptr, chan, func, unsafepointer. -// It is optional to extend this to also check if slices or interfaces are nil also. -func isNilRef(v interface{}) (rv reflect.Value, isnil bool) { - // There is no global way of checking if an interface is nil. - // For true references (map, ptr, func, chan), you can just look - // at the word of the interface. - // However, for slices, you have to dereference - // the word, and get a pointer to the 3-word interface value. - - isnil = ((*unsafeIntf)(unsafe.Pointer(&v))).word == nil +// // isNilRef says whether the interface is a nil reference or not. +// // +// // A reference here is a pointer-sized reference i.e. map, ptr, chan, func, unsafepointer. +// // It is optional to extend this to also check if slices or interfaces are nil also. +// // +// // NOTE: There is no global way of checking if an interface is nil. +// // For true references (map, ptr, func, chan), you can just look +// // at the word of the interface. +// // However, for slices, you have to dereference +// // the word, and get a pointer to the 3-word interface value. +// func isNilRef(v interface{}) (rv reflect.Value, isnil bool) { +// isnil = ((*unsafeIntf)(unsafe.Pointer(&v))).word == nil +// return +// } + +func isNil(v interface{}) (rv reflect.Value, isnil bool) { + var ui *unsafeIntf = (*unsafeIntf)(unsafe.Pointer(&v)) + if ui.word == nil { + isnil = true + return + } + rv = reflect.ValueOf(v) // reflect.value is cheap and inline'able + tk := rv.Kind() + isnil = (tk == reflect.Interface || tk == reflect.Slice) && *(*unsafe.Pointer)(ui.word) == nil return + // fmt.Printf(">>>> definitely nil: isnil: %v, TYPE: \t%T, word: %v, *word: %v, type: %v, nil: %v\n", + // v == nil, v, word, *((*unsafe.Pointer)(word)), ui.typ, nil) } func rv2ptr(urv *unsafeReflectValue) (ptr unsafe.Pointer) { @@ -694,14 +708,3 @@ func mapdelete(typ unsafe.Pointer, m unsafe.Pointer, key unsafe.Pointer) //go:linkname typedmemmove reflect.typedmemmove //go:noescape func typedmemmove(typ unsafe.Pointer, dst, src unsafe.Pointer) - -// func definitelyNil(v interface{}) bool { -// var ui *unsafeIntf = (*unsafeIntf)(unsafe.Pointer(&v)) -// if ui.word == nil { -// return true -// } -// var tk = reflect.TypeOf(v).Kind() -// return (tk == reflect.Interface || tk == reflect.Slice) && *(*unsafe.Pointer)(ui.word) == nil -// fmt.Printf(">>>> definitely nil: isnil: %v, TYPE: \t%T, word: %v, *word: %v, type: %v, nil: %v\n", -// v == nil, v, word, *((*unsafe.Pointer)(word)), ui.typ, nil) -// } diff --git a/codec/json.go b/codec/json.go index 32e7cb4e..6e2fd459 100644 --- a/codec/json.go +++ b/codec/json.go @@ -602,11 +602,11 @@ type jsonDecDriver struct { b [jsonScratchArrayLen]byte // scratch 1, used for parsing strings or numbers or time.Time // ---- cpu cache line boundary? // c containerState - tok uint8 // used to store the token read right after skipWhiteSpace - fnull bool // found null from appendStringAsBytes - _ [2]byte // padding - bstr [4]byte // scratch used for string \UXXX parsing - b2 [jsonScratchArrayLen - 8]byte // scratch 2, used only for readUntil, decNumBytes + tok uint8 // used to store the token read right after skipWhiteSpace + fnil bool // found null + _ [2]byte // padding + bstr [4]byte // scratch used for string \UXXX parsing + b2 [jsonScratchArrayLen - 8]byte // scratch 2, used only for readUntil, decNumBytes // _ [3]uint64 // padding // n jsonNum @@ -625,33 +625,33 @@ func (d *jsonDecDriver) uncacheRead() { } func (d *jsonDecDriver) ReadMapStart() int { - if d.tok == 0 { - d.tok = d.r.skip(&jsonCharWhitespaceSet) + d.advance() + if d.tok == 'n' { + d.readLit4Null() + return decContainerLenNil } - const xc uint8 = '{' - if d.tok != xc { - d.d.errorf("read map - expect char '%c' but got char '%c'", xc, d.tok) + if d.tok != '{' { + d.d.errorf("read map - expect char '%c' but got char '%c'", '{', d.tok) } d.tok = 0 - return -1 + return decContainerLenUnknown } func (d *jsonDecDriver) ReadArrayStart() int { - if d.tok == 0 { - d.tok = d.r.skip(&jsonCharWhitespaceSet) + d.advance() + if d.tok == 'n' { + d.readLit4Null() + return decContainerLenNil } - const xc uint8 = '[' - if d.tok != xc { - d.d.errorf("read array - expect char '%c' but got char '%c'", xc, d.tok) + if d.tok != '[' { + d.d.errorf("read array - expect char '%c' but got char '%c'", '[', d.tok) } d.tok = 0 - return -1 + return decContainerLenUnknown } func (d *jsonDecDriver) CheckBreak() bool { - if d.tok == 0 { - d.tok = d.r.skip(&jsonCharWhitespaceSet) - } + d.advance() return d.tok == '}' || d.tok == ']' } @@ -667,9 +667,7 @@ func (d *jsonDecDriver) CheckBreak() bool { func (d *jsonDecDriver) ReadArrayElem() { const xc uint8 = ',' - if d.tok == 0 { - d.tok = d.r.skip(&jsonCharWhitespaceSet) - } + d.advance() if d.d.c != containerArrayStart { if d.tok != xc { d.d.errorf("read array element - expect char '%c' but got char '%c'", xc, d.tok) @@ -680,9 +678,7 @@ func (d *jsonDecDriver) ReadArrayElem() { func (d *jsonDecDriver) ReadArrayEnd() { const xc uint8 = ']' - if d.tok == 0 { - d.tok = d.r.skip(&jsonCharWhitespaceSet) - } + d.advance() if d.tok != xc { d.d.errorf("read array end - expect char '%c' but got char '%c'", xc, d.tok) } @@ -691,9 +687,7 @@ func (d *jsonDecDriver) ReadArrayEnd() { func (d *jsonDecDriver) ReadMapElemKey() { const xc uint8 = ',' - if d.tok == 0 { - d.tok = d.r.skip(&jsonCharWhitespaceSet) - } + d.advance() if d.d.c != containerMapStart { if d.tok != xc { d.d.errorf("read map key - expect char '%c' but got char '%c'", xc, d.tok) @@ -704,9 +698,7 @@ func (d *jsonDecDriver) ReadMapElemKey() { func (d *jsonDecDriver) ReadMapElemValue() { const xc uint8 = ':' - if d.tok == 0 { - d.tok = d.r.skip(&jsonCharWhitespaceSet) - } + d.advance() if d.tok != xc { d.d.errorf("read map value - expect char '%c' but got char '%c'", xc, d.tok) } @@ -715,9 +707,7 @@ func (d *jsonDecDriver) ReadMapElemValue() { func (d *jsonDecDriver) ReadMapEnd() { const xc uint8 = '}' - if d.tok == 0 { - d.tok = d.r.skip(&jsonCharWhitespaceSet) - } + d.advance() if d.tok != xc { d.d.errorf("read map end - expect char '%c' but got char '%c'", xc, d.tok) } @@ -755,13 +745,19 @@ func (d *jsonDecDriver) readLit4Null() { if jsonValidateSymbols && !bytes.Equal(bs, jsonLiteral4Null) { d.d.errorf("expecting %s: got %s", jsonLiteral4Null, bs) } + d.fnil = true } -func (d *jsonDecDriver) TryDecodeAsNil() bool { +func (d *jsonDecDriver) advance() { if d.tok == 0 { + d.fnil = false d.tok = d.r.skip(&jsonCharWhitespaceSet) } - // we shouldn't try to see if "null" was here, right? +} + +func (d *jsonDecDriver) TryNil() bool { + d.advance() + // we shouldn't try to see if quoted "null" was here, right? // only the plain string: `null` denotes a nil (ie not quotes) if d.tok == 'n' { d.readLit4Null() @@ -770,9 +766,15 @@ func (d *jsonDecDriver) TryDecodeAsNil() bool { return false } +func (d *jsonDecDriver) Nil() bool { + return d.fnil +} + func (d *jsonDecDriver) DecodeBool() (v bool) { - if d.tok == 0 { - d.tok = d.r.skip(&jsonCharWhitespaceSet) + d.advance() + if d.tok == 'n' { + d.readLit4Null() + return } fquot := d.d.c == containerMapKey && d.tok == '"' if fquot { @@ -798,7 +800,7 @@ func (d *jsonDecDriver) DecodeBool() (v bool) { func (d *jsonDecDriver) DecodeTime() (t time.Time) { // read string, and pass the string into json.unmarshal d.appendStringAsBytes() - if d.fnull { + if d.fnil { return } t, err := time.Parse(time.RFC3339, stringView(d.bs)) @@ -810,22 +812,21 @@ func (d *jsonDecDriver) DecodeTime() (t time.Time) { func (d *jsonDecDriver) ContainerType() (vt valueType) { // check container type by checking the first char - if d.tok == 0 { - d.tok = d.r.skip(&jsonCharWhitespaceSet) - } + d.advance() // optimize this, so we don't do 4 checks but do one computation. // return jsonContainerSet[d.tok] // ContainerType is mostly called for Map and Array, // so this conditional is good enough (max 2 checks typically) - if b := d.tok; b == '{' { + if d.tok == '{' { return valueTypeMap - } else if b == '[' { + } else if d.tok == '[' { return valueTypeArray - } else if b == 'n' { + } else if d.tok == 'n' { + d.readLit4Null() return valueTypeNil - } else if b == '"' { + } else if d.tok == '"' { return valueTypeString } return valueTypeUnset @@ -833,18 +834,18 @@ func (d *jsonDecDriver) ContainerType() (vt valueType) { func (d *jsonDecDriver) decNumBytes() (bs []byte) { // stores num bytes in d.bs - if d.tok == 0 { - d.tok = d.r.skip(&jsonCharWhitespaceSet) - } + d.advance() if d.tok == '"' { bs = d.r.readUntil(d.b2[:0], '"') bs = bs[:len(bs)-1] + } else if d.tok == 'n' { + d.readLit4Null() } else { d.r.unreadn1() bs = d.r.readTo(d.bs[:0], &jsonNumSet) } d.tok = 0 - return bs + return } func (d *jsonDecDriver) DecodeUint64() (u uint64) { @@ -947,7 +948,12 @@ func (d *jsonDecDriver) DecodeFloat32() (f float32) { return } -func (d *jsonDecDriver) DecodeExt(rv interface{}, xtag uint64, ext Ext) (realxtag uint64) { +func (d *jsonDecDriver) DecodeExt(rv interface{}, xtag uint64, ext Ext) { + d.advance() + if d.tok == 'n' { + d.readLit4Null() + return + } if ext == nil { re := rv.(*RawExt) re.Tag = xtag @@ -958,7 +964,6 @@ func (d *jsonDecDriver) DecodeExt(rv interface{}, xtag uint64, ext Ext) (realxta } else { d.d.interfaceExtConvertAndDecode(rv, ext) } - return } func (d *jsonDecDriver) DecodeBytes(bs []byte, zerocopy bool) (bsOut []byte) { @@ -968,9 +973,7 @@ func (d *jsonDecDriver) DecodeBytes(bs []byte, zerocopy bool) (bsOut []byte) { d.DecodeExt(&bsOut, 0, &d.se) return } - if d.tok == 0 { - d.tok = d.r.skip(&jsonCharWhitespaceSet) - } + d.advance() // check if an "array" of uint8's (see ContainerType for how to infer if an array) if d.tok == '[' { // bsOut, _ = fastpathTV.DecSliceUint8V(bs, true, d.d) @@ -1000,11 +1003,11 @@ func (d *jsonDecDriver) DecodeBytes(bs []byte, zerocopy bool) (bsOut []byte) { // base64 encodes []byte{} as "", and we encode nil []byte as null. // Consequently, base64 should decode null as a nil []byte, and "" as an empty []byte{}. // appendStringAsBytes returns a zero-len slice for both, so as not to reset d.bs. - // However, it sets a fnull field to true, so we can check if a null was found. + // However, it sets a fnil field to true, so we can check if a null was found. + if d.fnil { + return nil + } if len(d.bs) == 0 { - if d.fnull { - return nil - } return []byte{} } bs0 := d.bs @@ -1033,16 +1036,18 @@ func (d *jsonDecDriver) DecodeBytes(bs []byte, zerocopy bool) (bsOut []byte) { // } func (d *jsonDecDriver) DecodeStringAsBytes() (s []byte) { + // defer func() { xdebug2f("DecodeStringAsBytes: %s", s) }() d.appendStringAsBytes() + if d.fnil { + return nil + } return d.bs } func (d *jsonDecDriver) appendStringAsBytes() { - if d.tok == 0 { - d.tok = d.r.skip(&jsonCharWhitespaceSet) - } + d.advance() - d.fnull = false + // xdebug2f("appendStringAsBytes: found: '%c'", d.tok) if d.tok != '"' { // d.d.errorf("expect char '%c' but got char '%c'", '"', d.tok) // handle non-string scalar: null, true, false or a number @@ -1050,7 +1055,6 @@ func (d *jsonDecDriver) appendStringAsBytes() { case 'n': d.readLit4Null() d.bs = d.bs[:0] - d.fnull = true case 'f': d.readLit4False() d.bs = d.bs[:5] @@ -1241,9 +1245,7 @@ func (d *jsonDecDriver) DecodeNaked() { z := d.d.naked() // var decodeFurther bool - if d.tok == 0 { - d.tok = d.r.skip(&jsonCharWhitespaceSet) - } + d.advance() switch d.tok { case 'n': d.readLit4Null() @@ -1444,6 +1446,7 @@ func (d *jsonDecDriver) reset() { d.bs = d.bs[:0] } d.tok = 0 + d.fnil = false // d.n.reset() } diff --git a/codec/mammoth-test.go.tmpl b/codec/mammoth-test.go.tmpl index c598cc73..1c72ba2a 100644 --- a/codec/mammoth-test.go.tmpl +++ b/codec/mammoth-test.go.tmpl @@ -18,37 +18,37 @@ func init() { _ = fmt.Printf } // so we can include fmt as needed type TestMammoth struct { -{{range .Values }}{{if .Primitive }}{{/* -*/}}{{ .MethodNamePfx "F" true }} {{ .Primitive }} +{{range .Values }}{{if .Primitive -}} +{{ .MethodNamePfx "F" true }} {{ .Primitive }} {{ .MethodNamePfx "Fptr" true }} *{{ .Primitive }} {{end}}{{end}} -{{range .Values }}{{if not .Primitive }}{{if not .MapKey }}{{/* -*/}}{{ .MethodNamePfx "F" false }} []{{ .Elem }} +{{range .Values }}{{if not .Primitive }}{{if not .MapKey -}} +{{ .MethodNamePfx "F" false }} []{{ .Elem }} {{ .MethodNamePfx "Fptr" false }} *[]{{ .Elem }} {{end}}{{end}}{{end}} -{{range .Values }}{{if not .Primitive }}{{if .MapKey }}{{/* -*/}}{{ .MethodNamePfx "F" false }} map[{{ .MapKey }}]{{ .Elem }} +{{range .Values }}{{if not .Primitive }}{{if .MapKey -}} +{{ .MethodNamePfx "F" false }} map[{{ .MapKey }}]{{ .Elem }} {{ .MethodNamePfx "Fptr" false }} *map[{{ .MapKey }}]{{ .Elem }} {{end}}{{end}}{{end}} } -{{range .Values }}{{if not .Primitive }}{{if not .MapKey }}{{/* -*/}} type {{ .MethodNamePfx "typMbs" false }} []{{ .Elem }} +{{range .Values }}{{if not .Primitive }}{{if not .MapKey -}} +type {{ .MethodNamePfx "typMbs" false }} []{{ .Elem }} func (_ {{ .MethodNamePfx "typMbs" false }}) MapBySlice() { } {{end}}{{end}}{{end}} -{{range .Values }}{{if not .Primitive }}{{if .MapKey }}{{/* -*/}} type {{ .MethodNamePfx "typMap" false }} map[{{ .MapKey }}]{{ .Elem }} +{{range .Values }}{{if not .Primitive }}{{if .MapKey -}} +type {{ .MethodNamePfx "typMap" false }} map[{{ .MapKey }}]{{ .Elem }} {{end}}{{end}}{{end}} func doTestMammothSlices(t *testing.T, h Handle) { -{{range $i, $e := .Values }}{{if not .Primitive }}{{if not .MapKey }}{{/* -*/}} +{{range $i, $e := .Values }}{{if not .Primitive }}{{if not .MapKey -}} var v{{$i}}va [8]{{ .Elem }} - for _, v := range [][]{{ .Elem }}{ nil, {}, { {{ nonzerocmd .Elem }}, {{ zerocmd .Elem }}, {{ zerocmd .Elem }}, {{ nonzerocmd .Elem }} } } { {{/* + for _, v := range [][]{{ .Elem }}{ nil, {}, { {{ nonzerocmd .Elem }}, {{ zerocmd .Elem }}, {{ zerocmd .Elem }}, {{ nonzerocmd .Elem }} } } { + {{/* // fmt.Printf(">>>> running mammoth slice v{{$i}}: %v\n", v) // - encode value to some []byte // - decode into a length-wise-equal []byte @@ -61,16 +61,19 @@ func doTestMammothSlices(t *testing.T, h Handle) { // - // - rinse and repeat for a MapBySlice version // - - */}} + */ -}} var v{{$i}}v1, v{{$i}}v2 []{{ .Elem }} + var bs{{$i}} []byte v{{$i}}v1 = v - bs{{$i}} := testMarshalErr(v{{$i}}v1, h, t, "enc-slice-v{{$i}}") + bs{{$i}} = testMarshalErr(v{{$i}}v1, h, t, "enc-slice-v{{$i}}") + if v != nil { if v == nil { v{{$i}}v2 = nil } else { v{{$i}}v2 = make([]{{ .Elem }}, len(v)) } testUnmarshalErr(v{{$i}}v2, bs{{$i}}, h, t, "dec-slice-v{{$i}}") testDeepEqualErr(v{{$i}}v1, v{{$i}}v2, t, "equal-slice-v{{$i}}") if v == nil { v{{$i}}v2 = nil } else { v{{$i}}v2 = make([]{{ .Elem }}, len(v)) } testUnmarshalErr(reflect.ValueOf(v{{$i}}v2), bs{{$i}}, h, t, "dec-slice-v{{$i}}-noaddr") // non-addressable value testDeepEqualErr(v{{$i}}v1, v{{$i}}v2, t, "equal-slice-v{{$i}}-noaddr") + } // ... bs{{$i}} = testMarshalErr(&v{{$i}}v1, h, t, "enc-slice-v{{$i}}-p") v{{$i}}v2 = nil @@ -102,9 +105,11 @@ func doTestMammothSlices(t *testing.T, h Handle) { if v != nil { v{{$i}}v2 = make([]{{ .Elem }}, len(v)) } v{{$i}}v3 = {{ .MethodNamePfx "typMbs" false }}(v{{$i}}v1) v{{$i}}v4 = {{ .MethodNamePfx "typMbs" false }}(v{{$i}}v2) + if v != nil { bs{{$i}} = testMarshalErr(v{{$i}}v3, h, t, "enc-slice-v{{$i}}-custom") testUnmarshalErr(v{{$i}}v4, bs{{$i}}, h, t, "dec-slice-v{{$i}}-custom") testDeepEqualErr(v{{$i}}v3, v{{$i}}v4, t, "equal-slice-v{{$i}}-custom") + } bs{{$i}} = testMarshalErr(&v{{$i}}v3, h, t, "enc-slice-v{{$i}}-custom-p") v{{$i}}v2 = nil v{{$i}}v4 = {{ .MethodNamePfx "typMbs" false }}(v{{$i}}v2) @@ -115,19 +120,21 @@ func doTestMammothSlices(t *testing.T, h Handle) { } func doTestMammothMaps(t *testing.T, h Handle) { -{{range $i, $e := .Values }}{{if not .Primitive }}{{if .MapKey }}{{/* -*/}} +{{range $i, $e := .Values }}{{if not .Primitive }}{{if .MapKey -}} for _, v := range []map[{{ .MapKey }}]{{ .Elem }}{ nil, {}, { {{ nonzerocmd .MapKey }}:{{ zerocmd .Elem }} {{if ne "bool" .MapKey}}, {{ nonzerocmd .MapKey }}:{{ nonzerocmd .Elem }} {{end}} } } { // fmt.Printf(">>>> running mammoth map v{{$i}}: %v\n", v) var v{{$i}}v1, v{{$i}}v2 map[{{ .MapKey }}]{{ .Elem }} + var bs{{$i}} []byte v{{$i}}v1 = v - bs{{$i}} := testMarshalErr(v{{$i}}v1, h, t, "enc-map-v{{$i}}") + bs{{$i}} = testMarshalErr(v{{$i}}v1, h, t, "enc-map-v{{$i}}") + if v != nil { if v == nil { v{{$i}}v2 = nil } else { v{{$i}}v2 = make(map[{{ .MapKey }}]{{ .Elem }}, len(v)) } // reset map testUnmarshalErr(v{{$i}}v2, bs{{$i}}, h, t, "dec-map-v{{$i}}") testDeepEqualErr(v{{$i}}v1, v{{$i}}v2, t, "equal-map-v{{$i}}") if v == nil { v{{$i}}v2 = nil } else { v{{$i}}v2 = make(map[{{ .MapKey }}]{{ .Elem }}, len(v)) } // reset map testUnmarshalErr(reflect.ValueOf(v{{$i}}v2), bs{{$i}}, h, t, "dec-map-v{{$i}}-noaddr") // decode into non-addressable map value testDeepEqualErr(v{{$i}}v1, v{{$i}}v2, t, "equal-map-v{{$i}}-noaddr") + } if v == nil { v{{$i}}v2 = nil } else { v{{$i}}v2 = make(map[{{ .MapKey }}]{{ .Elem }}, len(v)) } // reset map testUnmarshalErr(&v{{$i}}v2, bs{{$i}}, h, t, "dec-map-v{{$i}}-p-len") testDeepEqualErr(v{{$i}}v1, v{{$i}}v2, t, "equal-map-v{{$i}}-p-len") @@ -140,10 +147,12 @@ func doTestMammothMaps(t *testing.T, h Handle) { var v{{$i}}v3, v{{$i}}v4 {{ .MethodNamePfx "typMap" false }} v{{$i}}v3 = {{ .MethodNamePfx "typMap" false }}(v{{$i}}v1) v{{$i}}v4 = {{ .MethodNamePfx "typMap" false }}(v{{$i}}v2) + if v != nil { bs{{$i}} = testMarshalErr(v{{$i}}v3, h, t, "enc-map-v{{$i}}-custom") testUnmarshalErr(v{{$i}}v4, bs{{$i}}, h, t, "dec-map-v{{$i}}-p-len") testDeepEqualErr(v{{$i}}v3, v{{$i}}v4, t, "equal-map-v{{$i}}-p-len") } + } {{end}}{{end}}{{end}} } diff --git a/codec/mammoth2_codecgen_generated_test.go b/codec/mammoth2_codecgen_generated_test.go index 89054f7e..27a4cf10 100644 --- a/codec/mammoth2_codecgen_generated_test.go +++ b/codec/mammoth2_codecgen_generated_test.go @@ -15,13 +15,15 @@ const ( codecSelferCcUTF819781 = 1 codecSelferCcRAW19781 = 255 // ----- value types used ---- - codecSelferValueTypeArray19781 = 10 - codecSelferValueTypeMap19781 = 9 - codecSelferValueTypeString19781 = 6 - codecSelferValueTypeInt19781 = 2 - codecSelferValueTypeUint19781 = 3 - codecSelferValueTypeFloat19781 = 4 - codecSelferBitsize19781 = uint8(32 << (^uint(0) >> 63)) + codecSelferValueTypeArray19781 = 10 + codecSelferValueTypeMap19781 = 9 + codecSelferValueTypeString19781 = 6 + codecSelferValueTypeInt19781 = 2 + codecSelferValueTypeUint19781 = 3 + codecSelferValueTypeFloat19781 = 4 + codecSelferValueTypeNil19781 = 1 + codecSelferBitsize19781 = uint8(32 << (^uint(0) >> 63)) + codecSelferDecContainerLenNil19781 = -2147483648 ) var ( @@ -33,10 +35,10 @@ type codecSelfer19781 struct{} func codecSelfer19781False() bool { return false } func init() { - if GenVersion != 13 { + if GenVersion != 14 { _, file, _, _ := runtime.Caller(0) ver := strconv.FormatInt(int64(GenVersion), 10) - panic("codecgen version mismatch: current: 13, need " + ver + ". Re-generate file: " + file) + panic("codecgen version mismatch: current: 14, need " + ver + ". Re-generate file: " + file) } } @@ -46,7 +48,7 @@ func (x *TestMammoth2) CodecEncodeSelf(e *Encoder) { _, _, _ = h, z, r if x == nil { r.EncodeNil() - } else { // checkNil=true + } else { yysep2 := !z.EncBinary() yy2arr2 := z.EncBasicHandle().StructToArray _, _ = yysep2, yy2arr2 @@ -4522,7 +4524,7 @@ func (x *TestMammoth2) CodecEncodeSelf(e *Encoder) { } z.EncWriteMapEnd() } - } // checkNil=true + } } func (x *TestMammoth2) CodecDecodeSelf(d *Decoder) { @@ -4530,7 +4532,9 @@ func (x *TestMammoth2) CodecDecodeSelf(d *Decoder) { z, r := GenHelperDecoder(d) _, _, _ = h, z, r yyct2 := r.ContainerType() - if yyct2 == codecSelferValueTypeMap19781 { + if yyct2 == codecSelferValueTypeNil19781 { + *(x) = TestMammoth2{} + } else if yyct2 == codecSelferValueTypeMap19781 { yyl2 := z.DecReadMapStart() if yyl2 == 0 { } else { @@ -4568,13 +4572,9 @@ func (x *TestMammoth2) codecDecodeSelfFromMap(l int, d *Decoder) { z.DecReadMapElemValue() switch yys3 { case "FIntf": - if r.TryDecodeAsNil() { - x.FIntf = nil - } else { - z.DecFallback(&x.FIntf, true) - } + z.DecFallback(&x.FIntf, true) case "FptrIntf": - if r.TryDecodeAsNil() { + if r.TryNil() { if x.FptrIntf != nil { // remove the if-true x.FptrIntf = nil } @@ -4582,17 +4582,12 @@ func (x *TestMammoth2) codecDecodeSelfFromMap(l int, d *Decoder) { if x.FptrIntf == nil { x.FptrIntf = new(interface{}) } - z.DecFallback(x.FptrIntf, true) } case "FString": - if r.TryDecodeAsNil() { - x.FString = "" - } else { - x.FString = (string)(string(r.DecodeStringAsBytes())) - } + x.FString = (string)(string(r.DecodeStringAsBytes())) case "FptrString": - if r.TryDecodeAsNil() { + if r.TryNil() { if x.FptrString != nil { // remove the if-true x.FptrString = nil } @@ -4600,17 +4595,12 @@ func (x *TestMammoth2) codecDecodeSelfFromMap(l int, d *Decoder) { if x.FptrString == nil { x.FptrString = new(string) } - *x.FptrString = (string)(string(r.DecodeStringAsBytes())) } case "FBytes": - if r.TryDecodeAsNil() { - x.FBytes = nil - } else { - x.FBytes = r.DecodeBytes(([]byte)(x.FBytes), false) - } + x.FBytes = r.DecodeBytes(([]byte)(x.FBytes), false) case "FptrBytes": - if r.TryDecodeAsNil() { + if r.TryNil() { if x.FptrBytes != nil { // remove the if-true x.FptrBytes = nil } @@ -4618,17 +4608,12 @@ func (x *TestMammoth2) codecDecodeSelfFromMap(l int, d *Decoder) { if x.FptrBytes == nil { x.FptrBytes = new([]uint8) } - *x.FptrBytes = r.DecodeBytes(*(*[]byte)(x.FptrBytes), false) } case "FFloat32": - if r.TryDecodeAsNil() { - x.FFloat32 = 0 - } else { - x.FFloat32 = (float32)(z.DecDecodeFloat32()) - } + x.FFloat32 = (float32)(z.DecDecodeFloat32()) case "FptrFloat32": - if r.TryDecodeAsNil() { + if r.TryNil() { if x.FptrFloat32 != nil { // remove the if-true x.FptrFloat32 = nil } @@ -4636,17 +4621,12 @@ func (x *TestMammoth2) codecDecodeSelfFromMap(l int, d *Decoder) { if x.FptrFloat32 == nil { x.FptrFloat32 = new(float32) } - *x.FptrFloat32 = (float32)(z.DecDecodeFloat32()) } case "FFloat64": - if r.TryDecodeAsNil() { - x.FFloat64 = 0 - } else { - x.FFloat64 = (float64)(r.DecodeFloat64()) - } + x.FFloat64 = (float64)(r.DecodeFloat64()) case "FptrFloat64": - if r.TryDecodeAsNil() { + if r.TryNil() { if x.FptrFloat64 != nil { // remove the if-true x.FptrFloat64 = nil } @@ -4654,17 +4634,12 @@ func (x *TestMammoth2) codecDecodeSelfFromMap(l int, d *Decoder) { if x.FptrFloat64 == nil { x.FptrFloat64 = new(float64) } - *x.FptrFloat64 = (float64)(r.DecodeFloat64()) } case "FUint": - if r.TryDecodeAsNil() { - x.FUint = 0 - } else { - x.FUint = (uint)(z.C.UintV(r.DecodeUint64(), codecSelferBitsize19781)) - } + x.FUint = (uint)(z.C.UintV(r.DecodeUint64(), codecSelferBitsize19781)) case "FptrUint": - if r.TryDecodeAsNil() { + if r.TryNil() { if x.FptrUint != nil { // remove the if-true x.FptrUint = nil } @@ -4672,17 +4647,12 @@ func (x *TestMammoth2) codecDecodeSelfFromMap(l int, d *Decoder) { if x.FptrUint == nil { x.FptrUint = new(uint) } - *x.FptrUint = (uint)(z.C.UintV(r.DecodeUint64(), codecSelferBitsize19781)) } case "FUint8": - if r.TryDecodeAsNil() { - x.FUint8 = 0 - } else { - x.FUint8 = (uint8)(z.C.UintV(r.DecodeUint64(), 8)) - } + x.FUint8 = (uint8)(z.C.UintV(r.DecodeUint64(), 8)) case "FptrUint8": - if r.TryDecodeAsNil() { + if r.TryNil() { if x.FptrUint8 != nil { // remove the if-true x.FptrUint8 = nil } @@ -4690,17 +4660,12 @@ func (x *TestMammoth2) codecDecodeSelfFromMap(l int, d *Decoder) { if x.FptrUint8 == nil { x.FptrUint8 = new(uint8) } - *x.FptrUint8 = (uint8)(z.C.UintV(r.DecodeUint64(), 8)) } case "FUint16": - if r.TryDecodeAsNil() { - x.FUint16 = 0 - } else { - x.FUint16 = (uint16)(z.C.UintV(r.DecodeUint64(), 16)) - } + x.FUint16 = (uint16)(z.C.UintV(r.DecodeUint64(), 16)) case "FptrUint16": - if r.TryDecodeAsNil() { + if r.TryNil() { if x.FptrUint16 != nil { // remove the if-true x.FptrUint16 = nil } @@ -4708,17 +4673,12 @@ func (x *TestMammoth2) codecDecodeSelfFromMap(l int, d *Decoder) { if x.FptrUint16 == nil { x.FptrUint16 = new(uint16) } - *x.FptrUint16 = (uint16)(z.C.UintV(r.DecodeUint64(), 16)) } case "FUint32": - if r.TryDecodeAsNil() { - x.FUint32 = 0 - } else { - x.FUint32 = (uint32)(z.C.UintV(r.DecodeUint64(), 32)) - } + x.FUint32 = (uint32)(z.C.UintV(r.DecodeUint64(), 32)) case "FptrUint32": - if r.TryDecodeAsNil() { + if r.TryNil() { if x.FptrUint32 != nil { // remove the if-true x.FptrUint32 = nil } @@ -4726,17 +4686,12 @@ func (x *TestMammoth2) codecDecodeSelfFromMap(l int, d *Decoder) { if x.FptrUint32 == nil { x.FptrUint32 = new(uint32) } - *x.FptrUint32 = (uint32)(z.C.UintV(r.DecodeUint64(), 32)) } case "FUint64": - if r.TryDecodeAsNil() { - x.FUint64 = 0 - } else { - x.FUint64 = (uint64)(r.DecodeUint64()) - } + x.FUint64 = (uint64)(r.DecodeUint64()) case "FptrUint64": - if r.TryDecodeAsNil() { + if r.TryNil() { if x.FptrUint64 != nil { // remove the if-true x.FptrUint64 = nil } @@ -4744,17 +4699,12 @@ func (x *TestMammoth2) codecDecodeSelfFromMap(l int, d *Decoder) { if x.FptrUint64 == nil { x.FptrUint64 = new(uint64) } - *x.FptrUint64 = (uint64)(r.DecodeUint64()) } case "FUintptr": - if r.TryDecodeAsNil() { - x.FUintptr = 0 - } else { - x.FUintptr = (uintptr)(z.C.UintV(r.DecodeUint64(), codecSelferBitsize19781)) - } + x.FUintptr = (uintptr)(z.C.UintV(r.DecodeUint64(), codecSelferBitsize19781)) case "FptrUintptr": - if r.TryDecodeAsNil() { + if r.TryNil() { if x.FptrUintptr != nil { // remove the if-true x.FptrUintptr = nil } @@ -4762,17 +4712,12 @@ func (x *TestMammoth2) codecDecodeSelfFromMap(l int, d *Decoder) { if x.FptrUintptr == nil { x.FptrUintptr = new(uintptr) } - *x.FptrUintptr = (uintptr)(z.C.UintV(r.DecodeUint64(), codecSelferBitsize19781)) } case "FInt": - if r.TryDecodeAsNil() { - x.FInt = 0 - } else { - x.FInt = (int)(z.C.IntV(r.DecodeInt64(), codecSelferBitsize19781)) - } + x.FInt = (int)(z.C.IntV(r.DecodeInt64(), codecSelferBitsize19781)) case "FptrInt": - if r.TryDecodeAsNil() { + if r.TryNil() { if x.FptrInt != nil { // remove the if-true x.FptrInt = nil } @@ -4780,17 +4725,12 @@ func (x *TestMammoth2) codecDecodeSelfFromMap(l int, d *Decoder) { if x.FptrInt == nil { x.FptrInt = new(int) } - *x.FptrInt = (int)(z.C.IntV(r.DecodeInt64(), codecSelferBitsize19781)) } case "FInt8": - if r.TryDecodeAsNil() { - x.FInt8 = 0 - } else { - x.FInt8 = (int8)(z.C.IntV(r.DecodeInt64(), 8)) - } + x.FInt8 = (int8)(z.C.IntV(r.DecodeInt64(), 8)) case "FptrInt8": - if r.TryDecodeAsNil() { + if r.TryNil() { if x.FptrInt8 != nil { // remove the if-true x.FptrInt8 = nil } @@ -4798,17 +4738,12 @@ func (x *TestMammoth2) codecDecodeSelfFromMap(l int, d *Decoder) { if x.FptrInt8 == nil { x.FptrInt8 = new(int8) } - *x.FptrInt8 = (int8)(z.C.IntV(r.DecodeInt64(), 8)) } case "FInt16": - if r.TryDecodeAsNil() { - x.FInt16 = 0 - } else { - x.FInt16 = (int16)(z.C.IntV(r.DecodeInt64(), 16)) - } + x.FInt16 = (int16)(z.C.IntV(r.DecodeInt64(), 16)) case "FptrInt16": - if r.TryDecodeAsNil() { + if r.TryNil() { if x.FptrInt16 != nil { // remove the if-true x.FptrInt16 = nil } @@ -4816,17 +4751,12 @@ func (x *TestMammoth2) codecDecodeSelfFromMap(l int, d *Decoder) { if x.FptrInt16 == nil { x.FptrInt16 = new(int16) } - *x.FptrInt16 = (int16)(z.C.IntV(r.DecodeInt64(), 16)) } case "FInt32": - if r.TryDecodeAsNil() { - x.FInt32 = 0 - } else { - x.FInt32 = (int32)(z.C.IntV(r.DecodeInt64(), 32)) - } + x.FInt32 = (int32)(z.C.IntV(r.DecodeInt64(), 32)) case "FptrInt32": - if r.TryDecodeAsNil() { + if r.TryNil() { if x.FptrInt32 != nil { // remove the if-true x.FptrInt32 = nil } @@ -4834,17 +4764,12 @@ func (x *TestMammoth2) codecDecodeSelfFromMap(l int, d *Decoder) { if x.FptrInt32 == nil { x.FptrInt32 = new(int32) } - *x.FptrInt32 = (int32)(z.C.IntV(r.DecodeInt64(), 32)) } case "FInt64": - if r.TryDecodeAsNil() { - x.FInt64 = 0 - } else { - x.FInt64 = (int64)(r.DecodeInt64()) - } + x.FInt64 = (int64)(r.DecodeInt64()) case "FptrInt64": - if r.TryDecodeAsNil() { + if r.TryNil() { if x.FptrInt64 != nil { // remove the if-true x.FptrInt64 = nil } @@ -4852,17 +4777,12 @@ func (x *TestMammoth2) codecDecodeSelfFromMap(l int, d *Decoder) { if x.FptrInt64 == nil { x.FptrInt64 = new(int64) } - *x.FptrInt64 = (int64)(r.DecodeInt64()) } case "FBool": - if r.TryDecodeAsNil() { - x.FBool = false - } else { - x.FBool = (bool)(r.DecodeBool()) - } + x.FBool = (bool)(r.DecodeBool()) case "FptrBool": - if r.TryDecodeAsNil() { + if r.TryNil() { if x.FptrBool != nil { // remove the if-true x.FptrBool = nil } @@ -4870,17 +4790,12 @@ func (x *TestMammoth2) codecDecodeSelfFromMap(l int, d *Decoder) { if x.FptrBool == nil { x.FptrBool = new(bool) } - *x.FptrBool = (bool)(r.DecodeBool()) } case "FSliceIntf": - if r.TryDecodeAsNil() { - x.FSliceIntf = nil - } else { - z.F.DecSliceIntfX(&x.FSliceIntf, d) - } + z.F.DecSliceIntfX(&x.FSliceIntf, d) case "FptrSliceIntf": - if r.TryDecodeAsNil() { + if r.TryNil() { if x.FptrSliceIntf != nil { // remove the if-true x.FptrSliceIntf = nil } @@ -4888,17 +4803,12 @@ func (x *TestMammoth2) codecDecodeSelfFromMap(l int, d *Decoder) { if x.FptrSliceIntf == nil { x.FptrSliceIntf = new([]interface{}) } - z.F.DecSliceIntfX(x.FptrSliceIntf, d) } case "FSliceString": - if r.TryDecodeAsNil() { - x.FSliceString = nil - } else { - z.F.DecSliceStringX(&x.FSliceString, d) - } + z.F.DecSliceStringX(&x.FSliceString, d) case "FptrSliceString": - if r.TryDecodeAsNil() { + if r.TryNil() { if x.FptrSliceString != nil { // remove the if-true x.FptrSliceString = nil } @@ -4906,17 +4816,12 @@ func (x *TestMammoth2) codecDecodeSelfFromMap(l int, d *Decoder) { if x.FptrSliceString == nil { x.FptrSliceString = new([]string) } - z.F.DecSliceStringX(x.FptrSliceString, d) } case "FSliceBytes": - if r.TryDecodeAsNil() { - x.FSliceBytes = nil - } else { - z.F.DecSliceBytesX(&x.FSliceBytes, d) - } + z.F.DecSliceBytesX(&x.FSliceBytes, d) case "FptrSliceBytes": - if r.TryDecodeAsNil() { + if r.TryNil() { if x.FptrSliceBytes != nil { // remove the if-true x.FptrSliceBytes = nil } @@ -4924,17 +4829,12 @@ func (x *TestMammoth2) codecDecodeSelfFromMap(l int, d *Decoder) { if x.FptrSliceBytes == nil { x.FptrSliceBytes = new([][]uint8) } - z.F.DecSliceBytesX(x.FptrSliceBytes, d) } case "FSliceFloat32": - if r.TryDecodeAsNil() { - x.FSliceFloat32 = nil - } else { - z.F.DecSliceFloat32X(&x.FSliceFloat32, d) - } + z.F.DecSliceFloat32X(&x.FSliceFloat32, d) case "FptrSliceFloat32": - if r.TryDecodeAsNil() { + if r.TryNil() { if x.FptrSliceFloat32 != nil { // remove the if-true x.FptrSliceFloat32 = nil } @@ -4942,17 +4842,12 @@ func (x *TestMammoth2) codecDecodeSelfFromMap(l int, d *Decoder) { if x.FptrSliceFloat32 == nil { x.FptrSliceFloat32 = new([]float32) } - z.F.DecSliceFloat32X(x.FptrSliceFloat32, d) } case "FSliceFloat64": - if r.TryDecodeAsNil() { - x.FSliceFloat64 = nil - } else { - z.F.DecSliceFloat64X(&x.FSliceFloat64, d) - } + z.F.DecSliceFloat64X(&x.FSliceFloat64, d) case "FptrSliceFloat64": - if r.TryDecodeAsNil() { + if r.TryNil() { if x.FptrSliceFloat64 != nil { // remove the if-true x.FptrSliceFloat64 = nil } @@ -4960,17 +4855,12 @@ func (x *TestMammoth2) codecDecodeSelfFromMap(l int, d *Decoder) { if x.FptrSliceFloat64 == nil { x.FptrSliceFloat64 = new([]float64) } - z.F.DecSliceFloat64X(x.FptrSliceFloat64, d) } case "FSliceUint": - if r.TryDecodeAsNil() { - x.FSliceUint = nil - } else { - z.F.DecSliceUintX(&x.FSliceUint, d) - } + z.F.DecSliceUintX(&x.FSliceUint, d) case "FptrSliceUint": - if r.TryDecodeAsNil() { + if r.TryNil() { if x.FptrSliceUint != nil { // remove the if-true x.FptrSliceUint = nil } @@ -4978,17 +4868,12 @@ func (x *TestMammoth2) codecDecodeSelfFromMap(l int, d *Decoder) { if x.FptrSliceUint == nil { x.FptrSliceUint = new([]uint) } - z.F.DecSliceUintX(x.FptrSliceUint, d) } case "FSliceUint16": - if r.TryDecodeAsNil() { - x.FSliceUint16 = nil - } else { - z.F.DecSliceUint16X(&x.FSliceUint16, d) - } + z.F.DecSliceUint16X(&x.FSliceUint16, d) case "FptrSliceUint16": - if r.TryDecodeAsNil() { + if r.TryNil() { if x.FptrSliceUint16 != nil { // remove the if-true x.FptrSliceUint16 = nil } @@ -4996,17 +4881,12 @@ func (x *TestMammoth2) codecDecodeSelfFromMap(l int, d *Decoder) { if x.FptrSliceUint16 == nil { x.FptrSliceUint16 = new([]uint16) } - z.F.DecSliceUint16X(x.FptrSliceUint16, d) } case "FSliceUint32": - if r.TryDecodeAsNil() { - x.FSliceUint32 = nil - } else { - z.F.DecSliceUint32X(&x.FSliceUint32, d) - } + z.F.DecSliceUint32X(&x.FSliceUint32, d) case "FptrSliceUint32": - if r.TryDecodeAsNil() { + if r.TryNil() { if x.FptrSliceUint32 != nil { // remove the if-true x.FptrSliceUint32 = nil } @@ -5014,17 +4894,12 @@ func (x *TestMammoth2) codecDecodeSelfFromMap(l int, d *Decoder) { if x.FptrSliceUint32 == nil { x.FptrSliceUint32 = new([]uint32) } - z.F.DecSliceUint32X(x.FptrSliceUint32, d) } case "FSliceUint64": - if r.TryDecodeAsNil() { - x.FSliceUint64 = nil - } else { - z.F.DecSliceUint64X(&x.FSliceUint64, d) - } + z.F.DecSliceUint64X(&x.FSliceUint64, d) case "FptrSliceUint64": - if r.TryDecodeAsNil() { + if r.TryNil() { if x.FptrSliceUint64 != nil { // remove the if-true x.FptrSliceUint64 = nil } @@ -5032,17 +4907,12 @@ func (x *TestMammoth2) codecDecodeSelfFromMap(l int, d *Decoder) { if x.FptrSliceUint64 == nil { x.FptrSliceUint64 = new([]uint64) } - z.F.DecSliceUint64X(x.FptrSliceUint64, d) } case "FSliceInt": - if r.TryDecodeAsNil() { - x.FSliceInt = nil - } else { - z.F.DecSliceIntX(&x.FSliceInt, d) - } + z.F.DecSliceIntX(&x.FSliceInt, d) case "FptrSliceInt": - if r.TryDecodeAsNil() { + if r.TryNil() { if x.FptrSliceInt != nil { // remove the if-true x.FptrSliceInt = nil } @@ -5050,17 +4920,12 @@ func (x *TestMammoth2) codecDecodeSelfFromMap(l int, d *Decoder) { if x.FptrSliceInt == nil { x.FptrSliceInt = new([]int) } - z.F.DecSliceIntX(x.FptrSliceInt, d) } case "FSliceInt8": - if r.TryDecodeAsNil() { - x.FSliceInt8 = nil - } else { - z.F.DecSliceInt8X(&x.FSliceInt8, d) - } + z.F.DecSliceInt8X(&x.FSliceInt8, d) case "FptrSliceInt8": - if r.TryDecodeAsNil() { + if r.TryNil() { if x.FptrSliceInt8 != nil { // remove the if-true x.FptrSliceInt8 = nil } @@ -5068,17 +4933,12 @@ func (x *TestMammoth2) codecDecodeSelfFromMap(l int, d *Decoder) { if x.FptrSliceInt8 == nil { x.FptrSliceInt8 = new([]int8) } - z.F.DecSliceInt8X(x.FptrSliceInt8, d) } case "FSliceInt16": - if r.TryDecodeAsNil() { - x.FSliceInt16 = nil - } else { - z.F.DecSliceInt16X(&x.FSliceInt16, d) - } + z.F.DecSliceInt16X(&x.FSliceInt16, d) case "FptrSliceInt16": - if r.TryDecodeAsNil() { + if r.TryNil() { if x.FptrSliceInt16 != nil { // remove the if-true x.FptrSliceInt16 = nil } @@ -5086,17 +4946,12 @@ func (x *TestMammoth2) codecDecodeSelfFromMap(l int, d *Decoder) { if x.FptrSliceInt16 == nil { x.FptrSliceInt16 = new([]int16) } - z.F.DecSliceInt16X(x.FptrSliceInt16, d) } case "FSliceInt32": - if r.TryDecodeAsNil() { - x.FSliceInt32 = nil - } else { - z.F.DecSliceInt32X(&x.FSliceInt32, d) - } + z.F.DecSliceInt32X(&x.FSliceInt32, d) case "FptrSliceInt32": - if r.TryDecodeAsNil() { + if r.TryNil() { if x.FptrSliceInt32 != nil { // remove the if-true x.FptrSliceInt32 = nil } @@ -5104,17 +4959,12 @@ func (x *TestMammoth2) codecDecodeSelfFromMap(l int, d *Decoder) { if x.FptrSliceInt32 == nil { x.FptrSliceInt32 = new([]int32) } - z.F.DecSliceInt32X(x.FptrSliceInt32, d) } case "FSliceInt64": - if r.TryDecodeAsNil() { - x.FSliceInt64 = nil - } else { - z.F.DecSliceInt64X(&x.FSliceInt64, d) - } + z.F.DecSliceInt64X(&x.FSliceInt64, d) case "FptrSliceInt64": - if r.TryDecodeAsNil() { + if r.TryNil() { if x.FptrSliceInt64 != nil { // remove the if-true x.FptrSliceInt64 = nil } @@ -5122,17 +4972,12 @@ func (x *TestMammoth2) codecDecodeSelfFromMap(l int, d *Decoder) { if x.FptrSliceInt64 == nil { x.FptrSliceInt64 = new([]int64) } - z.F.DecSliceInt64X(x.FptrSliceInt64, d) } case "FSliceBool": - if r.TryDecodeAsNil() { - x.FSliceBool = nil - } else { - z.F.DecSliceBoolX(&x.FSliceBool, d) - } + z.F.DecSliceBoolX(&x.FSliceBool, d) case "FptrSliceBool": - if r.TryDecodeAsNil() { + if r.TryNil() { if x.FptrSliceBool != nil { // remove the if-true x.FptrSliceBool = nil } @@ -5140,17 +4985,12 @@ func (x *TestMammoth2) codecDecodeSelfFromMap(l int, d *Decoder) { if x.FptrSliceBool == nil { x.FptrSliceBool = new([]bool) } - z.F.DecSliceBoolX(x.FptrSliceBool, d) } case "FMapStringIntf": - if r.TryDecodeAsNil() { - x.FMapStringIntf = nil - } else { - z.F.DecMapStringIntfX(&x.FMapStringIntf, d) - } + z.F.DecMapStringIntfX(&x.FMapStringIntf, d) case "FptrMapStringIntf": - if r.TryDecodeAsNil() { + if r.TryNil() { if x.FptrMapStringIntf != nil { // remove the if-true x.FptrMapStringIntf = nil } @@ -5158,17 +4998,12 @@ func (x *TestMammoth2) codecDecodeSelfFromMap(l int, d *Decoder) { if x.FptrMapStringIntf == nil { x.FptrMapStringIntf = new(map[string]interface{}) } - z.F.DecMapStringIntfX(x.FptrMapStringIntf, d) } case "FMapStringString": - if r.TryDecodeAsNil() { - x.FMapStringString = nil - } else { - z.F.DecMapStringStringX(&x.FMapStringString, d) - } + z.F.DecMapStringStringX(&x.FMapStringString, d) case "FptrMapStringString": - if r.TryDecodeAsNil() { + if r.TryNil() { if x.FptrMapStringString != nil { // remove the if-true x.FptrMapStringString = nil } @@ -5176,17 +5011,12 @@ func (x *TestMammoth2) codecDecodeSelfFromMap(l int, d *Decoder) { if x.FptrMapStringString == nil { x.FptrMapStringString = new(map[string]string) } - z.F.DecMapStringStringX(x.FptrMapStringString, d) } case "FMapStringBytes": - if r.TryDecodeAsNil() { - x.FMapStringBytes = nil - } else { - z.F.DecMapStringBytesX(&x.FMapStringBytes, d) - } + z.F.DecMapStringBytesX(&x.FMapStringBytes, d) case "FptrMapStringBytes": - if r.TryDecodeAsNil() { + if r.TryNil() { if x.FptrMapStringBytes != nil { // remove the if-true x.FptrMapStringBytes = nil } @@ -5194,17 +5024,12 @@ func (x *TestMammoth2) codecDecodeSelfFromMap(l int, d *Decoder) { if x.FptrMapStringBytes == nil { x.FptrMapStringBytes = new(map[string][]uint8) } - z.F.DecMapStringBytesX(x.FptrMapStringBytes, d) } case "FMapStringUint": - if r.TryDecodeAsNil() { - x.FMapStringUint = nil - } else { - z.F.DecMapStringUintX(&x.FMapStringUint, d) - } + z.F.DecMapStringUintX(&x.FMapStringUint, d) case "FptrMapStringUint": - if r.TryDecodeAsNil() { + if r.TryNil() { if x.FptrMapStringUint != nil { // remove the if-true x.FptrMapStringUint = nil } @@ -5212,17 +5037,12 @@ func (x *TestMammoth2) codecDecodeSelfFromMap(l int, d *Decoder) { if x.FptrMapStringUint == nil { x.FptrMapStringUint = new(map[string]uint) } - z.F.DecMapStringUintX(x.FptrMapStringUint, d) } case "FMapStringUint8": - if r.TryDecodeAsNil() { - x.FMapStringUint8 = nil - } else { - z.F.DecMapStringUint8X(&x.FMapStringUint8, d) - } + z.F.DecMapStringUint8X(&x.FMapStringUint8, d) case "FptrMapStringUint8": - if r.TryDecodeAsNil() { + if r.TryNil() { if x.FptrMapStringUint8 != nil { // remove the if-true x.FptrMapStringUint8 = nil } @@ -5230,17 +5050,12 @@ func (x *TestMammoth2) codecDecodeSelfFromMap(l int, d *Decoder) { if x.FptrMapStringUint8 == nil { x.FptrMapStringUint8 = new(map[string]uint8) } - z.F.DecMapStringUint8X(x.FptrMapStringUint8, d) } case "FMapStringUint64": - if r.TryDecodeAsNil() { - x.FMapStringUint64 = nil - } else { - z.F.DecMapStringUint64X(&x.FMapStringUint64, d) - } + z.F.DecMapStringUint64X(&x.FMapStringUint64, d) case "FptrMapStringUint64": - if r.TryDecodeAsNil() { + if r.TryNil() { if x.FptrMapStringUint64 != nil { // remove the if-true x.FptrMapStringUint64 = nil } @@ -5248,17 +5063,12 @@ func (x *TestMammoth2) codecDecodeSelfFromMap(l int, d *Decoder) { if x.FptrMapStringUint64 == nil { x.FptrMapStringUint64 = new(map[string]uint64) } - z.F.DecMapStringUint64X(x.FptrMapStringUint64, d) } case "FMapStringInt": - if r.TryDecodeAsNil() { - x.FMapStringInt = nil - } else { - z.F.DecMapStringIntX(&x.FMapStringInt, d) - } + z.F.DecMapStringIntX(&x.FMapStringInt, d) case "FptrMapStringInt": - if r.TryDecodeAsNil() { + if r.TryNil() { if x.FptrMapStringInt != nil { // remove the if-true x.FptrMapStringInt = nil } @@ -5266,17 +5076,12 @@ func (x *TestMammoth2) codecDecodeSelfFromMap(l int, d *Decoder) { if x.FptrMapStringInt == nil { x.FptrMapStringInt = new(map[string]int) } - z.F.DecMapStringIntX(x.FptrMapStringInt, d) } case "FMapStringInt64": - if r.TryDecodeAsNil() { - x.FMapStringInt64 = nil - } else { - z.F.DecMapStringInt64X(&x.FMapStringInt64, d) - } + z.F.DecMapStringInt64X(&x.FMapStringInt64, d) case "FptrMapStringInt64": - if r.TryDecodeAsNil() { + if r.TryNil() { if x.FptrMapStringInt64 != nil { // remove the if-true x.FptrMapStringInt64 = nil } @@ -5284,17 +5089,12 @@ func (x *TestMammoth2) codecDecodeSelfFromMap(l int, d *Decoder) { if x.FptrMapStringInt64 == nil { x.FptrMapStringInt64 = new(map[string]int64) } - z.F.DecMapStringInt64X(x.FptrMapStringInt64, d) } case "FMapStringFloat32": - if r.TryDecodeAsNil() { - x.FMapStringFloat32 = nil - } else { - z.F.DecMapStringFloat32X(&x.FMapStringFloat32, d) - } + z.F.DecMapStringFloat32X(&x.FMapStringFloat32, d) case "FptrMapStringFloat32": - if r.TryDecodeAsNil() { + if r.TryNil() { if x.FptrMapStringFloat32 != nil { // remove the if-true x.FptrMapStringFloat32 = nil } @@ -5302,17 +5102,12 @@ func (x *TestMammoth2) codecDecodeSelfFromMap(l int, d *Decoder) { if x.FptrMapStringFloat32 == nil { x.FptrMapStringFloat32 = new(map[string]float32) } - z.F.DecMapStringFloat32X(x.FptrMapStringFloat32, d) } case "FMapStringFloat64": - if r.TryDecodeAsNil() { - x.FMapStringFloat64 = nil - } else { - z.F.DecMapStringFloat64X(&x.FMapStringFloat64, d) - } + z.F.DecMapStringFloat64X(&x.FMapStringFloat64, d) case "FptrMapStringFloat64": - if r.TryDecodeAsNil() { + if r.TryNil() { if x.FptrMapStringFloat64 != nil { // remove the if-true x.FptrMapStringFloat64 = nil } @@ -5320,17 +5115,12 @@ func (x *TestMammoth2) codecDecodeSelfFromMap(l int, d *Decoder) { if x.FptrMapStringFloat64 == nil { x.FptrMapStringFloat64 = new(map[string]float64) } - z.F.DecMapStringFloat64X(x.FptrMapStringFloat64, d) } case "FMapStringBool": - if r.TryDecodeAsNil() { - x.FMapStringBool = nil - } else { - z.F.DecMapStringBoolX(&x.FMapStringBool, d) - } + z.F.DecMapStringBoolX(&x.FMapStringBool, d) case "FptrMapStringBool": - if r.TryDecodeAsNil() { + if r.TryNil() { if x.FptrMapStringBool != nil { // remove the if-true x.FptrMapStringBool = nil } @@ -5338,17 +5128,12 @@ func (x *TestMammoth2) codecDecodeSelfFromMap(l int, d *Decoder) { if x.FptrMapStringBool == nil { x.FptrMapStringBool = new(map[string]bool) } - z.F.DecMapStringBoolX(x.FptrMapStringBool, d) } case "FMapUintIntf": - if r.TryDecodeAsNil() { - x.FMapUintIntf = nil - } else { - z.F.DecMapUintIntfX(&x.FMapUintIntf, d) - } + z.F.DecMapUintIntfX(&x.FMapUintIntf, d) case "FptrMapUintIntf": - if r.TryDecodeAsNil() { + if r.TryNil() { if x.FptrMapUintIntf != nil { // remove the if-true x.FptrMapUintIntf = nil } @@ -5356,17 +5141,12 @@ func (x *TestMammoth2) codecDecodeSelfFromMap(l int, d *Decoder) { if x.FptrMapUintIntf == nil { x.FptrMapUintIntf = new(map[uint]interface{}) } - z.F.DecMapUintIntfX(x.FptrMapUintIntf, d) } case "FMapUintString": - if r.TryDecodeAsNil() { - x.FMapUintString = nil - } else { - z.F.DecMapUintStringX(&x.FMapUintString, d) - } + z.F.DecMapUintStringX(&x.FMapUintString, d) case "FptrMapUintString": - if r.TryDecodeAsNil() { + if r.TryNil() { if x.FptrMapUintString != nil { // remove the if-true x.FptrMapUintString = nil } @@ -5374,17 +5154,12 @@ func (x *TestMammoth2) codecDecodeSelfFromMap(l int, d *Decoder) { if x.FptrMapUintString == nil { x.FptrMapUintString = new(map[uint]string) } - z.F.DecMapUintStringX(x.FptrMapUintString, d) } case "FMapUintBytes": - if r.TryDecodeAsNil() { - x.FMapUintBytes = nil - } else { - z.F.DecMapUintBytesX(&x.FMapUintBytes, d) - } + z.F.DecMapUintBytesX(&x.FMapUintBytes, d) case "FptrMapUintBytes": - if r.TryDecodeAsNil() { + if r.TryNil() { if x.FptrMapUintBytes != nil { // remove the if-true x.FptrMapUintBytes = nil } @@ -5392,17 +5167,12 @@ func (x *TestMammoth2) codecDecodeSelfFromMap(l int, d *Decoder) { if x.FptrMapUintBytes == nil { x.FptrMapUintBytes = new(map[uint][]uint8) } - z.F.DecMapUintBytesX(x.FptrMapUintBytes, d) } case "FMapUintUint": - if r.TryDecodeAsNil() { - x.FMapUintUint = nil - } else { - z.F.DecMapUintUintX(&x.FMapUintUint, d) - } + z.F.DecMapUintUintX(&x.FMapUintUint, d) case "FptrMapUintUint": - if r.TryDecodeAsNil() { + if r.TryNil() { if x.FptrMapUintUint != nil { // remove the if-true x.FptrMapUintUint = nil } @@ -5410,17 +5180,12 @@ func (x *TestMammoth2) codecDecodeSelfFromMap(l int, d *Decoder) { if x.FptrMapUintUint == nil { x.FptrMapUintUint = new(map[uint]uint) } - z.F.DecMapUintUintX(x.FptrMapUintUint, d) } case "FMapUintUint8": - if r.TryDecodeAsNil() { - x.FMapUintUint8 = nil - } else { - z.F.DecMapUintUint8X(&x.FMapUintUint8, d) - } + z.F.DecMapUintUint8X(&x.FMapUintUint8, d) case "FptrMapUintUint8": - if r.TryDecodeAsNil() { + if r.TryNil() { if x.FptrMapUintUint8 != nil { // remove the if-true x.FptrMapUintUint8 = nil } @@ -5428,17 +5193,12 @@ func (x *TestMammoth2) codecDecodeSelfFromMap(l int, d *Decoder) { if x.FptrMapUintUint8 == nil { x.FptrMapUintUint8 = new(map[uint]uint8) } - z.F.DecMapUintUint8X(x.FptrMapUintUint8, d) } case "FMapUintUint64": - if r.TryDecodeAsNil() { - x.FMapUintUint64 = nil - } else { - z.F.DecMapUintUint64X(&x.FMapUintUint64, d) - } + z.F.DecMapUintUint64X(&x.FMapUintUint64, d) case "FptrMapUintUint64": - if r.TryDecodeAsNil() { + if r.TryNil() { if x.FptrMapUintUint64 != nil { // remove the if-true x.FptrMapUintUint64 = nil } @@ -5446,17 +5206,12 @@ func (x *TestMammoth2) codecDecodeSelfFromMap(l int, d *Decoder) { if x.FptrMapUintUint64 == nil { x.FptrMapUintUint64 = new(map[uint]uint64) } - z.F.DecMapUintUint64X(x.FptrMapUintUint64, d) } case "FMapUintInt": - if r.TryDecodeAsNil() { - x.FMapUintInt = nil - } else { - z.F.DecMapUintIntX(&x.FMapUintInt, d) - } + z.F.DecMapUintIntX(&x.FMapUintInt, d) case "FptrMapUintInt": - if r.TryDecodeAsNil() { + if r.TryNil() { if x.FptrMapUintInt != nil { // remove the if-true x.FptrMapUintInt = nil } @@ -5464,17 +5219,12 @@ func (x *TestMammoth2) codecDecodeSelfFromMap(l int, d *Decoder) { if x.FptrMapUintInt == nil { x.FptrMapUintInt = new(map[uint]int) } - z.F.DecMapUintIntX(x.FptrMapUintInt, d) } case "FMapUintInt64": - if r.TryDecodeAsNil() { - x.FMapUintInt64 = nil - } else { - z.F.DecMapUintInt64X(&x.FMapUintInt64, d) - } + z.F.DecMapUintInt64X(&x.FMapUintInt64, d) case "FptrMapUintInt64": - if r.TryDecodeAsNil() { + if r.TryNil() { if x.FptrMapUintInt64 != nil { // remove the if-true x.FptrMapUintInt64 = nil } @@ -5482,17 +5232,12 @@ func (x *TestMammoth2) codecDecodeSelfFromMap(l int, d *Decoder) { if x.FptrMapUintInt64 == nil { x.FptrMapUintInt64 = new(map[uint]int64) } - z.F.DecMapUintInt64X(x.FptrMapUintInt64, d) } case "FMapUintFloat32": - if r.TryDecodeAsNil() { - x.FMapUintFloat32 = nil - } else { - z.F.DecMapUintFloat32X(&x.FMapUintFloat32, d) - } + z.F.DecMapUintFloat32X(&x.FMapUintFloat32, d) case "FptrMapUintFloat32": - if r.TryDecodeAsNil() { + if r.TryNil() { if x.FptrMapUintFloat32 != nil { // remove the if-true x.FptrMapUintFloat32 = nil } @@ -5500,17 +5245,12 @@ func (x *TestMammoth2) codecDecodeSelfFromMap(l int, d *Decoder) { if x.FptrMapUintFloat32 == nil { x.FptrMapUintFloat32 = new(map[uint]float32) } - z.F.DecMapUintFloat32X(x.FptrMapUintFloat32, d) } case "FMapUintFloat64": - if r.TryDecodeAsNil() { - x.FMapUintFloat64 = nil - } else { - z.F.DecMapUintFloat64X(&x.FMapUintFloat64, d) - } + z.F.DecMapUintFloat64X(&x.FMapUintFloat64, d) case "FptrMapUintFloat64": - if r.TryDecodeAsNil() { + if r.TryNil() { if x.FptrMapUintFloat64 != nil { // remove the if-true x.FptrMapUintFloat64 = nil } @@ -5518,17 +5258,12 @@ func (x *TestMammoth2) codecDecodeSelfFromMap(l int, d *Decoder) { if x.FptrMapUintFloat64 == nil { x.FptrMapUintFloat64 = new(map[uint]float64) } - z.F.DecMapUintFloat64X(x.FptrMapUintFloat64, d) } case "FMapUintBool": - if r.TryDecodeAsNil() { - x.FMapUintBool = nil - } else { - z.F.DecMapUintBoolX(&x.FMapUintBool, d) - } + z.F.DecMapUintBoolX(&x.FMapUintBool, d) case "FptrMapUintBool": - if r.TryDecodeAsNil() { + if r.TryNil() { if x.FptrMapUintBool != nil { // remove the if-true x.FptrMapUintBool = nil } @@ -5536,17 +5271,12 @@ func (x *TestMammoth2) codecDecodeSelfFromMap(l int, d *Decoder) { if x.FptrMapUintBool == nil { x.FptrMapUintBool = new(map[uint]bool) } - z.F.DecMapUintBoolX(x.FptrMapUintBool, d) } case "FMapUint8Intf": - if r.TryDecodeAsNil() { - x.FMapUint8Intf = nil - } else { - z.F.DecMapUint8IntfX(&x.FMapUint8Intf, d) - } + z.F.DecMapUint8IntfX(&x.FMapUint8Intf, d) case "FptrMapUint8Intf": - if r.TryDecodeAsNil() { + if r.TryNil() { if x.FptrMapUint8Intf != nil { // remove the if-true x.FptrMapUint8Intf = nil } @@ -5554,17 +5284,12 @@ func (x *TestMammoth2) codecDecodeSelfFromMap(l int, d *Decoder) { if x.FptrMapUint8Intf == nil { x.FptrMapUint8Intf = new(map[uint8]interface{}) } - z.F.DecMapUint8IntfX(x.FptrMapUint8Intf, d) } case "FMapUint8String": - if r.TryDecodeAsNil() { - x.FMapUint8String = nil - } else { - z.F.DecMapUint8StringX(&x.FMapUint8String, d) - } + z.F.DecMapUint8StringX(&x.FMapUint8String, d) case "FptrMapUint8String": - if r.TryDecodeAsNil() { + if r.TryNil() { if x.FptrMapUint8String != nil { // remove the if-true x.FptrMapUint8String = nil } @@ -5572,17 +5297,12 @@ func (x *TestMammoth2) codecDecodeSelfFromMap(l int, d *Decoder) { if x.FptrMapUint8String == nil { x.FptrMapUint8String = new(map[uint8]string) } - z.F.DecMapUint8StringX(x.FptrMapUint8String, d) } case "FMapUint8Bytes": - if r.TryDecodeAsNil() { - x.FMapUint8Bytes = nil - } else { - z.F.DecMapUint8BytesX(&x.FMapUint8Bytes, d) - } + z.F.DecMapUint8BytesX(&x.FMapUint8Bytes, d) case "FptrMapUint8Bytes": - if r.TryDecodeAsNil() { + if r.TryNil() { if x.FptrMapUint8Bytes != nil { // remove the if-true x.FptrMapUint8Bytes = nil } @@ -5590,17 +5310,12 @@ func (x *TestMammoth2) codecDecodeSelfFromMap(l int, d *Decoder) { if x.FptrMapUint8Bytes == nil { x.FptrMapUint8Bytes = new(map[uint8][]uint8) } - z.F.DecMapUint8BytesX(x.FptrMapUint8Bytes, d) } case "FMapUint8Uint": - if r.TryDecodeAsNil() { - x.FMapUint8Uint = nil - } else { - z.F.DecMapUint8UintX(&x.FMapUint8Uint, d) - } + z.F.DecMapUint8UintX(&x.FMapUint8Uint, d) case "FptrMapUint8Uint": - if r.TryDecodeAsNil() { + if r.TryNil() { if x.FptrMapUint8Uint != nil { // remove the if-true x.FptrMapUint8Uint = nil } @@ -5608,17 +5323,12 @@ func (x *TestMammoth2) codecDecodeSelfFromMap(l int, d *Decoder) { if x.FptrMapUint8Uint == nil { x.FptrMapUint8Uint = new(map[uint8]uint) } - z.F.DecMapUint8UintX(x.FptrMapUint8Uint, d) } case "FMapUint8Uint8": - if r.TryDecodeAsNil() { - x.FMapUint8Uint8 = nil - } else { - z.F.DecMapUint8Uint8X(&x.FMapUint8Uint8, d) - } + z.F.DecMapUint8Uint8X(&x.FMapUint8Uint8, d) case "FptrMapUint8Uint8": - if r.TryDecodeAsNil() { + if r.TryNil() { if x.FptrMapUint8Uint8 != nil { // remove the if-true x.FptrMapUint8Uint8 = nil } @@ -5626,17 +5336,12 @@ func (x *TestMammoth2) codecDecodeSelfFromMap(l int, d *Decoder) { if x.FptrMapUint8Uint8 == nil { x.FptrMapUint8Uint8 = new(map[uint8]uint8) } - z.F.DecMapUint8Uint8X(x.FptrMapUint8Uint8, d) } case "FMapUint8Uint64": - if r.TryDecodeAsNil() { - x.FMapUint8Uint64 = nil - } else { - z.F.DecMapUint8Uint64X(&x.FMapUint8Uint64, d) - } + z.F.DecMapUint8Uint64X(&x.FMapUint8Uint64, d) case "FptrMapUint8Uint64": - if r.TryDecodeAsNil() { + if r.TryNil() { if x.FptrMapUint8Uint64 != nil { // remove the if-true x.FptrMapUint8Uint64 = nil } @@ -5644,17 +5349,12 @@ func (x *TestMammoth2) codecDecodeSelfFromMap(l int, d *Decoder) { if x.FptrMapUint8Uint64 == nil { x.FptrMapUint8Uint64 = new(map[uint8]uint64) } - z.F.DecMapUint8Uint64X(x.FptrMapUint8Uint64, d) } case "FMapUint8Int": - if r.TryDecodeAsNil() { - x.FMapUint8Int = nil - } else { - z.F.DecMapUint8IntX(&x.FMapUint8Int, d) - } + z.F.DecMapUint8IntX(&x.FMapUint8Int, d) case "FptrMapUint8Int": - if r.TryDecodeAsNil() { + if r.TryNil() { if x.FptrMapUint8Int != nil { // remove the if-true x.FptrMapUint8Int = nil } @@ -5662,17 +5362,12 @@ func (x *TestMammoth2) codecDecodeSelfFromMap(l int, d *Decoder) { if x.FptrMapUint8Int == nil { x.FptrMapUint8Int = new(map[uint8]int) } - z.F.DecMapUint8IntX(x.FptrMapUint8Int, d) } case "FMapUint8Int64": - if r.TryDecodeAsNil() { - x.FMapUint8Int64 = nil - } else { - z.F.DecMapUint8Int64X(&x.FMapUint8Int64, d) - } + z.F.DecMapUint8Int64X(&x.FMapUint8Int64, d) case "FptrMapUint8Int64": - if r.TryDecodeAsNil() { + if r.TryNil() { if x.FptrMapUint8Int64 != nil { // remove the if-true x.FptrMapUint8Int64 = nil } @@ -5680,17 +5375,12 @@ func (x *TestMammoth2) codecDecodeSelfFromMap(l int, d *Decoder) { if x.FptrMapUint8Int64 == nil { x.FptrMapUint8Int64 = new(map[uint8]int64) } - z.F.DecMapUint8Int64X(x.FptrMapUint8Int64, d) } case "FMapUint8Float32": - if r.TryDecodeAsNil() { - x.FMapUint8Float32 = nil - } else { - z.F.DecMapUint8Float32X(&x.FMapUint8Float32, d) - } + z.F.DecMapUint8Float32X(&x.FMapUint8Float32, d) case "FptrMapUint8Float32": - if r.TryDecodeAsNil() { + if r.TryNil() { if x.FptrMapUint8Float32 != nil { // remove the if-true x.FptrMapUint8Float32 = nil } @@ -5698,17 +5388,12 @@ func (x *TestMammoth2) codecDecodeSelfFromMap(l int, d *Decoder) { if x.FptrMapUint8Float32 == nil { x.FptrMapUint8Float32 = new(map[uint8]float32) } - z.F.DecMapUint8Float32X(x.FptrMapUint8Float32, d) } case "FMapUint8Float64": - if r.TryDecodeAsNil() { - x.FMapUint8Float64 = nil - } else { - z.F.DecMapUint8Float64X(&x.FMapUint8Float64, d) - } + z.F.DecMapUint8Float64X(&x.FMapUint8Float64, d) case "FptrMapUint8Float64": - if r.TryDecodeAsNil() { + if r.TryNil() { if x.FptrMapUint8Float64 != nil { // remove the if-true x.FptrMapUint8Float64 = nil } @@ -5716,17 +5401,12 @@ func (x *TestMammoth2) codecDecodeSelfFromMap(l int, d *Decoder) { if x.FptrMapUint8Float64 == nil { x.FptrMapUint8Float64 = new(map[uint8]float64) } - z.F.DecMapUint8Float64X(x.FptrMapUint8Float64, d) } case "FMapUint8Bool": - if r.TryDecodeAsNil() { - x.FMapUint8Bool = nil - } else { - z.F.DecMapUint8BoolX(&x.FMapUint8Bool, d) - } + z.F.DecMapUint8BoolX(&x.FMapUint8Bool, d) case "FptrMapUint8Bool": - if r.TryDecodeAsNil() { + if r.TryNil() { if x.FptrMapUint8Bool != nil { // remove the if-true x.FptrMapUint8Bool = nil } @@ -5734,17 +5414,12 @@ func (x *TestMammoth2) codecDecodeSelfFromMap(l int, d *Decoder) { if x.FptrMapUint8Bool == nil { x.FptrMapUint8Bool = new(map[uint8]bool) } - z.F.DecMapUint8BoolX(x.FptrMapUint8Bool, d) } case "FMapUint64Intf": - if r.TryDecodeAsNil() { - x.FMapUint64Intf = nil - } else { - z.F.DecMapUint64IntfX(&x.FMapUint64Intf, d) - } + z.F.DecMapUint64IntfX(&x.FMapUint64Intf, d) case "FptrMapUint64Intf": - if r.TryDecodeAsNil() { + if r.TryNil() { if x.FptrMapUint64Intf != nil { // remove the if-true x.FptrMapUint64Intf = nil } @@ -5752,17 +5427,12 @@ func (x *TestMammoth2) codecDecodeSelfFromMap(l int, d *Decoder) { if x.FptrMapUint64Intf == nil { x.FptrMapUint64Intf = new(map[uint64]interface{}) } - z.F.DecMapUint64IntfX(x.FptrMapUint64Intf, d) } case "FMapUint64String": - if r.TryDecodeAsNil() { - x.FMapUint64String = nil - } else { - z.F.DecMapUint64StringX(&x.FMapUint64String, d) - } + z.F.DecMapUint64StringX(&x.FMapUint64String, d) case "FptrMapUint64String": - if r.TryDecodeAsNil() { + if r.TryNil() { if x.FptrMapUint64String != nil { // remove the if-true x.FptrMapUint64String = nil } @@ -5770,17 +5440,12 @@ func (x *TestMammoth2) codecDecodeSelfFromMap(l int, d *Decoder) { if x.FptrMapUint64String == nil { x.FptrMapUint64String = new(map[uint64]string) } - z.F.DecMapUint64StringX(x.FptrMapUint64String, d) } case "FMapUint64Bytes": - if r.TryDecodeAsNil() { - x.FMapUint64Bytes = nil - } else { - z.F.DecMapUint64BytesX(&x.FMapUint64Bytes, d) - } + z.F.DecMapUint64BytesX(&x.FMapUint64Bytes, d) case "FptrMapUint64Bytes": - if r.TryDecodeAsNil() { + if r.TryNil() { if x.FptrMapUint64Bytes != nil { // remove the if-true x.FptrMapUint64Bytes = nil } @@ -5788,17 +5453,12 @@ func (x *TestMammoth2) codecDecodeSelfFromMap(l int, d *Decoder) { if x.FptrMapUint64Bytes == nil { x.FptrMapUint64Bytes = new(map[uint64][]uint8) } - z.F.DecMapUint64BytesX(x.FptrMapUint64Bytes, d) } case "FMapUint64Uint": - if r.TryDecodeAsNil() { - x.FMapUint64Uint = nil - } else { - z.F.DecMapUint64UintX(&x.FMapUint64Uint, d) - } + z.F.DecMapUint64UintX(&x.FMapUint64Uint, d) case "FptrMapUint64Uint": - if r.TryDecodeAsNil() { + if r.TryNil() { if x.FptrMapUint64Uint != nil { // remove the if-true x.FptrMapUint64Uint = nil } @@ -5806,17 +5466,12 @@ func (x *TestMammoth2) codecDecodeSelfFromMap(l int, d *Decoder) { if x.FptrMapUint64Uint == nil { x.FptrMapUint64Uint = new(map[uint64]uint) } - z.F.DecMapUint64UintX(x.FptrMapUint64Uint, d) } case "FMapUint64Uint8": - if r.TryDecodeAsNil() { - x.FMapUint64Uint8 = nil - } else { - z.F.DecMapUint64Uint8X(&x.FMapUint64Uint8, d) - } + z.F.DecMapUint64Uint8X(&x.FMapUint64Uint8, d) case "FptrMapUint64Uint8": - if r.TryDecodeAsNil() { + if r.TryNil() { if x.FptrMapUint64Uint8 != nil { // remove the if-true x.FptrMapUint64Uint8 = nil } @@ -5824,17 +5479,12 @@ func (x *TestMammoth2) codecDecodeSelfFromMap(l int, d *Decoder) { if x.FptrMapUint64Uint8 == nil { x.FptrMapUint64Uint8 = new(map[uint64]uint8) } - z.F.DecMapUint64Uint8X(x.FptrMapUint64Uint8, d) } case "FMapUint64Uint64": - if r.TryDecodeAsNil() { - x.FMapUint64Uint64 = nil - } else { - z.F.DecMapUint64Uint64X(&x.FMapUint64Uint64, d) - } + z.F.DecMapUint64Uint64X(&x.FMapUint64Uint64, d) case "FptrMapUint64Uint64": - if r.TryDecodeAsNil() { + if r.TryNil() { if x.FptrMapUint64Uint64 != nil { // remove the if-true x.FptrMapUint64Uint64 = nil } @@ -5842,17 +5492,12 @@ func (x *TestMammoth2) codecDecodeSelfFromMap(l int, d *Decoder) { if x.FptrMapUint64Uint64 == nil { x.FptrMapUint64Uint64 = new(map[uint64]uint64) } - z.F.DecMapUint64Uint64X(x.FptrMapUint64Uint64, d) } case "FMapUint64Int": - if r.TryDecodeAsNil() { - x.FMapUint64Int = nil - } else { - z.F.DecMapUint64IntX(&x.FMapUint64Int, d) - } + z.F.DecMapUint64IntX(&x.FMapUint64Int, d) case "FptrMapUint64Int": - if r.TryDecodeAsNil() { + if r.TryNil() { if x.FptrMapUint64Int != nil { // remove the if-true x.FptrMapUint64Int = nil } @@ -5860,17 +5505,12 @@ func (x *TestMammoth2) codecDecodeSelfFromMap(l int, d *Decoder) { if x.FptrMapUint64Int == nil { x.FptrMapUint64Int = new(map[uint64]int) } - z.F.DecMapUint64IntX(x.FptrMapUint64Int, d) } case "FMapUint64Int64": - if r.TryDecodeAsNil() { - x.FMapUint64Int64 = nil - } else { - z.F.DecMapUint64Int64X(&x.FMapUint64Int64, d) - } + z.F.DecMapUint64Int64X(&x.FMapUint64Int64, d) case "FptrMapUint64Int64": - if r.TryDecodeAsNil() { + if r.TryNil() { if x.FptrMapUint64Int64 != nil { // remove the if-true x.FptrMapUint64Int64 = nil } @@ -5878,17 +5518,12 @@ func (x *TestMammoth2) codecDecodeSelfFromMap(l int, d *Decoder) { if x.FptrMapUint64Int64 == nil { x.FptrMapUint64Int64 = new(map[uint64]int64) } - z.F.DecMapUint64Int64X(x.FptrMapUint64Int64, d) } case "FMapUint64Float32": - if r.TryDecodeAsNil() { - x.FMapUint64Float32 = nil - } else { - z.F.DecMapUint64Float32X(&x.FMapUint64Float32, d) - } + z.F.DecMapUint64Float32X(&x.FMapUint64Float32, d) case "FptrMapUint64Float32": - if r.TryDecodeAsNil() { + if r.TryNil() { if x.FptrMapUint64Float32 != nil { // remove the if-true x.FptrMapUint64Float32 = nil } @@ -5896,17 +5531,12 @@ func (x *TestMammoth2) codecDecodeSelfFromMap(l int, d *Decoder) { if x.FptrMapUint64Float32 == nil { x.FptrMapUint64Float32 = new(map[uint64]float32) } - z.F.DecMapUint64Float32X(x.FptrMapUint64Float32, d) } case "FMapUint64Float64": - if r.TryDecodeAsNil() { - x.FMapUint64Float64 = nil - } else { - z.F.DecMapUint64Float64X(&x.FMapUint64Float64, d) - } + z.F.DecMapUint64Float64X(&x.FMapUint64Float64, d) case "FptrMapUint64Float64": - if r.TryDecodeAsNil() { + if r.TryNil() { if x.FptrMapUint64Float64 != nil { // remove the if-true x.FptrMapUint64Float64 = nil } @@ -5914,17 +5544,12 @@ func (x *TestMammoth2) codecDecodeSelfFromMap(l int, d *Decoder) { if x.FptrMapUint64Float64 == nil { x.FptrMapUint64Float64 = new(map[uint64]float64) } - z.F.DecMapUint64Float64X(x.FptrMapUint64Float64, d) } case "FMapUint64Bool": - if r.TryDecodeAsNil() { - x.FMapUint64Bool = nil - } else { - z.F.DecMapUint64BoolX(&x.FMapUint64Bool, d) - } + z.F.DecMapUint64BoolX(&x.FMapUint64Bool, d) case "FptrMapUint64Bool": - if r.TryDecodeAsNil() { + if r.TryNil() { if x.FptrMapUint64Bool != nil { // remove the if-true x.FptrMapUint64Bool = nil } @@ -5932,17 +5557,12 @@ func (x *TestMammoth2) codecDecodeSelfFromMap(l int, d *Decoder) { if x.FptrMapUint64Bool == nil { x.FptrMapUint64Bool = new(map[uint64]bool) } - z.F.DecMapUint64BoolX(x.FptrMapUint64Bool, d) } case "FMapIntIntf": - if r.TryDecodeAsNil() { - x.FMapIntIntf = nil - } else { - z.F.DecMapIntIntfX(&x.FMapIntIntf, d) - } + z.F.DecMapIntIntfX(&x.FMapIntIntf, d) case "FptrMapIntIntf": - if r.TryDecodeAsNil() { + if r.TryNil() { if x.FptrMapIntIntf != nil { // remove the if-true x.FptrMapIntIntf = nil } @@ -5950,17 +5570,12 @@ func (x *TestMammoth2) codecDecodeSelfFromMap(l int, d *Decoder) { if x.FptrMapIntIntf == nil { x.FptrMapIntIntf = new(map[int]interface{}) } - z.F.DecMapIntIntfX(x.FptrMapIntIntf, d) } case "FMapIntString": - if r.TryDecodeAsNil() { - x.FMapIntString = nil - } else { - z.F.DecMapIntStringX(&x.FMapIntString, d) - } + z.F.DecMapIntStringX(&x.FMapIntString, d) case "FptrMapIntString": - if r.TryDecodeAsNil() { + if r.TryNil() { if x.FptrMapIntString != nil { // remove the if-true x.FptrMapIntString = nil } @@ -5968,17 +5583,12 @@ func (x *TestMammoth2) codecDecodeSelfFromMap(l int, d *Decoder) { if x.FptrMapIntString == nil { x.FptrMapIntString = new(map[int]string) } - z.F.DecMapIntStringX(x.FptrMapIntString, d) } case "FMapIntBytes": - if r.TryDecodeAsNil() { - x.FMapIntBytes = nil - } else { - z.F.DecMapIntBytesX(&x.FMapIntBytes, d) - } + z.F.DecMapIntBytesX(&x.FMapIntBytes, d) case "FptrMapIntBytes": - if r.TryDecodeAsNil() { + if r.TryNil() { if x.FptrMapIntBytes != nil { // remove the if-true x.FptrMapIntBytes = nil } @@ -5986,17 +5596,12 @@ func (x *TestMammoth2) codecDecodeSelfFromMap(l int, d *Decoder) { if x.FptrMapIntBytes == nil { x.FptrMapIntBytes = new(map[int][]uint8) } - z.F.DecMapIntBytesX(x.FptrMapIntBytes, d) } case "FMapIntUint": - if r.TryDecodeAsNil() { - x.FMapIntUint = nil - } else { - z.F.DecMapIntUintX(&x.FMapIntUint, d) - } + z.F.DecMapIntUintX(&x.FMapIntUint, d) case "FptrMapIntUint": - if r.TryDecodeAsNil() { + if r.TryNil() { if x.FptrMapIntUint != nil { // remove the if-true x.FptrMapIntUint = nil } @@ -6004,17 +5609,12 @@ func (x *TestMammoth2) codecDecodeSelfFromMap(l int, d *Decoder) { if x.FptrMapIntUint == nil { x.FptrMapIntUint = new(map[int]uint) } - z.F.DecMapIntUintX(x.FptrMapIntUint, d) } case "FMapIntUint8": - if r.TryDecodeAsNil() { - x.FMapIntUint8 = nil - } else { - z.F.DecMapIntUint8X(&x.FMapIntUint8, d) - } + z.F.DecMapIntUint8X(&x.FMapIntUint8, d) case "FptrMapIntUint8": - if r.TryDecodeAsNil() { + if r.TryNil() { if x.FptrMapIntUint8 != nil { // remove the if-true x.FptrMapIntUint8 = nil } @@ -6022,17 +5622,12 @@ func (x *TestMammoth2) codecDecodeSelfFromMap(l int, d *Decoder) { if x.FptrMapIntUint8 == nil { x.FptrMapIntUint8 = new(map[int]uint8) } - z.F.DecMapIntUint8X(x.FptrMapIntUint8, d) } case "FMapIntUint64": - if r.TryDecodeAsNil() { - x.FMapIntUint64 = nil - } else { - z.F.DecMapIntUint64X(&x.FMapIntUint64, d) - } + z.F.DecMapIntUint64X(&x.FMapIntUint64, d) case "FptrMapIntUint64": - if r.TryDecodeAsNil() { + if r.TryNil() { if x.FptrMapIntUint64 != nil { // remove the if-true x.FptrMapIntUint64 = nil } @@ -6040,17 +5635,12 @@ func (x *TestMammoth2) codecDecodeSelfFromMap(l int, d *Decoder) { if x.FptrMapIntUint64 == nil { x.FptrMapIntUint64 = new(map[int]uint64) } - z.F.DecMapIntUint64X(x.FptrMapIntUint64, d) } case "FMapIntInt": - if r.TryDecodeAsNil() { - x.FMapIntInt = nil - } else { - z.F.DecMapIntIntX(&x.FMapIntInt, d) - } + z.F.DecMapIntIntX(&x.FMapIntInt, d) case "FptrMapIntInt": - if r.TryDecodeAsNil() { + if r.TryNil() { if x.FptrMapIntInt != nil { // remove the if-true x.FptrMapIntInt = nil } @@ -6058,17 +5648,12 @@ func (x *TestMammoth2) codecDecodeSelfFromMap(l int, d *Decoder) { if x.FptrMapIntInt == nil { x.FptrMapIntInt = new(map[int]int) } - z.F.DecMapIntIntX(x.FptrMapIntInt, d) } case "FMapIntInt64": - if r.TryDecodeAsNil() { - x.FMapIntInt64 = nil - } else { - z.F.DecMapIntInt64X(&x.FMapIntInt64, d) - } + z.F.DecMapIntInt64X(&x.FMapIntInt64, d) case "FptrMapIntInt64": - if r.TryDecodeAsNil() { + if r.TryNil() { if x.FptrMapIntInt64 != nil { // remove the if-true x.FptrMapIntInt64 = nil } @@ -6076,17 +5661,12 @@ func (x *TestMammoth2) codecDecodeSelfFromMap(l int, d *Decoder) { if x.FptrMapIntInt64 == nil { x.FptrMapIntInt64 = new(map[int]int64) } - z.F.DecMapIntInt64X(x.FptrMapIntInt64, d) } case "FMapIntFloat32": - if r.TryDecodeAsNil() { - x.FMapIntFloat32 = nil - } else { - z.F.DecMapIntFloat32X(&x.FMapIntFloat32, d) - } + z.F.DecMapIntFloat32X(&x.FMapIntFloat32, d) case "FptrMapIntFloat32": - if r.TryDecodeAsNil() { + if r.TryNil() { if x.FptrMapIntFloat32 != nil { // remove the if-true x.FptrMapIntFloat32 = nil } @@ -6094,17 +5674,12 @@ func (x *TestMammoth2) codecDecodeSelfFromMap(l int, d *Decoder) { if x.FptrMapIntFloat32 == nil { x.FptrMapIntFloat32 = new(map[int]float32) } - z.F.DecMapIntFloat32X(x.FptrMapIntFloat32, d) } case "FMapIntFloat64": - if r.TryDecodeAsNil() { - x.FMapIntFloat64 = nil - } else { - z.F.DecMapIntFloat64X(&x.FMapIntFloat64, d) - } + z.F.DecMapIntFloat64X(&x.FMapIntFloat64, d) case "FptrMapIntFloat64": - if r.TryDecodeAsNil() { + if r.TryNil() { if x.FptrMapIntFloat64 != nil { // remove the if-true x.FptrMapIntFloat64 = nil } @@ -6112,17 +5687,12 @@ func (x *TestMammoth2) codecDecodeSelfFromMap(l int, d *Decoder) { if x.FptrMapIntFloat64 == nil { x.FptrMapIntFloat64 = new(map[int]float64) } - z.F.DecMapIntFloat64X(x.FptrMapIntFloat64, d) } case "FMapIntBool": - if r.TryDecodeAsNil() { - x.FMapIntBool = nil - } else { - z.F.DecMapIntBoolX(&x.FMapIntBool, d) - } + z.F.DecMapIntBoolX(&x.FMapIntBool, d) case "FptrMapIntBool": - if r.TryDecodeAsNil() { + if r.TryNil() { if x.FptrMapIntBool != nil { // remove the if-true x.FptrMapIntBool = nil } @@ -6130,17 +5700,12 @@ func (x *TestMammoth2) codecDecodeSelfFromMap(l int, d *Decoder) { if x.FptrMapIntBool == nil { x.FptrMapIntBool = new(map[int]bool) } - z.F.DecMapIntBoolX(x.FptrMapIntBool, d) } case "FMapInt64Intf": - if r.TryDecodeAsNil() { - x.FMapInt64Intf = nil - } else { - z.F.DecMapInt64IntfX(&x.FMapInt64Intf, d) - } + z.F.DecMapInt64IntfX(&x.FMapInt64Intf, d) case "FptrMapInt64Intf": - if r.TryDecodeAsNil() { + if r.TryNil() { if x.FptrMapInt64Intf != nil { // remove the if-true x.FptrMapInt64Intf = nil } @@ -6148,17 +5713,12 @@ func (x *TestMammoth2) codecDecodeSelfFromMap(l int, d *Decoder) { if x.FptrMapInt64Intf == nil { x.FptrMapInt64Intf = new(map[int64]interface{}) } - z.F.DecMapInt64IntfX(x.FptrMapInt64Intf, d) } case "FMapInt64String": - if r.TryDecodeAsNil() { - x.FMapInt64String = nil - } else { - z.F.DecMapInt64StringX(&x.FMapInt64String, d) - } + z.F.DecMapInt64StringX(&x.FMapInt64String, d) case "FptrMapInt64String": - if r.TryDecodeAsNil() { + if r.TryNil() { if x.FptrMapInt64String != nil { // remove the if-true x.FptrMapInt64String = nil } @@ -6166,17 +5726,12 @@ func (x *TestMammoth2) codecDecodeSelfFromMap(l int, d *Decoder) { if x.FptrMapInt64String == nil { x.FptrMapInt64String = new(map[int64]string) } - z.F.DecMapInt64StringX(x.FptrMapInt64String, d) } case "FMapInt64Bytes": - if r.TryDecodeAsNil() { - x.FMapInt64Bytes = nil - } else { - z.F.DecMapInt64BytesX(&x.FMapInt64Bytes, d) - } + z.F.DecMapInt64BytesX(&x.FMapInt64Bytes, d) case "FptrMapInt64Bytes": - if r.TryDecodeAsNil() { + if r.TryNil() { if x.FptrMapInt64Bytes != nil { // remove the if-true x.FptrMapInt64Bytes = nil } @@ -6184,17 +5739,12 @@ func (x *TestMammoth2) codecDecodeSelfFromMap(l int, d *Decoder) { if x.FptrMapInt64Bytes == nil { x.FptrMapInt64Bytes = new(map[int64][]uint8) } - z.F.DecMapInt64BytesX(x.FptrMapInt64Bytes, d) } case "FMapInt64Uint": - if r.TryDecodeAsNil() { - x.FMapInt64Uint = nil - } else { - z.F.DecMapInt64UintX(&x.FMapInt64Uint, d) - } + z.F.DecMapInt64UintX(&x.FMapInt64Uint, d) case "FptrMapInt64Uint": - if r.TryDecodeAsNil() { + if r.TryNil() { if x.FptrMapInt64Uint != nil { // remove the if-true x.FptrMapInt64Uint = nil } @@ -6202,17 +5752,12 @@ func (x *TestMammoth2) codecDecodeSelfFromMap(l int, d *Decoder) { if x.FptrMapInt64Uint == nil { x.FptrMapInt64Uint = new(map[int64]uint) } - z.F.DecMapInt64UintX(x.FptrMapInt64Uint, d) } case "FMapInt64Uint8": - if r.TryDecodeAsNil() { - x.FMapInt64Uint8 = nil - } else { - z.F.DecMapInt64Uint8X(&x.FMapInt64Uint8, d) - } + z.F.DecMapInt64Uint8X(&x.FMapInt64Uint8, d) case "FptrMapInt64Uint8": - if r.TryDecodeAsNil() { + if r.TryNil() { if x.FptrMapInt64Uint8 != nil { // remove the if-true x.FptrMapInt64Uint8 = nil } @@ -6220,17 +5765,12 @@ func (x *TestMammoth2) codecDecodeSelfFromMap(l int, d *Decoder) { if x.FptrMapInt64Uint8 == nil { x.FptrMapInt64Uint8 = new(map[int64]uint8) } - z.F.DecMapInt64Uint8X(x.FptrMapInt64Uint8, d) } case "FMapInt64Uint64": - if r.TryDecodeAsNil() { - x.FMapInt64Uint64 = nil - } else { - z.F.DecMapInt64Uint64X(&x.FMapInt64Uint64, d) - } + z.F.DecMapInt64Uint64X(&x.FMapInt64Uint64, d) case "FptrMapInt64Uint64": - if r.TryDecodeAsNil() { + if r.TryNil() { if x.FptrMapInt64Uint64 != nil { // remove the if-true x.FptrMapInt64Uint64 = nil } @@ -6238,17 +5778,12 @@ func (x *TestMammoth2) codecDecodeSelfFromMap(l int, d *Decoder) { if x.FptrMapInt64Uint64 == nil { x.FptrMapInt64Uint64 = new(map[int64]uint64) } - z.F.DecMapInt64Uint64X(x.FptrMapInt64Uint64, d) } case "FMapInt64Int": - if r.TryDecodeAsNil() { - x.FMapInt64Int = nil - } else { - z.F.DecMapInt64IntX(&x.FMapInt64Int, d) - } + z.F.DecMapInt64IntX(&x.FMapInt64Int, d) case "FptrMapInt64Int": - if r.TryDecodeAsNil() { + if r.TryNil() { if x.FptrMapInt64Int != nil { // remove the if-true x.FptrMapInt64Int = nil } @@ -6256,17 +5791,12 @@ func (x *TestMammoth2) codecDecodeSelfFromMap(l int, d *Decoder) { if x.FptrMapInt64Int == nil { x.FptrMapInt64Int = new(map[int64]int) } - z.F.DecMapInt64IntX(x.FptrMapInt64Int, d) } case "FMapInt64Int64": - if r.TryDecodeAsNil() { - x.FMapInt64Int64 = nil - } else { - z.F.DecMapInt64Int64X(&x.FMapInt64Int64, d) - } + z.F.DecMapInt64Int64X(&x.FMapInt64Int64, d) case "FptrMapInt64Int64": - if r.TryDecodeAsNil() { + if r.TryNil() { if x.FptrMapInt64Int64 != nil { // remove the if-true x.FptrMapInt64Int64 = nil } @@ -6274,17 +5804,12 @@ func (x *TestMammoth2) codecDecodeSelfFromMap(l int, d *Decoder) { if x.FptrMapInt64Int64 == nil { x.FptrMapInt64Int64 = new(map[int64]int64) } - z.F.DecMapInt64Int64X(x.FptrMapInt64Int64, d) } case "FMapInt64Float32": - if r.TryDecodeAsNil() { - x.FMapInt64Float32 = nil - } else { - z.F.DecMapInt64Float32X(&x.FMapInt64Float32, d) - } + z.F.DecMapInt64Float32X(&x.FMapInt64Float32, d) case "FptrMapInt64Float32": - if r.TryDecodeAsNil() { + if r.TryNil() { if x.FptrMapInt64Float32 != nil { // remove the if-true x.FptrMapInt64Float32 = nil } @@ -6292,17 +5817,12 @@ func (x *TestMammoth2) codecDecodeSelfFromMap(l int, d *Decoder) { if x.FptrMapInt64Float32 == nil { x.FptrMapInt64Float32 = new(map[int64]float32) } - z.F.DecMapInt64Float32X(x.FptrMapInt64Float32, d) } case "FMapInt64Float64": - if r.TryDecodeAsNil() { - x.FMapInt64Float64 = nil - } else { - z.F.DecMapInt64Float64X(&x.FMapInt64Float64, d) - } + z.F.DecMapInt64Float64X(&x.FMapInt64Float64, d) case "FptrMapInt64Float64": - if r.TryDecodeAsNil() { + if r.TryNil() { if x.FptrMapInt64Float64 != nil { // remove the if-true x.FptrMapInt64Float64 = nil } @@ -6310,17 +5830,12 @@ func (x *TestMammoth2) codecDecodeSelfFromMap(l int, d *Decoder) { if x.FptrMapInt64Float64 == nil { x.FptrMapInt64Float64 = new(map[int64]float64) } - z.F.DecMapInt64Float64X(x.FptrMapInt64Float64, d) } case "FMapInt64Bool": - if r.TryDecodeAsNil() { - x.FMapInt64Bool = nil - } else { - z.F.DecMapInt64BoolX(&x.FMapInt64Bool, d) - } + z.F.DecMapInt64BoolX(&x.FMapInt64Bool, d) case "FptrMapInt64Bool": - if r.TryDecodeAsNil() { + if r.TryNil() { if x.FptrMapInt64Bool != nil { // remove the if-true x.FptrMapInt64Bool = nil } @@ -6328,7 +5843,6 @@ func (x *TestMammoth2) codecDecodeSelfFromMap(l int, d *Decoder) { if x.FptrMapInt64Bool == nil { x.FptrMapInt64Bool = new(map[int64]bool) } - z.F.DecMapInt64BoolX(x.FptrMapInt64Bool, d) } default: @@ -6355,11 +5869,7 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.FIntf = nil - } else { - z.DecFallback(&x.FIntf, true) - } + z.DecFallback(&x.FIntf, true) yyj381++ if yyhl381 { yyb381 = yyj381 > l @@ -6371,7 +5881,7 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { + if r.TryNil() { if x.FptrIntf != nil { // remove the if-true x.FptrIntf = nil } @@ -6379,7 +5889,6 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { if x.FptrIntf == nil { x.FptrIntf = new(interface{}) } - z.DecFallback(x.FptrIntf, true) } yyj381++ @@ -6393,11 +5902,7 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.FString = "" - } else { - x.FString = (string)(string(r.DecodeStringAsBytes())) - } + x.FString = (string)(string(r.DecodeStringAsBytes())) yyj381++ if yyhl381 { yyb381 = yyj381 > l @@ -6409,7 +5914,7 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { + if r.TryNil() { if x.FptrString != nil { // remove the if-true x.FptrString = nil } @@ -6417,7 +5922,6 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { if x.FptrString == nil { x.FptrString = new(string) } - *x.FptrString = (string)(string(r.DecodeStringAsBytes())) } yyj381++ @@ -6431,11 +5935,7 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.FBytes = nil - } else { - x.FBytes = r.DecodeBytes(([]byte)(x.FBytes), false) - } + x.FBytes = r.DecodeBytes(([]byte)(x.FBytes), false) yyj381++ if yyhl381 { yyb381 = yyj381 > l @@ -6447,7 +5947,7 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { + if r.TryNil() { if x.FptrBytes != nil { // remove the if-true x.FptrBytes = nil } @@ -6455,7 +5955,6 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { if x.FptrBytes == nil { x.FptrBytes = new([]uint8) } - *x.FptrBytes = r.DecodeBytes(*(*[]byte)(x.FptrBytes), false) } yyj381++ @@ -6469,11 +5968,7 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.FFloat32 = 0 - } else { - x.FFloat32 = (float32)(z.DecDecodeFloat32()) - } + x.FFloat32 = (float32)(z.DecDecodeFloat32()) yyj381++ if yyhl381 { yyb381 = yyj381 > l @@ -6485,7 +5980,7 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { + if r.TryNil() { if x.FptrFloat32 != nil { // remove the if-true x.FptrFloat32 = nil } @@ -6493,7 +5988,6 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { if x.FptrFloat32 == nil { x.FptrFloat32 = new(float32) } - *x.FptrFloat32 = (float32)(z.DecDecodeFloat32()) } yyj381++ @@ -6507,11 +6001,7 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.FFloat64 = 0 - } else { - x.FFloat64 = (float64)(r.DecodeFloat64()) - } + x.FFloat64 = (float64)(r.DecodeFloat64()) yyj381++ if yyhl381 { yyb381 = yyj381 > l @@ -6523,7 +6013,7 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { + if r.TryNil() { if x.FptrFloat64 != nil { // remove the if-true x.FptrFloat64 = nil } @@ -6531,7 +6021,6 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { if x.FptrFloat64 == nil { x.FptrFloat64 = new(float64) } - *x.FptrFloat64 = (float64)(r.DecodeFloat64()) } yyj381++ @@ -6545,11 +6034,7 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.FUint = 0 - } else { - x.FUint = (uint)(z.C.UintV(r.DecodeUint64(), codecSelferBitsize19781)) - } + x.FUint = (uint)(z.C.UintV(r.DecodeUint64(), codecSelferBitsize19781)) yyj381++ if yyhl381 { yyb381 = yyj381 > l @@ -6561,7 +6046,7 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { + if r.TryNil() { if x.FptrUint != nil { // remove the if-true x.FptrUint = nil } @@ -6569,7 +6054,6 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { if x.FptrUint == nil { x.FptrUint = new(uint) } - *x.FptrUint = (uint)(z.C.UintV(r.DecodeUint64(), codecSelferBitsize19781)) } yyj381++ @@ -6583,11 +6067,7 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.FUint8 = 0 - } else { - x.FUint8 = (uint8)(z.C.UintV(r.DecodeUint64(), 8)) - } + x.FUint8 = (uint8)(z.C.UintV(r.DecodeUint64(), 8)) yyj381++ if yyhl381 { yyb381 = yyj381 > l @@ -6599,7 +6079,7 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { + if r.TryNil() { if x.FptrUint8 != nil { // remove the if-true x.FptrUint8 = nil } @@ -6607,7 +6087,6 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { if x.FptrUint8 == nil { x.FptrUint8 = new(uint8) } - *x.FptrUint8 = (uint8)(z.C.UintV(r.DecodeUint64(), 8)) } yyj381++ @@ -6621,11 +6100,7 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.FUint16 = 0 - } else { - x.FUint16 = (uint16)(z.C.UintV(r.DecodeUint64(), 16)) - } + x.FUint16 = (uint16)(z.C.UintV(r.DecodeUint64(), 16)) yyj381++ if yyhl381 { yyb381 = yyj381 > l @@ -6637,7 +6112,7 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { + if r.TryNil() { if x.FptrUint16 != nil { // remove the if-true x.FptrUint16 = nil } @@ -6645,7 +6120,6 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { if x.FptrUint16 == nil { x.FptrUint16 = new(uint16) } - *x.FptrUint16 = (uint16)(z.C.UintV(r.DecodeUint64(), 16)) } yyj381++ @@ -6659,11 +6133,7 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.FUint32 = 0 - } else { - x.FUint32 = (uint32)(z.C.UintV(r.DecodeUint64(), 32)) - } + x.FUint32 = (uint32)(z.C.UintV(r.DecodeUint64(), 32)) yyj381++ if yyhl381 { yyb381 = yyj381 > l @@ -6675,7 +6145,7 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { + if r.TryNil() { if x.FptrUint32 != nil { // remove the if-true x.FptrUint32 = nil } @@ -6683,7 +6153,6 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { if x.FptrUint32 == nil { x.FptrUint32 = new(uint32) } - *x.FptrUint32 = (uint32)(z.C.UintV(r.DecodeUint64(), 32)) } yyj381++ @@ -6697,11 +6166,7 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.FUint64 = 0 - } else { - x.FUint64 = (uint64)(r.DecodeUint64()) - } + x.FUint64 = (uint64)(r.DecodeUint64()) yyj381++ if yyhl381 { yyb381 = yyj381 > l @@ -6713,7 +6178,7 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { + if r.TryNil() { if x.FptrUint64 != nil { // remove the if-true x.FptrUint64 = nil } @@ -6721,7 +6186,6 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { if x.FptrUint64 == nil { x.FptrUint64 = new(uint64) } - *x.FptrUint64 = (uint64)(r.DecodeUint64()) } yyj381++ @@ -6735,11 +6199,7 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.FUintptr = 0 - } else { - x.FUintptr = (uintptr)(z.C.UintV(r.DecodeUint64(), codecSelferBitsize19781)) - } + x.FUintptr = (uintptr)(z.C.UintV(r.DecodeUint64(), codecSelferBitsize19781)) yyj381++ if yyhl381 { yyb381 = yyj381 > l @@ -6751,7 +6211,7 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { + if r.TryNil() { if x.FptrUintptr != nil { // remove the if-true x.FptrUintptr = nil } @@ -6759,7 +6219,6 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { if x.FptrUintptr == nil { x.FptrUintptr = new(uintptr) } - *x.FptrUintptr = (uintptr)(z.C.UintV(r.DecodeUint64(), codecSelferBitsize19781)) } yyj381++ @@ -6773,11 +6232,7 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.FInt = 0 - } else { - x.FInt = (int)(z.C.IntV(r.DecodeInt64(), codecSelferBitsize19781)) - } + x.FInt = (int)(z.C.IntV(r.DecodeInt64(), codecSelferBitsize19781)) yyj381++ if yyhl381 { yyb381 = yyj381 > l @@ -6789,7 +6244,7 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { + if r.TryNil() { if x.FptrInt != nil { // remove the if-true x.FptrInt = nil } @@ -6797,7 +6252,6 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { if x.FptrInt == nil { x.FptrInt = new(int) } - *x.FptrInt = (int)(z.C.IntV(r.DecodeInt64(), codecSelferBitsize19781)) } yyj381++ @@ -6811,11 +6265,7 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.FInt8 = 0 - } else { - x.FInt8 = (int8)(z.C.IntV(r.DecodeInt64(), 8)) - } + x.FInt8 = (int8)(z.C.IntV(r.DecodeInt64(), 8)) yyj381++ if yyhl381 { yyb381 = yyj381 > l @@ -6827,7 +6277,7 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { + if r.TryNil() { if x.FptrInt8 != nil { // remove the if-true x.FptrInt8 = nil } @@ -6835,7 +6285,6 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { if x.FptrInt8 == nil { x.FptrInt8 = new(int8) } - *x.FptrInt8 = (int8)(z.C.IntV(r.DecodeInt64(), 8)) } yyj381++ @@ -6849,11 +6298,7 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.FInt16 = 0 - } else { - x.FInt16 = (int16)(z.C.IntV(r.DecodeInt64(), 16)) - } + x.FInt16 = (int16)(z.C.IntV(r.DecodeInt64(), 16)) yyj381++ if yyhl381 { yyb381 = yyj381 > l @@ -6865,7 +6310,7 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { + if r.TryNil() { if x.FptrInt16 != nil { // remove the if-true x.FptrInt16 = nil } @@ -6873,7 +6318,6 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { if x.FptrInt16 == nil { x.FptrInt16 = new(int16) } - *x.FptrInt16 = (int16)(z.C.IntV(r.DecodeInt64(), 16)) } yyj381++ @@ -6887,11 +6331,7 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.FInt32 = 0 - } else { - x.FInt32 = (int32)(z.C.IntV(r.DecodeInt64(), 32)) - } + x.FInt32 = (int32)(z.C.IntV(r.DecodeInt64(), 32)) yyj381++ if yyhl381 { yyb381 = yyj381 > l @@ -6903,7 +6343,7 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { + if r.TryNil() { if x.FptrInt32 != nil { // remove the if-true x.FptrInt32 = nil } @@ -6911,7 +6351,6 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { if x.FptrInt32 == nil { x.FptrInt32 = new(int32) } - *x.FptrInt32 = (int32)(z.C.IntV(r.DecodeInt64(), 32)) } yyj381++ @@ -6925,11 +6364,7 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.FInt64 = 0 - } else { - x.FInt64 = (int64)(r.DecodeInt64()) - } + x.FInt64 = (int64)(r.DecodeInt64()) yyj381++ if yyhl381 { yyb381 = yyj381 > l @@ -6941,7 +6376,7 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { + if r.TryNil() { if x.FptrInt64 != nil { // remove the if-true x.FptrInt64 = nil } @@ -6949,7 +6384,6 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { if x.FptrInt64 == nil { x.FptrInt64 = new(int64) } - *x.FptrInt64 = (int64)(r.DecodeInt64()) } yyj381++ @@ -6963,11 +6397,7 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.FBool = false - } else { - x.FBool = (bool)(r.DecodeBool()) - } + x.FBool = (bool)(r.DecodeBool()) yyj381++ if yyhl381 { yyb381 = yyj381 > l @@ -6979,7 +6409,7 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { + if r.TryNil() { if x.FptrBool != nil { // remove the if-true x.FptrBool = nil } @@ -6987,7 +6417,6 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { if x.FptrBool == nil { x.FptrBool = new(bool) } - *x.FptrBool = (bool)(r.DecodeBool()) } yyj381++ @@ -7001,11 +6430,7 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.FSliceIntf = nil - } else { - z.F.DecSliceIntfX(&x.FSliceIntf, d) - } + z.F.DecSliceIntfX(&x.FSliceIntf, d) yyj381++ if yyhl381 { yyb381 = yyj381 > l @@ -7017,7 +6442,7 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { + if r.TryNil() { if x.FptrSliceIntf != nil { // remove the if-true x.FptrSliceIntf = nil } @@ -7025,7 +6450,6 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { if x.FptrSliceIntf == nil { x.FptrSliceIntf = new([]interface{}) } - z.F.DecSliceIntfX(x.FptrSliceIntf, d) } yyj381++ @@ -7039,11 +6463,7 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.FSliceString = nil - } else { - z.F.DecSliceStringX(&x.FSliceString, d) - } + z.F.DecSliceStringX(&x.FSliceString, d) yyj381++ if yyhl381 { yyb381 = yyj381 > l @@ -7055,7 +6475,7 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { + if r.TryNil() { if x.FptrSliceString != nil { // remove the if-true x.FptrSliceString = nil } @@ -7063,7 +6483,6 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { if x.FptrSliceString == nil { x.FptrSliceString = new([]string) } - z.F.DecSliceStringX(x.FptrSliceString, d) } yyj381++ @@ -7077,11 +6496,7 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.FSliceBytes = nil - } else { - z.F.DecSliceBytesX(&x.FSliceBytes, d) - } + z.F.DecSliceBytesX(&x.FSliceBytes, d) yyj381++ if yyhl381 { yyb381 = yyj381 > l @@ -7093,7 +6508,7 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { + if r.TryNil() { if x.FptrSliceBytes != nil { // remove the if-true x.FptrSliceBytes = nil } @@ -7101,7 +6516,6 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { if x.FptrSliceBytes == nil { x.FptrSliceBytes = new([][]uint8) } - z.F.DecSliceBytesX(x.FptrSliceBytes, d) } yyj381++ @@ -7115,11 +6529,7 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.FSliceFloat32 = nil - } else { - z.F.DecSliceFloat32X(&x.FSliceFloat32, d) - } + z.F.DecSliceFloat32X(&x.FSliceFloat32, d) yyj381++ if yyhl381 { yyb381 = yyj381 > l @@ -7131,7 +6541,7 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { + if r.TryNil() { if x.FptrSliceFloat32 != nil { // remove the if-true x.FptrSliceFloat32 = nil } @@ -7139,7 +6549,6 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { if x.FptrSliceFloat32 == nil { x.FptrSliceFloat32 = new([]float32) } - z.F.DecSliceFloat32X(x.FptrSliceFloat32, d) } yyj381++ @@ -7153,11 +6562,7 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.FSliceFloat64 = nil - } else { - z.F.DecSliceFloat64X(&x.FSliceFloat64, d) - } + z.F.DecSliceFloat64X(&x.FSliceFloat64, d) yyj381++ if yyhl381 { yyb381 = yyj381 > l @@ -7169,7 +6574,7 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { + if r.TryNil() { if x.FptrSliceFloat64 != nil { // remove the if-true x.FptrSliceFloat64 = nil } @@ -7177,7 +6582,6 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { if x.FptrSliceFloat64 == nil { x.FptrSliceFloat64 = new([]float64) } - z.F.DecSliceFloat64X(x.FptrSliceFloat64, d) } yyj381++ @@ -7191,11 +6595,7 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.FSliceUint = nil - } else { - z.F.DecSliceUintX(&x.FSliceUint, d) - } + z.F.DecSliceUintX(&x.FSliceUint, d) yyj381++ if yyhl381 { yyb381 = yyj381 > l @@ -7207,7 +6607,7 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { + if r.TryNil() { if x.FptrSliceUint != nil { // remove the if-true x.FptrSliceUint = nil } @@ -7215,7 +6615,6 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { if x.FptrSliceUint == nil { x.FptrSliceUint = new([]uint) } - z.F.DecSliceUintX(x.FptrSliceUint, d) } yyj381++ @@ -7229,11 +6628,7 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.FSliceUint16 = nil - } else { - z.F.DecSliceUint16X(&x.FSliceUint16, d) - } + z.F.DecSliceUint16X(&x.FSliceUint16, d) yyj381++ if yyhl381 { yyb381 = yyj381 > l @@ -7245,7 +6640,7 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { + if r.TryNil() { if x.FptrSliceUint16 != nil { // remove the if-true x.FptrSliceUint16 = nil } @@ -7253,7 +6648,6 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { if x.FptrSliceUint16 == nil { x.FptrSliceUint16 = new([]uint16) } - z.F.DecSliceUint16X(x.FptrSliceUint16, d) } yyj381++ @@ -7267,11 +6661,7 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.FSliceUint32 = nil - } else { - z.F.DecSliceUint32X(&x.FSliceUint32, d) - } + z.F.DecSliceUint32X(&x.FSliceUint32, d) yyj381++ if yyhl381 { yyb381 = yyj381 > l @@ -7283,7 +6673,7 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { + if r.TryNil() { if x.FptrSliceUint32 != nil { // remove the if-true x.FptrSliceUint32 = nil } @@ -7291,7 +6681,6 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { if x.FptrSliceUint32 == nil { x.FptrSliceUint32 = new([]uint32) } - z.F.DecSliceUint32X(x.FptrSliceUint32, d) } yyj381++ @@ -7305,11 +6694,7 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.FSliceUint64 = nil - } else { - z.F.DecSliceUint64X(&x.FSliceUint64, d) - } + z.F.DecSliceUint64X(&x.FSliceUint64, d) yyj381++ if yyhl381 { yyb381 = yyj381 > l @@ -7321,7 +6706,7 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { + if r.TryNil() { if x.FptrSliceUint64 != nil { // remove the if-true x.FptrSliceUint64 = nil } @@ -7329,7 +6714,6 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { if x.FptrSliceUint64 == nil { x.FptrSliceUint64 = new([]uint64) } - z.F.DecSliceUint64X(x.FptrSliceUint64, d) } yyj381++ @@ -7343,11 +6727,7 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.FSliceInt = nil - } else { - z.F.DecSliceIntX(&x.FSliceInt, d) - } + z.F.DecSliceIntX(&x.FSliceInt, d) yyj381++ if yyhl381 { yyb381 = yyj381 > l @@ -7359,7 +6739,7 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { + if r.TryNil() { if x.FptrSliceInt != nil { // remove the if-true x.FptrSliceInt = nil } @@ -7367,7 +6747,6 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { if x.FptrSliceInt == nil { x.FptrSliceInt = new([]int) } - z.F.DecSliceIntX(x.FptrSliceInt, d) } yyj381++ @@ -7381,11 +6760,7 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.FSliceInt8 = nil - } else { - z.F.DecSliceInt8X(&x.FSliceInt8, d) - } + z.F.DecSliceInt8X(&x.FSliceInt8, d) yyj381++ if yyhl381 { yyb381 = yyj381 > l @@ -7397,7 +6772,7 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { + if r.TryNil() { if x.FptrSliceInt8 != nil { // remove the if-true x.FptrSliceInt8 = nil } @@ -7405,7 +6780,6 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { if x.FptrSliceInt8 == nil { x.FptrSliceInt8 = new([]int8) } - z.F.DecSliceInt8X(x.FptrSliceInt8, d) } yyj381++ @@ -7419,11 +6793,7 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.FSliceInt16 = nil - } else { - z.F.DecSliceInt16X(&x.FSliceInt16, d) - } + z.F.DecSliceInt16X(&x.FSliceInt16, d) yyj381++ if yyhl381 { yyb381 = yyj381 > l @@ -7435,7 +6805,7 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { + if r.TryNil() { if x.FptrSliceInt16 != nil { // remove the if-true x.FptrSliceInt16 = nil } @@ -7443,7 +6813,6 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { if x.FptrSliceInt16 == nil { x.FptrSliceInt16 = new([]int16) } - z.F.DecSliceInt16X(x.FptrSliceInt16, d) } yyj381++ @@ -7457,11 +6826,7 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.FSliceInt32 = nil - } else { - z.F.DecSliceInt32X(&x.FSliceInt32, d) - } + z.F.DecSliceInt32X(&x.FSliceInt32, d) yyj381++ if yyhl381 { yyb381 = yyj381 > l @@ -7473,7 +6838,7 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { + if r.TryNil() { if x.FptrSliceInt32 != nil { // remove the if-true x.FptrSliceInt32 = nil } @@ -7481,7 +6846,6 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { if x.FptrSliceInt32 == nil { x.FptrSliceInt32 = new([]int32) } - z.F.DecSliceInt32X(x.FptrSliceInt32, d) } yyj381++ @@ -7495,11 +6859,7 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.FSliceInt64 = nil - } else { - z.F.DecSliceInt64X(&x.FSliceInt64, d) - } + z.F.DecSliceInt64X(&x.FSliceInt64, d) yyj381++ if yyhl381 { yyb381 = yyj381 > l @@ -7511,7 +6871,7 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { + if r.TryNil() { if x.FptrSliceInt64 != nil { // remove the if-true x.FptrSliceInt64 = nil } @@ -7519,7 +6879,6 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { if x.FptrSliceInt64 == nil { x.FptrSliceInt64 = new([]int64) } - z.F.DecSliceInt64X(x.FptrSliceInt64, d) } yyj381++ @@ -7533,11 +6892,7 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.FSliceBool = nil - } else { - z.F.DecSliceBoolX(&x.FSliceBool, d) - } + z.F.DecSliceBoolX(&x.FSliceBool, d) yyj381++ if yyhl381 { yyb381 = yyj381 > l @@ -7549,7 +6904,7 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { + if r.TryNil() { if x.FptrSliceBool != nil { // remove the if-true x.FptrSliceBool = nil } @@ -7557,7 +6912,6 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { if x.FptrSliceBool == nil { x.FptrSliceBool = new([]bool) } - z.F.DecSliceBoolX(x.FptrSliceBool, d) } yyj381++ @@ -7571,11 +6925,7 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.FMapStringIntf = nil - } else { - z.F.DecMapStringIntfX(&x.FMapStringIntf, d) - } + z.F.DecMapStringIntfX(&x.FMapStringIntf, d) yyj381++ if yyhl381 { yyb381 = yyj381 > l @@ -7587,7 +6937,7 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { + if r.TryNil() { if x.FptrMapStringIntf != nil { // remove the if-true x.FptrMapStringIntf = nil } @@ -7595,7 +6945,6 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { if x.FptrMapStringIntf == nil { x.FptrMapStringIntf = new(map[string]interface{}) } - z.F.DecMapStringIntfX(x.FptrMapStringIntf, d) } yyj381++ @@ -7609,11 +6958,7 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.FMapStringString = nil - } else { - z.F.DecMapStringStringX(&x.FMapStringString, d) - } + z.F.DecMapStringStringX(&x.FMapStringString, d) yyj381++ if yyhl381 { yyb381 = yyj381 > l @@ -7625,7 +6970,7 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { + if r.TryNil() { if x.FptrMapStringString != nil { // remove the if-true x.FptrMapStringString = nil } @@ -7633,7 +6978,6 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { if x.FptrMapStringString == nil { x.FptrMapStringString = new(map[string]string) } - z.F.DecMapStringStringX(x.FptrMapStringString, d) } yyj381++ @@ -7647,11 +6991,7 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.FMapStringBytes = nil - } else { - z.F.DecMapStringBytesX(&x.FMapStringBytes, d) - } + z.F.DecMapStringBytesX(&x.FMapStringBytes, d) yyj381++ if yyhl381 { yyb381 = yyj381 > l @@ -7663,7 +7003,7 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { + if r.TryNil() { if x.FptrMapStringBytes != nil { // remove the if-true x.FptrMapStringBytes = nil } @@ -7671,7 +7011,6 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { if x.FptrMapStringBytes == nil { x.FptrMapStringBytes = new(map[string][]uint8) } - z.F.DecMapStringBytesX(x.FptrMapStringBytes, d) } yyj381++ @@ -7685,11 +7024,7 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.FMapStringUint = nil - } else { - z.F.DecMapStringUintX(&x.FMapStringUint, d) - } + z.F.DecMapStringUintX(&x.FMapStringUint, d) yyj381++ if yyhl381 { yyb381 = yyj381 > l @@ -7701,7 +7036,7 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { + if r.TryNil() { if x.FptrMapStringUint != nil { // remove the if-true x.FptrMapStringUint = nil } @@ -7709,7 +7044,6 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { if x.FptrMapStringUint == nil { x.FptrMapStringUint = new(map[string]uint) } - z.F.DecMapStringUintX(x.FptrMapStringUint, d) } yyj381++ @@ -7723,11 +7057,7 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.FMapStringUint8 = nil - } else { - z.F.DecMapStringUint8X(&x.FMapStringUint8, d) - } + z.F.DecMapStringUint8X(&x.FMapStringUint8, d) yyj381++ if yyhl381 { yyb381 = yyj381 > l @@ -7739,7 +7069,7 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { + if r.TryNil() { if x.FptrMapStringUint8 != nil { // remove the if-true x.FptrMapStringUint8 = nil } @@ -7747,7 +7077,6 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { if x.FptrMapStringUint8 == nil { x.FptrMapStringUint8 = new(map[string]uint8) } - z.F.DecMapStringUint8X(x.FptrMapStringUint8, d) } yyj381++ @@ -7761,11 +7090,7 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.FMapStringUint64 = nil - } else { - z.F.DecMapStringUint64X(&x.FMapStringUint64, d) - } + z.F.DecMapStringUint64X(&x.FMapStringUint64, d) yyj381++ if yyhl381 { yyb381 = yyj381 > l @@ -7777,7 +7102,7 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { + if r.TryNil() { if x.FptrMapStringUint64 != nil { // remove the if-true x.FptrMapStringUint64 = nil } @@ -7785,7 +7110,6 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { if x.FptrMapStringUint64 == nil { x.FptrMapStringUint64 = new(map[string]uint64) } - z.F.DecMapStringUint64X(x.FptrMapStringUint64, d) } yyj381++ @@ -7799,11 +7123,7 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.FMapStringInt = nil - } else { - z.F.DecMapStringIntX(&x.FMapStringInt, d) - } + z.F.DecMapStringIntX(&x.FMapStringInt, d) yyj381++ if yyhl381 { yyb381 = yyj381 > l @@ -7815,7 +7135,7 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { + if r.TryNil() { if x.FptrMapStringInt != nil { // remove the if-true x.FptrMapStringInt = nil } @@ -7823,7 +7143,6 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { if x.FptrMapStringInt == nil { x.FptrMapStringInt = new(map[string]int) } - z.F.DecMapStringIntX(x.FptrMapStringInt, d) } yyj381++ @@ -7837,11 +7156,7 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.FMapStringInt64 = nil - } else { - z.F.DecMapStringInt64X(&x.FMapStringInt64, d) - } + z.F.DecMapStringInt64X(&x.FMapStringInt64, d) yyj381++ if yyhl381 { yyb381 = yyj381 > l @@ -7853,7 +7168,7 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { + if r.TryNil() { if x.FptrMapStringInt64 != nil { // remove the if-true x.FptrMapStringInt64 = nil } @@ -7861,7 +7176,6 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { if x.FptrMapStringInt64 == nil { x.FptrMapStringInt64 = new(map[string]int64) } - z.F.DecMapStringInt64X(x.FptrMapStringInt64, d) } yyj381++ @@ -7875,11 +7189,7 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.FMapStringFloat32 = nil - } else { - z.F.DecMapStringFloat32X(&x.FMapStringFloat32, d) - } + z.F.DecMapStringFloat32X(&x.FMapStringFloat32, d) yyj381++ if yyhl381 { yyb381 = yyj381 > l @@ -7891,7 +7201,7 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { + if r.TryNil() { if x.FptrMapStringFloat32 != nil { // remove the if-true x.FptrMapStringFloat32 = nil } @@ -7899,7 +7209,6 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { if x.FptrMapStringFloat32 == nil { x.FptrMapStringFloat32 = new(map[string]float32) } - z.F.DecMapStringFloat32X(x.FptrMapStringFloat32, d) } yyj381++ @@ -7913,11 +7222,7 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.FMapStringFloat64 = nil - } else { - z.F.DecMapStringFloat64X(&x.FMapStringFloat64, d) - } + z.F.DecMapStringFloat64X(&x.FMapStringFloat64, d) yyj381++ if yyhl381 { yyb381 = yyj381 > l @@ -7929,7 +7234,7 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { + if r.TryNil() { if x.FptrMapStringFloat64 != nil { // remove the if-true x.FptrMapStringFloat64 = nil } @@ -7937,7 +7242,6 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { if x.FptrMapStringFloat64 == nil { x.FptrMapStringFloat64 = new(map[string]float64) } - z.F.DecMapStringFloat64X(x.FptrMapStringFloat64, d) } yyj381++ @@ -7951,11 +7255,7 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.FMapStringBool = nil - } else { - z.F.DecMapStringBoolX(&x.FMapStringBool, d) - } + z.F.DecMapStringBoolX(&x.FMapStringBool, d) yyj381++ if yyhl381 { yyb381 = yyj381 > l @@ -7967,7 +7267,7 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { + if r.TryNil() { if x.FptrMapStringBool != nil { // remove the if-true x.FptrMapStringBool = nil } @@ -7975,7 +7275,6 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { if x.FptrMapStringBool == nil { x.FptrMapStringBool = new(map[string]bool) } - z.F.DecMapStringBoolX(x.FptrMapStringBool, d) } yyj381++ @@ -7989,11 +7288,7 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.FMapUintIntf = nil - } else { - z.F.DecMapUintIntfX(&x.FMapUintIntf, d) - } + z.F.DecMapUintIntfX(&x.FMapUintIntf, d) yyj381++ if yyhl381 { yyb381 = yyj381 > l @@ -8005,7 +7300,7 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { + if r.TryNil() { if x.FptrMapUintIntf != nil { // remove the if-true x.FptrMapUintIntf = nil } @@ -8013,7 +7308,6 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { if x.FptrMapUintIntf == nil { x.FptrMapUintIntf = new(map[uint]interface{}) } - z.F.DecMapUintIntfX(x.FptrMapUintIntf, d) } yyj381++ @@ -8027,11 +7321,7 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.FMapUintString = nil - } else { - z.F.DecMapUintStringX(&x.FMapUintString, d) - } + z.F.DecMapUintStringX(&x.FMapUintString, d) yyj381++ if yyhl381 { yyb381 = yyj381 > l @@ -8043,7 +7333,7 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { + if r.TryNil() { if x.FptrMapUintString != nil { // remove the if-true x.FptrMapUintString = nil } @@ -8051,7 +7341,6 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { if x.FptrMapUintString == nil { x.FptrMapUintString = new(map[uint]string) } - z.F.DecMapUintStringX(x.FptrMapUintString, d) } yyj381++ @@ -8065,11 +7354,7 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.FMapUintBytes = nil - } else { - z.F.DecMapUintBytesX(&x.FMapUintBytes, d) - } + z.F.DecMapUintBytesX(&x.FMapUintBytes, d) yyj381++ if yyhl381 { yyb381 = yyj381 > l @@ -8081,7 +7366,7 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { + if r.TryNil() { if x.FptrMapUintBytes != nil { // remove the if-true x.FptrMapUintBytes = nil } @@ -8089,7 +7374,6 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { if x.FptrMapUintBytes == nil { x.FptrMapUintBytes = new(map[uint][]uint8) } - z.F.DecMapUintBytesX(x.FptrMapUintBytes, d) } yyj381++ @@ -8103,11 +7387,7 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.FMapUintUint = nil - } else { - z.F.DecMapUintUintX(&x.FMapUintUint, d) - } + z.F.DecMapUintUintX(&x.FMapUintUint, d) yyj381++ if yyhl381 { yyb381 = yyj381 > l @@ -8119,7 +7399,7 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { + if r.TryNil() { if x.FptrMapUintUint != nil { // remove the if-true x.FptrMapUintUint = nil } @@ -8127,7 +7407,6 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { if x.FptrMapUintUint == nil { x.FptrMapUintUint = new(map[uint]uint) } - z.F.DecMapUintUintX(x.FptrMapUintUint, d) } yyj381++ @@ -8141,11 +7420,7 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.FMapUintUint8 = nil - } else { - z.F.DecMapUintUint8X(&x.FMapUintUint8, d) - } + z.F.DecMapUintUint8X(&x.FMapUintUint8, d) yyj381++ if yyhl381 { yyb381 = yyj381 > l @@ -8157,7 +7432,7 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { + if r.TryNil() { if x.FptrMapUintUint8 != nil { // remove the if-true x.FptrMapUintUint8 = nil } @@ -8165,7 +7440,6 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { if x.FptrMapUintUint8 == nil { x.FptrMapUintUint8 = new(map[uint]uint8) } - z.F.DecMapUintUint8X(x.FptrMapUintUint8, d) } yyj381++ @@ -8179,11 +7453,7 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.FMapUintUint64 = nil - } else { - z.F.DecMapUintUint64X(&x.FMapUintUint64, d) - } + z.F.DecMapUintUint64X(&x.FMapUintUint64, d) yyj381++ if yyhl381 { yyb381 = yyj381 > l @@ -8195,7 +7465,7 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { + if r.TryNil() { if x.FptrMapUintUint64 != nil { // remove the if-true x.FptrMapUintUint64 = nil } @@ -8203,7 +7473,6 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { if x.FptrMapUintUint64 == nil { x.FptrMapUintUint64 = new(map[uint]uint64) } - z.F.DecMapUintUint64X(x.FptrMapUintUint64, d) } yyj381++ @@ -8217,11 +7486,7 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.FMapUintInt = nil - } else { - z.F.DecMapUintIntX(&x.FMapUintInt, d) - } + z.F.DecMapUintIntX(&x.FMapUintInt, d) yyj381++ if yyhl381 { yyb381 = yyj381 > l @@ -8233,7 +7498,7 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { + if r.TryNil() { if x.FptrMapUintInt != nil { // remove the if-true x.FptrMapUintInt = nil } @@ -8241,7 +7506,6 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { if x.FptrMapUintInt == nil { x.FptrMapUintInt = new(map[uint]int) } - z.F.DecMapUintIntX(x.FptrMapUintInt, d) } yyj381++ @@ -8255,11 +7519,7 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.FMapUintInt64 = nil - } else { - z.F.DecMapUintInt64X(&x.FMapUintInt64, d) - } + z.F.DecMapUintInt64X(&x.FMapUintInt64, d) yyj381++ if yyhl381 { yyb381 = yyj381 > l @@ -8271,7 +7531,7 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { + if r.TryNil() { if x.FptrMapUintInt64 != nil { // remove the if-true x.FptrMapUintInt64 = nil } @@ -8279,7 +7539,6 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { if x.FptrMapUintInt64 == nil { x.FptrMapUintInt64 = new(map[uint]int64) } - z.F.DecMapUintInt64X(x.FptrMapUintInt64, d) } yyj381++ @@ -8293,11 +7552,7 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.FMapUintFloat32 = nil - } else { - z.F.DecMapUintFloat32X(&x.FMapUintFloat32, d) - } + z.F.DecMapUintFloat32X(&x.FMapUintFloat32, d) yyj381++ if yyhl381 { yyb381 = yyj381 > l @@ -8309,7 +7564,7 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { + if r.TryNil() { if x.FptrMapUintFloat32 != nil { // remove the if-true x.FptrMapUintFloat32 = nil } @@ -8317,7 +7572,6 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { if x.FptrMapUintFloat32 == nil { x.FptrMapUintFloat32 = new(map[uint]float32) } - z.F.DecMapUintFloat32X(x.FptrMapUintFloat32, d) } yyj381++ @@ -8331,11 +7585,7 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.FMapUintFloat64 = nil - } else { - z.F.DecMapUintFloat64X(&x.FMapUintFloat64, d) - } + z.F.DecMapUintFloat64X(&x.FMapUintFloat64, d) yyj381++ if yyhl381 { yyb381 = yyj381 > l @@ -8347,7 +7597,7 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { + if r.TryNil() { if x.FptrMapUintFloat64 != nil { // remove the if-true x.FptrMapUintFloat64 = nil } @@ -8355,7 +7605,6 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { if x.FptrMapUintFloat64 == nil { x.FptrMapUintFloat64 = new(map[uint]float64) } - z.F.DecMapUintFloat64X(x.FptrMapUintFloat64, d) } yyj381++ @@ -8369,11 +7618,7 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.FMapUintBool = nil - } else { - z.F.DecMapUintBoolX(&x.FMapUintBool, d) - } + z.F.DecMapUintBoolX(&x.FMapUintBool, d) yyj381++ if yyhl381 { yyb381 = yyj381 > l @@ -8385,7 +7630,7 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { + if r.TryNil() { if x.FptrMapUintBool != nil { // remove the if-true x.FptrMapUintBool = nil } @@ -8393,7 +7638,6 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { if x.FptrMapUintBool == nil { x.FptrMapUintBool = new(map[uint]bool) } - z.F.DecMapUintBoolX(x.FptrMapUintBool, d) } yyj381++ @@ -8407,11 +7651,7 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.FMapUint8Intf = nil - } else { - z.F.DecMapUint8IntfX(&x.FMapUint8Intf, d) - } + z.F.DecMapUint8IntfX(&x.FMapUint8Intf, d) yyj381++ if yyhl381 { yyb381 = yyj381 > l @@ -8423,7 +7663,7 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { + if r.TryNil() { if x.FptrMapUint8Intf != nil { // remove the if-true x.FptrMapUint8Intf = nil } @@ -8431,7 +7671,6 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { if x.FptrMapUint8Intf == nil { x.FptrMapUint8Intf = new(map[uint8]interface{}) } - z.F.DecMapUint8IntfX(x.FptrMapUint8Intf, d) } yyj381++ @@ -8445,11 +7684,7 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.FMapUint8String = nil - } else { - z.F.DecMapUint8StringX(&x.FMapUint8String, d) - } + z.F.DecMapUint8StringX(&x.FMapUint8String, d) yyj381++ if yyhl381 { yyb381 = yyj381 > l @@ -8461,7 +7696,7 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { + if r.TryNil() { if x.FptrMapUint8String != nil { // remove the if-true x.FptrMapUint8String = nil } @@ -8469,7 +7704,6 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { if x.FptrMapUint8String == nil { x.FptrMapUint8String = new(map[uint8]string) } - z.F.DecMapUint8StringX(x.FptrMapUint8String, d) } yyj381++ @@ -8483,11 +7717,7 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.FMapUint8Bytes = nil - } else { - z.F.DecMapUint8BytesX(&x.FMapUint8Bytes, d) - } + z.F.DecMapUint8BytesX(&x.FMapUint8Bytes, d) yyj381++ if yyhl381 { yyb381 = yyj381 > l @@ -8499,7 +7729,7 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { + if r.TryNil() { if x.FptrMapUint8Bytes != nil { // remove the if-true x.FptrMapUint8Bytes = nil } @@ -8507,7 +7737,6 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { if x.FptrMapUint8Bytes == nil { x.FptrMapUint8Bytes = new(map[uint8][]uint8) } - z.F.DecMapUint8BytesX(x.FptrMapUint8Bytes, d) } yyj381++ @@ -8521,11 +7750,7 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.FMapUint8Uint = nil - } else { - z.F.DecMapUint8UintX(&x.FMapUint8Uint, d) - } + z.F.DecMapUint8UintX(&x.FMapUint8Uint, d) yyj381++ if yyhl381 { yyb381 = yyj381 > l @@ -8537,7 +7762,7 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { + if r.TryNil() { if x.FptrMapUint8Uint != nil { // remove the if-true x.FptrMapUint8Uint = nil } @@ -8545,7 +7770,6 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { if x.FptrMapUint8Uint == nil { x.FptrMapUint8Uint = new(map[uint8]uint) } - z.F.DecMapUint8UintX(x.FptrMapUint8Uint, d) } yyj381++ @@ -8559,11 +7783,7 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.FMapUint8Uint8 = nil - } else { - z.F.DecMapUint8Uint8X(&x.FMapUint8Uint8, d) - } + z.F.DecMapUint8Uint8X(&x.FMapUint8Uint8, d) yyj381++ if yyhl381 { yyb381 = yyj381 > l @@ -8575,7 +7795,7 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { + if r.TryNil() { if x.FptrMapUint8Uint8 != nil { // remove the if-true x.FptrMapUint8Uint8 = nil } @@ -8583,7 +7803,6 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { if x.FptrMapUint8Uint8 == nil { x.FptrMapUint8Uint8 = new(map[uint8]uint8) } - z.F.DecMapUint8Uint8X(x.FptrMapUint8Uint8, d) } yyj381++ @@ -8597,11 +7816,7 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.FMapUint8Uint64 = nil - } else { - z.F.DecMapUint8Uint64X(&x.FMapUint8Uint64, d) - } + z.F.DecMapUint8Uint64X(&x.FMapUint8Uint64, d) yyj381++ if yyhl381 { yyb381 = yyj381 > l @@ -8613,7 +7828,7 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { + if r.TryNil() { if x.FptrMapUint8Uint64 != nil { // remove the if-true x.FptrMapUint8Uint64 = nil } @@ -8621,7 +7836,6 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { if x.FptrMapUint8Uint64 == nil { x.FptrMapUint8Uint64 = new(map[uint8]uint64) } - z.F.DecMapUint8Uint64X(x.FptrMapUint8Uint64, d) } yyj381++ @@ -8635,11 +7849,7 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.FMapUint8Int = nil - } else { - z.F.DecMapUint8IntX(&x.FMapUint8Int, d) - } + z.F.DecMapUint8IntX(&x.FMapUint8Int, d) yyj381++ if yyhl381 { yyb381 = yyj381 > l @@ -8651,7 +7861,7 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { + if r.TryNil() { if x.FptrMapUint8Int != nil { // remove the if-true x.FptrMapUint8Int = nil } @@ -8659,7 +7869,6 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { if x.FptrMapUint8Int == nil { x.FptrMapUint8Int = new(map[uint8]int) } - z.F.DecMapUint8IntX(x.FptrMapUint8Int, d) } yyj381++ @@ -8673,11 +7882,7 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.FMapUint8Int64 = nil - } else { - z.F.DecMapUint8Int64X(&x.FMapUint8Int64, d) - } + z.F.DecMapUint8Int64X(&x.FMapUint8Int64, d) yyj381++ if yyhl381 { yyb381 = yyj381 > l @@ -8689,7 +7894,7 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { + if r.TryNil() { if x.FptrMapUint8Int64 != nil { // remove the if-true x.FptrMapUint8Int64 = nil } @@ -8697,7 +7902,6 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { if x.FptrMapUint8Int64 == nil { x.FptrMapUint8Int64 = new(map[uint8]int64) } - z.F.DecMapUint8Int64X(x.FptrMapUint8Int64, d) } yyj381++ @@ -8711,11 +7915,7 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.FMapUint8Float32 = nil - } else { - z.F.DecMapUint8Float32X(&x.FMapUint8Float32, d) - } + z.F.DecMapUint8Float32X(&x.FMapUint8Float32, d) yyj381++ if yyhl381 { yyb381 = yyj381 > l @@ -8727,7 +7927,7 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { + if r.TryNil() { if x.FptrMapUint8Float32 != nil { // remove the if-true x.FptrMapUint8Float32 = nil } @@ -8735,7 +7935,6 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { if x.FptrMapUint8Float32 == nil { x.FptrMapUint8Float32 = new(map[uint8]float32) } - z.F.DecMapUint8Float32X(x.FptrMapUint8Float32, d) } yyj381++ @@ -8749,11 +7948,7 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.FMapUint8Float64 = nil - } else { - z.F.DecMapUint8Float64X(&x.FMapUint8Float64, d) - } + z.F.DecMapUint8Float64X(&x.FMapUint8Float64, d) yyj381++ if yyhl381 { yyb381 = yyj381 > l @@ -8765,7 +7960,7 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { + if r.TryNil() { if x.FptrMapUint8Float64 != nil { // remove the if-true x.FptrMapUint8Float64 = nil } @@ -8773,7 +7968,6 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { if x.FptrMapUint8Float64 == nil { x.FptrMapUint8Float64 = new(map[uint8]float64) } - z.F.DecMapUint8Float64X(x.FptrMapUint8Float64, d) } yyj381++ @@ -8787,11 +7981,7 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.FMapUint8Bool = nil - } else { - z.F.DecMapUint8BoolX(&x.FMapUint8Bool, d) - } + z.F.DecMapUint8BoolX(&x.FMapUint8Bool, d) yyj381++ if yyhl381 { yyb381 = yyj381 > l @@ -8803,7 +7993,7 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { + if r.TryNil() { if x.FptrMapUint8Bool != nil { // remove the if-true x.FptrMapUint8Bool = nil } @@ -8811,7 +8001,6 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { if x.FptrMapUint8Bool == nil { x.FptrMapUint8Bool = new(map[uint8]bool) } - z.F.DecMapUint8BoolX(x.FptrMapUint8Bool, d) } yyj381++ @@ -8825,11 +8014,7 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.FMapUint64Intf = nil - } else { - z.F.DecMapUint64IntfX(&x.FMapUint64Intf, d) - } + z.F.DecMapUint64IntfX(&x.FMapUint64Intf, d) yyj381++ if yyhl381 { yyb381 = yyj381 > l @@ -8841,7 +8026,7 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { + if r.TryNil() { if x.FptrMapUint64Intf != nil { // remove the if-true x.FptrMapUint64Intf = nil } @@ -8849,7 +8034,6 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { if x.FptrMapUint64Intf == nil { x.FptrMapUint64Intf = new(map[uint64]interface{}) } - z.F.DecMapUint64IntfX(x.FptrMapUint64Intf, d) } yyj381++ @@ -8863,11 +8047,7 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.FMapUint64String = nil - } else { - z.F.DecMapUint64StringX(&x.FMapUint64String, d) - } + z.F.DecMapUint64StringX(&x.FMapUint64String, d) yyj381++ if yyhl381 { yyb381 = yyj381 > l @@ -8879,7 +8059,7 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { + if r.TryNil() { if x.FptrMapUint64String != nil { // remove the if-true x.FptrMapUint64String = nil } @@ -8887,7 +8067,6 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { if x.FptrMapUint64String == nil { x.FptrMapUint64String = new(map[uint64]string) } - z.F.DecMapUint64StringX(x.FptrMapUint64String, d) } yyj381++ @@ -8901,11 +8080,7 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.FMapUint64Bytes = nil - } else { - z.F.DecMapUint64BytesX(&x.FMapUint64Bytes, d) - } + z.F.DecMapUint64BytesX(&x.FMapUint64Bytes, d) yyj381++ if yyhl381 { yyb381 = yyj381 > l @@ -8917,7 +8092,7 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { + if r.TryNil() { if x.FptrMapUint64Bytes != nil { // remove the if-true x.FptrMapUint64Bytes = nil } @@ -8925,7 +8100,6 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { if x.FptrMapUint64Bytes == nil { x.FptrMapUint64Bytes = new(map[uint64][]uint8) } - z.F.DecMapUint64BytesX(x.FptrMapUint64Bytes, d) } yyj381++ @@ -8939,11 +8113,7 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.FMapUint64Uint = nil - } else { - z.F.DecMapUint64UintX(&x.FMapUint64Uint, d) - } + z.F.DecMapUint64UintX(&x.FMapUint64Uint, d) yyj381++ if yyhl381 { yyb381 = yyj381 > l @@ -8955,7 +8125,7 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { + if r.TryNil() { if x.FptrMapUint64Uint != nil { // remove the if-true x.FptrMapUint64Uint = nil } @@ -8963,7 +8133,6 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { if x.FptrMapUint64Uint == nil { x.FptrMapUint64Uint = new(map[uint64]uint) } - z.F.DecMapUint64UintX(x.FptrMapUint64Uint, d) } yyj381++ @@ -8977,11 +8146,7 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.FMapUint64Uint8 = nil - } else { - z.F.DecMapUint64Uint8X(&x.FMapUint64Uint8, d) - } + z.F.DecMapUint64Uint8X(&x.FMapUint64Uint8, d) yyj381++ if yyhl381 { yyb381 = yyj381 > l @@ -8993,7 +8158,7 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { + if r.TryNil() { if x.FptrMapUint64Uint8 != nil { // remove the if-true x.FptrMapUint64Uint8 = nil } @@ -9001,7 +8166,6 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { if x.FptrMapUint64Uint8 == nil { x.FptrMapUint64Uint8 = new(map[uint64]uint8) } - z.F.DecMapUint64Uint8X(x.FptrMapUint64Uint8, d) } yyj381++ @@ -9015,11 +8179,7 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.FMapUint64Uint64 = nil - } else { - z.F.DecMapUint64Uint64X(&x.FMapUint64Uint64, d) - } + z.F.DecMapUint64Uint64X(&x.FMapUint64Uint64, d) yyj381++ if yyhl381 { yyb381 = yyj381 > l @@ -9031,7 +8191,7 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { + if r.TryNil() { if x.FptrMapUint64Uint64 != nil { // remove the if-true x.FptrMapUint64Uint64 = nil } @@ -9039,7 +8199,6 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { if x.FptrMapUint64Uint64 == nil { x.FptrMapUint64Uint64 = new(map[uint64]uint64) } - z.F.DecMapUint64Uint64X(x.FptrMapUint64Uint64, d) } yyj381++ @@ -9053,11 +8212,7 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.FMapUint64Int = nil - } else { - z.F.DecMapUint64IntX(&x.FMapUint64Int, d) - } + z.F.DecMapUint64IntX(&x.FMapUint64Int, d) yyj381++ if yyhl381 { yyb381 = yyj381 > l @@ -9069,7 +8224,7 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { + if r.TryNil() { if x.FptrMapUint64Int != nil { // remove the if-true x.FptrMapUint64Int = nil } @@ -9077,7 +8232,6 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { if x.FptrMapUint64Int == nil { x.FptrMapUint64Int = new(map[uint64]int) } - z.F.DecMapUint64IntX(x.FptrMapUint64Int, d) } yyj381++ @@ -9091,11 +8245,7 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.FMapUint64Int64 = nil - } else { - z.F.DecMapUint64Int64X(&x.FMapUint64Int64, d) - } + z.F.DecMapUint64Int64X(&x.FMapUint64Int64, d) yyj381++ if yyhl381 { yyb381 = yyj381 > l @@ -9107,7 +8257,7 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { + if r.TryNil() { if x.FptrMapUint64Int64 != nil { // remove the if-true x.FptrMapUint64Int64 = nil } @@ -9115,7 +8265,6 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { if x.FptrMapUint64Int64 == nil { x.FptrMapUint64Int64 = new(map[uint64]int64) } - z.F.DecMapUint64Int64X(x.FptrMapUint64Int64, d) } yyj381++ @@ -9129,11 +8278,7 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.FMapUint64Float32 = nil - } else { - z.F.DecMapUint64Float32X(&x.FMapUint64Float32, d) - } + z.F.DecMapUint64Float32X(&x.FMapUint64Float32, d) yyj381++ if yyhl381 { yyb381 = yyj381 > l @@ -9145,7 +8290,7 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { + if r.TryNil() { if x.FptrMapUint64Float32 != nil { // remove the if-true x.FptrMapUint64Float32 = nil } @@ -9153,7 +8298,6 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { if x.FptrMapUint64Float32 == nil { x.FptrMapUint64Float32 = new(map[uint64]float32) } - z.F.DecMapUint64Float32X(x.FptrMapUint64Float32, d) } yyj381++ @@ -9167,11 +8311,7 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.FMapUint64Float64 = nil - } else { - z.F.DecMapUint64Float64X(&x.FMapUint64Float64, d) - } + z.F.DecMapUint64Float64X(&x.FMapUint64Float64, d) yyj381++ if yyhl381 { yyb381 = yyj381 > l @@ -9183,7 +8323,7 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { + if r.TryNil() { if x.FptrMapUint64Float64 != nil { // remove the if-true x.FptrMapUint64Float64 = nil } @@ -9191,7 +8331,6 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { if x.FptrMapUint64Float64 == nil { x.FptrMapUint64Float64 = new(map[uint64]float64) } - z.F.DecMapUint64Float64X(x.FptrMapUint64Float64, d) } yyj381++ @@ -9205,11 +8344,7 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.FMapUint64Bool = nil - } else { - z.F.DecMapUint64BoolX(&x.FMapUint64Bool, d) - } + z.F.DecMapUint64BoolX(&x.FMapUint64Bool, d) yyj381++ if yyhl381 { yyb381 = yyj381 > l @@ -9221,7 +8356,7 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { + if r.TryNil() { if x.FptrMapUint64Bool != nil { // remove the if-true x.FptrMapUint64Bool = nil } @@ -9229,7 +8364,6 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { if x.FptrMapUint64Bool == nil { x.FptrMapUint64Bool = new(map[uint64]bool) } - z.F.DecMapUint64BoolX(x.FptrMapUint64Bool, d) } yyj381++ @@ -9243,11 +8377,7 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.FMapIntIntf = nil - } else { - z.F.DecMapIntIntfX(&x.FMapIntIntf, d) - } + z.F.DecMapIntIntfX(&x.FMapIntIntf, d) yyj381++ if yyhl381 { yyb381 = yyj381 > l @@ -9259,7 +8389,7 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { + if r.TryNil() { if x.FptrMapIntIntf != nil { // remove the if-true x.FptrMapIntIntf = nil } @@ -9267,7 +8397,6 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { if x.FptrMapIntIntf == nil { x.FptrMapIntIntf = new(map[int]interface{}) } - z.F.DecMapIntIntfX(x.FptrMapIntIntf, d) } yyj381++ @@ -9281,11 +8410,7 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.FMapIntString = nil - } else { - z.F.DecMapIntStringX(&x.FMapIntString, d) - } + z.F.DecMapIntStringX(&x.FMapIntString, d) yyj381++ if yyhl381 { yyb381 = yyj381 > l @@ -9297,7 +8422,7 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { + if r.TryNil() { if x.FptrMapIntString != nil { // remove the if-true x.FptrMapIntString = nil } @@ -9305,7 +8430,6 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { if x.FptrMapIntString == nil { x.FptrMapIntString = new(map[int]string) } - z.F.DecMapIntStringX(x.FptrMapIntString, d) } yyj381++ @@ -9319,11 +8443,7 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.FMapIntBytes = nil - } else { - z.F.DecMapIntBytesX(&x.FMapIntBytes, d) - } + z.F.DecMapIntBytesX(&x.FMapIntBytes, d) yyj381++ if yyhl381 { yyb381 = yyj381 > l @@ -9335,7 +8455,7 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { + if r.TryNil() { if x.FptrMapIntBytes != nil { // remove the if-true x.FptrMapIntBytes = nil } @@ -9343,7 +8463,6 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { if x.FptrMapIntBytes == nil { x.FptrMapIntBytes = new(map[int][]uint8) } - z.F.DecMapIntBytesX(x.FptrMapIntBytes, d) } yyj381++ @@ -9357,11 +8476,7 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.FMapIntUint = nil - } else { - z.F.DecMapIntUintX(&x.FMapIntUint, d) - } + z.F.DecMapIntUintX(&x.FMapIntUint, d) yyj381++ if yyhl381 { yyb381 = yyj381 > l @@ -9373,7 +8488,7 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { + if r.TryNil() { if x.FptrMapIntUint != nil { // remove the if-true x.FptrMapIntUint = nil } @@ -9381,7 +8496,6 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { if x.FptrMapIntUint == nil { x.FptrMapIntUint = new(map[int]uint) } - z.F.DecMapIntUintX(x.FptrMapIntUint, d) } yyj381++ @@ -9395,11 +8509,7 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.FMapIntUint8 = nil - } else { - z.F.DecMapIntUint8X(&x.FMapIntUint8, d) - } + z.F.DecMapIntUint8X(&x.FMapIntUint8, d) yyj381++ if yyhl381 { yyb381 = yyj381 > l @@ -9411,7 +8521,7 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { + if r.TryNil() { if x.FptrMapIntUint8 != nil { // remove the if-true x.FptrMapIntUint8 = nil } @@ -9419,7 +8529,6 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { if x.FptrMapIntUint8 == nil { x.FptrMapIntUint8 = new(map[int]uint8) } - z.F.DecMapIntUint8X(x.FptrMapIntUint8, d) } yyj381++ @@ -9433,11 +8542,7 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.FMapIntUint64 = nil - } else { - z.F.DecMapIntUint64X(&x.FMapIntUint64, d) - } + z.F.DecMapIntUint64X(&x.FMapIntUint64, d) yyj381++ if yyhl381 { yyb381 = yyj381 > l @@ -9449,7 +8554,7 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { + if r.TryNil() { if x.FptrMapIntUint64 != nil { // remove the if-true x.FptrMapIntUint64 = nil } @@ -9457,7 +8562,6 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { if x.FptrMapIntUint64 == nil { x.FptrMapIntUint64 = new(map[int]uint64) } - z.F.DecMapIntUint64X(x.FptrMapIntUint64, d) } yyj381++ @@ -9471,11 +8575,7 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.FMapIntInt = nil - } else { - z.F.DecMapIntIntX(&x.FMapIntInt, d) - } + z.F.DecMapIntIntX(&x.FMapIntInt, d) yyj381++ if yyhl381 { yyb381 = yyj381 > l @@ -9487,7 +8587,7 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { + if r.TryNil() { if x.FptrMapIntInt != nil { // remove the if-true x.FptrMapIntInt = nil } @@ -9495,7 +8595,6 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { if x.FptrMapIntInt == nil { x.FptrMapIntInt = new(map[int]int) } - z.F.DecMapIntIntX(x.FptrMapIntInt, d) } yyj381++ @@ -9509,11 +8608,7 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.FMapIntInt64 = nil - } else { - z.F.DecMapIntInt64X(&x.FMapIntInt64, d) - } + z.F.DecMapIntInt64X(&x.FMapIntInt64, d) yyj381++ if yyhl381 { yyb381 = yyj381 > l @@ -9525,7 +8620,7 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { + if r.TryNil() { if x.FptrMapIntInt64 != nil { // remove the if-true x.FptrMapIntInt64 = nil } @@ -9533,7 +8628,6 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { if x.FptrMapIntInt64 == nil { x.FptrMapIntInt64 = new(map[int]int64) } - z.F.DecMapIntInt64X(x.FptrMapIntInt64, d) } yyj381++ @@ -9547,11 +8641,7 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.FMapIntFloat32 = nil - } else { - z.F.DecMapIntFloat32X(&x.FMapIntFloat32, d) - } + z.F.DecMapIntFloat32X(&x.FMapIntFloat32, d) yyj381++ if yyhl381 { yyb381 = yyj381 > l @@ -9563,7 +8653,7 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { + if r.TryNil() { if x.FptrMapIntFloat32 != nil { // remove the if-true x.FptrMapIntFloat32 = nil } @@ -9571,7 +8661,6 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { if x.FptrMapIntFloat32 == nil { x.FptrMapIntFloat32 = new(map[int]float32) } - z.F.DecMapIntFloat32X(x.FptrMapIntFloat32, d) } yyj381++ @@ -9585,11 +8674,7 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.FMapIntFloat64 = nil - } else { - z.F.DecMapIntFloat64X(&x.FMapIntFloat64, d) - } + z.F.DecMapIntFloat64X(&x.FMapIntFloat64, d) yyj381++ if yyhl381 { yyb381 = yyj381 > l @@ -9601,7 +8686,7 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { + if r.TryNil() { if x.FptrMapIntFloat64 != nil { // remove the if-true x.FptrMapIntFloat64 = nil } @@ -9609,7 +8694,6 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { if x.FptrMapIntFloat64 == nil { x.FptrMapIntFloat64 = new(map[int]float64) } - z.F.DecMapIntFloat64X(x.FptrMapIntFloat64, d) } yyj381++ @@ -9623,11 +8707,7 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.FMapIntBool = nil - } else { - z.F.DecMapIntBoolX(&x.FMapIntBool, d) - } + z.F.DecMapIntBoolX(&x.FMapIntBool, d) yyj381++ if yyhl381 { yyb381 = yyj381 > l @@ -9639,7 +8719,7 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { + if r.TryNil() { if x.FptrMapIntBool != nil { // remove the if-true x.FptrMapIntBool = nil } @@ -9647,7 +8727,6 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { if x.FptrMapIntBool == nil { x.FptrMapIntBool = new(map[int]bool) } - z.F.DecMapIntBoolX(x.FptrMapIntBool, d) } yyj381++ @@ -9661,11 +8740,7 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.FMapInt64Intf = nil - } else { - z.F.DecMapInt64IntfX(&x.FMapInt64Intf, d) - } + z.F.DecMapInt64IntfX(&x.FMapInt64Intf, d) yyj381++ if yyhl381 { yyb381 = yyj381 > l @@ -9677,7 +8752,7 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { + if r.TryNil() { if x.FptrMapInt64Intf != nil { // remove the if-true x.FptrMapInt64Intf = nil } @@ -9685,7 +8760,6 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { if x.FptrMapInt64Intf == nil { x.FptrMapInt64Intf = new(map[int64]interface{}) } - z.F.DecMapInt64IntfX(x.FptrMapInt64Intf, d) } yyj381++ @@ -9699,11 +8773,7 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.FMapInt64String = nil - } else { - z.F.DecMapInt64StringX(&x.FMapInt64String, d) - } + z.F.DecMapInt64StringX(&x.FMapInt64String, d) yyj381++ if yyhl381 { yyb381 = yyj381 > l @@ -9715,7 +8785,7 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { + if r.TryNil() { if x.FptrMapInt64String != nil { // remove the if-true x.FptrMapInt64String = nil } @@ -9723,7 +8793,6 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { if x.FptrMapInt64String == nil { x.FptrMapInt64String = new(map[int64]string) } - z.F.DecMapInt64StringX(x.FptrMapInt64String, d) } yyj381++ @@ -9737,11 +8806,7 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.FMapInt64Bytes = nil - } else { - z.F.DecMapInt64BytesX(&x.FMapInt64Bytes, d) - } + z.F.DecMapInt64BytesX(&x.FMapInt64Bytes, d) yyj381++ if yyhl381 { yyb381 = yyj381 > l @@ -9753,7 +8818,7 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { + if r.TryNil() { if x.FptrMapInt64Bytes != nil { // remove the if-true x.FptrMapInt64Bytes = nil } @@ -9761,7 +8826,6 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { if x.FptrMapInt64Bytes == nil { x.FptrMapInt64Bytes = new(map[int64][]uint8) } - z.F.DecMapInt64BytesX(x.FptrMapInt64Bytes, d) } yyj381++ @@ -9775,11 +8839,7 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.FMapInt64Uint = nil - } else { - z.F.DecMapInt64UintX(&x.FMapInt64Uint, d) - } + z.F.DecMapInt64UintX(&x.FMapInt64Uint, d) yyj381++ if yyhl381 { yyb381 = yyj381 > l @@ -9791,7 +8851,7 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { + if r.TryNil() { if x.FptrMapInt64Uint != nil { // remove the if-true x.FptrMapInt64Uint = nil } @@ -9799,7 +8859,6 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { if x.FptrMapInt64Uint == nil { x.FptrMapInt64Uint = new(map[int64]uint) } - z.F.DecMapInt64UintX(x.FptrMapInt64Uint, d) } yyj381++ @@ -9813,11 +8872,7 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.FMapInt64Uint8 = nil - } else { - z.F.DecMapInt64Uint8X(&x.FMapInt64Uint8, d) - } + z.F.DecMapInt64Uint8X(&x.FMapInt64Uint8, d) yyj381++ if yyhl381 { yyb381 = yyj381 > l @@ -9829,7 +8884,7 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { + if r.TryNil() { if x.FptrMapInt64Uint8 != nil { // remove the if-true x.FptrMapInt64Uint8 = nil } @@ -9837,7 +8892,6 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { if x.FptrMapInt64Uint8 == nil { x.FptrMapInt64Uint8 = new(map[int64]uint8) } - z.F.DecMapInt64Uint8X(x.FptrMapInt64Uint8, d) } yyj381++ @@ -9851,11 +8905,7 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.FMapInt64Uint64 = nil - } else { - z.F.DecMapInt64Uint64X(&x.FMapInt64Uint64, d) - } + z.F.DecMapInt64Uint64X(&x.FMapInt64Uint64, d) yyj381++ if yyhl381 { yyb381 = yyj381 > l @@ -9867,7 +8917,7 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { + if r.TryNil() { if x.FptrMapInt64Uint64 != nil { // remove the if-true x.FptrMapInt64Uint64 = nil } @@ -9875,7 +8925,6 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { if x.FptrMapInt64Uint64 == nil { x.FptrMapInt64Uint64 = new(map[int64]uint64) } - z.F.DecMapInt64Uint64X(x.FptrMapInt64Uint64, d) } yyj381++ @@ -9889,11 +8938,7 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.FMapInt64Int = nil - } else { - z.F.DecMapInt64IntX(&x.FMapInt64Int, d) - } + z.F.DecMapInt64IntX(&x.FMapInt64Int, d) yyj381++ if yyhl381 { yyb381 = yyj381 > l @@ -9905,7 +8950,7 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { + if r.TryNil() { if x.FptrMapInt64Int != nil { // remove the if-true x.FptrMapInt64Int = nil } @@ -9913,7 +8958,6 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { if x.FptrMapInt64Int == nil { x.FptrMapInt64Int = new(map[int64]int) } - z.F.DecMapInt64IntX(x.FptrMapInt64Int, d) } yyj381++ @@ -9927,11 +8971,7 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.FMapInt64Int64 = nil - } else { - z.F.DecMapInt64Int64X(&x.FMapInt64Int64, d) - } + z.F.DecMapInt64Int64X(&x.FMapInt64Int64, d) yyj381++ if yyhl381 { yyb381 = yyj381 > l @@ -9943,7 +8983,7 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { + if r.TryNil() { if x.FptrMapInt64Int64 != nil { // remove the if-true x.FptrMapInt64Int64 = nil } @@ -9951,7 +8991,6 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { if x.FptrMapInt64Int64 == nil { x.FptrMapInt64Int64 = new(map[int64]int64) } - z.F.DecMapInt64Int64X(x.FptrMapInt64Int64, d) } yyj381++ @@ -9965,11 +9004,7 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.FMapInt64Float32 = nil - } else { - z.F.DecMapInt64Float32X(&x.FMapInt64Float32, d) - } + z.F.DecMapInt64Float32X(&x.FMapInt64Float32, d) yyj381++ if yyhl381 { yyb381 = yyj381 > l @@ -9981,7 +9016,7 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { + if r.TryNil() { if x.FptrMapInt64Float32 != nil { // remove the if-true x.FptrMapInt64Float32 = nil } @@ -9989,7 +9024,6 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { if x.FptrMapInt64Float32 == nil { x.FptrMapInt64Float32 = new(map[int64]float32) } - z.F.DecMapInt64Float32X(x.FptrMapInt64Float32, d) } yyj381++ @@ -10003,11 +9037,7 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.FMapInt64Float64 = nil - } else { - z.F.DecMapInt64Float64X(&x.FMapInt64Float64, d) - } + z.F.DecMapInt64Float64X(&x.FMapInt64Float64, d) yyj381++ if yyhl381 { yyb381 = yyj381 > l @@ -10019,7 +9049,7 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { + if r.TryNil() { if x.FptrMapInt64Float64 != nil { // remove the if-true x.FptrMapInt64Float64 = nil } @@ -10027,7 +9057,6 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { if x.FptrMapInt64Float64 == nil { x.FptrMapInt64Float64 = new(map[int64]float64) } - z.F.DecMapInt64Float64X(x.FptrMapInt64Float64, d) } yyj381++ @@ -10041,11 +9070,7 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.FMapInt64Bool = nil - } else { - z.F.DecMapInt64BoolX(&x.FMapInt64Bool, d) - } + z.F.DecMapInt64BoolX(&x.FMapInt64Bool, d) yyj381++ if yyhl381 { yyb381 = yyj381 > l @@ -10057,7 +9082,7 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { + if r.TryNil() { if x.FptrMapInt64Bool != nil { // remove the if-true x.FptrMapInt64Bool = nil } @@ -10065,7 +9090,6 @@ func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { if x.FptrMapInt64Bool == nil { x.FptrMapInt64Bool = new(map[int64]bool) } - z.F.DecMapInt64BoolX(x.FptrMapInt64Bool, d) } for { @@ -10155,9 +9179,9 @@ func (x *testMammoth2Basic) CodecEncodeSelf(e *Encoder) { _, _, _ = h, z, r if x == nil { r.EncodeNil() - } else { // checkNil=true + } else { h.enctestMammoth2Basic((*testMammoth2Basic)(x), e) - } // checkNil=true + } } func (x *testMammoth2Basic) CodecDecodeSelf(d *Decoder) { @@ -10173,7 +9197,7 @@ func (x *TestMammoth2Wrapper) CodecEncodeSelf(e *Encoder) { _, _, _ = h, z, r if x == nil { r.EncodeNil() - } else { // checkNil=true + } else { yysep2 := !z.EncBinary() yy2arr2 := z.EncBasicHandle().StructToArray _, _ = yysep2, yy2arr2 @@ -10287,7 +9311,7 @@ func (x *TestMammoth2Wrapper) CodecEncodeSelf(e *Encoder) { h.encArray4int64((*[4]int64)(yy31), e) z.EncWriteMapEnd() } - } // checkNil=true + } } func (x *TestMammoth2Wrapper) CodecDecodeSelf(d *Decoder) { @@ -10295,7 +9319,9 @@ func (x *TestMammoth2Wrapper) CodecDecodeSelf(d *Decoder) { z, r := GenHelperDecoder(d) _, _, _ = h, z, r yyct2 := r.ContainerType() - if yyct2 == codecSelferValueTypeMap19781 { + if yyct2 == codecSelferValueTypeNil19781 { + *(x) = TestMammoth2Wrapper{} + } else if yyct2 == codecSelferValueTypeMap19781 { yyl2 := z.DecReadMapStart() if yyl2 == 0 { } else { @@ -10333,53 +9359,21 @@ func (x *TestMammoth2Wrapper) codecDecodeSelfFromMap(l int, d *Decoder) { z.DecReadMapElemValue() switch yys3 { case "V": - if r.TryDecodeAsNil() { - x.V = TestMammoth2{} - } else { - x.V.CodecDecodeSelf(d) - } + x.V.CodecDecodeSelf(d) case "T": - if r.TryDecodeAsNil() { - x.T = 0 - } else { - x.T.CodecDecodeSelf(d) - } + x.T.CodecDecodeSelf(d) case "B": - if r.TryDecodeAsNil() { - x.B = 0 - } else { - x.B.CodecDecodeSelf(d) - } + x.B.CodecDecodeSelf(d) case "J": - if r.TryDecodeAsNil() { - x.J = 0 - } else { - x.J.CodecDecodeSelf(d) - } + x.J.CodecDecodeSelf(d) case "C": - if r.TryDecodeAsNil() { - x.C = testMammoth2Basic{} - } else { - x.C.CodecDecodeSelf(d) - } + x.C.CodecDecodeSelf(d) case "M": - if r.TryDecodeAsNil() { - x.M = nil - } else { - h.decMaptestMammoth2BasicTestMammoth2((*map[testMammoth2Basic]TestMammoth2)(&x.M), d) - } + h.decMaptestMammoth2BasicTestMammoth2((*map[testMammoth2Basic]TestMammoth2)(&x.M), d) case "L": - if r.TryDecodeAsNil() { - x.L = nil - } else { - h.decSliceTestMammoth2((*[]TestMammoth2)(&x.L), d) - } + h.decSliceTestMammoth2((*[]TestMammoth2)(&x.L), d) case "A": - if r.TryDecodeAsNil() { - x.A = [4]int64{} - } else { - h.decArray4int64((*[4]int64)(&x.A), d) - } + h.decArray4int64((*[4]int64)(&x.A), d) default: z.DecStructFieldNotFound(-1, yys3) } // end switch yys3 @@ -10404,11 +9398,7 @@ func (x *TestMammoth2Wrapper) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.V = TestMammoth2{} - } else { - x.V.CodecDecodeSelf(d) - } + x.V.CodecDecodeSelf(d) yyj15++ if yyhl15 { yyb15 = yyj15 > l @@ -10420,11 +9410,7 @@ func (x *TestMammoth2Wrapper) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.T = 0 - } else { - x.T.CodecDecodeSelf(d) - } + x.T.CodecDecodeSelf(d) yyj15++ if yyhl15 { yyb15 = yyj15 > l @@ -10436,11 +9422,7 @@ func (x *TestMammoth2Wrapper) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.B = 0 - } else { - x.B.CodecDecodeSelf(d) - } + x.B.CodecDecodeSelf(d) yyj15++ if yyhl15 { yyb15 = yyj15 > l @@ -10452,11 +9434,7 @@ func (x *TestMammoth2Wrapper) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.J = 0 - } else { - x.J.CodecDecodeSelf(d) - } + x.J.CodecDecodeSelf(d) yyj15++ if yyhl15 { yyb15 = yyj15 > l @@ -10468,11 +9446,7 @@ func (x *TestMammoth2Wrapper) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.C = testMammoth2Basic{} - } else { - x.C.CodecDecodeSelf(d) - } + x.C.CodecDecodeSelf(d) yyj15++ if yyhl15 { yyb15 = yyj15 > l @@ -10484,11 +9458,7 @@ func (x *TestMammoth2Wrapper) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.M = nil - } else { - h.decMaptestMammoth2BasicTestMammoth2((*map[testMammoth2Basic]TestMammoth2)(&x.M), d) - } + h.decMaptestMammoth2BasicTestMammoth2((*map[testMammoth2Basic]TestMammoth2)(&x.M), d) yyj15++ if yyhl15 { yyb15 = yyj15 > l @@ -10500,11 +9470,7 @@ func (x *TestMammoth2Wrapper) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.L = nil - } else { - h.decSliceTestMammoth2((*[]TestMammoth2)(&x.L), d) - } + h.decSliceTestMammoth2((*[]TestMammoth2)(&x.L), d) yyj15++ if yyhl15 { yyb15 = yyj15 > l @@ -10516,11 +9482,7 @@ func (x *TestMammoth2Wrapper) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.A = [4]int64{} - } else { - h.decArray4int64((*[4]int64)(&x.A), d) - } + h.decArray4int64((*[4]int64)(&x.A), d) for { yyj15++ if yyhl15 { @@ -10575,11 +9537,7 @@ func (x codecSelfer19781) dectestMammoth2Basic(v *testMammoth2Basic, d *Decoder) if yydb1 { z.DecSwallow() } else { - if r.TryDecodeAsNil() { - yyv1[yyj1] = 0 - } else { - yyv1[yyj1] = (uint64)(r.DecodeUint64()) - } + yyv1[yyj1] = (uint64)(r.DecodeUint64()) } } } @@ -10613,51 +9571,46 @@ func (x codecSelfer19781) decMaptestMammoth2BasicTestMammoth2(v *map[testMammoth yyv1 := *v yyl1 := z.DecReadMapStart() - yybh1 := z.DecBasicHandle() - if yyv1 == nil { - yyrl1 := z.DecInferLen(yyl1, yybh1.MaxInitLen, 1872) - yyv1 = make(map[testMammoth2Basic]TestMammoth2, yyrl1) - *v = yyv1 - } - var yymk1 testMammoth2Basic - var yymv1 TestMammoth2 - var yymg1, yymdn1 bool - if yybh1.MapValueReset { - yymg1 = true - } - if yyl1 != 0 { - yyhl1 := yyl1 > 0 - for yyj1 := 0; (yyhl1 && yyj1 < yyl1) || !(yyhl1 || r.CheckBreak()); yyj1++ { - z.DecReadMapElemKey() - if r.TryDecodeAsNil() { - yymk1 = testMammoth2Basic{} - } else { + if yyl1 == codecSelferDecContainerLenNil19781 { + *v = nil + } else { + if yyv1 == nil { + yyrl1 := z.DecInferLen(yyl1, z.DecBasicHandle().MaxInitLen, 1872) + yyv1 = make(map[testMammoth2Basic]TestMammoth2, yyrl1) + *v = yyv1 + } + var yymk1 testMammoth2Basic + var yymv1 TestMammoth2 + var yymg1, yymdn1 bool + if z.DecBasicHandle().MapValueReset { + yymg1 = true + } + if yyl1 != 0 { + yyhl1 := yyl1 > 0 + for yyj1 := 0; (yyhl1 && yyj1 < yyl1) || !(yyhl1 || r.CheckBreak()); yyj1++ { + z.DecReadMapElemKey() yymk1.CodecDecodeSelf(d) - } - if yymg1 { - yymv1 = yyv1[yymk1] - } else { - yymv1 = TestMammoth2{} - } - z.DecReadMapElemValue() - yymdn1 = false - if r.TryDecodeAsNil() { - yymdn1 = true - } else { - yymv1.CodecDecodeSelf(d) - } - if yymdn1 { - if yybh1.DeleteOnNilMapValue { - delete(yyv1, yymk1) + if yymg1 { + yymv1 = yyv1[yymk1] } else { - yyv1[yymk1] = TestMammoth2{} + yymv1 = TestMammoth2{} + } + z.DecReadMapElemValue() + yymdn1 = false + yymv1.CodecDecodeSelf(d) + if yymdn1 { + if z.DecBasicHandle().DeleteOnNilMapValue { + delete(yyv1, yymk1) + } else { + yyv1[yymk1] = TestMammoth2{} + } + } else if yyv1 != nil { + yyv1[yymk1] = yymv1 } - } else if yyv1 != nil { - yyv1[yymk1] = yymv1 } - } - } // else len==0: TODO: Should we clear map entries? - z.DecReadMapEnd() + } // else len==0: TODO: Should we clear map entries? + z.DecReadMapEnd() + } } func (x codecSelfer19781) encSliceTestMammoth2(v []TestMammoth2, e *Encoder) { @@ -10686,7 +9639,12 @@ func (x codecSelfer19781) decSliceTestMammoth2(v *[]TestMammoth2, d *Decoder) { yyh1, yyl1 := z.DecSliceHelperStart() var yyc1 bool _ = yyc1 - if yyl1 == 0 { + if yyh1.IsNil { + if yyv1 != nil { + yyv1 = nil + yyc1 = true + } + } else if yyl1 == 0 { if yyv1 == nil { yyv1 = []TestMammoth2{} yyc1 = true @@ -10732,11 +9690,7 @@ func (x codecSelfer19781) decSliceTestMammoth2(v *[]TestMammoth2, d *Decoder) { if yydb1 { z.DecSwallow() } else { - if r.TryDecodeAsNil() { - yyv1[yyj1] = TestMammoth2{} - } else { - yyv1[yyj1].CodecDecodeSelf(d) - } + yyv1[yyj1].CodecDecodeSelf(d) } } if yyj1 < len(yyv1) { @@ -10792,11 +9746,7 @@ func (x codecSelfer19781) decArray4int64(v *[4]int64, d *Decoder) { if yydb1 { z.DecSwallow() } else { - if r.TryDecodeAsNil() { - yyv1[yyj1] = 0 - } else { - yyv1[yyj1] = (int64)(r.DecodeInt64()) - } + yyv1[yyj1] = (int64)(r.DecodeInt64()) } } } diff --git a/codec/mammoth_generated_test.go b/codec/mammoth_generated_test.go index a22b55f8..74339bc4 100644 --- a/codec/mammoth_generated_test.go +++ b/codec/mammoth_generated_test.go @@ -345,26 +345,28 @@ type typMapMapInt64Float64 map[int64]float64 type typMapMapInt64Bool map[int64]bool func doTestMammothSlices(t *testing.T, h Handle) { - var v17va [8]interface{} for _, v := range [][]interface{}{nil, {}, {"string-is-an-interface-2", nil, nil, "string-is-an-interface-3"}} { var v17v1, v17v2 []interface{} + var bs17 []byte v17v1 = v - bs17 := testMarshalErr(v17v1, h, t, "enc-slice-v17") - if v == nil { - v17v2 = nil - } else { - v17v2 = make([]interface{}, len(v)) - } - testUnmarshalErr(v17v2, bs17, h, t, "dec-slice-v17") - testDeepEqualErr(v17v1, v17v2, t, "equal-slice-v17") - if v == nil { - v17v2 = nil - } else { - v17v2 = make([]interface{}, len(v)) + bs17 = testMarshalErr(v17v1, h, t, "enc-slice-v17") + if v != nil { + if v == nil { + v17v2 = nil + } else { + v17v2 = make([]interface{}, len(v)) + } + testUnmarshalErr(v17v2, bs17, h, t, "dec-slice-v17") + testDeepEqualErr(v17v1, v17v2, t, "equal-slice-v17") + if v == nil { + v17v2 = nil + } else { + v17v2 = make([]interface{}, len(v)) + } + testUnmarshalErr(reflect.ValueOf(v17v2), bs17, h, t, "dec-slice-v17-noaddr") // non-addressable value + testDeepEqualErr(v17v1, v17v2, t, "equal-slice-v17-noaddr") } - testUnmarshalErr(reflect.ValueOf(v17v2), bs17, h, t, "dec-slice-v17-noaddr") // non-addressable value - testDeepEqualErr(v17v1, v17v2, t, "equal-slice-v17-noaddr") // ... bs17 = testMarshalErr(&v17v1, h, t, "enc-slice-v17-p") v17v2 = nil @@ -398,35 +400,39 @@ func doTestMammothSlices(t *testing.T, h Handle) { } v17v3 = typMbsSliceIntf(v17v1) v17v4 = typMbsSliceIntf(v17v2) - bs17 = testMarshalErr(v17v3, h, t, "enc-slice-v17-custom") - testUnmarshalErr(v17v4, bs17, h, t, "dec-slice-v17-custom") - testDeepEqualErr(v17v3, v17v4, t, "equal-slice-v17-custom") + if v != nil { + bs17 = testMarshalErr(v17v3, h, t, "enc-slice-v17-custom") + testUnmarshalErr(v17v4, bs17, h, t, "dec-slice-v17-custom") + testDeepEqualErr(v17v3, v17v4, t, "equal-slice-v17-custom") + } bs17 = testMarshalErr(&v17v3, h, t, "enc-slice-v17-custom-p") v17v2 = nil v17v4 = typMbsSliceIntf(v17v2) testUnmarshalErr(&v17v4, bs17, h, t, "dec-slice-v17-custom-p") testDeepEqualErr(v17v3, v17v4, t, "equal-slice-v17-custom-p") } - var v18va [8]string for _, v := range [][]string{nil, {}, {"some-string-2", "", "", "some-string-3"}} { var v18v1, v18v2 []string + var bs18 []byte v18v1 = v - bs18 := testMarshalErr(v18v1, h, t, "enc-slice-v18") - if v == nil { - v18v2 = nil - } else { - v18v2 = make([]string, len(v)) - } - testUnmarshalErr(v18v2, bs18, h, t, "dec-slice-v18") - testDeepEqualErr(v18v1, v18v2, t, "equal-slice-v18") - if v == nil { - v18v2 = nil - } else { - v18v2 = make([]string, len(v)) + bs18 = testMarshalErr(v18v1, h, t, "enc-slice-v18") + if v != nil { + if v == nil { + v18v2 = nil + } else { + v18v2 = make([]string, len(v)) + } + testUnmarshalErr(v18v2, bs18, h, t, "dec-slice-v18") + testDeepEqualErr(v18v1, v18v2, t, "equal-slice-v18") + if v == nil { + v18v2 = nil + } else { + v18v2 = make([]string, len(v)) + } + testUnmarshalErr(reflect.ValueOf(v18v2), bs18, h, t, "dec-slice-v18-noaddr") // non-addressable value + testDeepEqualErr(v18v1, v18v2, t, "equal-slice-v18-noaddr") } - testUnmarshalErr(reflect.ValueOf(v18v2), bs18, h, t, "dec-slice-v18-noaddr") // non-addressable value - testDeepEqualErr(v18v1, v18v2, t, "equal-slice-v18-noaddr") // ... bs18 = testMarshalErr(&v18v1, h, t, "enc-slice-v18-p") v18v2 = nil @@ -460,35 +466,39 @@ func doTestMammothSlices(t *testing.T, h Handle) { } v18v3 = typMbsSliceString(v18v1) v18v4 = typMbsSliceString(v18v2) - bs18 = testMarshalErr(v18v3, h, t, "enc-slice-v18-custom") - testUnmarshalErr(v18v4, bs18, h, t, "dec-slice-v18-custom") - testDeepEqualErr(v18v3, v18v4, t, "equal-slice-v18-custom") + if v != nil { + bs18 = testMarshalErr(v18v3, h, t, "enc-slice-v18-custom") + testUnmarshalErr(v18v4, bs18, h, t, "dec-slice-v18-custom") + testDeepEqualErr(v18v3, v18v4, t, "equal-slice-v18-custom") + } bs18 = testMarshalErr(&v18v3, h, t, "enc-slice-v18-custom-p") v18v2 = nil v18v4 = typMbsSliceString(v18v2) testUnmarshalErr(&v18v4, bs18, h, t, "dec-slice-v18-custom-p") testDeepEqualErr(v18v3, v18v4, t, "equal-slice-v18-custom-p") } - var v19va [8][]byte for _, v := range [][][]byte{nil, {}, {[]byte("some-string-2"), nil, nil, []byte("some-string-3")}} { var v19v1, v19v2 [][]byte + var bs19 []byte v19v1 = v - bs19 := testMarshalErr(v19v1, h, t, "enc-slice-v19") - if v == nil { - v19v2 = nil - } else { - v19v2 = make([][]byte, len(v)) - } - testUnmarshalErr(v19v2, bs19, h, t, "dec-slice-v19") - testDeepEqualErr(v19v1, v19v2, t, "equal-slice-v19") - if v == nil { - v19v2 = nil - } else { - v19v2 = make([][]byte, len(v)) + bs19 = testMarshalErr(v19v1, h, t, "enc-slice-v19") + if v != nil { + if v == nil { + v19v2 = nil + } else { + v19v2 = make([][]byte, len(v)) + } + testUnmarshalErr(v19v2, bs19, h, t, "dec-slice-v19") + testDeepEqualErr(v19v1, v19v2, t, "equal-slice-v19") + if v == nil { + v19v2 = nil + } else { + v19v2 = make([][]byte, len(v)) + } + testUnmarshalErr(reflect.ValueOf(v19v2), bs19, h, t, "dec-slice-v19-noaddr") // non-addressable value + testDeepEqualErr(v19v1, v19v2, t, "equal-slice-v19-noaddr") } - testUnmarshalErr(reflect.ValueOf(v19v2), bs19, h, t, "dec-slice-v19-noaddr") // non-addressable value - testDeepEqualErr(v19v1, v19v2, t, "equal-slice-v19-noaddr") // ... bs19 = testMarshalErr(&v19v1, h, t, "enc-slice-v19-p") v19v2 = nil @@ -522,35 +532,39 @@ func doTestMammothSlices(t *testing.T, h Handle) { } v19v3 = typMbsSliceBytes(v19v1) v19v4 = typMbsSliceBytes(v19v2) - bs19 = testMarshalErr(v19v3, h, t, "enc-slice-v19-custom") - testUnmarshalErr(v19v4, bs19, h, t, "dec-slice-v19-custom") - testDeepEqualErr(v19v3, v19v4, t, "equal-slice-v19-custom") + if v != nil { + bs19 = testMarshalErr(v19v3, h, t, "enc-slice-v19-custom") + testUnmarshalErr(v19v4, bs19, h, t, "dec-slice-v19-custom") + testDeepEqualErr(v19v3, v19v4, t, "equal-slice-v19-custom") + } bs19 = testMarshalErr(&v19v3, h, t, "enc-slice-v19-custom-p") v19v2 = nil v19v4 = typMbsSliceBytes(v19v2) testUnmarshalErr(&v19v4, bs19, h, t, "dec-slice-v19-custom-p") testDeepEqualErr(v19v3, v19v4, t, "equal-slice-v19-custom-p") } - var v20va [8]float32 for _, v := range [][]float32{nil, {}, {22.2, 0, 0, 33.3e3}} { var v20v1, v20v2 []float32 + var bs20 []byte v20v1 = v - bs20 := testMarshalErr(v20v1, h, t, "enc-slice-v20") - if v == nil { - v20v2 = nil - } else { - v20v2 = make([]float32, len(v)) - } - testUnmarshalErr(v20v2, bs20, h, t, "dec-slice-v20") - testDeepEqualErr(v20v1, v20v2, t, "equal-slice-v20") - if v == nil { - v20v2 = nil - } else { - v20v2 = make([]float32, len(v)) + bs20 = testMarshalErr(v20v1, h, t, "enc-slice-v20") + if v != nil { + if v == nil { + v20v2 = nil + } else { + v20v2 = make([]float32, len(v)) + } + testUnmarshalErr(v20v2, bs20, h, t, "dec-slice-v20") + testDeepEqualErr(v20v1, v20v2, t, "equal-slice-v20") + if v == nil { + v20v2 = nil + } else { + v20v2 = make([]float32, len(v)) + } + testUnmarshalErr(reflect.ValueOf(v20v2), bs20, h, t, "dec-slice-v20-noaddr") // non-addressable value + testDeepEqualErr(v20v1, v20v2, t, "equal-slice-v20-noaddr") } - testUnmarshalErr(reflect.ValueOf(v20v2), bs20, h, t, "dec-slice-v20-noaddr") // non-addressable value - testDeepEqualErr(v20v1, v20v2, t, "equal-slice-v20-noaddr") // ... bs20 = testMarshalErr(&v20v1, h, t, "enc-slice-v20-p") v20v2 = nil @@ -584,35 +598,39 @@ func doTestMammothSlices(t *testing.T, h Handle) { } v20v3 = typMbsSliceFloat32(v20v1) v20v4 = typMbsSliceFloat32(v20v2) - bs20 = testMarshalErr(v20v3, h, t, "enc-slice-v20-custom") - testUnmarshalErr(v20v4, bs20, h, t, "dec-slice-v20-custom") - testDeepEqualErr(v20v3, v20v4, t, "equal-slice-v20-custom") + if v != nil { + bs20 = testMarshalErr(v20v3, h, t, "enc-slice-v20-custom") + testUnmarshalErr(v20v4, bs20, h, t, "dec-slice-v20-custom") + testDeepEqualErr(v20v3, v20v4, t, "equal-slice-v20-custom") + } bs20 = testMarshalErr(&v20v3, h, t, "enc-slice-v20-custom-p") v20v2 = nil v20v4 = typMbsSliceFloat32(v20v2) testUnmarshalErr(&v20v4, bs20, h, t, "dec-slice-v20-custom-p") testDeepEqualErr(v20v3, v20v4, t, "equal-slice-v20-custom-p") } - var v21va [8]float64 for _, v := range [][]float64{nil, {}, {11.1, 0, 0, 22.2}} { var v21v1, v21v2 []float64 + var bs21 []byte v21v1 = v - bs21 := testMarshalErr(v21v1, h, t, "enc-slice-v21") - if v == nil { - v21v2 = nil - } else { - v21v2 = make([]float64, len(v)) - } - testUnmarshalErr(v21v2, bs21, h, t, "dec-slice-v21") - testDeepEqualErr(v21v1, v21v2, t, "equal-slice-v21") - if v == nil { - v21v2 = nil - } else { - v21v2 = make([]float64, len(v)) + bs21 = testMarshalErr(v21v1, h, t, "enc-slice-v21") + if v != nil { + if v == nil { + v21v2 = nil + } else { + v21v2 = make([]float64, len(v)) + } + testUnmarshalErr(v21v2, bs21, h, t, "dec-slice-v21") + testDeepEqualErr(v21v1, v21v2, t, "equal-slice-v21") + if v == nil { + v21v2 = nil + } else { + v21v2 = make([]float64, len(v)) + } + testUnmarshalErr(reflect.ValueOf(v21v2), bs21, h, t, "dec-slice-v21-noaddr") // non-addressable value + testDeepEqualErr(v21v1, v21v2, t, "equal-slice-v21-noaddr") } - testUnmarshalErr(reflect.ValueOf(v21v2), bs21, h, t, "dec-slice-v21-noaddr") // non-addressable value - testDeepEqualErr(v21v1, v21v2, t, "equal-slice-v21-noaddr") // ... bs21 = testMarshalErr(&v21v1, h, t, "enc-slice-v21-p") v21v2 = nil @@ -646,35 +664,39 @@ func doTestMammothSlices(t *testing.T, h Handle) { } v21v3 = typMbsSliceFloat64(v21v1) v21v4 = typMbsSliceFloat64(v21v2) - bs21 = testMarshalErr(v21v3, h, t, "enc-slice-v21-custom") - testUnmarshalErr(v21v4, bs21, h, t, "dec-slice-v21-custom") - testDeepEqualErr(v21v3, v21v4, t, "equal-slice-v21-custom") + if v != nil { + bs21 = testMarshalErr(v21v3, h, t, "enc-slice-v21-custom") + testUnmarshalErr(v21v4, bs21, h, t, "dec-slice-v21-custom") + testDeepEqualErr(v21v3, v21v4, t, "equal-slice-v21-custom") + } bs21 = testMarshalErr(&v21v3, h, t, "enc-slice-v21-custom-p") v21v2 = nil v21v4 = typMbsSliceFloat64(v21v2) testUnmarshalErr(&v21v4, bs21, h, t, "dec-slice-v21-custom-p") testDeepEqualErr(v21v3, v21v4, t, "equal-slice-v21-custom-p") } - var v22va [8]uint for _, v := range [][]uint{nil, {}, {77, 0, 0, 127}} { var v22v1, v22v2 []uint + var bs22 []byte v22v1 = v - bs22 := testMarshalErr(v22v1, h, t, "enc-slice-v22") - if v == nil { - v22v2 = nil - } else { - v22v2 = make([]uint, len(v)) - } - testUnmarshalErr(v22v2, bs22, h, t, "dec-slice-v22") - testDeepEqualErr(v22v1, v22v2, t, "equal-slice-v22") - if v == nil { - v22v2 = nil - } else { - v22v2 = make([]uint, len(v)) + bs22 = testMarshalErr(v22v1, h, t, "enc-slice-v22") + if v != nil { + if v == nil { + v22v2 = nil + } else { + v22v2 = make([]uint, len(v)) + } + testUnmarshalErr(v22v2, bs22, h, t, "dec-slice-v22") + testDeepEqualErr(v22v1, v22v2, t, "equal-slice-v22") + if v == nil { + v22v2 = nil + } else { + v22v2 = make([]uint, len(v)) + } + testUnmarshalErr(reflect.ValueOf(v22v2), bs22, h, t, "dec-slice-v22-noaddr") // non-addressable value + testDeepEqualErr(v22v1, v22v2, t, "equal-slice-v22-noaddr") } - testUnmarshalErr(reflect.ValueOf(v22v2), bs22, h, t, "dec-slice-v22-noaddr") // non-addressable value - testDeepEqualErr(v22v1, v22v2, t, "equal-slice-v22-noaddr") // ... bs22 = testMarshalErr(&v22v1, h, t, "enc-slice-v22-p") v22v2 = nil @@ -708,35 +730,39 @@ func doTestMammothSlices(t *testing.T, h Handle) { } v22v3 = typMbsSliceUint(v22v1) v22v4 = typMbsSliceUint(v22v2) - bs22 = testMarshalErr(v22v3, h, t, "enc-slice-v22-custom") - testUnmarshalErr(v22v4, bs22, h, t, "dec-slice-v22-custom") - testDeepEqualErr(v22v3, v22v4, t, "equal-slice-v22-custom") + if v != nil { + bs22 = testMarshalErr(v22v3, h, t, "enc-slice-v22-custom") + testUnmarshalErr(v22v4, bs22, h, t, "dec-slice-v22-custom") + testDeepEqualErr(v22v3, v22v4, t, "equal-slice-v22-custom") + } bs22 = testMarshalErr(&v22v3, h, t, "enc-slice-v22-custom-p") v22v2 = nil v22v4 = typMbsSliceUint(v22v2) testUnmarshalErr(&v22v4, bs22, h, t, "dec-slice-v22-custom-p") testDeepEqualErr(v22v3, v22v4, t, "equal-slice-v22-custom-p") } - var v23va [8]uint16 for _, v := range [][]uint16{nil, {}, {111, 0, 0, 77}} { var v23v1, v23v2 []uint16 + var bs23 []byte v23v1 = v - bs23 := testMarshalErr(v23v1, h, t, "enc-slice-v23") - if v == nil { - v23v2 = nil - } else { - v23v2 = make([]uint16, len(v)) - } - testUnmarshalErr(v23v2, bs23, h, t, "dec-slice-v23") - testDeepEqualErr(v23v1, v23v2, t, "equal-slice-v23") - if v == nil { - v23v2 = nil - } else { - v23v2 = make([]uint16, len(v)) + bs23 = testMarshalErr(v23v1, h, t, "enc-slice-v23") + if v != nil { + if v == nil { + v23v2 = nil + } else { + v23v2 = make([]uint16, len(v)) + } + testUnmarshalErr(v23v2, bs23, h, t, "dec-slice-v23") + testDeepEqualErr(v23v1, v23v2, t, "equal-slice-v23") + if v == nil { + v23v2 = nil + } else { + v23v2 = make([]uint16, len(v)) + } + testUnmarshalErr(reflect.ValueOf(v23v2), bs23, h, t, "dec-slice-v23-noaddr") // non-addressable value + testDeepEqualErr(v23v1, v23v2, t, "equal-slice-v23-noaddr") } - testUnmarshalErr(reflect.ValueOf(v23v2), bs23, h, t, "dec-slice-v23-noaddr") // non-addressable value - testDeepEqualErr(v23v1, v23v2, t, "equal-slice-v23-noaddr") // ... bs23 = testMarshalErr(&v23v1, h, t, "enc-slice-v23-p") v23v2 = nil @@ -770,35 +796,39 @@ func doTestMammothSlices(t *testing.T, h Handle) { } v23v3 = typMbsSliceUint16(v23v1) v23v4 = typMbsSliceUint16(v23v2) - bs23 = testMarshalErr(v23v3, h, t, "enc-slice-v23-custom") - testUnmarshalErr(v23v4, bs23, h, t, "dec-slice-v23-custom") - testDeepEqualErr(v23v3, v23v4, t, "equal-slice-v23-custom") + if v != nil { + bs23 = testMarshalErr(v23v3, h, t, "enc-slice-v23-custom") + testUnmarshalErr(v23v4, bs23, h, t, "dec-slice-v23-custom") + testDeepEqualErr(v23v3, v23v4, t, "equal-slice-v23-custom") + } bs23 = testMarshalErr(&v23v3, h, t, "enc-slice-v23-custom-p") v23v2 = nil v23v4 = typMbsSliceUint16(v23v2) testUnmarshalErr(&v23v4, bs23, h, t, "dec-slice-v23-custom-p") testDeepEqualErr(v23v3, v23v4, t, "equal-slice-v23-custom-p") } - var v24va [8]uint32 for _, v := range [][]uint32{nil, {}, {127, 0, 0, 111}} { var v24v1, v24v2 []uint32 + var bs24 []byte v24v1 = v - bs24 := testMarshalErr(v24v1, h, t, "enc-slice-v24") - if v == nil { - v24v2 = nil - } else { - v24v2 = make([]uint32, len(v)) - } - testUnmarshalErr(v24v2, bs24, h, t, "dec-slice-v24") - testDeepEqualErr(v24v1, v24v2, t, "equal-slice-v24") - if v == nil { - v24v2 = nil - } else { - v24v2 = make([]uint32, len(v)) + bs24 = testMarshalErr(v24v1, h, t, "enc-slice-v24") + if v != nil { + if v == nil { + v24v2 = nil + } else { + v24v2 = make([]uint32, len(v)) + } + testUnmarshalErr(v24v2, bs24, h, t, "dec-slice-v24") + testDeepEqualErr(v24v1, v24v2, t, "equal-slice-v24") + if v == nil { + v24v2 = nil + } else { + v24v2 = make([]uint32, len(v)) + } + testUnmarshalErr(reflect.ValueOf(v24v2), bs24, h, t, "dec-slice-v24-noaddr") // non-addressable value + testDeepEqualErr(v24v1, v24v2, t, "equal-slice-v24-noaddr") } - testUnmarshalErr(reflect.ValueOf(v24v2), bs24, h, t, "dec-slice-v24-noaddr") // non-addressable value - testDeepEqualErr(v24v1, v24v2, t, "equal-slice-v24-noaddr") // ... bs24 = testMarshalErr(&v24v1, h, t, "enc-slice-v24-p") v24v2 = nil @@ -832,35 +862,39 @@ func doTestMammothSlices(t *testing.T, h Handle) { } v24v3 = typMbsSliceUint32(v24v1) v24v4 = typMbsSliceUint32(v24v2) - bs24 = testMarshalErr(v24v3, h, t, "enc-slice-v24-custom") - testUnmarshalErr(v24v4, bs24, h, t, "dec-slice-v24-custom") - testDeepEqualErr(v24v3, v24v4, t, "equal-slice-v24-custom") + if v != nil { + bs24 = testMarshalErr(v24v3, h, t, "enc-slice-v24-custom") + testUnmarshalErr(v24v4, bs24, h, t, "dec-slice-v24-custom") + testDeepEqualErr(v24v3, v24v4, t, "equal-slice-v24-custom") + } bs24 = testMarshalErr(&v24v3, h, t, "enc-slice-v24-custom-p") v24v2 = nil v24v4 = typMbsSliceUint32(v24v2) testUnmarshalErr(&v24v4, bs24, h, t, "dec-slice-v24-custom-p") testDeepEqualErr(v24v3, v24v4, t, "equal-slice-v24-custom-p") } - var v25va [8]uint64 for _, v := range [][]uint64{nil, {}, {77, 0, 0, 127}} { var v25v1, v25v2 []uint64 + var bs25 []byte v25v1 = v - bs25 := testMarshalErr(v25v1, h, t, "enc-slice-v25") - if v == nil { - v25v2 = nil - } else { - v25v2 = make([]uint64, len(v)) - } - testUnmarshalErr(v25v2, bs25, h, t, "dec-slice-v25") - testDeepEqualErr(v25v1, v25v2, t, "equal-slice-v25") - if v == nil { - v25v2 = nil - } else { - v25v2 = make([]uint64, len(v)) + bs25 = testMarshalErr(v25v1, h, t, "enc-slice-v25") + if v != nil { + if v == nil { + v25v2 = nil + } else { + v25v2 = make([]uint64, len(v)) + } + testUnmarshalErr(v25v2, bs25, h, t, "dec-slice-v25") + testDeepEqualErr(v25v1, v25v2, t, "equal-slice-v25") + if v == nil { + v25v2 = nil + } else { + v25v2 = make([]uint64, len(v)) + } + testUnmarshalErr(reflect.ValueOf(v25v2), bs25, h, t, "dec-slice-v25-noaddr") // non-addressable value + testDeepEqualErr(v25v1, v25v2, t, "equal-slice-v25-noaddr") } - testUnmarshalErr(reflect.ValueOf(v25v2), bs25, h, t, "dec-slice-v25-noaddr") // non-addressable value - testDeepEqualErr(v25v1, v25v2, t, "equal-slice-v25-noaddr") // ... bs25 = testMarshalErr(&v25v1, h, t, "enc-slice-v25-p") v25v2 = nil @@ -894,35 +928,39 @@ func doTestMammothSlices(t *testing.T, h Handle) { } v25v3 = typMbsSliceUint64(v25v1) v25v4 = typMbsSliceUint64(v25v2) - bs25 = testMarshalErr(v25v3, h, t, "enc-slice-v25-custom") - testUnmarshalErr(v25v4, bs25, h, t, "dec-slice-v25-custom") - testDeepEqualErr(v25v3, v25v4, t, "equal-slice-v25-custom") + if v != nil { + bs25 = testMarshalErr(v25v3, h, t, "enc-slice-v25-custom") + testUnmarshalErr(v25v4, bs25, h, t, "dec-slice-v25-custom") + testDeepEqualErr(v25v3, v25v4, t, "equal-slice-v25-custom") + } bs25 = testMarshalErr(&v25v3, h, t, "enc-slice-v25-custom-p") v25v2 = nil v25v4 = typMbsSliceUint64(v25v2) testUnmarshalErr(&v25v4, bs25, h, t, "dec-slice-v25-custom-p") testDeepEqualErr(v25v3, v25v4, t, "equal-slice-v25-custom-p") } - var v26va [8]int for _, v := range [][]int{nil, {}, {111, 0, 0, 77}} { var v26v1, v26v2 []int + var bs26 []byte v26v1 = v - bs26 := testMarshalErr(v26v1, h, t, "enc-slice-v26") - if v == nil { - v26v2 = nil - } else { - v26v2 = make([]int, len(v)) - } - testUnmarshalErr(v26v2, bs26, h, t, "dec-slice-v26") - testDeepEqualErr(v26v1, v26v2, t, "equal-slice-v26") - if v == nil { - v26v2 = nil - } else { - v26v2 = make([]int, len(v)) + bs26 = testMarshalErr(v26v1, h, t, "enc-slice-v26") + if v != nil { + if v == nil { + v26v2 = nil + } else { + v26v2 = make([]int, len(v)) + } + testUnmarshalErr(v26v2, bs26, h, t, "dec-slice-v26") + testDeepEqualErr(v26v1, v26v2, t, "equal-slice-v26") + if v == nil { + v26v2 = nil + } else { + v26v2 = make([]int, len(v)) + } + testUnmarshalErr(reflect.ValueOf(v26v2), bs26, h, t, "dec-slice-v26-noaddr") // non-addressable value + testDeepEqualErr(v26v1, v26v2, t, "equal-slice-v26-noaddr") } - testUnmarshalErr(reflect.ValueOf(v26v2), bs26, h, t, "dec-slice-v26-noaddr") // non-addressable value - testDeepEqualErr(v26v1, v26v2, t, "equal-slice-v26-noaddr") // ... bs26 = testMarshalErr(&v26v1, h, t, "enc-slice-v26-p") v26v2 = nil @@ -956,35 +994,39 @@ func doTestMammothSlices(t *testing.T, h Handle) { } v26v3 = typMbsSliceInt(v26v1) v26v4 = typMbsSliceInt(v26v2) - bs26 = testMarshalErr(v26v3, h, t, "enc-slice-v26-custom") - testUnmarshalErr(v26v4, bs26, h, t, "dec-slice-v26-custom") - testDeepEqualErr(v26v3, v26v4, t, "equal-slice-v26-custom") + if v != nil { + bs26 = testMarshalErr(v26v3, h, t, "enc-slice-v26-custom") + testUnmarshalErr(v26v4, bs26, h, t, "dec-slice-v26-custom") + testDeepEqualErr(v26v3, v26v4, t, "equal-slice-v26-custom") + } bs26 = testMarshalErr(&v26v3, h, t, "enc-slice-v26-custom-p") v26v2 = nil v26v4 = typMbsSliceInt(v26v2) testUnmarshalErr(&v26v4, bs26, h, t, "dec-slice-v26-custom-p") testDeepEqualErr(v26v3, v26v4, t, "equal-slice-v26-custom-p") } - var v27va [8]int8 for _, v := range [][]int8{nil, {}, {127, 0, 0, 111}} { var v27v1, v27v2 []int8 + var bs27 []byte v27v1 = v - bs27 := testMarshalErr(v27v1, h, t, "enc-slice-v27") - if v == nil { - v27v2 = nil - } else { - v27v2 = make([]int8, len(v)) - } - testUnmarshalErr(v27v2, bs27, h, t, "dec-slice-v27") - testDeepEqualErr(v27v1, v27v2, t, "equal-slice-v27") - if v == nil { - v27v2 = nil - } else { - v27v2 = make([]int8, len(v)) + bs27 = testMarshalErr(v27v1, h, t, "enc-slice-v27") + if v != nil { + if v == nil { + v27v2 = nil + } else { + v27v2 = make([]int8, len(v)) + } + testUnmarshalErr(v27v2, bs27, h, t, "dec-slice-v27") + testDeepEqualErr(v27v1, v27v2, t, "equal-slice-v27") + if v == nil { + v27v2 = nil + } else { + v27v2 = make([]int8, len(v)) + } + testUnmarshalErr(reflect.ValueOf(v27v2), bs27, h, t, "dec-slice-v27-noaddr") // non-addressable value + testDeepEqualErr(v27v1, v27v2, t, "equal-slice-v27-noaddr") } - testUnmarshalErr(reflect.ValueOf(v27v2), bs27, h, t, "dec-slice-v27-noaddr") // non-addressable value - testDeepEqualErr(v27v1, v27v2, t, "equal-slice-v27-noaddr") // ... bs27 = testMarshalErr(&v27v1, h, t, "enc-slice-v27-p") v27v2 = nil @@ -1018,35 +1060,39 @@ func doTestMammothSlices(t *testing.T, h Handle) { } v27v3 = typMbsSliceInt8(v27v1) v27v4 = typMbsSliceInt8(v27v2) - bs27 = testMarshalErr(v27v3, h, t, "enc-slice-v27-custom") - testUnmarshalErr(v27v4, bs27, h, t, "dec-slice-v27-custom") - testDeepEqualErr(v27v3, v27v4, t, "equal-slice-v27-custom") + if v != nil { + bs27 = testMarshalErr(v27v3, h, t, "enc-slice-v27-custom") + testUnmarshalErr(v27v4, bs27, h, t, "dec-slice-v27-custom") + testDeepEqualErr(v27v3, v27v4, t, "equal-slice-v27-custom") + } bs27 = testMarshalErr(&v27v3, h, t, "enc-slice-v27-custom-p") v27v2 = nil v27v4 = typMbsSliceInt8(v27v2) testUnmarshalErr(&v27v4, bs27, h, t, "dec-slice-v27-custom-p") testDeepEqualErr(v27v3, v27v4, t, "equal-slice-v27-custom-p") } - var v28va [8]int16 for _, v := range [][]int16{nil, {}, {77, 0, 0, 127}} { var v28v1, v28v2 []int16 + var bs28 []byte v28v1 = v - bs28 := testMarshalErr(v28v1, h, t, "enc-slice-v28") - if v == nil { - v28v2 = nil - } else { - v28v2 = make([]int16, len(v)) - } - testUnmarshalErr(v28v2, bs28, h, t, "dec-slice-v28") - testDeepEqualErr(v28v1, v28v2, t, "equal-slice-v28") - if v == nil { - v28v2 = nil - } else { - v28v2 = make([]int16, len(v)) + bs28 = testMarshalErr(v28v1, h, t, "enc-slice-v28") + if v != nil { + if v == nil { + v28v2 = nil + } else { + v28v2 = make([]int16, len(v)) + } + testUnmarshalErr(v28v2, bs28, h, t, "dec-slice-v28") + testDeepEqualErr(v28v1, v28v2, t, "equal-slice-v28") + if v == nil { + v28v2 = nil + } else { + v28v2 = make([]int16, len(v)) + } + testUnmarshalErr(reflect.ValueOf(v28v2), bs28, h, t, "dec-slice-v28-noaddr") // non-addressable value + testDeepEqualErr(v28v1, v28v2, t, "equal-slice-v28-noaddr") } - testUnmarshalErr(reflect.ValueOf(v28v2), bs28, h, t, "dec-slice-v28-noaddr") // non-addressable value - testDeepEqualErr(v28v1, v28v2, t, "equal-slice-v28-noaddr") // ... bs28 = testMarshalErr(&v28v1, h, t, "enc-slice-v28-p") v28v2 = nil @@ -1080,35 +1126,39 @@ func doTestMammothSlices(t *testing.T, h Handle) { } v28v3 = typMbsSliceInt16(v28v1) v28v4 = typMbsSliceInt16(v28v2) - bs28 = testMarshalErr(v28v3, h, t, "enc-slice-v28-custom") - testUnmarshalErr(v28v4, bs28, h, t, "dec-slice-v28-custom") - testDeepEqualErr(v28v3, v28v4, t, "equal-slice-v28-custom") + if v != nil { + bs28 = testMarshalErr(v28v3, h, t, "enc-slice-v28-custom") + testUnmarshalErr(v28v4, bs28, h, t, "dec-slice-v28-custom") + testDeepEqualErr(v28v3, v28v4, t, "equal-slice-v28-custom") + } bs28 = testMarshalErr(&v28v3, h, t, "enc-slice-v28-custom-p") v28v2 = nil v28v4 = typMbsSliceInt16(v28v2) testUnmarshalErr(&v28v4, bs28, h, t, "dec-slice-v28-custom-p") testDeepEqualErr(v28v3, v28v4, t, "equal-slice-v28-custom-p") } - var v29va [8]int32 for _, v := range [][]int32{nil, {}, {111, 0, 0, 77}} { var v29v1, v29v2 []int32 + var bs29 []byte v29v1 = v - bs29 := testMarshalErr(v29v1, h, t, "enc-slice-v29") - if v == nil { - v29v2 = nil - } else { - v29v2 = make([]int32, len(v)) - } - testUnmarshalErr(v29v2, bs29, h, t, "dec-slice-v29") - testDeepEqualErr(v29v1, v29v2, t, "equal-slice-v29") - if v == nil { - v29v2 = nil - } else { - v29v2 = make([]int32, len(v)) + bs29 = testMarshalErr(v29v1, h, t, "enc-slice-v29") + if v != nil { + if v == nil { + v29v2 = nil + } else { + v29v2 = make([]int32, len(v)) + } + testUnmarshalErr(v29v2, bs29, h, t, "dec-slice-v29") + testDeepEqualErr(v29v1, v29v2, t, "equal-slice-v29") + if v == nil { + v29v2 = nil + } else { + v29v2 = make([]int32, len(v)) + } + testUnmarshalErr(reflect.ValueOf(v29v2), bs29, h, t, "dec-slice-v29-noaddr") // non-addressable value + testDeepEqualErr(v29v1, v29v2, t, "equal-slice-v29-noaddr") } - testUnmarshalErr(reflect.ValueOf(v29v2), bs29, h, t, "dec-slice-v29-noaddr") // non-addressable value - testDeepEqualErr(v29v1, v29v2, t, "equal-slice-v29-noaddr") // ... bs29 = testMarshalErr(&v29v1, h, t, "enc-slice-v29-p") v29v2 = nil @@ -1142,35 +1192,39 @@ func doTestMammothSlices(t *testing.T, h Handle) { } v29v3 = typMbsSliceInt32(v29v1) v29v4 = typMbsSliceInt32(v29v2) - bs29 = testMarshalErr(v29v3, h, t, "enc-slice-v29-custom") - testUnmarshalErr(v29v4, bs29, h, t, "dec-slice-v29-custom") - testDeepEqualErr(v29v3, v29v4, t, "equal-slice-v29-custom") + if v != nil { + bs29 = testMarshalErr(v29v3, h, t, "enc-slice-v29-custom") + testUnmarshalErr(v29v4, bs29, h, t, "dec-slice-v29-custom") + testDeepEqualErr(v29v3, v29v4, t, "equal-slice-v29-custom") + } bs29 = testMarshalErr(&v29v3, h, t, "enc-slice-v29-custom-p") v29v2 = nil v29v4 = typMbsSliceInt32(v29v2) testUnmarshalErr(&v29v4, bs29, h, t, "dec-slice-v29-custom-p") testDeepEqualErr(v29v3, v29v4, t, "equal-slice-v29-custom-p") } - var v30va [8]int64 for _, v := range [][]int64{nil, {}, {127, 0, 0, 111}} { var v30v1, v30v2 []int64 + var bs30 []byte v30v1 = v - bs30 := testMarshalErr(v30v1, h, t, "enc-slice-v30") - if v == nil { - v30v2 = nil - } else { - v30v2 = make([]int64, len(v)) - } - testUnmarshalErr(v30v2, bs30, h, t, "dec-slice-v30") - testDeepEqualErr(v30v1, v30v2, t, "equal-slice-v30") - if v == nil { - v30v2 = nil - } else { - v30v2 = make([]int64, len(v)) + bs30 = testMarshalErr(v30v1, h, t, "enc-slice-v30") + if v != nil { + if v == nil { + v30v2 = nil + } else { + v30v2 = make([]int64, len(v)) + } + testUnmarshalErr(v30v2, bs30, h, t, "dec-slice-v30") + testDeepEqualErr(v30v1, v30v2, t, "equal-slice-v30") + if v == nil { + v30v2 = nil + } else { + v30v2 = make([]int64, len(v)) + } + testUnmarshalErr(reflect.ValueOf(v30v2), bs30, h, t, "dec-slice-v30-noaddr") // non-addressable value + testDeepEqualErr(v30v1, v30v2, t, "equal-slice-v30-noaddr") } - testUnmarshalErr(reflect.ValueOf(v30v2), bs30, h, t, "dec-slice-v30-noaddr") // non-addressable value - testDeepEqualErr(v30v1, v30v2, t, "equal-slice-v30-noaddr") // ... bs30 = testMarshalErr(&v30v1, h, t, "enc-slice-v30-p") v30v2 = nil @@ -1204,35 +1258,39 @@ func doTestMammothSlices(t *testing.T, h Handle) { } v30v3 = typMbsSliceInt64(v30v1) v30v4 = typMbsSliceInt64(v30v2) - bs30 = testMarshalErr(v30v3, h, t, "enc-slice-v30-custom") - testUnmarshalErr(v30v4, bs30, h, t, "dec-slice-v30-custom") - testDeepEqualErr(v30v3, v30v4, t, "equal-slice-v30-custom") + if v != nil { + bs30 = testMarshalErr(v30v3, h, t, "enc-slice-v30-custom") + testUnmarshalErr(v30v4, bs30, h, t, "dec-slice-v30-custom") + testDeepEqualErr(v30v3, v30v4, t, "equal-slice-v30-custom") + } bs30 = testMarshalErr(&v30v3, h, t, "enc-slice-v30-custom-p") v30v2 = nil v30v4 = typMbsSliceInt64(v30v2) testUnmarshalErr(&v30v4, bs30, h, t, "dec-slice-v30-custom-p") testDeepEqualErr(v30v3, v30v4, t, "equal-slice-v30-custom-p") } - var v31va [8]bool for _, v := range [][]bool{nil, {}, {false, false, false, true}} { var v31v1, v31v2 []bool + var bs31 []byte v31v1 = v - bs31 := testMarshalErr(v31v1, h, t, "enc-slice-v31") - if v == nil { - v31v2 = nil - } else { - v31v2 = make([]bool, len(v)) - } - testUnmarshalErr(v31v2, bs31, h, t, "dec-slice-v31") - testDeepEqualErr(v31v1, v31v2, t, "equal-slice-v31") - if v == nil { - v31v2 = nil - } else { - v31v2 = make([]bool, len(v)) + bs31 = testMarshalErr(v31v1, h, t, "enc-slice-v31") + if v != nil { + if v == nil { + v31v2 = nil + } else { + v31v2 = make([]bool, len(v)) + } + testUnmarshalErr(v31v2, bs31, h, t, "dec-slice-v31") + testDeepEqualErr(v31v1, v31v2, t, "equal-slice-v31") + if v == nil { + v31v2 = nil + } else { + v31v2 = make([]bool, len(v)) + } + testUnmarshalErr(reflect.ValueOf(v31v2), bs31, h, t, "dec-slice-v31-noaddr") // non-addressable value + testDeepEqualErr(v31v1, v31v2, t, "equal-slice-v31-noaddr") } - testUnmarshalErr(reflect.ValueOf(v31v2), bs31, h, t, "dec-slice-v31-noaddr") // non-addressable value - testDeepEqualErr(v31v1, v31v2, t, "equal-slice-v31-noaddr") // ... bs31 = testMarshalErr(&v31v1, h, t, "enc-slice-v31-p") v31v2 = nil @@ -1266,9 +1324,11 @@ func doTestMammothSlices(t *testing.T, h Handle) { } v31v3 = typMbsSliceBool(v31v1) v31v4 = typMbsSliceBool(v31v2) - bs31 = testMarshalErr(v31v3, h, t, "enc-slice-v31-custom") - testUnmarshalErr(v31v4, bs31, h, t, "dec-slice-v31-custom") - testDeepEqualErr(v31v3, v31v4, t, "equal-slice-v31-custom") + if v != nil { + bs31 = testMarshalErr(v31v3, h, t, "enc-slice-v31-custom") + testUnmarshalErr(v31v4, bs31, h, t, "dec-slice-v31-custom") + testDeepEqualErr(v31v3, v31v4, t, "equal-slice-v31-custom") + } bs31 = testMarshalErr(&v31v3, h, t, "enc-slice-v31-custom-p") v31v2 = nil v31v4 = typMbsSliceBool(v31v2) @@ -1279,26 +1339,28 @@ func doTestMammothSlices(t *testing.T, h Handle) { } func doTestMammothMaps(t *testing.T, h Handle) { - for _, v := range []map[string]interface{}{nil, {}, {"some-string-1": nil, "some-string-2": "string-is-an-interface-1"}} { // fmt.Printf(">>>> running mammoth map v32: %v\n", v) var v32v1, v32v2 map[string]interface{} + var bs32 []byte v32v1 = v - bs32 := testMarshalErr(v32v1, h, t, "enc-map-v32") - if v == nil { - v32v2 = nil - } else { - v32v2 = make(map[string]interface{}, len(v)) - } // reset map - testUnmarshalErr(v32v2, bs32, h, t, "dec-map-v32") - testDeepEqualErr(v32v1, v32v2, t, "equal-map-v32") - if v == nil { - v32v2 = nil - } else { - v32v2 = make(map[string]interface{}, len(v)) - } // reset map - testUnmarshalErr(reflect.ValueOf(v32v2), bs32, h, t, "dec-map-v32-noaddr") // decode into non-addressable map value - testDeepEqualErr(v32v1, v32v2, t, "equal-map-v32-noaddr") + bs32 = testMarshalErr(v32v1, h, t, "enc-map-v32") + if v != nil { + if v == nil { + v32v2 = nil + } else { + v32v2 = make(map[string]interface{}, len(v)) + } // reset map + testUnmarshalErr(v32v2, bs32, h, t, "dec-map-v32") + testDeepEqualErr(v32v1, v32v2, t, "equal-map-v32") + if v == nil { + v32v2 = nil + } else { + v32v2 = make(map[string]interface{}, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v32v2), bs32, h, t, "dec-map-v32-noaddr") // decode into non-addressable map value + testDeepEqualErr(v32v1, v32v2, t, "equal-map-v32-noaddr") + } if v == nil { v32v2 = nil } else { @@ -1319,30 +1381,34 @@ func doTestMammothMaps(t *testing.T, h Handle) { var v32v3, v32v4 typMapMapStringIntf v32v3 = typMapMapStringIntf(v32v1) v32v4 = typMapMapStringIntf(v32v2) - bs32 = testMarshalErr(v32v3, h, t, "enc-map-v32-custom") - testUnmarshalErr(v32v4, bs32, h, t, "dec-map-v32-p-len") - testDeepEqualErr(v32v3, v32v4, t, "equal-map-v32-p-len") + if v != nil { + bs32 = testMarshalErr(v32v3, h, t, "enc-map-v32-custom") + testUnmarshalErr(v32v4, bs32, h, t, "dec-map-v32-p-len") + testDeepEqualErr(v32v3, v32v4, t, "equal-map-v32-p-len") + } } - for _, v := range []map[string]string{nil, {}, {"some-string-3": "", "some-string-1": "some-string-2"}} { // fmt.Printf(">>>> running mammoth map v33: %v\n", v) var v33v1, v33v2 map[string]string + var bs33 []byte v33v1 = v - bs33 := testMarshalErr(v33v1, h, t, "enc-map-v33") - if v == nil { - v33v2 = nil - } else { - v33v2 = make(map[string]string, len(v)) - } // reset map - testUnmarshalErr(v33v2, bs33, h, t, "dec-map-v33") - testDeepEqualErr(v33v1, v33v2, t, "equal-map-v33") - if v == nil { - v33v2 = nil - } else { - v33v2 = make(map[string]string, len(v)) - } // reset map - testUnmarshalErr(reflect.ValueOf(v33v2), bs33, h, t, "dec-map-v33-noaddr") // decode into non-addressable map value - testDeepEqualErr(v33v1, v33v2, t, "equal-map-v33-noaddr") + bs33 = testMarshalErr(v33v1, h, t, "enc-map-v33") + if v != nil { + if v == nil { + v33v2 = nil + } else { + v33v2 = make(map[string]string, len(v)) + } // reset map + testUnmarshalErr(v33v2, bs33, h, t, "dec-map-v33") + testDeepEqualErr(v33v1, v33v2, t, "equal-map-v33") + if v == nil { + v33v2 = nil + } else { + v33v2 = make(map[string]string, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v33v2), bs33, h, t, "dec-map-v33-noaddr") // decode into non-addressable map value + testDeepEqualErr(v33v1, v33v2, t, "equal-map-v33-noaddr") + } if v == nil { v33v2 = nil } else { @@ -1363,30 +1429,34 @@ func doTestMammothMaps(t *testing.T, h Handle) { var v33v3, v33v4 typMapMapStringString v33v3 = typMapMapStringString(v33v1) v33v4 = typMapMapStringString(v33v2) - bs33 = testMarshalErr(v33v3, h, t, "enc-map-v33-custom") - testUnmarshalErr(v33v4, bs33, h, t, "dec-map-v33-p-len") - testDeepEqualErr(v33v3, v33v4, t, "equal-map-v33-p-len") + if v != nil { + bs33 = testMarshalErr(v33v3, h, t, "enc-map-v33-custom") + testUnmarshalErr(v33v4, bs33, h, t, "dec-map-v33-p-len") + testDeepEqualErr(v33v3, v33v4, t, "equal-map-v33-p-len") + } } - for _, v := range []map[string][]byte{nil, {}, {"some-string-3": nil, "some-string-1": []byte("some-string-1")}} { // fmt.Printf(">>>> running mammoth map v34: %v\n", v) var v34v1, v34v2 map[string][]byte + var bs34 []byte v34v1 = v - bs34 := testMarshalErr(v34v1, h, t, "enc-map-v34") - if v == nil { - v34v2 = nil - } else { - v34v2 = make(map[string][]byte, len(v)) - } // reset map - testUnmarshalErr(v34v2, bs34, h, t, "dec-map-v34") - testDeepEqualErr(v34v1, v34v2, t, "equal-map-v34") - if v == nil { - v34v2 = nil - } else { - v34v2 = make(map[string][]byte, len(v)) - } // reset map - testUnmarshalErr(reflect.ValueOf(v34v2), bs34, h, t, "dec-map-v34-noaddr") // decode into non-addressable map value - testDeepEqualErr(v34v1, v34v2, t, "equal-map-v34-noaddr") + bs34 = testMarshalErr(v34v1, h, t, "enc-map-v34") + if v != nil { + if v == nil { + v34v2 = nil + } else { + v34v2 = make(map[string][]byte, len(v)) + } // reset map + testUnmarshalErr(v34v2, bs34, h, t, "dec-map-v34") + testDeepEqualErr(v34v1, v34v2, t, "equal-map-v34") + if v == nil { + v34v2 = nil + } else { + v34v2 = make(map[string][]byte, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v34v2), bs34, h, t, "dec-map-v34-noaddr") // decode into non-addressable map value + testDeepEqualErr(v34v1, v34v2, t, "equal-map-v34-noaddr") + } if v == nil { v34v2 = nil } else { @@ -1407,30 +1477,34 @@ func doTestMammothMaps(t *testing.T, h Handle) { var v34v3, v34v4 typMapMapStringBytes v34v3 = typMapMapStringBytes(v34v1) v34v4 = typMapMapStringBytes(v34v2) - bs34 = testMarshalErr(v34v3, h, t, "enc-map-v34-custom") - testUnmarshalErr(v34v4, bs34, h, t, "dec-map-v34-p-len") - testDeepEqualErr(v34v3, v34v4, t, "equal-map-v34-p-len") + if v != nil { + bs34 = testMarshalErr(v34v3, h, t, "enc-map-v34-custom") + testUnmarshalErr(v34v4, bs34, h, t, "dec-map-v34-p-len") + testDeepEqualErr(v34v3, v34v4, t, "equal-map-v34-p-len") + } } - for _, v := range []map[string]uint{nil, {}, {"some-string-2": 0, "some-string-3": 77}} { // fmt.Printf(">>>> running mammoth map v35: %v\n", v) var v35v1, v35v2 map[string]uint + var bs35 []byte v35v1 = v - bs35 := testMarshalErr(v35v1, h, t, "enc-map-v35") - if v == nil { - v35v2 = nil - } else { - v35v2 = make(map[string]uint, len(v)) - } // reset map - testUnmarshalErr(v35v2, bs35, h, t, "dec-map-v35") - testDeepEqualErr(v35v1, v35v2, t, "equal-map-v35") - if v == nil { - v35v2 = nil - } else { - v35v2 = make(map[string]uint, len(v)) - } // reset map - testUnmarshalErr(reflect.ValueOf(v35v2), bs35, h, t, "dec-map-v35-noaddr") // decode into non-addressable map value - testDeepEqualErr(v35v1, v35v2, t, "equal-map-v35-noaddr") + bs35 = testMarshalErr(v35v1, h, t, "enc-map-v35") + if v != nil { + if v == nil { + v35v2 = nil + } else { + v35v2 = make(map[string]uint, len(v)) + } // reset map + testUnmarshalErr(v35v2, bs35, h, t, "dec-map-v35") + testDeepEqualErr(v35v1, v35v2, t, "equal-map-v35") + if v == nil { + v35v2 = nil + } else { + v35v2 = make(map[string]uint, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v35v2), bs35, h, t, "dec-map-v35-noaddr") // decode into non-addressable map value + testDeepEqualErr(v35v1, v35v2, t, "equal-map-v35-noaddr") + } if v == nil { v35v2 = nil } else { @@ -1451,30 +1525,34 @@ func doTestMammothMaps(t *testing.T, h Handle) { var v35v3, v35v4 typMapMapStringUint v35v3 = typMapMapStringUint(v35v1) v35v4 = typMapMapStringUint(v35v2) - bs35 = testMarshalErr(v35v3, h, t, "enc-map-v35-custom") - testUnmarshalErr(v35v4, bs35, h, t, "dec-map-v35-p-len") - testDeepEqualErr(v35v3, v35v4, t, "equal-map-v35-p-len") + if v != nil { + bs35 = testMarshalErr(v35v3, h, t, "enc-map-v35-custom") + testUnmarshalErr(v35v4, bs35, h, t, "dec-map-v35-p-len") + testDeepEqualErr(v35v3, v35v4, t, "equal-map-v35-p-len") + } } - for _, v := range []map[string]uint8{nil, {}, {"some-string-1": 0, "some-string-2": 127}} { // fmt.Printf(">>>> running mammoth map v36: %v\n", v) var v36v1, v36v2 map[string]uint8 + var bs36 []byte v36v1 = v - bs36 := testMarshalErr(v36v1, h, t, "enc-map-v36") - if v == nil { - v36v2 = nil - } else { - v36v2 = make(map[string]uint8, len(v)) - } // reset map - testUnmarshalErr(v36v2, bs36, h, t, "dec-map-v36") - testDeepEqualErr(v36v1, v36v2, t, "equal-map-v36") - if v == nil { - v36v2 = nil - } else { - v36v2 = make(map[string]uint8, len(v)) - } // reset map - testUnmarshalErr(reflect.ValueOf(v36v2), bs36, h, t, "dec-map-v36-noaddr") // decode into non-addressable map value - testDeepEqualErr(v36v1, v36v2, t, "equal-map-v36-noaddr") + bs36 = testMarshalErr(v36v1, h, t, "enc-map-v36") + if v != nil { + if v == nil { + v36v2 = nil + } else { + v36v2 = make(map[string]uint8, len(v)) + } // reset map + testUnmarshalErr(v36v2, bs36, h, t, "dec-map-v36") + testDeepEqualErr(v36v1, v36v2, t, "equal-map-v36") + if v == nil { + v36v2 = nil + } else { + v36v2 = make(map[string]uint8, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v36v2), bs36, h, t, "dec-map-v36-noaddr") // decode into non-addressable map value + testDeepEqualErr(v36v1, v36v2, t, "equal-map-v36-noaddr") + } if v == nil { v36v2 = nil } else { @@ -1495,30 +1573,34 @@ func doTestMammothMaps(t *testing.T, h Handle) { var v36v3, v36v4 typMapMapStringUint8 v36v3 = typMapMapStringUint8(v36v1) v36v4 = typMapMapStringUint8(v36v2) - bs36 = testMarshalErr(v36v3, h, t, "enc-map-v36-custom") - testUnmarshalErr(v36v4, bs36, h, t, "dec-map-v36-p-len") - testDeepEqualErr(v36v3, v36v4, t, "equal-map-v36-p-len") + if v != nil { + bs36 = testMarshalErr(v36v3, h, t, "enc-map-v36-custom") + testUnmarshalErr(v36v4, bs36, h, t, "dec-map-v36-p-len") + testDeepEqualErr(v36v3, v36v4, t, "equal-map-v36-p-len") + } } - for _, v := range []map[string]uint64{nil, {}, {"some-string-3": 0, "some-string-1": 111}} { // fmt.Printf(">>>> running mammoth map v37: %v\n", v) var v37v1, v37v2 map[string]uint64 + var bs37 []byte v37v1 = v - bs37 := testMarshalErr(v37v1, h, t, "enc-map-v37") - if v == nil { - v37v2 = nil - } else { - v37v2 = make(map[string]uint64, len(v)) - } // reset map - testUnmarshalErr(v37v2, bs37, h, t, "dec-map-v37") - testDeepEqualErr(v37v1, v37v2, t, "equal-map-v37") - if v == nil { - v37v2 = nil - } else { - v37v2 = make(map[string]uint64, len(v)) - } // reset map - testUnmarshalErr(reflect.ValueOf(v37v2), bs37, h, t, "dec-map-v37-noaddr") // decode into non-addressable map value - testDeepEqualErr(v37v1, v37v2, t, "equal-map-v37-noaddr") + bs37 = testMarshalErr(v37v1, h, t, "enc-map-v37") + if v != nil { + if v == nil { + v37v2 = nil + } else { + v37v2 = make(map[string]uint64, len(v)) + } // reset map + testUnmarshalErr(v37v2, bs37, h, t, "dec-map-v37") + testDeepEqualErr(v37v1, v37v2, t, "equal-map-v37") + if v == nil { + v37v2 = nil + } else { + v37v2 = make(map[string]uint64, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v37v2), bs37, h, t, "dec-map-v37-noaddr") // decode into non-addressable map value + testDeepEqualErr(v37v1, v37v2, t, "equal-map-v37-noaddr") + } if v == nil { v37v2 = nil } else { @@ -1539,30 +1621,34 @@ func doTestMammothMaps(t *testing.T, h Handle) { var v37v3, v37v4 typMapMapStringUint64 v37v3 = typMapMapStringUint64(v37v1) v37v4 = typMapMapStringUint64(v37v2) - bs37 = testMarshalErr(v37v3, h, t, "enc-map-v37-custom") - testUnmarshalErr(v37v4, bs37, h, t, "dec-map-v37-p-len") - testDeepEqualErr(v37v3, v37v4, t, "equal-map-v37-p-len") + if v != nil { + bs37 = testMarshalErr(v37v3, h, t, "enc-map-v37-custom") + testUnmarshalErr(v37v4, bs37, h, t, "dec-map-v37-p-len") + testDeepEqualErr(v37v3, v37v4, t, "equal-map-v37-p-len") + } } - for _, v := range []map[string]int{nil, {}, {"some-string-2": 0, "some-string-3": 77}} { // fmt.Printf(">>>> running mammoth map v38: %v\n", v) var v38v1, v38v2 map[string]int + var bs38 []byte v38v1 = v - bs38 := testMarshalErr(v38v1, h, t, "enc-map-v38") - if v == nil { - v38v2 = nil - } else { - v38v2 = make(map[string]int, len(v)) - } // reset map - testUnmarshalErr(v38v2, bs38, h, t, "dec-map-v38") - testDeepEqualErr(v38v1, v38v2, t, "equal-map-v38") - if v == nil { - v38v2 = nil - } else { - v38v2 = make(map[string]int, len(v)) - } // reset map - testUnmarshalErr(reflect.ValueOf(v38v2), bs38, h, t, "dec-map-v38-noaddr") // decode into non-addressable map value - testDeepEqualErr(v38v1, v38v2, t, "equal-map-v38-noaddr") + bs38 = testMarshalErr(v38v1, h, t, "enc-map-v38") + if v != nil { + if v == nil { + v38v2 = nil + } else { + v38v2 = make(map[string]int, len(v)) + } // reset map + testUnmarshalErr(v38v2, bs38, h, t, "dec-map-v38") + testDeepEqualErr(v38v1, v38v2, t, "equal-map-v38") + if v == nil { + v38v2 = nil + } else { + v38v2 = make(map[string]int, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v38v2), bs38, h, t, "dec-map-v38-noaddr") // decode into non-addressable map value + testDeepEqualErr(v38v1, v38v2, t, "equal-map-v38-noaddr") + } if v == nil { v38v2 = nil } else { @@ -1583,30 +1669,34 @@ func doTestMammothMaps(t *testing.T, h Handle) { var v38v3, v38v4 typMapMapStringInt v38v3 = typMapMapStringInt(v38v1) v38v4 = typMapMapStringInt(v38v2) - bs38 = testMarshalErr(v38v3, h, t, "enc-map-v38-custom") - testUnmarshalErr(v38v4, bs38, h, t, "dec-map-v38-p-len") - testDeepEqualErr(v38v3, v38v4, t, "equal-map-v38-p-len") + if v != nil { + bs38 = testMarshalErr(v38v3, h, t, "enc-map-v38-custom") + testUnmarshalErr(v38v4, bs38, h, t, "dec-map-v38-p-len") + testDeepEqualErr(v38v3, v38v4, t, "equal-map-v38-p-len") + } } - for _, v := range []map[string]int64{nil, {}, {"some-string-1": 0, "some-string-2": 127}} { // fmt.Printf(">>>> running mammoth map v39: %v\n", v) var v39v1, v39v2 map[string]int64 + var bs39 []byte v39v1 = v - bs39 := testMarshalErr(v39v1, h, t, "enc-map-v39") - if v == nil { - v39v2 = nil - } else { - v39v2 = make(map[string]int64, len(v)) - } // reset map - testUnmarshalErr(v39v2, bs39, h, t, "dec-map-v39") - testDeepEqualErr(v39v1, v39v2, t, "equal-map-v39") - if v == nil { - v39v2 = nil - } else { - v39v2 = make(map[string]int64, len(v)) - } // reset map - testUnmarshalErr(reflect.ValueOf(v39v2), bs39, h, t, "dec-map-v39-noaddr") // decode into non-addressable map value - testDeepEqualErr(v39v1, v39v2, t, "equal-map-v39-noaddr") + bs39 = testMarshalErr(v39v1, h, t, "enc-map-v39") + if v != nil { + if v == nil { + v39v2 = nil + } else { + v39v2 = make(map[string]int64, len(v)) + } // reset map + testUnmarshalErr(v39v2, bs39, h, t, "dec-map-v39") + testDeepEqualErr(v39v1, v39v2, t, "equal-map-v39") + if v == nil { + v39v2 = nil + } else { + v39v2 = make(map[string]int64, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v39v2), bs39, h, t, "dec-map-v39-noaddr") // decode into non-addressable map value + testDeepEqualErr(v39v1, v39v2, t, "equal-map-v39-noaddr") + } if v == nil { v39v2 = nil } else { @@ -1627,30 +1717,34 @@ func doTestMammothMaps(t *testing.T, h Handle) { var v39v3, v39v4 typMapMapStringInt64 v39v3 = typMapMapStringInt64(v39v1) v39v4 = typMapMapStringInt64(v39v2) - bs39 = testMarshalErr(v39v3, h, t, "enc-map-v39-custom") - testUnmarshalErr(v39v4, bs39, h, t, "dec-map-v39-p-len") - testDeepEqualErr(v39v3, v39v4, t, "equal-map-v39-p-len") + if v != nil { + bs39 = testMarshalErr(v39v3, h, t, "enc-map-v39-custom") + testUnmarshalErr(v39v4, bs39, h, t, "dec-map-v39-p-len") + testDeepEqualErr(v39v3, v39v4, t, "equal-map-v39-p-len") + } } - for _, v := range []map[string]float32{nil, {}, {"some-string-3": 0, "some-string-1": 33.3e3}} { // fmt.Printf(">>>> running mammoth map v40: %v\n", v) var v40v1, v40v2 map[string]float32 + var bs40 []byte v40v1 = v - bs40 := testMarshalErr(v40v1, h, t, "enc-map-v40") - if v == nil { - v40v2 = nil - } else { - v40v2 = make(map[string]float32, len(v)) - } // reset map - testUnmarshalErr(v40v2, bs40, h, t, "dec-map-v40") - testDeepEqualErr(v40v1, v40v2, t, "equal-map-v40") - if v == nil { - v40v2 = nil - } else { - v40v2 = make(map[string]float32, len(v)) - } // reset map - testUnmarshalErr(reflect.ValueOf(v40v2), bs40, h, t, "dec-map-v40-noaddr") // decode into non-addressable map value - testDeepEqualErr(v40v1, v40v2, t, "equal-map-v40-noaddr") + bs40 = testMarshalErr(v40v1, h, t, "enc-map-v40") + if v != nil { + if v == nil { + v40v2 = nil + } else { + v40v2 = make(map[string]float32, len(v)) + } // reset map + testUnmarshalErr(v40v2, bs40, h, t, "dec-map-v40") + testDeepEqualErr(v40v1, v40v2, t, "equal-map-v40") + if v == nil { + v40v2 = nil + } else { + v40v2 = make(map[string]float32, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v40v2), bs40, h, t, "dec-map-v40-noaddr") // decode into non-addressable map value + testDeepEqualErr(v40v1, v40v2, t, "equal-map-v40-noaddr") + } if v == nil { v40v2 = nil } else { @@ -1671,30 +1765,34 @@ func doTestMammothMaps(t *testing.T, h Handle) { var v40v3, v40v4 typMapMapStringFloat32 v40v3 = typMapMapStringFloat32(v40v1) v40v4 = typMapMapStringFloat32(v40v2) - bs40 = testMarshalErr(v40v3, h, t, "enc-map-v40-custom") - testUnmarshalErr(v40v4, bs40, h, t, "dec-map-v40-p-len") - testDeepEqualErr(v40v3, v40v4, t, "equal-map-v40-p-len") + if v != nil { + bs40 = testMarshalErr(v40v3, h, t, "enc-map-v40-custom") + testUnmarshalErr(v40v4, bs40, h, t, "dec-map-v40-p-len") + testDeepEqualErr(v40v3, v40v4, t, "equal-map-v40-p-len") + } } - for _, v := range []map[string]float64{nil, {}, {"some-string-2": 0, "some-string-3": 11.1}} { // fmt.Printf(">>>> running mammoth map v41: %v\n", v) var v41v1, v41v2 map[string]float64 + var bs41 []byte v41v1 = v - bs41 := testMarshalErr(v41v1, h, t, "enc-map-v41") - if v == nil { - v41v2 = nil - } else { - v41v2 = make(map[string]float64, len(v)) - } // reset map - testUnmarshalErr(v41v2, bs41, h, t, "dec-map-v41") - testDeepEqualErr(v41v1, v41v2, t, "equal-map-v41") - if v == nil { - v41v2 = nil - } else { - v41v2 = make(map[string]float64, len(v)) - } // reset map - testUnmarshalErr(reflect.ValueOf(v41v2), bs41, h, t, "dec-map-v41-noaddr") // decode into non-addressable map value - testDeepEqualErr(v41v1, v41v2, t, "equal-map-v41-noaddr") + bs41 = testMarshalErr(v41v1, h, t, "enc-map-v41") + if v != nil { + if v == nil { + v41v2 = nil + } else { + v41v2 = make(map[string]float64, len(v)) + } // reset map + testUnmarshalErr(v41v2, bs41, h, t, "dec-map-v41") + testDeepEqualErr(v41v1, v41v2, t, "equal-map-v41") + if v == nil { + v41v2 = nil + } else { + v41v2 = make(map[string]float64, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v41v2), bs41, h, t, "dec-map-v41-noaddr") // decode into non-addressable map value + testDeepEqualErr(v41v1, v41v2, t, "equal-map-v41-noaddr") + } if v == nil { v41v2 = nil } else { @@ -1715,30 +1813,34 @@ func doTestMammothMaps(t *testing.T, h Handle) { var v41v3, v41v4 typMapMapStringFloat64 v41v3 = typMapMapStringFloat64(v41v1) v41v4 = typMapMapStringFloat64(v41v2) - bs41 = testMarshalErr(v41v3, h, t, "enc-map-v41-custom") - testUnmarshalErr(v41v4, bs41, h, t, "dec-map-v41-p-len") - testDeepEqualErr(v41v3, v41v4, t, "equal-map-v41-p-len") + if v != nil { + bs41 = testMarshalErr(v41v3, h, t, "enc-map-v41-custom") + testUnmarshalErr(v41v4, bs41, h, t, "dec-map-v41-p-len") + testDeepEqualErr(v41v3, v41v4, t, "equal-map-v41-p-len") + } } - for _, v := range []map[string]bool{nil, {}, {"some-string-1": false, "some-string-2": true}} { // fmt.Printf(">>>> running mammoth map v42: %v\n", v) var v42v1, v42v2 map[string]bool + var bs42 []byte v42v1 = v - bs42 := testMarshalErr(v42v1, h, t, "enc-map-v42") - if v == nil { - v42v2 = nil - } else { - v42v2 = make(map[string]bool, len(v)) - } // reset map - testUnmarshalErr(v42v2, bs42, h, t, "dec-map-v42") - testDeepEqualErr(v42v1, v42v2, t, "equal-map-v42") - if v == nil { - v42v2 = nil - } else { - v42v2 = make(map[string]bool, len(v)) - } // reset map - testUnmarshalErr(reflect.ValueOf(v42v2), bs42, h, t, "dec-map-v42-noaddr") // decode into non-addressable map value - testDeepEqualErr(v42v1, v42v2, t, "equal-map-v42-noaddr") + bs42 = testMarshalErr(v42v1, h, t, "enc-map-v42") + if v != nil { + if v == nil { + v42v2 = nil + } else { + v42v2 = make(map[string]bool, len(v)) + } // reset map + testUnmarshalErr(v42v2, bs42, h, t, "dec-map-v42") + testDeepEqualErr(v42v1, v42v2, t, "equal-map-v42") + if v == nil { + v42v2 = nil + } else { + v42v2 = make(map[string]bool, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v42v2), bs42, h, t, "dec-map-v42-noaddr") // decode into non-addressable map value + testDeepEqualErr(v42v1, v42v2, t, "equal-map-v42-noaddr") + } if v == nil { v42v2 = nil } else { @@ -1759,30 +1861,34 @@ func doTestMammothMaps(t *testing.T, h Handle) { var v42v3, v42v4 typMapMapStringBool v42v3 = typMapMapStringBool(v42v1) v42v4 = typMapMapStringBool(v42v2) - bs42 = testMarshalErr(v42v3, h, t, "enc-map-v42-custom") - testUnmarshalErr(v42v4, bs42, h, t, "dec-map-v42-p-len") - testDeepEqualErr(v42v3, v42v4, t, "equal-map-v42-p-len") + if v != nil { + bs42 = testMarshalErr(v42v3, h, t, "enc-map-v42-custom") + testUnmarshalErr(v42v4, bs42, h, t, "dec-map-v42-p-len") + testDeepEqualErr(v42v3, v42v4, t, "equal-map-v42-p-len") + } } - for _, v := range []map[uint]interface{}{nil, {}, {111: nil, 77: "string-is-an-interface-2"}} { // fmt.Printf(">>>> running mammoth map v43: %v\n", v) var v43v1, v43v2 map[uint]interface{} + var bs43 []byte v43v1 = v - bs43 := testMarshalErr(v43v1, h, t, "enc-map-v43") - if v == nil { - v43v2 = nil - } else { - v43v2 = make(map[uint]interface{}, len(v)) - } // reset map - testUnmarshalErr(v43v2, bs43, h, t, "dec-map-v43") - testDeepEqualErr(v43v1, v43v2, t, "equal-map-v43") - if v == nil { - v43v2 = nil - } else { - v43v2 = make(map[uint]interface{}, len(v)) - } // reset map - testUnmarshalErr(reflect.ValueOf(v43v2), bs43, h, t, "dec-map-v43-noaddr") // decode into non-addressable map value - testDeepEqualErr(v43v1, v43v2, t, "equal-map-v43-noaddr") + bs43 = testMarshalErr(v43v1, h, t, "enc-map-v43") + if v != nil { + if v == nil { + v43v2 = nil + } else { + v43v2 = make(map[uint]interface{}, len(v)) + } // reset map + testUnmarshalErr(v43v2, bs43, h, t, "dec-map-v43") + testDeepEqualErr(v43v1, v43v2, t, "equal-map-v43") + if v == nil { + v43v2 = nil + } else { + v43v2 = make(map[uint]interface{}, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v43v2), bs43, h, t, "dec-map-v43-noaddr") // decode into non-addressable map value + testDeepEqualErr(v43v1, v43v2, t, "equal-map-v43-noaddr") + } if v == nil { v43v2 = nil } else { @@ -1803,30 +1909,34 @@ func doTestMammothMaps(t *testing.T, h Handle) { var v43v3, v43v4 typMapMapUintIntf v43v3 = typMapMapUintIntf(v43v1) v43v4 = typMapMapUintIntf(v43v2) - bs43 = testMarshalErr(v43v3, h, t, "enc-map-v43-custom") - testUnmarshalErr(v43v4, bs43, h, t, "dec-map-v43-p-len") - testDeepEqualErr(v43v3, v43v4, t, "equal-map-v43-p-len") + if v != nil { + bs43 = testMarshalErr(v43v3, h, t, "enc-map-v43-custom") + testUnmarshalErr(v43v4, bs43, h, t, "dec-map-v43-p-len") + testDeepEqualErr(v43v3, v43v4, t, "equal-map-v43-p-len") + } } - for _, v := range []map[uint]string{nil, {}, {127: "", 111: "some-string-3"}} { // fmt.Printf(">>>> running mammoth map v44: %v\n", v) var v44v1, v44v2 map[uint]string + var bs44 []byte v44v1 = v - bs44 := testMarshalErr(v44v1, h, t, "enc-map-v44") - if v == nil { - v44v2 = nil - } else { - v44v2 = make(map[uint]string, len(v)) - } // reset map - testUnmarshalErr(v44v2, bs44, h, t, "dec-map-v44") - testDeepEqualErr(v44v1, v44v2, t, "equal-map-v44") - if v == nil { - v44v2 = nil - } else { - v44v2 = make(map[uint]string, len(v)) - } // reset map - testUnmarshalErr(reflect.ValueOf(v44v2), bs44, h, t, "dec-map-v44-noaddr") // decode into non-addressable map value - testDeepEqualErr(v44v1, v44v2, t, "equal-map-v44-noaddr") + bs44 = testMarshalErr(v44v1, h, t, "enc-map-v44") + if v != nil { + if v == nil { + v44v2 = nil + } else { + v44v2 = make(map[uint]string, len(v)) + } // reset map + testUnmarshalErr(v44v2, bs44, h, t, "dec-map-v44") + testDeepEqualErr(v44v1, v44v2, t, "equal-map-v44") + if v == nil { + v44v2 = nil + } else { + v44v2 = make(map[uint]string, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v44v2), bs44, h, t, "dec-map-v44-noaddr") // decode into non-addressable map value + testDeepEqualErr(v44v1, v44v2, t, "equal-map-v44-noaddr") + } if v == nil { v44v2 = nil } else { @@ -1847,30 +1957,34 @@ func doTestMammothMaps(t *testing.T, h Handle) { var v44v3, v44v4 typMapMapUintString v44v3 = typMapMapUintString(v44v1) v44v4 = typMapMapUintString(v44v2) - bs44 = testMarshalErr(v44v3, h, t, "enc-map-v44-custom") - testUnmarshalErr(v44v4, bs44, h, t, "dec-map-v44-p-len") - testDeepEqualErr(v44v3, v44v4, t, "equal-map-v44-p-len") + if v != nil { + bs44 = testMarshalErr(v44v3, h, t, "enc-map-v44-custom") + testUnmarshalErr(v44v4, bs44, h, t, "dec-map-v44-p-len") + testDeepEqualErr(v44v3, v44v4, t, "equal-map-v44-p-len") + } } - for _, v := range []map[uint][]byte{nil, {}, {77: nil, 127: []byte("some-string-2")}} { // fmt.Printf(">>>> running mammoth map v45: %v\n", v) var v45v1, v45v2 map[uint][]byte + var bs45 []byte v45v1 = v - bs45 := testMarshalErr(v45v1, h, t, "enc-map-v45") - if v == nil { - v45v2 = nil - } else { - v45v2 = make(map[uint][]byte, len(v)) - } // reset map - testUnmarshalErr(v45v2, bs45, h, t, "dec-map-v45") - testDeepEqualErr(v45v1, v45v2, t, "equal-map-v45") - if v == nil { - v45v2 = nil - } else { - v45v2 = make(map[uint][]byte, len(v)) - } // reset map - testUnmarshalErr(reflect.ValueOf(v45v2), bs45, h, t, "dec-map-v45-noaddr") // decode into non-addressable map value - testDeepEqualErr(v45v1, v45v2, t, "equal-map-v45-noaddr") + bs45 = testMarshalErr(v45v1, h, t, "enc-map-v45") + if v != nil { + if v == nil { + v45v2 = nil + } else { + v45v2 = make(map[uint][]byte, len(v)) + } // reset map + testUnmarshalErr(v45v2, bs45, h, t, "dec-map-v45") + testDeepEqualErr(v45v1, v45v2, t, "equal-map-v45") + if v == nil { + v45v2 = nil + } else { + v45v2 = make(map[uint][]byte, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v45v2), bs45, h, t, "dec-map-v45-noaddr") // decode into non-addressable map value + testDeepEqualErr(v45v1, v45v2, t, "equal-map-v45-noaddr") + } if v == nil { v45v2 = nil } else { @@ -1891,30 +2005,34 @@ func doTestMammothMaps(t *testing.T, h Handle) { var v45v3, v45v4 typMapMapUintBytes v45v3 = typMapMapUintBytes(v45v1) v45v4 = typMapMapUintBytes(v45v2) - bs45 = testMarshalErr(v45v3, h, t, "enc-map-v45-custom") - testUnmarshalErr(v45v4, bs45, h, t, "dec-map-v45-p-len") - testDeepEqualErr(v45v3, v45v4, t, "equal-map-v45-p-len") + if v != nil { + bs45 = testMarshalErr(v45v3, h, t, "enc-map-v45-custom") + testUnmarshalErr(v45v4, bs45, h, t, "dec-map-v45-p-len") + testDeepEqualErr(v45v3, v45v4, t, "equal-map-v45-p-len") + } } - for _, v := range []map[uint]uint{nil, {}, {111: 0, 77: 127}} { // fmt.Printf(">>>> running mammoth map v46: %v\n", v) var v46v1, v46v2 map[uint]uint + var bs46 []byte v46v1 = v - bs46 := testMarshalErr(v46v1, h, t, "enc-map-v46") - if v == nil { - v46v2 = nil - } else { - v46v2 = make(map[uint]uint, len(v)) - } // reset map - testUnmarshalErr(v46v2, bs46, h, t, "dec-map-v46") - testDeepEqualErr(v46v1, v46v2, t, "equal-map-v46") - if v == nil { - v46v2 = nil - } else { - v46v2 = make(map[uint]uint, len(v)) - } // reset map - testUnmarshalErr(reflect.ValueOf(v46v2), bs46, h, t, "dec-map-v46-noaddr") // decode into non-addressable map value - testDeepEqualErr(v46v1, v46v2, t, "equal-map-v46-noaddr") + bs46 = testMarshalErr(v46v1, h, t, "enc-map-v46") + if v != nil { + if v == nil { + v46v2 = nil + } else { + v46v2 = make(map[uint]uint, len(v)) + } // reset map + testUnmarshalErr(v46v2, bs46, h, t, "dec-map-v46") + testDeepEqualErr(v46v1, v46v2, t, "equal-map-v46") + if v == nil { + v46v2 = nil + } else { + v46v2 = make(map[uint]uint, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v46v2), bs46, h, t, "dec-map-v46-noaddr") // decode into non-addressable map value + testDeepEqualErr(v46v1, v46v2, t, "equal-map-v46-noaddr") + } if v == nil { v46v2 = nil } else { @@ -1935,30 +2053,34 @@ func doTestMammothMaps(t *testing.T, h Handle) { var v46v3, v46v4 typMapMapUintUint v46v3 = typMapMapUintUint(v46v1) v46v4 = typMapMapUintUint(v46v2) - bs46 = testMarshalErr(v46v3, h, t, "enc-map-v46-custom") - testUnmarshalErr(v46v4, bs46, h, t, "dec-map-v46-p-len") - testDeepEqualErr(v46v3, v46v4, t, "equal-map-v46-p-len") + if v != nil { + bs46 = testMarshalErr(v46v3, h, t, "enc-map-v46-custom") + testUnmarshalErr(v46v4, bs46, h, t, "dec-map-v46-p-len") + testDeepEqualErr(v46v3, v46v4, t, "equal-map-v46-p-len") + } } - for _, v := range []map[uint]uint8{nil, {}, {111: 0, 77: 127}} { // fmt.Printf(">>>> running mammoth map v47: %v\n", v) var v47v1, v47v2 map[uint]uint8 + var bs47 []byte v47v1 = v - bs47 := testMarshalErr(v47v1, h, t, "enc-map-v47") - if v == nil { - v47v2 = nil - } else { - v47v2 = make(map[uint]uint8, len(v)) - } // reset map - testUnmarshalErr(v47v2, bs47, h, t, "dec-map-v47") - testDeepEqualErr(v47v1, v47v2, t, "equal-map-v47") - if v == nil { - v47v2 = nil - } else { - v47v2 = make(map[uint]uint8, len(v)) - } // reset map - testUnmarshalErr(reflect.ValueOf(v47v2), bs47, h, t, "dec-map-v47-noaddr") // decode into non-addressable map value - testDeepEqualErr(v47v1, v47v2, t, "equal-map-v47-noaddr") + bs47 = testMarshalErr(v47v1, h, t, "enc-map-v47") + if v != nil { + if v == nil { + v47v2 = nil + } else { + v47v2 = make(map[uint]uint8, len(v)) + } // reset map + testUnmarshalErr(v47v2, bs47, h, t, "dec-map-v47") + testDeepEqualErr(v47v1, v47v2, t, "equal-map-v47") + if v == nil { + v47v2 = nil + } else { + v47v2 = make(map[uint]uint8, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v47v2), bs47, h, t, "dec-map-v47-noaddr") // decode into non-addressable map value + testDeepEqualErr(v47v1, v47v2, t, "equal-map-v47-noaddr") + } if v == nil { v47v2 = nil } else { @@ -1979,30 +2101,34 @@ func doTestMammothMaps(t *testing.T, h Handle) { var v47v3, v47v4 typMapMapUintUint8 v47v3 = typMapMapUintUint8(v47v1) v47v4 = typMapMapUintUint8(v47v2) - bs47 = testMarshalErr(v47v3, h, t, "enc-map-v47-custom") - testUnmarshalErr(v47v4, bs47, h, t, "dec-map-v47-p-len") - testDeepEqualErr(v47v3, v47v4, t, "equal-map-v47-p-len") + if v != nil { + bs47 = testMarshalErr(v47v3, h, t, "enc-map-v47-custom") + testUnmarshalErr(v47v4, bs47, h, t, "dec-map-v47-p-len") + testDeepEqualErr(v47v3, v47v4, t, "equal-map-v47-p-len") + } } - for _, v := range []map[uint]uint64{nil, {}, {111: 0, 77: 127}} { // fmt.Printf(">>>> running mammoth map v48: %v\n", v) var v48v1, v48v2 map[uint]uint64 + var bs48 []byte v48v1 = v - bs48 := testMarshalErr(v48v1, h, t, "enc-map-v48") - if v == nil { - v48v2 = nil - } else { - v48v2 = make(map[uint]uint64, len(v)) - } // reset map - testUnmarshalErr(v48v2, bs48, h, t, "dec-map-v48") - testDeepEqualErr(v48v1, v48v2, t, "equal-map-v48") - if v == nil { - v48v2 = nil - } else { - v48v2 = make(map[uint]uint64, len(v)) - } // reset map - testUnmarshalErr(reflect.ValueOf(v48v2), bs48, h, t, "dec-map-v48-noaddr") // decode into non-addressable map value - testDeepEqualErr(v48v1, v48v2, t, "equal-map-v48-noaddr") + bs48 = testMarshalErr(v48v1, h, t, "enc-map-v48") + if v != nil { + if v == nil { + v48v2 = nil + } else { + v48v2 = make(map[uint]uint64, len(v)) + } // reset map + testUnmarshalErr(v48v2, bs48, h, t, "dec-map-v48") + testDeepEqualErr(v48v1, v48v2, t, "equal-map-v48") + if v == nil { + v48v2 = nil + } else { + v48v2 = make(map[uint]uint64, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v48v2), bs48, h, t, "dec-map-v48-noaddr") // decode into non-addressable map value + testDeepEqualErr(v48v1, v48v2, t, "equal-map-v48-noaddr") + } if v == nil { v48v2 = nil } else { @@ -2023,30 +2149,34 @@ func doTestMammothMaps(t *testing.T, h Handle) { var v48v3, v48v4 typMapMapUintUint64 v48v3 = typMapMapUintUint64(v48v1) v48v4 = typMapMapUintUint64(v48v2) - bs48 = testMarshalErr(v48v3, h, t, "enc-map-v48-custom") - testUnmarshalErr(v48v4, bs48, h, t, "dec-map-v48-p-len") - testDeepEqualErr(v48v3, v48v4, t, "equal-map-v48-p-len") + if v != nil { + bs48 = testMarshalErr(v48v3, h, t, "enc-map-v48-custom") + testUnmarshalErr(v48v4, bs48, h, t, "dec-map-v48-p-len") + testDeepEqualErr(v48v3, v48v4, t, "equal-map-v48-p-len") + } } - for _, v := range []map[uint]int{nil, {}, {111: 0, 77: 127}} { // fmt.Printf(">>>> running mammoth map v49: %v\n", v) var v49v1, v49v2 map[uint]int + var bs49 []byte v49v1 = v - bs49 := testMarshalErr(v49v1, h, t, "enc-map-v49") - if v == nil { - v49v2 = nil - } else { - v49v2 = make(map[uint]int, len(v)) - } // reset map - testUnmarshalErr(v49v2, bs49, h, t, "dec-map-v49") - testDeepEqualErr(v49v1, v49v2, t, "equal-map-v49") - if v == nil { - v49v2 = nil - } else { - v49v2 = make(map[uint]int, len(v)) - } // reset map - testUnmarshalErr(reflect.ValueOf(v49v2), bs49, h, t, "dec-map-v49-noaddr") // decode into non-addressable map value - testDeepEqualErr(v49v1, v49v2, t, "equal-map-v49-noaddr") + bs49 = testMarshalErr(v49v1, h, t, "enc-map-v49") + if v != nil { + if v == nil { + v49v2 = nil + } else { + v49v2 = make(map[uint]int, len(v)) + } // reset map + testUnmarshalErr(v49v2, bs49, h, t, "dec-map-v49") + testDeepEqualErr(v49v1, v49v2, t, "equal-map-v49") + if v == nil { + v49v2 = nil + } else { + v49v2 = make(map[uint]int, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v49v2), bs49, h, t, "dec-map-v49-noaddr") // decode into non-addressable map value + testDeepEqualErr(v49v1, v49v2, t, "equal-map-v49-noaddr") + } if v == nil { v49v2 = nil } else { @@ -2067,30 +2197,34 @@ func doTestMammothMaps(t *testing.T, h Handle) { var v49v3, v49v4 typMapMapUintInt v49v3 = typMapMapUintInt(v49v1) v49v4 = typMapMapUintInt(v49v2) - bs49 = testMarshalErr(v49v3, h, t, "enc-map-v49-custom") - testUnmarshalErr(v49v4, bs49, h, t, "dec-map-v49-p-len") - testDeepEqualErr(v49v3, v49v4, t, "equal-map-v49-p-len") + if v != nil { + bs49 = testMarshalErr(v49v3, h, t, "enc-map-v49-custom") + testUnmarshalErr(v49v4, bs49, h, t, "dec-map-v49-p-len") + testDeepEqualErr(v49v3, v49v4, t, "equal-map-v49-p-len") + } } - for _, v := range []map[uint]int64{nil, {}, {111: 0, 77: 127}} { // fmt.Printf(">>>> running mammoth map v50: %v\n", v) var v50v1, v50v2 map[uint]int64 + var bs50 []byte v50v1 = v - bs50 := testMarshalErr(v50v1, h, t, "enc-map-v50") - if v == nil { - v50v2 = nil - } else { - v50v2 = make(map[uint]int64, len(v)) - } // reset map - testUnmarshalErr(v50v2, bs50, h, t, "dec-map-v50") - testDeepEqualErr(v50v1, v50v2, t, "equal-map-v50") - if v == nil { - v50v2 = nil - } else { - v50v2 = make(map[uint]int64, len(v)) - } // reset map - testUnmarshalErr(reflect.ValueOf(v50v2), bs50, h, t, "dec-map-v50-noaddr") // decode into non-addressable map value - testDeepEqualErr(v50v1, v50v2, t, "equal-map-v50-noaddr") + bs50 = testMarshalErr(v50v1, h, t, "enc-map-v50") + if v != nil { + if v == nil { + v50v2 = nil + } else { + v50v2 = make(map[uint]int64, len(v)) + } // reset map + testUnmarshalErr(v50v2, bs50, h, t, "dec-map-v50") + testDeepEqualErr(v50v1, v50v2, t, "equal-map-v50") + if v == nil { + v50v2 = nil + } else { + v50v2 = make(map[uint]int64, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v50v2), bs50, h, t, "dec-map-v50-noaddr") // decode into non-addressable map value + testDeepEqualErr(v50v1, v50v2, t, "equal-map-v50-noaddr") + } if v == nil { v50v2 = nil } else { @@ -2111,30 +2245,34 @@ func doTestMammothMaps(t *testing.T, h Handle) { var v50v3, v50v4 typMapMapUintInt64 v50v3 = typMapMapUintInt64(v50v1) v50v4 = typMapMapUintInt64(v50v2) - bs50 = testMarshalErr(v50v3, h, t, "enc-map-v50-custom") - testUnmarshalErr(v50v4, bs50, h, t, "dec-map-v50-p-len") - testDeepEqualErr(v50v3, v50v4, t, "equal-map-v50-p-len") + if v != nil { + bs50 = testMarshalErr(v50v3, h, t, "enc-map-v50-custom") + testUnmarshalErr(v50v4, bs50, h, t, "dec-map-v50-p-len") + testDeepEqualErr(v50v3, v50v4, t, "equal-map-v50-p-len") + } } - for _, v := range []map[uint]float32{nil, {}, {111: 0, 77: 22.2}} { // fmt.Printf(">>>> running mammoth map v51: %v\n", v) var v51v1, v51v2 map[uint]float32 + var bs51 []byte v51v1 = v - bs51 := testMarshalErr(v51v1, h, t, "enc-map-v51") - if v == nil { - v51v2 = nil - } else { - v51v2 = make(map[uint]float32, len(v)) - } // reset map - testUnmarshalErr(v51v2, bs51, h, t, "dec-map-v51") - testDeepEqualErr(v51v1, v51v2, t, "equal-map-v51") - if v == nil { - v51v2 = nil - } else { - v51v2 = make(map[uint]float32, len(v)) - } // reset map - testUnmarshalErr(reflect.ValueOf(v51v2), bs51, h, t, "dec-map-v51-noaddr") // decode into non-addressable map value - testDeepEqualErr(v51v1, v51v2, t, "equal-map-v51-noaddr") + bs51 = testMarshalErr(v51v1, h, t, "enc-map-v51") + if v != nil { + if v == nil { + v51v2 = nil + } else { + v51v2 = make(map[uint]float32, len(v)) + } // reset map + testUnmarshalErr(v51v2, bs51, h, t, "dec-map-v51") + testDeepEqualErr(v51v1, v51v2, t, "equal-map-v51") + if v == nil { + v51v2 = nil + } else { + v51v2 = make(map[uint]float32, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v51v2), bs51, h, t, "dec-map-v51-noaddr") // decode into non-addressable map value + testDeepEqualErr(v51v1, v51v2, t, "equal-map-v51-noaddr") + } if v == nil { v51v2 = nil } else { @@ -2155,30 +2293,34 @@ func doTestMammothMaps(t *testing.T, h Handle) { var v51v3, v51v4 typMapMapUintFloat32 v51v3 = typMapMapUintFloat32(v51v1) v51v4 = typMapMapUintFloat32(v51v2) - bs51 = testMarshalErr(v51v3, h, t, "enc-map-v51-custom") - testUnmarshalErr(v51v4, bs51, h, t, "dec-map-v51-p-len") - testDeepEqualErr(v51v3, v51v4, t, "equal-map-v51-p-len") + if v != nil { + bs51 = testMarshalErr(v51v3, h, t, "enc-map-v51-custom") + testUnmarshalErr(v51v4, bs51, h, t, "dec-map-v51-p-len") + testDeepEqualErr(v51v3, v51v4, t, "equal-map-v51-p-len") + } } - for _, v := range []map[uint]float64{nil, {}, {127: 0, 111: 33.3e3}} { // fmt.Printf(">>>> running mammoth map v52: %v\n", v) var v52v1, v52v2 map[uint]float64 + var bs52 []byte v52v1 = v - bs52 := testMarshalErr(v52v1, h, t, "enc-map-v52") - if v == nil { - v52v2 = nil - } else { - v52v2 = make(map[uint]float64, len(v)) - } // reset map - testUnmarshalErr(v52v2, bs52, h, t, "dec-map-v52") - testDeepEqualErr(v52v1, v52v2, t, "equal-map-v52") - if v == nil { - v52v2 = nil - } else { - v52v2 = make(map[uint]float64, len(v)) - } // reset map - testUnmarshalErr(reflect.ValueOf(v52v2), bs52, h, t, "dec-map-v52-noaddr") // decode into non-addressable map value - testDeepEqualErr(v52v1, v52v2, t, "equal-map-v52-noaddr") + bs52 = testMarshalErr(v52v1, h, t, "enc-map-v52") + if v != nil { + if v == nil { + v52v2 = nil + } else { + v52v2 = make(map[uint]float64, len(v)) + } // reset map + testUnmarshalErr(v52v2, bs52, h, t, "dec-map-v52") + testDeepEqualErr(v52v1, v52v2, t, "equal-map-v52") + if v == nil { + v52v2 = nil + } else { + v52v2 = make(map[uint]float64, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v52v2), bs52, h, t, "dec-map-v52-noaddr") // decode into non-addressable map value + testDeepEqualErr(v52v1, v52v2, t, "equal-map-v52-noaddr") + } if v == nil { v52v2 = nil } else { @@ -2199,30 +2341,34 @@ func doTestMammothMaps(t *testing.T, h Handle) { var v52v3, v52v4 typMapMapUintFloat64 v52v3 = typMapMapUintFloat64(v52v1) v52v4 = typMapMapUintFloat64(v52v2) - bs52 = testMarshalErr(v52v3, h, t, "enc-map-v52-custom") - testUnmarshalErr(v52v4, bs52, h, t, "dec-map-v52-p-len") - testDeepEqualErr(v52v3, v52v4, t, "equal-map-v52-p-len") + if v != nil { + bs52 = testMarshalErr(v52v3, h, t, "enc-map-v52-custom") + testUnmarshalErr(v52v4, bs52, h, t, "dec-map-v52-p-len") + testDeepEqualErr(v52v3, v52v4, t, "equal-map-v52-p-len") + } } - for _, v := range []map[uint]bool{nil, {}, {77: false, 127: false}} { // fmt.Printf(">>>> running mammoth map v53: %v\n", v) var v53v1, v53v2 map[uint]bool + var bs53 []byte v53v1 = v - bs53 := testMarshalErr(v53v1, h, t, "enc-map-v53") - if v == nil { - v53v2 = nil - } else { - v53v2 = make(map[uint]bool, len(v)) - } // reset map - testUnmarshalErr(v53v2, bs53, h, t, "dec-map-v53") - testDeepEqualErr(v53v1, v53v2, t, "equal-map-v53") - if v == nil { - v53v2 = nil - } else { - v53v2 = make(map[uint]bool, len(v)) - } // reset map - testUnmarshalErr(reflect.ValueOf(v53v2), bs53, h, t, "dec-map-v53-noaddr") // decode into non-addressable map value - testDeepEqualErr(v53v1, v53v2, t, "equal-map-v53-noaddr") + bs53 = testMarshalErr(v53v1, h, t, "enc-map-v53") + if v != nil { + if v == nil { + v53v2 = nil + } else { + v53v2 = make(map[uint]bool, len(v)) + } // reset map + testUnmarshalErr(v53v2, bs53, h, t, "dec-map-v53") + testDeepEqualErr(v53v1, v53v2, t, "equal-map-v53") + if v == nil { + v53v2 = nil + } else { + v53v2 = make(map[uint]bool, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v53v2), bs53, h, t, "dec-map-v53-noaddr") // decode into non-addressable map value + testDeepEqualErr(v53v1, v53v2, t, "equal-map-v53-noaddr") + } if v == nil { v53v2 = nil } else { @@ -2243,30 +2389,34 @@ func doTestMammothMaps(t *testing.T, h Handle) { var v53v3, v53v4 typMapMapUintBool v53v3 = typMapMapUintBool(v53v1) v53v4 = typMapMapUintBool(v53v2) - bs53 = testMarshalErr(v53v3, h, t, "enc-map-v53-custom") - testUnmarshalErr(v53v4, bs53, h, t, "dec-map-v53-p-len") - testDeepEqualErr(v53v3, v53v4, t, "equal-map-v53-p-len") + if v != nil { + bs53 = testMarshalErr(v53v3, h, t, "enc-map-v53-custom") + testUnmarshalErr(v53v4, bs53, h, t, "dec-map-v53-p-len") + testDeepEqualErr(v53v3, v53v4, t, "equal-map-v53-p-len") + } } - for _, v := range []map[uint8]interface{}{nil, {}, {111: nil, 77: "string-is-an-interface-3"}} { // fmt.Printf(">>>> running mammoth map v54: %v\n", v) var v54v1, v54v2 map[uint8]interface{} + var bs54 []byte v54v1 = v - bs54 := testMarshalErr(v54v1, h, t, "enc-map-v54") - if v == nil { - v54v2 = nil - } else { - v54v2 = make(map[uint8]interface{}, len(v)) - } // reset map - testUnmarshalErr(v54v2, bs54, h, t, "dec-map-v54") - testDeepEqualErr(v54v1, v54v2, t, "equal-map-v54") - if v == nil { - v54v2 = nil - } else { - v54v2 = make(map[uint8]interface{}, len(v)) - } // reset map - testUnmarshalErr(reflect.ValueOf(v54v2), bs54, h, t, "dec-map-v54-noaddr") // decode into non-addressable map value - testDeepEqualErr(v54v1, v54v2, t, "equal-map-v54-noaddr") + bs54 = testMarshalErr(v54v1, h, t, "enc-map-v54") + if v != nil { + if v == nil { + v54v2 = nil + } else { + v54v2 = make(map[uint8]interface{}, len(v)) + } // reset map + testUnmarshalErr(v54v2, bs54, h, t, "dec-map-v54") + testDeepEqualErr(v54v1, v54v2, t, "equal-map-v54") + if v == nil { + v54v2 = nil + } else { + v54v2 = make(map[uint8]interface{}, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v54v2), bs54, h, t, "dec-map-v54-noaddr") // decode into non-addressable map value + testDeepEqualErr(v54v1, v54v2, t, "equal-map-v54-noaddr") + } if v == nil { v54v2 = nil } else { @@ -2287,30 +2437,34 @@ func doTestMammothMaps(t *testing.T, h Handle) { var v54v3, v54v4 typMapMapUint8Intf v54v3 = typMapMapUint8Intf(v54v1) v54v4 = typMapMapUint8Intf(v54v2) - bs54 = testMarshalErr(v54v3, h, t, "enc-map-v54-custom") - testUnmarshalErr(v54v4, bs54, h, t, "dec-map-v54-p-len") - testDeepEqualErr(v54v3, v54v4, t, "equal-map-v54-p-len") + if v != nil { + bs54 = testMarshalErr(v54v3, h, t, "enc-map-v54-custom") + testUnmarshalErr(v54v4, bs54, h, t, "dec-map-v54-p-len") + testDeepEqualErr(v54v3, v54v4, t, "equal-map-v54-p-len") + } } - for _, v := range []map[uint8]string{nil, {}, {127: "", 111: "some-string-1"}} { // fmt.Printf(">>>> running mammoth map v55: %v\n", v) var v55v1, v55v2 map[uint8]string + var bs55 []byte v55v1 = v - bs55 := testMarshalErr(v55v1, h, t, "enc-map-v55") - if v == nil { - v55v2 = nil - } else { - v55v2 = make(map[uint8]string, len(v)) - } // reset map - testUnmarshalErr(v55v2, bs55, h, t, "dec-map-v55") - testDeepEqualErr(v55v1, v55v2, t, "equal-map-v55") - if v == nil { - v55v2 = nil - } else { - v55v2 = make(map[uint8]string, len(v)) - } // reset map - testUnmarshalErr(reflect.ValueOf(v55v2), bs55, h, t, "dec-map-v55-noaddr") // decode into non-addressable map value - testDeepEqualErr(v55v1, v55v2, t, "equal-map-v55-noaddr") + bs55 = testMarshalErr(v55v1, h, t, "enc-map-v55") + if v != nil { + if v == nil { + v55v2 = nil + } else { + v55v2 = make(map[uint8]string, len(v)) + } // reset map + testUnmarshalErr(v55v2, bs55, h, t, "dec-map-v55") + testDeepEqualErr(v55v1, v55v2, t, "equal-map-v55") + if v == nil { + v55v2 = nil + } else { + v55v2 = make(map[uint8]string, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v55v2), bs55, h, t, "dec-map-v55-noaddr") // decode into non-addressable map value + testDeepEqualErr(v55v1, v55v2, t, "equal-map-v55-noaddr") + } if v == nil { v55v2 = nil } else { @@ -2331,30 +2485,34 @@ func doTestMammothMaps(t *testing.T, h Handle) { var v55v3, v55v4 typMapMapUint8String v55v3 = typMapMapUint8String(v55v1) v55v4 = typMapMapUint8String(v55v2) - bs55 = testMarshalErr(v55v3, h, t, "enc-map-v55-custom") - testUnmarshalErr(v55v4, bs55, h, t, "dec-map-v55-p-len") - testDeepEqualErr(v55v3, v55v4, t, "equal-map-v55-p-len") + if v != nil { + bs55 = testMarshalErr(v55v3, h, t, "enc-map-v55-custom") + testUnmarshalErr(v55v4, bs55, h, t, "dec-map-v55-p-len") + testDeepEqualErr(v55v3, v55v4, t, "equal-map-v55-p-len") + } } - for _, v := range []map[uint8][]byte{nil, {}, {77: nil, 127: []byte("some-string-3")}} { // fmt.Printf(">>>> running mammoth map v56: %v\n", v) var v56v1, v56v2 map[uint8][]byte + var bs56 []byte v56v1 = v - bs56 := testMarshalErr(v56v1, h, t, "enc-map-v56") - if v == nil { - v56v2 = nil - } else { - v56v2 = make(map[uint8][]byte, len(v)) - } // reset map - testUnmarshalErr(v56v2, bs56, h, t, "dec-map-v56") - testDeepEqualErr(v56v1, v56v2, t, "equal-map-v56") - if v == nil { - v56v2 = nil - } else { - v56v2 = make(map[uint8][]byte, len(v)) - } // reset map - testUnmarshalErr(reflect.ValueOf(v56v2), bs56, h, t, "dec-map-v56-noaddr") // decode into non-addressable map value - testDeepEqualErr(v56v1, v56v2, t, "equal-map-v56-noaddr") + bs56 = testMarshalErr(v56v1, h, t, "enc-map-v56") + if v != nil { + if v == nil { + v56v2 = nil + } else { + v56v2 = make(map[uint8][]byte, len(v)) + } // reset map + testUnmarshalErr(v56v2, bs56, h, t, "dec-map-v56") + testDeepEqualErr(v56v1, v56v2, t, "equal-map-v56") + if v == nil { + v56v2 = nil + } else { + v56v2 = make(map[uint8][]byte, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v56v2), bs56, h, t, "dec-map-v56-noaddr") // decode into non-addressable map value + testDeepEqualErr(v56v1, v56v2, t, "equal-map-v56-noaddr") + } if v == nil { v56v2 = nil } else { @@ -2375,30 +2533,34 @@ func doTestMammothMaps(t *testing.T, h Handle) { var v56v3, v56v4 typMapMapUint8Bytes v56v3 = typMapMapUint8Bytes(v56v1) v56v4 = typMapMapUint8Bytes(v56v2) - bs56 = testMarshalErr(v56v3, h, t, "enc-map-v56-custom") - testUnmarshalErr(v56v4, bs56, h, t, "dec-map-v56-p-len") - testDeepEqualErr(v56v3, v56v4, t, "equal-map-v56-p-len") + if v != nil { + bs56 = testMarshalErr(v56v3, h, t, "enc-map-v56-custom") + testUnmarshalErr(v56v4, bs56, h, t, "dec-map-v56-p-len") + testDeepEqualErr(v56v3, v56v4, t, "equal-map-v56-p-len") + } } - for _, v := range []map[uint8]uint{nil, {}, {111: 0, 77: 127}} { // fmt.Printf(">>>> running mammoth map v57: %v\n", v) var v57v1, v57v2 map[uint8]uint + var bs57 []byte v57v1 = v - bs57 := testMarshalErr(v57v1, h, t, "enc-map-v57") - if v == nil { - v57v2 = nil - } else { - v57v2 = make(map[uint8]uint, len(v)) - } // reset map - testUnmarshalErr(v57v2, bs57, h, t, "dec-map-v57") - testDeepEqualErr(v57v1, v57v2, t, "equal-map-v57") - if v == nil { - v57v2 = nil - } else { - v57v2 = make(map[uint8]uint, len(v)) - } // reset map - testUnmarshalErr(reflect.ValueOf(v57v2), bs57, h, t, "dec-map-v57-noaddr") // decode into non-addressable map value - testDeepEqualErr(v57v1, v57v2, t, "equal-map-v57-noaddr") + bs57 = testMarshalErr(v57v1, h, t, "enc-map-v57") + if v != nil { + if v == nil { + v57v2 = nil + } else { + v57v2 = make(map[uint8]uint, len(v)) + } // reset map + testUnmarshalErr(v57v2, bs57, h, t, "dec-map-v57") + testDeepEqualErr(v57v1, v57v2, t, "equal-map-v57") + if v == nil { + v57v2 = nil + } else { + v57v2 = make(map[uint8]uint, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v57v2), bs57, h, t, "dec-map-v57-noaddr") // decode into non-addressable map value + testDeepEqualErr(v57v1, v57v2, t, "equal-map-v57-noaddr") + } if v == nil { v57v2 = nil } else { @@ -2419,30 +2581,34 @@ func doTestMammothMaps(t *testing.T, h Handle) { var v57v3, v57v4 typMapMapUint8Uint v57v3 = typMapMapUint8Uint(v57v1) v57v4 = typMapMapUint8Uint(v57v2) - bs57 = testMarshalErr(v57v3, h, t, "enc-map-v57-custom") - testUnmarshalErr(v57v4, bs57, h, t, "dec-map-v57-p-len") - testDeepEqualErr(v57v3, v57v4, t, "equal-map-v57-p-len") + if v != nil { + bs57 = testMarshalErr(v57v3, h, t, "enc-map-v57-custom") + testUnmarshalErr(v57v4, bs57, h, t, "dec-map-v57-p-len") + testDeepEqualErr(v57v3, v57v4, t, "equal-map-v57-p-len") + } } - for _, v := range []map[uint8]uint8{nil, {}, {111: 0, 77: 127}} { // fmt.Printf(">>>> running mammoth map v58: %v\n", v) var v58v1, v58v2 map[uint8]uint8 + var bs58 []byte v58v1 = v - bs58 := testMarshalErr(v58v1, h, t, "enc-map-v58") - if v == nil { - v58v2 = nil - } else { - v58v2 = make(map[uint8]uint8, len(v)) - } // reset map - testUnmarshalErr(v58v2, bs58, h, t, "dec-map-v58") - testDeepEqualErr(v58v1, v58v2, t, "equal-map-v58") - if v == nil { - v58v2 = nil - } else { - v58v2 = make(map[uint8]uint8, len(v)) - } // reset map - testUnmarshalErr(reflect.ValueOf(v58v2), bs58, h, t, "dec-map-v58-noaddr") // decode into non-addressable map value - testDeepEqualErr(v58v1, v58v2, t, "equal-map-v58-noaddr") + bs58 = testMarshalErr(v58v1, h, t, "enc-map-v58") + if v != nil { + if v == nil { + v58v2 = nil + } else { + v58v2 = make(map[uint8]uint8, len(v)) + } // reset map + testUnmarshalErr(v58v2, bs58, h, t, "dec-map-v58") + testDeepEqualErr(v58v1, v58v2, t, "equal-map-v58") + if v == nil { + v58v2 = nil + } else { + v58v2 = make(map[uint8]uint8, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v58v2), bs58, h, t, "dec-map-v58-noaddr") // decode into non-addressable map value + testDeepEqualErr(v58v1, v58v2, t, "equal-map-v58-noaddr") + } if v == nil { v58v2 = nil } else { @@ -2463,30 +2629,34 @@ func doTestMammothMaps(t *testing.T, h Handle) { var v58v3, v58v4 typMapMapUint8Uint8 v58v3 = typMapMapUint8Uint8(v58v1) v58v4 = typMapMapUint8Uint8(v58v2) - bs58 = testMarshalErr(v58v3, h, t, "enc-map-v58-custom") - testUnmarshalErr(v58v4, bs58, h, t, "dec-map-v58-p-len") - testDeepEqualErr(v58v3, v58v4, t, "equal-map-v58-p-len") + if v != nil { + bs58 = testMarshalErr(v58v3, h, t, "enc-map-v58-custom") + testUnmarshalErr(v58v4, bs58, h, t, "dec-map-v58-p-len") + testDeepEqualErr(v58v3, v58v4, t, "equal-map-v58-p-len") + } } - for _, v := range []map[uint8]uint64{nil, {}, {111: 0, 77: 127}} { // fmt.Printf(">>>> running mammoth map v59: %v\n", v) var v59v1, v59v2 map[uint8]uint64 + var bs59 []byte v59v1 = v - bs59 := testMarshalErr(v59v1, h, t, "enc-map-v59") - if v == nil { - v59v2 = nil - } else { - v59v2 = make(map[uint8]uint64, len(v)) - } // reset map - testUnmarshalErr(v59v2, bs59, h, t, "dec-map-v59") - testDeepEqualErr(v59v1, v59v2, t, "equal-map-v59") - if v == nil { - v59v2 = nil - } else { - v59v2 = make(map[uint8]uint64, len(v)) - } // reset map - testUnmarshalErr(reflect.ValueOf(v59v2), bs59, h, t, "dec-map-v59-noaddr") // decode into non-addressable map value - testDeepEqualErr(v59v1, v59v2, t, "equal-map-v59-noaddr") + bs59 = testMarshalErr(v59v1, h, t, "enc-map-v59") + if v != nil { + if v == nil { + v59v2 = nil + } else { + v59v2 = make(map[uint8]uint64, len(v)) + } // reset map + testUnmarshalErr(v59v2, bs59, h, t, "dec-map-v59") + testDeepEqualErr(v59v1, v59v2, t, "equal-map-v59") + if v == nil { + v59v2 = nil + } else { + v59v2 = make(map[uint8]uint64, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v59v2), bs59, h, t, "dec-map-v59-noaddr") // decode into non-addressable map value + testDeepEqualErr(v59v1, v59v2, t, "equal-map-v59-noaddr") + } if v == nil { v59v2 = nil } else { @@ -2507,30 +2677,34 @@ func doTestMammothMaps(t *testing.T, h Handle) { var v59v3, v59v4 typMapMapUint8Uint64 v59v3 = typMapMapUint8Uint64(v59v1) v59v4 = typMapMapUint8Uint64(v59v2) - bs59 = testMarshalErr(v59v3, h, t, "enc-map-v59-custom") - testUnmarshalErr(v59v4, bs59, h, t, "dec-map-v59-p-len") - testDeepEqualErr(v59v3, v59v4, t, "equal-map-v59-p-len") + if v != nil { + bs59 = testMarshalErr(v59v3, h, t, "enc-map-v59-custom") + testUnmarshalErr(v59v4, bs59, h, t, "dec-map-v59-p-len") + testDeepEqualErr(v59v3, v59v4, t, "equal-map-v59-p-len") + } } - for _, v := range []map[uint8]int{nil, {}, {111: 0, 77: 127}} { // fmt.Printf(">>>> running mammoth map v60: %v\n", v) var v60v1, v60v2 map[uint8]int + var bs60 []byte v60v1 = v - bs60 := testMarshalErr(v60v1, h, t, "enc-map-v60") - if v == nil { - v60v2 = nil - } else { - v60v2 = make(map[uint8]int, len(v)) - } // reset map - testUnmarshalErr(v60v2, bs60, h, t, "dec-map-v60") - testDeepEqualErr(v60v1, v60v2, t, "equal-map-v60") - if v == nil { - v60v2 = nil - } else { - v60v2 = make(map[uint8]int, len(v)) - } // reset map - testUnmarshalErr(reflect.ValueOf(v60v2), bs60, h, t, "dec-map-v60-noaddr") // decode into non-addressable map value - testDeepEqualErr(v60v1, v60v2, t, "equal-map-v60-noaddr") + bs60 = testMarshalErr(v60v1, h, t, "enc-map-v60") + if v != nil { + if v == nil { + v60v2 = nil + } else { + v60v2 = make(map[uint8]int, len(v)) + } // reset map + testUnmarshalErr(v60v2, bs60, h, t, "dec-map-v60") + testDeepEqualErr(v60v1, v60v2, t, "equal-map-v60") + if v == nil { + v60v2 = nil + } else { + v60v2 = make(map[uint8]int, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v60v2), bs60, h, t, "dec-map-v60-noaddr") // decode into non-addressable map value + testDeepEqualErr(v60v1, v60v2, t, "equal-map-v60-noaddr") + } if v == nil { v60v2 = nil } else { @@ -2551,30 +2725,34 @@ func doTestMammothMaps(t *testing.T, h Handle) { var v60v3, v60v4 typMapMapUint8Int v60v3 = typMapMapUint8Int(v60v1) v60v4 = typMapMapUint8Int(v60v2) - bs60 = testMarshalErr(v60v3, h, t, "enc-map-v60-custom") - testUnmarshalErr(v60v4, bs60, h, t, "dec-map-v60-p-len") - testDeepEqualErr(v60v3, v60v4, t, "equal-map-v60-p-len") + if v != nil { + bs60 = testMarshalErr(v60v3, h, t, "enc-map-v60-custom") + testUnmarshalErr(v60v4, bs60, h, t, "dec-map-v60-p-len") + testDeepEqualErr(v60v3, v60v4, t, "equal-map-v60-p-len") + } } - for _, v := range []map[uint8]int64{nil, {}, {111: 0, 77: 127}} { // fmt.Printf(">>>> running mammoth map v61: %v\n", v) var v61v1, v61v2 map[uint8]int64 + var bs61 []byte v61v1 = v - bs61 := testMarshalErr(v61v1, h, t, "enc-map-v61") - if v == nil { - v61v2 = nil - } else { - v61v2 = make(map[uint8]int64, len(v)) - } // reset map - testUnmarshalErr(v61v2, bs61, h, t, "dec-map-v61") - testDeepEqualErr(v61v1, v61v2, t, "equal-map-v61") - if v == nil { - v61v2 = nil - } else { - v61v2 = make(map[uint8]int64, len(v)) - } // reset map - testUnmarshalErr(reflect.ValueOf(v61v2), bs61, h, t, "dec-map-v61-noaddr") // decode into non-addressable map value - testDeepEqualErr(v61v1, v61v2, t, "equal-map-v61-noaddr") + bs61 = testMarshalErr(v61v1, h, t, "enc-map-v61") + if v != nil { + if v == nil { + v61v2 = nil + } else { + v61v2 = make(map[uint8]int64, len(v)) + } // reset map + testUnmarshalErr(v61v2, bs61, h, t, "dec-map-v61") + testDeepEqualErr(v61v1, v61v2, t, "equal-map-v61") + if v == nil { + v61v2 = nil + } else { + v61v2 = make(map[uint8]int64, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v61v2), bs61, h, t, "dec-map-v61-noaddr") // decode into non-addressable map value + testDeepEqualErr(v61v1, v61v2, t, "equal-map-v61-noaddr") + } if v == nil { v61v2 = nil } else { @@ -2595,30 +2773,34 @@ func doTestMammothMaps(t *testing.T, h Handle) { var v61v3, v61v4 typMapMapUint8Int64 v61v3 = typMapMapUint8Int64(v61v1) v61v4 = typMapMapUint8Int64(v61v2) - bs61 = testMarshalErr(v61v3, h, t, "enc-map-v61-custom") - testUnmarshalErr(v61v4, bs61, h, t, "dec-map-v61-p-len") - testDeepEqualErr(v61v3, v61v4, t, "equal-map-v61-p-len") + if v != nil { + bs61 = testMarshalErr(v61v3, h, t, "enc-map-v61-custom") + testUnmarshalErr(v61v4, bs61, h, t, "dec-map-v61-p-len") + testDeepEqualErr(v61v3, v61v4, t, "equal-map-v61-p-len") + } } - for _, v := range []map[uint8]float32{nil, {}, {111: 0, 77: 11.1}} { // fmt.Printf(">>>> running mammoth map v62: %v\n", v) var v62v1, v62v2 map[uint8]float32 + var bs62 []byte v62v1 = v - bs62 := testMarshalErr(v62v1, h, t, "enc-map-v62") - if v == nil { - v62v2 = nil - } else { - v62v2 = make(map[uint8]float32, len(v)) - } // reset map - testUnmarshalErr(v62v2, bs62, h, t, "dec-map-v62") - testDeepEqualErr(v62v1, v62v2, t, "equal-map-v62") - if v == nil { - v62v2 = nil - } else { - v62v2 = make(map[uint8]float32, len(v)) - } // reset map - testUnmarshalErr(reflect.ValueOf(v62v2), bs62, h, t, "dec-map-v62-noaddr") // decode into non-addressable map value - testDeepEqualErr(v62v1, v62v2, t, "equal-map-v62-noaddr") + bs62 = testMarshalErr(v62v1, h, t, "enc-map-v62") + if v != nil { + if v == nil { + v62v2 = nil + } else { + v62v2 = make(map[uint8]float32, len(v)) + } // reset map + testUnmarshalErr(v62v2, bs62, h, t, "dec-map-v62") + testDeepEqualErr(v62v1, v62v2, t, "equal-map-v62") + if v == nil { + v62v2 = nil + } else { + v62v2 = make(map[uint8]float32, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v62v2), bs62, h, t, "dec-map-v62-noaddr") // decode into non-addressable map value + testDeepEqualErr(v62v1, v62v2, t, "equal-map-v62-noaddr") + } if v == nil { v62v2 = nil } else { @@ -2639,30 +2821,34 @@ func doTestMammothMaps(t *testing.T, h Handle) { var v62v3, v62v4 typMapMapUint8Float32 v62v3 = typMapMapUint8Float32(v62v1) v62v4 = typMapMapUint8Float32(v62v2) - bs62 = testMarshalErr(v62v3, h, t, "enc-map-v62-custom") - testUnmarshalErr(v62v4, bs62, h, t, "dec-map-v62-p-len") - testDeepEqualErr(v62v3, v62v4, t, "equal-map-v62-p-len") + if v != nil { + bs62 = testMarshalErr(v62v3, h, t, "enc-map-v62-custom") + testUnmarshalErr(v62v4, bs62, h, t, "dec-map-v62-p-len") + testDeepEqualErr(v62v3, v62v4, t, "equal-map-v62-p-len") + } } - for _, v := range []map[uint8]float64{nil, {}, {127: 0, 111: 22.2}} { // fmt.Printf(">>>> running mammoth map v63: %v\n", v) var v63v1, v63v2 map[uint8]float64 + var bs63 []byte v63v1 = v - bs63 := testMarshalErr(v63v1, h, t, "enc-map-v63") - if v == nil { - v63v2 = nil - } else { - v63v2 = make(map[uint8]float64, len(v)) - } // reset map - testUnmarshalErr(v63v2, bs63, h, t, "dec-map-v63") - testDeepEqualErr(v63v1, v63v2, t, "equal-map-v63") - if v == nil { - v63v2 = nil - } else { - v63v2 = make(map[uint8]float64, len(v)) - } // reset map - testUnmarshalErr(reflect.ValueOf(v63v2), bs63, h, t, "dec-map-v63-noaddr") // decode into non-addressable map value - testDeepEqualErr(v63v1, v63v2, t, "equal-map-v63-noaddr") + bs63 = testMarshalErr(v63v1, h, t, "enc-map-v63") + if v != nil { + if v == nil { + v63v2 = nil + } else { + v63v2 = make(map[uint8]float64, len(v)) + } // reset map + testUnmarshalErr(v63v2, bs63, h, t, "dec-map-v63") + testDeepEqualErr(v63v1, v63v2, t, "equal-map-v63") + if v == nil { + v63v2 = nil + } else { + v63v2 = make(map[uint8]float64, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v63v2), bs63, h, t, "dec-map-v63-noaddr") // decode into non-addressable map value + testDeepEqualErr(v63v1, v63v2, t, "equal-map-v63-noaddr") + } if v == nil { v63v2 = nil } else { @@ -2683,30 +2869,34 @@ func doTestMammothMaps(t *testing.T, h Handle) { var v63v3, v63v4 typMapMapUint8Float64 v63v3 = typMapMapUint8Float64(v63v1) v63v4 = typMapMapUint8Float64(v63v2) - bs63 = testMarshalErr(v63v3, h, t, "enc-map-v63-custom") - testUnmarshalErr(v63v4, bs63, h, t, "dec-map-v63-p-len") - testDeepEqualErr(v63v3, v63v4, t, "equal-map-v63-p-len") + if v != nil { + bs63 = testMarshalErr(v63v3, h, t, "enc-map-v63-custom") + testUnmarshalErr(v63v4, bs63, h, t, "dec-map-v63-p-len") + testDeepEqualErr(v63v3, v63v4, t, "equal-map-v63-p-len") + } } - for _, v := range []map[uint8]bool{nil, {}, {77: false, 127: true}} { // fmt.Printf(">>>> running mammoth map v64: %v\n", v) var v64v1, v64v2 map[uint8]bool + var bs64 []byte v64v1 = v - bs64 := testMarshalErr(v64v1, h, t, "enc-map-v64") - if v == nil { - v64v2 = nil - } else { - v64v2 = make(map[uint8]bool, len(v)) - } // reset map - testUnmarshalErr(v64v2, bs64, h, t, "dec-map-v64") - testDeepEqualErr(v64v1, v64v2, t, "equal-map-v64") - if v == nil { - v64v2 = nil - } else { - v64v2 = make(map[uint8]bool, len(v)) - } // reset map - testUnmarshalErr(reflect.ValueOf(v64v2), bs64, h, t, "dec-map-v64-noaddr") // decode into non-addressable map value - testDeepEqualErr(v64v1, v64v2, t, "equal-map-v64-noaddr") + bs64 = testMarshalErr(v64v1, h, t, "enc-map-v64") + if v != nil { + if v == nil { + v64v2 = nil + } else { + v64v2 = make(map[uint8]bool, len(v)) + } // reset map + testUnmarshalErr(v64v2, bs64, h, t, "dec-map-v64") + testDeepEqualErr(v64v1, v64v2, t, "equal-map-v64") + if v == nil { + v64v2 = nil + } else { + v64v2 = make(map[uint8]bool, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v64v2), bs64, h, t, "dec-map-v64-noaddr") // decode into non-addressable map value + testDeepEqualErr(v64v1, v64v2, t, "equal-map-v64-noaddr") + } if v == nil { v64v2 = nil } else { @@ -2727,30 +2917,34 @@ func doTestMammothMaps(t *testing.T, h Handle) { var v64v3, v64v4 typMapMapUint8Bool v64v3 = typMapMapUint8Bool(v64v1) v64v4 = typMapMapUint8Bool(v64v2) - bs64 = testMarshalErr(v64v3, h, t, "enc-map-v64-custom") - testUnmarshalErr(v64v4, bs64, h, t, "dec-map-v64-p-len") - testDeepEqualErr(v64v3, v64v4, t, "equal-map-v64-p-len") + if v != nil { + bs64 = testMarshalErr(v64v3, h, t, "enc-map-v64-custom") + testUnmarshalErr(v64v4, bs64, h, t, "dec-map-v64-p-len") + testDeepEqualErr(v64v3, v64v4, t, "equal-map-v64-p-len") + } } - for _, v := range []map[uint64]interface{}{nil, {}, {111: nil, 77: "string-is-an-interface-1"}} { // fmt.Printf(">>>> running mammoth map v65: %v\n", v) var v65v1, v65v2 map[uint64]interface{} + var bs65 []byte v65v1 = v - bs65 := testMarshalErr(v65v1, h, t, "enc-map-v65") - if v == nil { - v65v2 = nil - } else { - v65v2 = make(map[uint64]interface{}, len(v)) - } // reset map - testUnmarshalErr(v65v2, bs65, h, t, "dec-map-v65") - testDeepEqualErr(v65v1, v65v2, t, "equal-map-v65") - if v == nil { - v65v2 = nil - } else { - v65v2 = make(map[uint64]interface{}, len(v)) - } // reset map - testUnmarshalErr(reflect.ValueOf(v65v2), bs65, h, t, "dec-map-v65-noaddr") // decode into non-addressable map value - testDeepEqualErr(v65v1, v65v2, t, "equal-map-v65-noaddr") + bs65 = testMarshalErr(v65v1, h, t, "enc-map-v65") + if v != nil { + if v == nil { + v65v2 = nil + } else { + v65v2 = make(map[uint64]interface{}, len(v)) + } // reset map + testUnmarshalErr(v65v2, bs65, h, t, "dec-map-v65") + testDeepEqualErr(v65v1, v65v2, t, "equal-map-v65") + if v == nil { + v65v2 = nil + } else { + v65v2 = make(map[uint64]interface{}, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v65v2), bs65, h, t, "dec-map-v65-noaddr") // decode into non-addressable map value + testDeepEqualErr(v65v1, v65v2, t, "equal-map-v65-noaddr") + } if v == nil { v65v2 = nil } else { @@ -2771,30 +2965,34 @@ func doTestMammothMaps(t *testing.T, h Handle) { var v65v3, v65v4 typMapMapUint64Intf v65v3 = typMapMapUint64Intf(v65v1) v65v4 = typMapMapUint64Intf(v65v2) - bs65 = testMarshalErr(v65v3, h, t, "enc-map-v65-custom") - testUnmarshalErr(v65v4, bs65, h, t, "dec-map-v65-p-len") - testDeepEqualErr(v65v3, v65v4, t, "equal-map-v65-p-len") + if v != nil { + bs65 = testMarshalErr(v65v3, h, t, "enc-map-v65-custom") + testUnmarshalErr(v65v4, bs65, h, t, "dec-map-v65-p-len") + testDeepEqualErr(v65v3, v65v4, t, "equal-map-v65-p-len") + } } - for _, v := range []map[uint64]string{nil, {}, {127: "", 111: "some-string-2"}} { // fmt.Printf(">>>> running mammoth map v66: %v\n", v) var v66v1, v66v2 map[uint64]string + var bs66 []byte v66v1 = v - bs66 := testMarshalErr(v66v1, h, t, "enc-map-v66") - if v == nil { - v66v2 = nil - } else { - v66v2 = make(map[uint64]string, len(v)) - } // reset map - testUnmarshalErr(v66v2, bs66, h, t, "dec-map-v66") - testDeepEqualErr(v66v1, v66v2, t, "equal-map-v66") - if v == nil { - v66v2 = nil - } else { - v66v2 = make(map[uint64]string, len(v)) - } // reset map - testUnmarshalErr(reflect.ValueOf(v66v2), bs66, h, t, "dec-map-v66-noaddr") // decode into non-addressable map value - testDeepEqualErr(v66v1, v66v2, t, "equal-map-v66-noaddr") + bs66 = testMarshalErr(v66v1, h, t, "enc-map-v66") + if v != nil { + if v == nil { + v66v2 = nil + } else { + v66v2 = make(map[uint64]string, len(v)) + } // reset map + testUnmarshalErr(v66v2, bs66, h, t, "dec-map-v66") + testDeepEqualErr(v66v1, v66v2, t, "equal-map-v66") + if v == nil { + v66v2 = nil + } else { + v66v2 = make(map[uint64]string, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v66v2), bs66, h, t, "dec-map-v66-noaddr") // decode into non-addressable map value + testDeepEqualErr(v66v1, v66v2, t, "equal-map-v66-noaddr") + } if v == nil { v66v2 = nil } else { @@ -2815,30 +3013,34 @@ func doTestMammothMaps(t *testing.T, h Handle) { var v66v3, v66v4 typMapMapUint64String v66v3 = typMapMapUint64String(v66v1) v66v4 = typMapMapUint64String(v66v2) - bs66 = testMarshalErr(v66v3, h, t, "enc-map-v66-custom") - testUnmarshalErr(v66v4, bs66, h, t, "dec-map-v66-p-len") - testDeepEqualErr(v66v3, v66v4, t, "equal-map-v66-p-len") + if v != nil { + bs66 = testMarshalErr(v66v3, h, t, "enc-map-v66-custom") + testUnmarshalErr(v66v4, bs66, h, t, "dec-map-v66-p-len") + testDeepEqualErr(v66v3, v66v4, t, "equal-map-v66-p-len") + } } - for _, v := range []map[uint64][]byte{nil, {}, {77: nil, 127: []byte("some-string-1")}} { // fmt.Printf(">>>> running mammoth map v67: %v\n", v) var v67v1, v67v2 map[uint64][]byte + var bs67 []byte v67v1 = v - bs67 := testMarshalErr(v67v1, h, t, "enc-map-v67") - if v == nil { - v67v2 = nil - } else { - v67v2 = make(map[uint64][]byte, len(v)) - } // reset map - testUnmarshalErr(v67v2, bs67, h, t, "dec-map-v67") - testDeepEqualErr(v67v1, v67v2, t, "equal-map-v67") - if v == nil { - v67v2 = nil - } else { - v67v2 = make(map[uint64][]byte, len(v)) - } // reset map - testUnmarshalErr(reflect.ValueOf(v67v2), bs67, h, t, "dec-map-v67-noaddr") // decode into non-addressable map value - testDeepEqualErr(v67v1, v67v2, t, "equal-map-v67-noaddr") + bs67 = testMarshalErr(v67v1, h, t, "enc-map-v67") + if v != nil { + if v == nil { + v67v2 = nil + } else { + v67v2 = make(map[uint64][]byte, len(v)) + } // reset map + testUnmarshalErr(v67v2, bs67, h, t, "dec-map-v67") + testDeepEqualErr(v67v1, v67v2, t, "equal-map-v67") + if v == nil { + v67v2 = nil + } else { + v67v2 = make(map[uint64][]byte, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v67v2), bs67, h, t, "dec-map-v67-noaddr") // decode into non-addressable map value + testDeepEqualErr(v67v1, v67v2, t, "equal-map-v67-noaddr") + } if v == nil { v67v2 = nil } else { @@ -2859,30 +3061,34 @@ func doTestMammothMaps(t *testing.T, h Handle) { var v67v3, v67v4 typMapMapUint64Bytes v67v3 = typMapMapUint64Bytes(v67v1) v67v4 = typMapMapUint64Bytes(v67v2) - bs67 = testMarshalErr(v67v3, h, t, "enc-map-v67-custom") - testUnmarshalErr(v67v4, bs67, h, t, "dec-map-v67-p-len") - testDeepEqualErr(v67v3, v67v4, t, "equal-map-v67-p-len") + if v != nil { + bs67 = testMarshalErr(v67v3, h, t, "enc-map-v67-custom") + testUnmarshalErr(v67v4, bs67, h, t, "dec-map-v67-p-len") + testDeepEqualErr(v67v3, v67v4, t, "equal-map-v67-p-len") + } } - for _, v := range []map[uint64]uint{nil, {}, {111: 0, 77: 127}} { // fmt.Printf(">>>> running mammoth map v68: %v\n", v) var v68v1, v68v2 map[uint64]uint + var bs68 []byte v68v1 = v - bs68 := testMarshalErr(v68v1, h, t, "enc-map-v68") - if v == nil { - v68v2 = nil - } else { - v68v2 = make(map[uint64]uint, len(v)) - } // reset map - testUnmarshalErr(v68v2, bs68, h, t, "dec-map-v68") - testDeepEqualErr(v68v1, v68v2, t, "equal-map-v68") - if v == nil { - v68v2 = nil - } else { - v68v2 = make(map[uint64]uint, len(v)) - } // reset map - testUnmarshalErr(reflect.ValueOf(v68v2), bs68, h, t, "dec-map-v68-noaddr") // decode into non-addressable map value - testDeepEqualErr(v68v1, v68v2, t, "equal-map-v68-noaddr") + bs68 = testMarshalErr(v68v1, h, t, "enc-map-v68") + if v != nil { + if v == nil { + v68v2 = nil + } else { + v68v2 = make(map[uint64]uint, len(v)) + } // reset map + testUnmarshalErr(v68v2, bs68, h, t, "dec-map-v68") + testDeepEqualErr(v68v1, v68v2, t, "equal-map-v68") + if v == nil { + v68v2 = nil + } else { + v68v2 = make(map[uint64]uint, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v68v2), bs68, h, t, "dec-map-v68-noaddr") // decode into non-addressable map value + testDeepEqualErr(v68v1, v68v2, t, "equal-map-v68-noaddr") + } if v == nil { v68v2 = nil } else { @@ -2903,30 +3109,34 @@ func doTestMammothMaps(t *testing.T, h Handle) { var v68v3, v68v4 typMapMapUint64Uint v68v3 = typMapMapUint64Uint(v68v1) v68v4 = typMapMapUint64Uint(v68v2) - bs68 = testMarshalErr(v68v3, h, t, "enc-map-v68-custom") - testUnmarshalErr(v68v4, bs68, h, t, "dec-map-v68-p-len") - testDeepEqualErr(v68v3, v68v4, t, "equal-map-v68-p-len") + if v != nil { + bs68 = testMarshalErr(v68v3, h, t, "enc-map-v68-custom") + testUnmarshalErr(v68v4, bs68, h, t, "dec-map-v68-p-len") + testDeepEqualErr(v68v3, v68v4, t, "equal-map-v68-p-len") + } } - for _, v := range []map[uint64]uint8{nil, {}, {111: 0, 77: 127}} { // fmt.Printf(">>>> running mammoth map v69: %v\n", v) var v69v1, v69v2 map[uint64]uint8 + var bs69 []byte v69v1 = v - bs69 := testMarshalErr(v69v1, h, t, "enc-map-v69") - if v == nil { - v69v2 = nil - } else { - v69v2 = make(map[uint64]uint8, len(v)) - } // reset map - testUnmarshalErr(v69v2, bs69, h, t, "dec-map-v69") - testDeepEqualErr(v69v1, v69v2, t, "equal-map-v69") - if v == nil { - v69v2 = nil - } else { - v69v2 = make(map[uint64]uint8, len(v)) - } // reset map - testUnmarshalErr(reflect.ValueOf(v69v2), bs69, h, t, "dec-map-v69-noaddr") // decode into non-addressable map value - testDeepEqualErr(v69v1, v69v2, t, "equal-map-v69-noaddr") + bs69 = testMarshalErr(v69v1, h, t, "enc-map-v69") + if v != nil { + if v == nil { + v69v2 = nil + } else { + v69v2 = make(map[uint64]uint8, len(v)) + } // reset map + testUnmarshalErr(v69v2, bs69, h, t, "dec-map-v69") + testDeepEqualErr(v69v1, v69v2, t, "equal-map-v69") + if v == nil { + v69v2 = nil + } else { + v69v2 = make(map[uint64]uint8, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v69v2), bs69, h, t, "dec-map-v69-noaddr") // decode into non-addressable map value + testDeepEqualErr(v69v1, v69v2, t, "equal-map-v69-noaddr") + } if v == nil { v69v2 = nil } else { @@ -2947,30 +3157,34 @@ func doTestMammothMaps(t *testing.T, h Handle) { var v69v3, v69v4 typMapMapUint64Uint8 v69v3 = typMapMapUint64Uint8(v69v1) v69v4 = typMapMapUint64Uint8(v69v2) - bs69 = testMarshalErr(v69v3, h, t, "enc-map-v69-custom") - testUnmarshalErr(v69v4, bs69, h, t, "dec-map-v69-p-len") - testDeepEqualErr(v69v3, v69v4, t, "equal-map-v69-p-len") + if v != nil { + bs69 = testMarshalErr(v69v3, h, t, "enc-map-v69-custom") + testUnmarshalErr(v69v4, bs69, h, t, "dec-map-v69-p-len") + testDeepEqualErr(v69v3, v69v4, t, "equal-map-v69-p-len") + } } - for _, v := range []map[uint64]uint64{nil, {}, {111: 0, 77: 127}} { // fmt.Printf(">>>> running mammoth map v70: %v\n", v) var v70v1, v70v2 map[uint64]uint64 + var bs70 []byte v70v1 = v - bs70 := testMarshalErr(v70v1, h, t, "enc-map-v70") - if v == nil { - v70v2 = nil - } else { - v70v2 = make(map[uint64]uint64, len(v)) - } // reset map - testUnmarshalErr(v70v2, bs70, h, t, "dec-map-v70") - testDeepEqualErr(v70v1, v70v2, t, "equal-map-v70") - if v == nil { - v70v2 = nil - } else { - v70v2 = make(map[uint64]uint64, len(v)) - } // reset map - testUnmarshalErr(reflect.ValueOf(v70v2), bs70, h, t, "dec-map-v70-noaddr") // decode into non-addressable map value - testDeepEqualErr(v70v1, v70v2, t, "equal-map-v70-noaddr") + bs70 = testMarshalErr(v70v1, h, t, "enc-map-v70") + if v != nil { + if v == nil { + v70v2 = nil + } else { + v70v2 = make(map[uint64]uint64, len(v)) + } // reset map + testUnmarshalErr(v70v2, bs70, h, t, "dec-map-v70") + testDeepEqualErr(v70v1, v70v2, t, "equal-map-v70") + if v == nil { + v70v2 = nil + } else { + v70v2 = make(map[uint64]uint64, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v70v2), bs70, h, t, "dec-map-v70-noaddr") // decode into non-addressable map value + testDeepEqualErr(v70v1, v70v2, t, "equal-map-v70-noaddr") + } if v == nil { v70v2 = nil } else { @@ -2991,30 +3205,34 @@ func doTestMammothMaps(t *testing.T, h Handle) { var v70v3, v70v4 typMapMapUint64Uint64 v70v3 = typMapMapUint64Uint64(v70v1) v70v4 = typMapMapUint64Uint64(v70v2) - bs70 = testMarshalErr(v70v3, h, t, "enc-map-v70-custom") - testUnmarshalErr(v70v4, bs70, h, t, "dec-map-v70-p-len") - testDeepEqualErr(v70v3, v70v4, t, "equal-map-v70-p-len") + if v != nil { + bs70 = testMarshalErr(v70v3, h, t, "enc-map-v70-custom") + testUnmarshalErr(v70v4, bs70, h, t, "dec-map-v70-p-len") + testDeepEqualErr(v70v3, v70v4, t, "equal-map-v70-p-len") + } } - for _, v := range []map[uint64]int{nil, {}, {111: 0, 77: 127}} { // fmt.Printf(">>>> running mammoth map v71: %v\n", v) var v71v1, v71v2 map[uint64]int + var bs71 []byte v71v1 = v - bs71 := testMarshalErr(v71v1, h, t, "enc-map-v71") - if v == nil { - v71v2 = nil - } else { - v71v2 = make(map[uint64]int, len(v)) - } // reset map - testUnmarshalErr(v71v2, bs71, h, t, "dec-map-v71") - testDeepEqualErr(v71v1, v71v2, t, "equal-map-v71") - if v == nil { - v71v2 = nil - } else { - v71v2 = make(map[uint64]int, len(v)) - } // reset map - testUnmarshalErr(reflect.ValueOf(v71v2), bs71, h, t, "dec-map-v71-noaddr") // decode into non-addressable map value - testDeepEqualErr(v71v1, v71v2, t, "equal-map-v71-noaddr") + bs71 = testMarshalErr(v71v1, h, t, "enc-map-v71") + if v != nil { + if v == nil { + v71v2 = nil + } else { + v71v2 = make(map[uint64]int, len(v)) + } // reset map + testUnmarshalErr(v71v2, bs71, h, t, "dec-map-v71") + testDeepEqualErr(v71v1, v71v2, t, "equal-map-v71") + if v == nil { + v71v2 = nil + } else { + v71v2 = make(map[uint64]int, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v71v2), bs71, h, t, "dec-map-v71-noaddr") // decode into non-addressable map value + testDeepEqualErr(v71v1, v71v2, t, "equal-map-v71-noaddr") + } if v == nil { v71v2 = nil } else { @@ -3035,30 +3253,34 @@ func doTestMammothMaps(t *testing.T, h Handle) { var v71v3, v71v4 typMapMapUint64Int v71v3 = typMapMapUint64Int(v71v1) v71v4 = typMapMapUint64Int(v71v2) - bs71 = testMarshalErr(v71v3, h, t, "enc-map-v71-custom") - testUnmarshalErr(v71v4, bs71, h, t, "dec-map-v71-p-len") - testDeepEqualErr(v71v3, v71v4, t, "equal-map-v71-p-len") + if v != nil { + bs71 = testMarshalErr(v71v3, h, t, "enc-map-v71-custom") + testUnmarshalErr(v71v4, bs71, h, t, "dec-map-v71-p-len") + testDeepEqualErr(v71v3, v71v4, t, "equal-map-v71-p-len") + } } - for _, v := range []map[uint64]int64{nil, {}, {111: 0, 77: 127}} { // fmt.Printf(">>>> running mammoth map v72: %v\n", v) var v72v1, v72v2 map[uint64]int64 + var bs72 []byte v72v1 = v - bs72 := testMarshalErr(v72v1, h, t, "enc-map-v72") - if v == nil { - v72v2 = nil - } else { - v72v2 = make(map[uint64]int64, len(v)) - } // reset map - testUnmarshalErr(v72v2, bs72, h, t, "dec-map-v72") - testDeepEqualErr(v72v1, v72v2, t, "equal-map-v72") - if v == nil { - v72v2 = nil - } else { - v72v2 = make(map[uint64]int64, len(v)) - } // reset map - testUnmarshalErr(reflect.ValueOf(v72v2), bs72, h, t, "dec-map-v72-noaddr") // decode into non-addressable map value - testDeepEqualErr(v72v1, v72v2, t, "equal-map-v72-noaddr") + bs72 = testMarshalErr(v72v1, h, t, "enc-map-v72") + if v != nil { + if v == nil { + v72v2 = nil + } else { + v72v2 = make(map[uint64]int64, len(v)) + } // reset map + testUnmarshalErr(v72v2, bs72, h, t, "dec-map-v72") + testDeepEqualErr(v72v1, v72v2, t, "equal-map-v72") + if v == nil { + v72v2 = nil + } else { + v72v2 = make(map[uint64]int64, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v72v2), bs72, h, t, "dec-map-v72-noaddr") // decode into non-addressable map value + testDeepEqualErr(v72v1, v72v2, t, "equal-map-v72-noaddr") + } if v == nil { v72v2 = nil } else { @@ -3079,30 +3301,34 @@ func doTestMammothMaps(t *testing.T, h Handle) { var v72v3, v72v4 typMapMapUint64Int64 v72v3 = typMapMapUint64Int64(v72v1) v72v4 = typMapMapUint64Int64(v72v2) - bs72 = testMarshalErr(v72v3, h, t, "enc-map-v72-custom") - testUnmarshalErr(v72v4, bs72, h, t, "dec-map-v72-p-len") - testDeepEqualErr(v72v3, v72v4, t, "equal-map-v72-p-len") + if v != nil { + bs72 = testMarshalErr(v72v3, h, t, "enc-map-v72-custom") + testUnmarshalErr(v72v4, bs72, h, t, "dec-map-v72-p-len") + testDeepEqualErr(v72v3, v72v4, t, "equal-map-v72-p-len") + } } - for _, v := range []map[uint64]float32{nil, {}, {111: 0, 77: 33.3e3}} { // fmt.Printf(">>>> running mammoth map v73: %v\n", v) var v73v1, v73v2 map[uint64]float32 + var bs73 []byte v73v1 = v - bs73 := testMarshalErr(v73v1, h, t, "enc-map-v73") - if v == nil { - v73v2 = nil - } else { - v73v2 = make(map[uint64]float32, len(v)) - } // reset map - testUnmarshalErr(v73v2, bs73, h, t, "dec-map-v73") - testDeepEqualErr(v73v1, v73v2, t, "equal-map-v73") - if v == nil { - v73v2 = nil - } else { - v73v2 = make(map[uint64]float32, len(v)) - } // reset map - testUnmarshalErr(reflect.ValueOf(v73v2), bs73, h, t, "dec-map-v73-noaddr") // decode into non-addressable map value - testDeepEqualErr(v73v1, v73v2, t, "equal-map-v73-noaddr") + bs73 = testMarshalErr(v73v1, h, t, "enc-map-v73") + if v != nil { + if v == nil { + v73v2 = nil + } else { + v73v2 = make(map[uint64]float32, len(v)) + } // reset map + testUnmarshalErr(v73v2, bs73, h, t, "dec-map-v73") + testDeepEqualErr(v73v1, v73v2, t, "equal-map-v73") + if v == nil { + v73v2 = nil + } else { + v73v2 = make(map[uint64]float32, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v73v2), bs73, h, t, "dec-map-v73-noaddr") // decode into non-addressable map value + testDeepEqualErr(v73v1, v73v2, t, "equal-map-v73-noaddr") + } if v == nil { v73v2 = nil } else { @@ -3123,30 +3349,34 @@ func doTestMammothMaps(t *testing.T, h Handle) { var v73v3, v73v4 typMapMapUint64Float32 v73v3 = typMapMapUint64Float32(v73v1) v73v4 = typMapMapUint64Float32(v73v2) - bs73 = testMarshalErr(v73v3, h, t, "enc-map-v73-custom") - testUnmarshalErr(v73v4, bs73, h, t, "dec-map-v73-p-len") - testDeepEqualErr(v73v3, v73v4, t, "equal-map-v73-p-len") + if v != nil { + bs73 = testMarshalErr(v73v3, h, t, "enc-map-v73-custom") + testUnmarshalErr(v73v4, bs73, h, t, "dec-map-v73-p-len") + testDeepEqualErr(v73v3, v73v4, t, "equal-map-v73-p-len") + } } - for _, v := range []map[uint64]float64{nil, {}, {127: 0, 111: 11.1}} { // fmt.Printf(">>>> running mammoth map v74: %v\n", v) var v74v1, v74v2 map[uint64]float64 + var bs74 []byte v74v1 = v - bs74 := testMarshalErr(v74v1, h, t, "enc-map-v74") - if v == nil { - v74v2 = nil - } else { - v74v2 = make(map[uint64]float64, len(v)) - } // reset map - testUnmarshalErr(v74v2, bs74, h, t, "dec-map-v74") - testDeepEqualErr(v74v1, v74v2, t, "equal-map-v74") - if v == nil { - v74v2 = nil - } else { - v74v2 = make(map[uint64]float64, len(v)) - } // reset map - testUnmarshalErr(reflect.ValueOf(v74v2), bs74, h, t, "dec-map-v74-noaddr") // decode into non-addressable map value - testDeepEqualErr(v74v1, v74v2, t, "equal-map-v74-noaddr") + bs74 = testMarshalErr(v74v1, h, t, "enc-map-v74") + if v != nil { + if v == nil { + v74v2 = nil + } else { + v74v2 = make(map[uint64]float64, len(v)) + } // reset map + testUnmarshalErr(v74v2, bs74, h, t, "dec-map-v74") + testDeepEqualErr(v74v1, v74v2, t, "equal-map-v74") + if v == nil { + v74v2 = nil + } else { + v74v2 = make(map[uint64]float64, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v74v2), bs74, h, t, "dec-map-v74-noaddr") // decode into non-addressable map value + testDeepEqualErr(v74v1, v74v2, t, "equal-map-v74-noaddr") + } if v == nil { v74v2 = nil } else { @@ -3167,30 +3397,34 @@ func doTestMammothMaps(t *testing.T, h Handle) { var v74v3, v74v4 typMapMapUint64Float64 v74v3 = typMapMapUint64Float64(v74v1) v74v4 = typMapMapUint64Float64(v74v2) - bs74 = testMarshalErr(v74v3, h, t, "enc-map-v74-custom") - testUnmarshalErr(v74v4, bs74, h, t, "dec-map-v74-p-len") - testDeepEqualErr(v74v3, v74v4, t, "equal-map-v74-p-len") + if v != nil { + bs74 = testMarshalErr(v74v3, h, t, "enc-map-v74-custom") + testUnmarshalErr(v74v4, bs74, h, t, "dec-map-v74-p-len") + testDeepEqualErr(v74v3, v74v4, t, "equal-map-v74-p-len") + } } - for _, v := range []map[uint64]bool{nil, {}, {77: false, 127: true}} { // fmt.Printf(">>>> running mammoth map v75: %v\n", v) var v75v1, v75v2 map[uint64]bool + var bs75 []byte v75v1 = v - bs75 := testMarshalErr(v75v1, h, t, "enc-map-v75") - if v == nil { - v75v2 = nil - } else { - v75v2 = make(map[uint64]bool, len(v)) - } // reset map - testUnmarshalErr(v75v2, bs75, h, t, "dec-map-v75") - testDeepEqualErr(v75v1, v75v2, t, "equal-map-v75") - if v == nil { - v75v2 = nil - } else { - v75v2 = make(map[uint64]bool, len(v)) - } // reset map - testUnmarshalErr(reflect.ValueOf(v75v2), bs75, h, t, "dec-map-v75-noaddr") // decode into non-addressable map value - testDeepEqualErr(v75v1, v75v2, t, "equal-map-v75-noaddr") + bs75 = testMarshalErr(v75v1, h, t, "enc-map-v75") + if v != nil { + if v == nil { + v75v2 = nil + } else { + v75v2 = make(map[uint64]bool, len(v)) + } // reset map + testUnmarshalErr(v75v2, bs75, h, t, "dec-map-v75") + testDeepEqualErr(v75v1, v75v2, t, "equal-map-v75") + if v == nil { + v75v2 = nil + } else { + v75v2 = make(map[uint64]bool, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v75v2), bs75, h, t, "dec-map-v75-noaddr") // decode into non-addressable map value + testDeepEqualErr(v75v1, v75v2, t, "equal-map-v75-noaddr") + } if v == nil { v75v2 = nil } else { @@ -3211,30 +3445,34 @@ func doTestMammothMaps(t *testing.T, h Handle) { var v75v3, v75v4 typMapMapUint64Bool v75v3 = typMapMapUint64Bool(v75v1) v75v4 = typMapMapUint64Bool(v75v2) - bs75 = testMarshalErr(v75v3, h, t, "enc-map-v75-custom") - testUnmarshalErr(v75v4, bs75, h, t, "dec-map-v75-p-len") - testDeepEqualErr(v75v3, v75v4, t, "equal-map-v75-p-len") + if v != nil { + bs75 = testMarshalErr(v75v3, h, t, "enc-map-v75-custom") + testUnmarshalErr(v75v4, bs75, h, t, "dec-map-v75-p-len") + testDeepEqualErr(v75v3, v75v4, t, "equal-map-v75-p-len") + } } - for _, v := range []map[int]interface{}{nil, {}, {111: nil, 77: "string-is-an-interface-2"}} { // fmt.Printf(">>>> running mammoth map v76: %v\n", v) var v76v1, v76v2 map[int]interface{} + var bs76 []byte v76v1 = v - bs76 := testMarshalErr(v76v1, h, t, "enc-map-v76") - if v == nil { - v76v2 = nil - } else { - v76v2 = make(map[int]interface{}, len(v)) - } // reset map - testUnmarshalErr(v76v2, bs76, h, t, "dec-map-v76") - testDeepEqualErr(v76v1, v76v2, t, "equal-map-v76") - if v == nil { - v76v2 = nil - } else { - v76v2 = make(map[int]interface{}, len(v)) - } // reset map - testUnmarshalErr(reflect.ValueOf(v76v2), bs76, h, t, "dec-map-v76-noaddr") // decode into non-addressable map value - testDeepEqualErr(v76v1, v76v2, t, "equal-map-v76-noaddr") + bs76 = testMarshalErr(v76v1, h, t, "enc-map-v76") + if v != nil { + if v == nil { + v76v2 = nil + } else { + v76v2 = make(map[int]interface{}, len(v)) + } // reset map + testUnmarshalErr(v76v2, bs76, h, t, "dec-map-v76") + testDeepEqualErr(v76v1, v76v2, t, "equal-map-v76") + if v == nil { + v76v2 = nil + } else { + v76v2 = make(map[int]interface{}, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v76v2), bs76, h, t, "dec-map-v76-noaddr") // decode into non-addressable map value + testDeepEqualErr(v76v1, v76v2, t, "equal-map-v76-noaddr") + } if v == nil { v76v2 = nil } else { @@ -3255,30 +3493,34 @@ func doTestMammothMaps(t *testing.T, h Handle) { var v76v3, v76v4 typMapMapIntIntf v76v3 = typMapMapIntIntf(v76v1) v76v4 = typMapMapIntIntf(v76v2) - bs76 = testMarshalErr(v76v3, h, t, "enc-map-v76-custom") - testUnmarshalErr(v76v4, bs76, h, t, "dec-map-v76-p-len") - testDeepEqualErr(v76v3, v76v4, t, "equal-map-v76-p-len") + if v != nil { + bs76 = testMarshalErr(v76v3, h, t, "enc-map-v76-custom") + testUnmarshalErr(v76v4, bs76, h, t, "dec-map-v76-p-len") + testDeepEqualErr(v76v3, v76v4, t, "equal-map-v76-p-len") + } } - for _, v := range []map[int]string{nil, {}, {127: "", 111: "some-string-3"}} { // fmt.Printf(">>>> running mammoth map v77: %v\n", v) var v77v1, v77v2 map[int]string + var bs77 []byte v77v1 = v - bs77 := testMarshalErr(v77v1, h, t, "enc-map-v77") - if v == nil { - v77v2 = nil - } else { - v77v2 = make(map[int]string, len(v)) - } // reset map - testUnmarshalErr(v77v2, bs77, h, t, "dec-map-v77") - testDeepEqualErr(v77v1, v77v2, t, "equal-map-v77") - if v == nil { - v77v2 = nil - } else { - v77v2 = make(map[int]string, len(v)) - } // reset map - testUnmarshalErr(reflect.ValueOf(v77v2), bs77, h, t, "dec-map-v77-noaddr") // decode into non-addressable map value - testDeepEqualErr(v77v1, v77v2, t, "equal-map-v77-noaddr") + bs77 = testMarshalErr(v77v1, h, t, "enc-map-v77") + if v != nil { + if v == nil { + v77v2 = nil + } else { + v77v2 = make(map[int]string, len(v)) + } // reset map + testUnmarshalErr(v77v2, bs77, h, t, "dec-map-v77") + testDeepEqualErr(v77v1, v77v2, t, "equal-map-v77") + if v == nil { + v77v2 = nil + } else { + v77v2 = make(map[int]string, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v77v2), bs77, h, t, "dec-map-v77-noaddr") // decode into non-addressable map value + testDeepEqualErr(v77v1, v77v2, t, "equal-map-v77-noaddr") + } if v == nil { v77v2 = nil } else { @@ -3299,30 +3541,34 @@ func doTestMammothMaps(t *testing.T, h Handle) { var v77v3, v77v4 typMapMapIntString v77v3 = typMapMapIntString(v77v1) v77v4 = typMapMapIntString(v77v2) - bs77 = testMarshalErr(v77v3, h, t, "enc-map-v77-custom") - testUnmarshalErr(v77v4, bs77, h, t, "dec-map-v77-p-len") - testDeepEqualErr(v77v3, v77v4, t, "equal-map-v77-p-len") + if v != nil { + bs77 = testMarshalErr(v77v3, h, t, "enc-map-v77-custom") + testUnmarshalErr(v77v4, bs77, h, t, "dec-map-v77-p-len") + testDeepEqualErr(v77v3, v77v4, t, "equal-map-v77-p-len") + } } - for _, v := range []map[int][]byte{nil, {}, {77: nil, 127: []byte("some-string-2")}} { // fmt.Printf(">>>> running mammoth map v78: %v\n", v) var v78v1, v78v2 map[int][]byte + var bs78 []byte v78v1 = v - bs78 := testMarshalErr(v78v1, h, t, "enc-map-v78") - if v == nil { - v78v2 = nil - } else { - v78v2 = make(map[int][]byte, len(v)) - } // reset map - testUnmarshalErr(v78v2, bs78, h, t, "dec-map-v78") - testDeepEqualErr(v78v1, v78v2, t, "equal-map-v78") - if v == nil { - v78v2 = nil - } else { - v78v2 = make(map[int][]byte, len(v)) - } // reset map - testUnmarshalErr(reflect.ValueOf(v78v2), bs78, h, t, "dec-map-v78-noaddr") // decode into non-addressable map value - testDeepEqualErr(v78v1, v78v2, t, "equal-map-v78-noaddr") + bs78 = testMarshalErr(v78v1, h, t, "enc-map-v78") + if v != nil { + if v == nil { + v78v2 = nil + } else { + v78v2 = make(map[int][]byte, len(v)) + } // reset map + testUnmarshalErr(v78v2, bs78, h, t, "dec-map-v78") + testDeepEqualErr(v78v1, v78v2, t, "equal-map-v78") + if v == nil { + v78v2 = nil + } else { + v78v2 = make(map[int][]byte, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v78v2), bs78, h, t, "dec-map-v78-noaddr") // decode into non-addressable map value + testDeepEqualErr(v78v1, v78v2, t, "equal-map-v78-noaddr") + } if v == nil { v78v2 = nil } else { @@ -3343,30 +3589,34 @@ func doTestMammothMaps(t *testing.T, h Handle) { var v78v3, v78v4 typMapMapIntBytes v78v3 = typMapMapIntBytes(v78v1) v78v4 = typMapMapIntBytes(v78v2) - bs78 = testMarshalErr(v78v3, h, t, "enc-map-v78-custom") - testUnmarshalErr(v78v4, bs78, h, t, "dec-map-v78-p-len") - testDeepEqualErr(v78v3, v78v4, t, "equal-map-v78-p-len") + if v != nil { + bs78 = testMarshalErr(v78v3, h, t, "enc-map-v78-custom") + testUnmarshalErr(v78v4, bs78, h, t, "dec-map-v78-p-len") + testDeepEqualErr(v78v3, v78v4, t, "equal-map-v78-p-len") + } } - for _, v := range []map[int]uint{nil, {}, {111: 0, 77: 127}} { // fmt.Printf(">>>> running mammoth map v79: %v\n", v) var v79v1, v79v2 map[int]uint + var bs79 []byte v79v1 = v - bs79 := testMarshalErr(v79v1, h, t, "enc-map-v79") - if v == nil { - v79v2 = nil - } else { - v79v2 = make(map[int]uint, len(v)) - } // reset map - testUnmarshalErr(v79v2, bs79, h, t, "dec-map-v79") - testDeepEqualErr(v79v1, v79v2, t, "equal-map-v79") - if v == nil { - v79v2 = nil - } else { - v79v2 = make(map[int]uint, len(v)) - } // reset map - testUnmarshalErr(reflect.ValueOf(v79v2), bs79, h, t, "dec-map-v79-noaddr") // decode into non-addressable map value - testDeepEqualErr(v79v1, v79v2, t, "equal-map-v79-noaddr") + bs79 = testMarshalErr(v79v1, h, t, "enc-map-v79") + if v != nil { + if v == nil { + v79v2 = nil + } else { + v79v2 = make(map[int]uint, len(v)) + } // reset map + testUnmarshalErr(v79v2, bs79, h, t, "dec-map-v79") + testDeepEqualErr(v79v1, v79v2, t, "equal-map-v79") + if v == nil { + v79v2 = nil + } else { + v79v2 = make(map[int]uint, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v79v2), bs79, h, t, "dec-map-v79-noaddr") // decode into non-addressable map value + testDeepEqualErr(v79v1, v79v2, t, "equal-map-v79-noaddr") + } if v == nil { v79v2 = nil } else { @@ -3387,30 +3637,34 @@ func doTestMammothMaps(t *testing.T, h Handle) { var v79v3, v79v4 typMapMapIntUint v79v3 = typMapMapIntUint(v79v1) v79v4 = typMapMapIntUint(v79v2) - bs79 = testMarshalErr(v79v3, h, t, "enc-map-v79-custom") - testUnmarshalErr(v79v4, bs79, h, t, "dec-map-v79-p-len") - testDeepEqualErr(v79v3, v79v4, t, "equal-map-v79-p-len") + if v != nil { + bs79 = testMarshalErr(v79v3, h, t, "enc-map-v79-custom") + testUnmarshalErr(v79v4, bs79, h, t, "dec-map-v79-p-len") + testDeepEqualErr(v79v3, v79v4, t, "equal-map-v79-p-len") + } } - for _, v := range []map[int]uint8{nil, {}, {111: 0, 77: 127}} { // fmt.Printf(">>>> running mammoth map v80: %v\n", v) var v80v1, v80v2 map[int]uint8 + var bs80 []byte v80v1 = v - bs80 := testMarshalErr(v80v1, h, t, "enc-map-v80") - if v == nil { - v80v2 = nil - } else { - v80v2 = make(map[int]uint8, len(v)) - } // reset map - testUnmarshalErr(v80v2, bs80, h, t, "dec-map-v80") - testDeepEqualErr(v80v1, v80v2, t, "equal-map-v80") - if v == nil { - v80v2 = nil - } else { - v80v2 = make(map[int]uint8, len(v)) - } // reset map - testUnmarshalErr(reflect.ValueOf(v80v2), bs80, h, t, "dec-map-v80-noaddr") // decode into non-addressable map value - testDeepEqualErr(v80v1, v80v2, t, "equal-map-v80-noaddr") + bs80 = testMarshalErr(v80v1, h, t, "enc-map-v80") + if v != nil { + if v == nil { + v80v2 = nil + } else { + v80v2 = make(map[int]uint8, len(v)) + } // reset map + testUnmarshalErr(v80v2, bs80, h, t, "dec-map-v80") + testDeepEqualErr(v80v1, v80v2, t, "equal-map-v80") + if v == nil { + v80v2 = nil + } else { + v80v2 = make(map[int]uint8, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v80v2), bs80, h, t, "dec-map-v80-noaddr") // decode into non-addressable map value + testDeepEqualErr(v80v1, v80v2, t, "equal-map-v80-noaddr") + } if v == nil { v80v2 = nil } else { @@ -3431,30 +3685,34 @@ func doTestMammothMaps(t *testing.T, h Handle) { var v80v3, v80v4 typMapMapIntUint8 v80v3 = typMapMapIntUint8(v80v1) v80v4 = typMapMapIntUint8(v80v2) - bs80 = testMarshalErr(v80v3, h, t, "enc-map-v80-custom") - testUnmarshalErr(v80v4, bs80, h, t, "dec-map-v80-p-len") - testDeepEqualErr(v80v3, v80v4, t, "equal-map-v80-p-len") + if v != nil { + bs80 = testMarshalErr(v80v3, h, t, "enc-map-v80-custom") + testUnmarshalErr(v80v4, bs80, h, t, "dec-map-v80-p-len") + testDeepEqualErr(v80v3, v80v4, t, "equal-map-v80-p-len") + } } - for _, v := range []map[int]uint64{nil, {}, {111: 0, 77: 127}} { // fmt.Printf(">>>> running mammoth map v81: %v\n", v) var v81v1, v81v2 map[int]uint64 + var bs81 []byte v81v1 = v - bs81 := testMarshalErr(v81v1, h, t, "enc-map-v81") - if v == nil { - v81v2 = nil - } else { - v81v2 = make(map[int]uint64, len(v)) - } // reset map - testUnmarshalErr(v81v2, bs81, h, t, "dec-map-v81") - testDeepEqualErr(v81v1, v81v2, t, "equal-map-v81") - if v == nil { - v81v2 = nil - } else { - v81v2 = make(map[int]uint64, len(v)) - } // reset map - testUnmarshalErr(reflect.ValueOf(v81v2), bs81, h, t, "dec-map-v81-noaddr") // decode into non-addressable map value - testDeepEqualErr(v81v1, v81v2, t, "equal-map-v81-noaddr") + bs81 = testMarshalErr(v81v1, h, t, "enc-map-v81") + if v != nil { + if v == nil { + v81v2 = nil + } else { + v81v2 = make(map[int]uint64, len(v)) + } // reset map + testUnmarshalErr(v81v2, bs81, h, t, "dec-map-v81") + testDeepEqualErr(v81v1, v81v2, t, "equal-map-v81") + if v == nil { + v81v2 = nil + } else { + v81v2 = make(map[int]uint64, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v81v2), bs81, h, t, "dec-map-v81-noaddr") // decode into non-addressable map value + testDeepEqualErr(v81v1, v81v2, t, "equal-map-v81-noaddr") + } if v == nil { v81v2 = nil } else { @@ -3475,30 +3733,34 @@ func doTestMammothMaps(t *testing.T, h Handle) { var v81v3, v81v4 typMapMapIntUint64 v81v3 = typMapMapIntUint64(v81v1) v81v4 = typMapMapIntUint64(v81v2) - bs81 = testMarshalErr(v81v3, h, t, "enc-map-v81-custom") - testUnmarshalErr(v81v4, bs81, h, t, "dec-map-v81-p-len") - testDeepEqualErr(v81v3, v81v4, t, "equal-map-v81-p-len") + if v != nil { + bs81 = testMarshalErr(v81v3, h, t, "enc-map-v81-custom") + testUnmarshalErr(v81v4, bs81, h, t, "dec-map-v81-p-len") + testDeepEqualErr(v81v3, v81v4, t, "equal-map-v81-p-len") + } } - for _, v := range []map[int]int{nil, {}, {111: 0, 77: 127}} { // fmt.Printf(">>>> running mammoth map v82: %v\n", v) var v82v1, v82v2 map[int]int + var bs82 []byte v82v1 = v - bs82 := testMarshalErr(v82v1, h, t, "enc-map-v82") - if v == nil { - v82v2 = nil - } else { - v82v2 = make(map[int]int, len(v)) - } // reset map - testUnmarshalErr(v82v2, bs82, h, t, "dec-map-v82") - testDeepEqualErr(v82v1, v82v2, t, "equal-map-v82") - if v == nil { - v82v2 = nil - } else { - v82v2 = make(map[int]int, len(v)) - } // reset map - testUnmarshalErr(reflect.ValueOf(v82v2), bs82, h, t, "dec-map-v82-noaddr") // decode into non-addressable map value - testDeepEqualErr(v82v1, v82v2, t, "equal-map-v82-noaddr") + bs82 = testMarshalErr(v82v1, h, t, "enc-map-v82") + if v != nil { + if v == nil { + v82v2 = nil + } else { + v82v2 = make(map[int]int, len(v)) + } // reset map + testUnmarshalErr(v82v2, bs82, h, t, "dec-map-v82") + testDeepEqualErr(v82v1, v82v2, t, "equal-map-v82") + if v == nil { + v82v2 = nil + } else { + v82v2 = make(map[int]int, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v82v2), bs82, h, t, "dec-map-v82-noaddr") // decode into non-addressable map value + testDeepEqualErr(v82v1, v82v2, t, "equal-map-v82-noaddr") + } if v == nil { v82v2 = nil } else { @@ -3519,30 +3781,34 @@ func doTestMammothMaps(t *testing.T, h Handle) { var v82v3, v82v4 typMapMapIntInt v82v3 = typMapMapIntInt(v82v1) v82v4 = typMapMapIntInt(v82v2) - bs82 = testMarshalErr(v82v3, h, t, "enc-map-v82-custom") - testUnmarshalErr(v82v4, bs82, h, t, "dec-map-v82-p-len") - testDeepEqualErr(v82v3, v82v4, t, "equal-map-v82-p-len") + if v != nil { + bs82 = testMarshalErr(v82v3, h, t, "enc-map-v82-custom") + testUnmarshalErr(v82v4, bs82, h, t, "dec-map-v82-p-len") + testDeepEqualErr(v82v3, v82v4, t, "equal-map-v82-p-len") + } } - for _, v := range []map[int]int64{nil, {}, {111: 0, 77: 127}} { // fmt.Printf(">>>> running mammoth map v83: %v\n", v) var v83v1, v83v2 map[int]int64 + var bs83 []byte v83v1 = v - bs83 := testMarshalErr(v83v1, h, t, "enc-map-v83") - if v == nil { - v83v2 = nil - } else { - v83v2 = make(map[int]int64, len(v)) - } // reset map - testUnmarshalErr(v83v2, bs83, h, t, "dec-map-v83") - testDeepEqualErr(v83v1, v83v2, t, "equal-map-v83") - if v == nil { - v83v2 = nil - } else { - v83v2 = make(map[int]int64, len(v)) - } // reset map - testUnmarshalErr(reflect.ValueOf(v83v2), bs83, h, t, "dec-map-v83-noaddr") // decode into non-addressable map value - testDeepEqualErr(v83v1, v83v2, t, "equal-map-v83-noaddr") + bs83 = testMarshalErr(v83v1, h, t, "enc-map-v83") + if v != nil { + if v == nil { + v83v2 = nil + } else { + v83v2 = make(map[int]int64, len(v)) + } // reset map + testUnmarshalErr(v83v2, bs83, h, t, "dec-map-v83") + testDeepEqualErr(v83v1, v83v2, t, "equal-map-v83") + if v == nil { + v83v2 = nil + } else { + v83v2 = make(map[int]int64, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v83v2), bs83, h, t, "dec-map-v83-noaddr") // decode into non-addressable map value + testDeepEqualErr(v83v1, v83v2, t, "equal-map-v83-noaddr") + } if v == nil { v83v2 = nil } else { @@ -3563,30 +3829,34 @@ func doTestMammothMaps(t *testing.T, h Handle) { var v83v3, v83v4 typMapMapIntInt64 v83v3 = typMapMapIntInt64(v83v1) v83v4 = typMapMapIntInt64(v83v2) - bs83 = testMarshalErr(v83v3, h, t, "enc-map-v83-custom") - testUnmarshalErr(v83v4, bs83, h, t, "dec-map-v83-p-len") - testDeepEqualErr(v83v3, v83v4, t, "equal-map-v83-p-len") + if v != nil { + bs83 = testMarshalErr(v83v3, h, t, "enc-map-v83-custom") + testUnmarshalErr(v83v4, bs83, h, t, "dec-map-v83-p-len") + testDeepEqualErr(v83v3, v83v4, t, "equal-map-v83-p-len") + } } - for _, v := range []map[int]float32{nil, {}, {111: 0, 77: 22.2}} { // fmt.Printf(">>>> running mammoth map v84: %v\n", v) var v84v1, v84v2 map[int]float32 + var bs84 []byte v84v1 = v - bs84 := testMarshalErr(v84v1, h, t, "enc-map-v84") - if v == nil { - v84v2 = nil - } else { - v84v2 = make(map[int]float32, len(v)) - } // reset map - testUnmarshalErr(v84v2, bs84, h, t, "dec-map-v84") - testDeepEqualErr(v84v1, v84v2, t, "equal-map-v84") - if v == nil { - v84v2 = nil - } else { - v84v2 = make(map[int]float32, len(v)) - } // reset map - testUnmarshalErr(reflect.ValueOf(v84v2), bs84, h, t, "dec-map-v84-noaddr") // decode into non-addressable map value - testDeepEqualErr(v84v1, v84v2, t, "equal-map-v84-noaddr") + bs84 = testMarshalErr(v84v1, h, t, "enc-map-v84") + if v != nil { + if v == nil { + v84v2 = nil + } else { + v84v2 = make(map[int]float32, len(v)) + } // reset map + testUnmarshalErr(v84v2, bs84, h, t, "dec-map-v84") + testDeepEqualErr(v84v1, v84v2, t, "equal-map-v84") + if v == nil { + v84v2 = nil + } else { + v84v2 = make(map[int]float32, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v84v2), bs84, h, t, "dec-map-v84-noaddr") // decode into non-addressable map value + testDeepEqualErr(v84v1, v84v2, t, "equal-map-v84-noaddr") + } if v == nil { v84v2 = nil } else { @@ -3607,30 +3877,34 @@ func doTestMammothMaps(t *testing.T, h Handle) { var v84v3, v84v4 typMapMapIntFloat32 v84v3 = typMapMapIntFloat32(v84v1) v84v4 = typMapMapIntFloat32(v84v2) - bs84 = testMarshalErr(v84v3, h, t, "enc-map-v84-custom") - testUnmarshalErr(v84v4, bs84, h, t, "dec-map-v84-p-len") - testDeepEqualErr(v84v3, v84v4, t, "equal-map-v84-p-len") + if v != nil { + bs84 = testMarshalErr(v84v3, h, t, "enc-map-v84-custom") + testUnmarshalErr(v84v4, bs84, h, t, "dec-map-v84-p-len") + testDeepEqualErr(v84v3, v84v4, t, "equal-map-v84-p-len") + } } - for _, v := range []map[int]float64{nil, {}, {127: 0, 111: 33.3e3}} { // fmt.Printf(">>>> running mammoth map v85: %v\n", v) var v85v1, v85v2 map[int]float64 + var bs85 []byte v85v1 = v - bs85 := testMarshalErr(v85v1, h, t, "enc-map-v85") - if v == nil { - v85v2 = nil - } else { - v85v2 = make(map[int]float64, len(v)) - } // reset map - testUnmarshalErr(v85v2, bs85, h, t, "dec-map-v85") - testDeepEqualErr(v85v1, v85v2, t, "equal-map-v85") - if v == nil { - v85v2 = nil - } else { - v85v2 = make(map[int]float64, len(v)) - } // reset map - testUnmarshalErr(reflect.ValueOf(v85v2), bs85, h, t, "dec-map-v85-noaddr") // decode into non-addressable map value - testDeepEqualErr(v85v1, v85v2, t, "equal-map-v85-noaddr") + bs85 = testMarshalErr(v85v1, h, t, "enc-map-v85") + if v != nil { + if v == nil { + v85v2 = nil + } else { + v85v2 = make(map[int]float64, len(v)) + } // reset map + testUnmarshalErr(v85v2, bs85, h, t, "dec-map-v85") + testDeepEqualErr(v85v1, v85v2, t, "equal-map-v85") + if v == nil { + v85v2 = nil + } else { + v85v2 = make(map[int]float64, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v85v2), bs85, h, t, "dec-map-v85-noaddr") // decode into non-addressable map value + testDeepEqualErr(v85v1, v85v2, t, "equal-map-v85-noaddr") + } if v == nil { v85v2 = nil } else { @@ -3651,30 +3925,34 @@ func doTestMammothMaps(t *testing.T, h Handle) { var v85v3, v85v4 typMapMapIntFloat64 v85v3 = typMapMapIntFloat64(v85v1) v85v4 = typMapMapIntFloat64(v85v2) - bs85 = testMarshalErr(v85v3, h, t, "enc-map-v85-custom") - testUnmarshalErr(v85v4, bs85, h, t, "dec-map-v85-p-len") - testDeepEqualErr(v85v3, v85v4, t, "equal-map-v85-p-len") + if v != nil { + bs85 = testMarshalErr(v85v3, h, t, "enc-map-v85-custom") + testUnmarshalErr(v85v4, bs85, h, t, "dec-map-v85-p-len") + testDeepEqualErr(v85v3, v85v4, t, "equal-map-v85-p-len") + } } - for _, v := range []map[int]bool{nil, {}, {77: false, 127: false}} { // fmt.Printf(">>>> running mammoth map v86: %v\n", v) var v86v1, v86v2 map[int]bool + var bs86 []byte v86v1 = v - bs86 := testMarshalErr(v86v1, h, t, "enc-map-v86") - if v == nil { - v86v2 = nil - } else { - v86v2 = make(map[int]bool, len(v)) - } // reset map - testUnmarshalErr(v86v2, bs86, h, t, "dec-map-v86") - testDeepEqualErr(v86v1, v86v2, t, "equal-map-v86") - if v == nil { - v86v2 = nil - } else { - v86v2 = make(map[int]bool, len(v)) - } // reset map - testUnmarshalErr(reflect.ValueOf(v86v2), bs86, h, t, "dec-map-v86-noaddr") // decode into non-addressable map value - testDeepEqualErr(v86v1, v86v2, t, "equal-map-v86-noaddr") + bs86 = testMarshalErr(v86v1, h, t, "enc-map-v86") + if v != nil { + if v == nil { + v86v2 = nil + } else { + v86v2 = make(map[int]bool, len(v)) + } // reset map + testUnmarshalErr(v86v2, bs86, h, t, "dec-map-v86") + testDeepEqualErr(v86v1, v86v2, t, "equal-map-v86") + if v == nil { + v86v2 = nil + } else { + v86v2 = make(map[int]bool, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v86v2), bs86, h, t, "dec-map-v86-noaddr") // decode into non-addressable map value + testDeepEqualErr(v86v1, v86v2, t, "equal-map-v86-noaddr") + } if v == nil { v86v2 = nil } else { @@ -3695,30 +3973,34 @@ func doTestMammothMaps(t *testing.T, h Handle) { var v86v3, v86v4 typMapMapIntBool v86v3 = typMapMapIntBool(v86v1) v86v4 = typMapMapIntBool(v86v2) - bs86 = testMarshalErr(v86v3, h, t, "enc-map-v86-custom") - testUnmarshalErr(v86v4, bs86, h, t, "dec-map-v86-p-len") - testDeepEqualErr(v86v3, v86v4, t, "equal-map-v86-p-len") + if v != nil { + bs86 = testMarshalErr(v86v3, h, t, "enc-map-v86-custom") + testUnmarshalErr(v86v4, bs86, h, t, "dec-map-v86-p-len") + testDeepEqualErr(v86v3, v86v4, t, "equal-map-v86-p-len") + } } - for _, v := range []map[int64]interface{}{nil, {}, {111: nil, 77: "string-is-an-interface-3"}} { // fmt.Printf(">>>> running mammoth map v87: %v\n", v) var v87v1, v87v2 map[int64]interface{} + var bs87 []byte v87v1 = v - bs87 := testMarshalErr(v87v1, h, t, "enc-map-v87") - if v == nil { - v87v2 = nil - } else { - v87v2 = make(map[int64]interface{}, len(v)) - } // reset map - testUnmarshalErr(v87v2, bs87, h, t, "dec-map-v87") - testDeepEqualErr(v87v1, v87v2, t, "equal-map-v87") - if v == nil { - v87v2 = nil - } else { - v87v2 = make(map[int64]interface{}, len(v)) - } // reset map - testUnmarshalErr(reflect.ValueOf(v87v2), bs87, h, t, "dec-map-v87-noaddr") // decode into non-addressable map value - testDeepEqualErr(v87v1, v87v2, t, "equal-map-v87-noaddr") + bs87 = testMarshalErr(v87v1, h, t, "enc-map-v87") + if v != nil { + if v == nil { + v87v2 = nil + } else { + v87v2 = make(map[int64]interface{}, len(v)) + } // reset map + testUnmarshalErr(v87v2, bs87, h, t, "dec-map-v87") + testDeepEqualErr(v87v1, v87v2, t, "equal-map-v87") + if v == nil { + v87v2 = nil + } else { + v87v2 = make(map[int64]interface{}, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v87v2), bs87, h, t, "dec-map-v87-noaddr") // decode into non-addressable map value + testDeepEqualErr(v87v1, v87v2, t, "equal-map-v87-noaddr") + } if v == nil { v87v2 = nil } else { @@ -3739,30 +4021,34 @@ func doTestMammothMaps(t *testing.T, h Handle) { var v87v3, v87v4 typMapMapInt64Intf v87v3 = typMapMapInt64Intf(v87v1) v87v4 = typMapMapInt64Intf(v87v2) - bs87 = testMarshalErr(v87v3, h, t, "enc-map-v87-custom") - testUnmarshalErr(v87v4, bs87, h, t, "dec-map-v87-p-len") - testDeepEqualErr(v87v3, v87v4, t, "equal-map-v87-p-len") + if v != nil { + bs87 = testMarshalErr(v87v3, h, t, "enc-map-v87-custom") + testUnmarshalErr(v87v4, bs87, h, t, "dec-map-v87-p-len") + testDeepEqualErr(v87v3, v87v4, t, "equal-map-v87-p-len") + } } - for _, v := range []map[int64]string{nil, {}, {127: "", 111: "some-string-1"}} { // fmt.Printf(">>>> running mammoth map v88: %v\n", v) var v88v1, v88v2 map[int64]string + var bs88 []byte v88v1 = v - bs88 := testMarshalErr(v88v1, h, t, "enc-map-v88") - if v == nil { - v88v2 = nil - } else { - v88v2 = make(map[int64]string, len(v)) - } // reset map - testUnmarshalErr(v88v2, bs88, h, t, "dec-map-v88") - testDeepEqualErr(v88v1, v88v2, t, "equal-map-v88") - if v == nil { - v88v2 = nil - } else { - v88v2 = make(map[int64]string, len(v)) - } // reset map - testUnmarshalErr(reflect.ValueOf(v88v2), bs88, h, t, "dec-map-v88-noaddr") // decode into non-addressable map value - testDeepEqualErr(v88v1, v88v2, t, "equal-map-v88-noaddr") + bs88 = testMarshalErr(v88v1, h, t, "enc-map-v88") + if v != nil { + if v == nil { + v88v2 = nil + } else { + v88v2 = make(map[int64]string, len(v)) + } // reset map + testUnmarshalErr(v88v2, bs88, h, t, "dec-map-v88") + testDeepEqualErr(v88v1, v88v2, t, "equal-map-v88") + if v == nil { + v88v2 = nil + } else { + v88v2 = make(map[int64]string, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v88v2), bs88, h, t, "dec-map-v88-noaddr") // decode into non-addressable map value + testDeepEqualErr(v88v1, v88v2, t, "equal-map-v88-noaddr") + } if v == nil { v88v2 = nil } else { @@ -3783,30 +4069,34 @@ func doTestMammothMaps(t *testing.T, h Handle) { var v88v3, v88v4 typMapMapInt64String v88v3 = typMapMapInt64String(v88v1) v88v4 = typMapMapInt64String(v88v2) - bs88 = testMarshalErr(v88v3, h, t, "enc-map-v88-custom") - testUnmarshalErr(v88v4, bs88, h, t, "dec-map-v88-p-len") - testDeepEqualErr(v88v3, v88v4, t, "equal-map-v88-p-len") + if v != nil { + bs88 = testMarshalErr(v88v3, h, t, "enc-map-v88-custom") + testUnmarshalErr(v88v4, bs88, h, t, "dec-map-v88-p-len") + testDeepEqualErr(v88v3, v88v4, t, "equal-map-v88-p-len") + } } - for _, v := range []map[int64][]byte{nil, {}, {77: nil, 127: []byte("some-string-3")}} { // fmt.Printf(">>>> running mammoth map v89: %v\n", v) var v89v1, v89v2 map[int64][]byte + var bs89 []byte v89v1 = v - bs89 := testMarshalErr(v89v1, h, t, "enc-map-v89") - if v == nil { - v89v2 = nil - } else { - v89v2 = make(map[int64][]byte, len(v)) - } // reset map - testUnmarshalErr(v89v2, bs89, h, t, "dec-map-v89") - testDeepEqualErr(v89v1, v89v2, t, "equal-map-v89") - if v == nil { - v89v2 = nil - } else { - v89v2 = make(map[int64][]byte, len(v)) - } // reset map - testUnmarshalErr(reflect.ValueOf(v89v2), bs89, h, t, "dec-map-v89-noaddr") // decode into non-addressable map value - testDeepEqualErr(v89v1, v89v2, t, "equal-map-v89-noaddr") + bs89 = testMarshalErr(v89v1, h, t, "enc-map-v89") + if v != nil { + if v == nil { + v89v2 = nil + } else { + v89v2 = make(map[int64][]byte, len(v)) + } // reset map + testUnmarshalErr(v89v2, bs89, h, t, "dec-map-v89") + testDeepEqualErr(v89v1, v89v2, t, "equal-map-v89") + if v == nil { + v89v2 = nil + } else { + v89v2 = make(map[int64][]byte, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v89v2), bs89, h, t, "dec-map-v89-noaddr") // decode into non-addressable map value + testDeepEqualErr(v89v1, v89v2, t, "equal-map-v89-noaddr") + } if v == nil { v89v2 = nil } else { @@ -3827,30 +4117,34 @@ func doTestMammothMaps(t *testing.T, h Handle) { var v89v3, v89v4 typMapMapInt64Bytes v89v3 = typMapMapInt64Bytes(v89v1) v89v4 = typMapMapInt64Bytes(v89v2) - bs89 = testMarshalErr(v89v3, h, t, "enc-map-v89-custom") - testUnmarshalErr(v89v4, bs89, h, t, "dec-map-v89-p-len") - testDeepEqualErr(v89v3, v89v4, t, "equal-map-v89-p-len") + if v != nil { + bs89 = testMarshalErr(v89v3, h, t, "enc-map-v89-custom") + testUnmarshalErr(v89v4, bs89, h, t, "dec-map-v89-p-len") + testDeepEqualErr(v89v3, v89v4, t, "equal-map-v89-p-len") + } } - for _, v := range []map[int64]uint{nil, {}, {111: 0, 77: 127}} { // fmt.Printf(">>>> running mammoth map v90: %v\n", v) var v90v1, v90v2 map[int64]uint + var bs90 []byte v90v1 = v - bs90 := testMarshalErr(v90v1, h, t, "enc-map-v90") - if v == nil { - v90v2 = nil - } else { - v90v2 = make(map[int64]uint, len(v)) - } // reset map - testUnmarshalErr(v90v2, bs90, h, t, "dec-map-v90") - testDeepEqualErr(v90v1, v90v2, t, "equal-map-v90") - if v == nil { - v90v2 = nil - } else { - v90v2 = make(map[int64]uint, len(v)) - } // reset map - testUnmarshalErr(reflect.ValueOf(v90v2), bs90, h, t, "dec-map-v90-noaddr") // decode into non-addressable map value - testDeepEqualErr(v90v1, v90v2, t, "equal-map-v90-noaddr") + bs90 = testMarshalErr(v90v1, h, t, "enc-map-v90") + if v != nil { + if v == nil { + v90v2 = nil + } else { + v90v2 = make(map[int64]uint, len(v)) + } // reset map + testUnmarshalErr(v90v2, bs90, h, t, "dec-map-v90") + testDeepEqualErr(v90v1, v90v2, t, "equal-map-v90") + if v == nil { + v90v2 = nil + } else { + v90v2 = make(map[int64]uint, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v90v2), bs90, h, t, "dec-map-v90-noaddr") // decode into non-addressable map value + testDeepEqualErr(v90v1, v90v2, t, "equal-map-v90-noaddr") + } if v == nil { v90v2 = nil } else { @@ -3871,30 +4165,34 @@ func doTestMammothMaps(t *testing.T, h Handle) { var v90v3, v90v4 typMapMapInt64Uint v90v3 = typMapMapInt64Uint(v90v1) v90v4 = typMapMapInt64Uint(v90v2) - bs90 = testMarshalErr(v90v3, h, t, "enc-map-v90-custom") - testUnmarshalErr(v90v4, bs90, h, t, "dec-map-v90-p-len") - testDeepEqualErr(v90v3, v90v4, t, "equal-map-v90-p-len") + if v != nil { + bs90 = testMarshalErr(v90v3, h, t, "enc-map-v90-custom") + testUnmarshalErr(v90v4, bs90, h, t, "dec-map-v90-p-len") + testDeepEqualErr(v90v3, v90v4, t, "equal-map-v90-p-len") + } } - for _, v := range []map[int64]uint8{nil, {}, {111: 0, 77: 127}} { // fmt.Printf(">>>> running mammoth map v91: %v\n", v) var v91v1, v91v2 map[int64]uint8 + var bs91 []byte v91v1 = v - bs91 := testMarshalErr(v91v1, h, t, "enc-map-v91") - if v == nil { - v91v2 = nil - } else { - v91v2 = make(map[int64]uint8, len(v)) - } // reset map - testUnmarshalErr(v91v2, bs91, h, t, "dec-map-v91") - testDeepEqualErr(v91v1, v91v2, t, "equal-map-v91") - if v == nil { - v91v2 = nil - } else { - v91v2 = make(map[int64]uint8, len(v)) - } // reset map - testUnmarshalErr(reflect.ValueOf(v91v2), bs91, h, t, "dec-map-v91-noaddr") // decode into non-addressable map value - testDeepEqualErr(v91v1, v91v2, t, "equal-map-v91-noaddr") + bs91 = testMarshalErr(v91v1, h, t, "enc-map-v91") + if v != nil { + if v == nil { + v91v2 = nil + } else { + v91v2 = make(map[int64]uint8, len(v)) + } // reset map + testUnmarshalErr(v91v2, bs91, h, t, "dec-map-v91") + testDeepEqualErr(v91v1, v91v2, t, "equal-map-v91") + if v == nil { + v91v2 = nil + } else { + v91v2 = make(map[int64]uint8, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v91v2), bs91, h, t, "dec-map-v91-noaddr") // decode into non-addressable map value + testDeepEqualErr(v91v1, v91v2, t, "equal-map-v91-noaddr") + } if v == nil { v91v2 = nil } else { @@ -3915,30 +4213,34 @@ func doTestMammothMaps(t *testing.T, h Handle) { var v91v3, v91v4 typMapMapInt64Uint8 v91v3 = typMapMapInt64Uint8(v91v1) v91v4 = typMapMapInt64Uint8(v91v2) - bs91 = testMarshalErr(v91v3, h, t, "enc-map-v91-custom") - testUnmarshalErr(v91v4, bs91, h, t, "dec-map-v91-p-len") - testDeepEqualErr(v91v3, v91v4, t, "equal-map-v91-p-len") + if v != nil { + bs91 = testMarshalErr(v91v3, h, t, "enc-map-v91-custom") + testUnmarshalErr(v91v4, bs91, h, t, "dec-map-v91-p-len") + testDeepEqualErr(v91v3, v91v4, t, "equal-map-v91-p-len") + } } - for _, v := range []map[int64]uint64{nil, {}, {111: 0, 77: 127}} { // fmt.Printf(">>>> running mammoth map v92: %v\n", v) var v92v1, v92v2 map[int64]uint64 + var bs92 []byte v92v1 = v - bs92 := testMarshalErr(v92v1, h, t, "enc-map-v92") - if v == nil { - v92v2 = nil - } else { - v92v2 = make(map[int64]uint64, len(v)) - } // reset map - testUnmarshalErr(v92v2, bs92, h, t, "dec-map-v92") - testDeepEqualErr(v92v1, v92v2, t, "equal-map-v92") - if v == nil { - v92v2 = nil - } else { - v92v2 = make(map[int64]uint64, len(v)) - } // reset map - testUnmarshalErr(reflect.ValueOf(v92v2), bs92, h, t, "dec-map-v92-noaddr") // decode into non-addressable map value - testDeepEqualErr(v92v1, v92v2, t, "equal-map-v92-noaddr") + bs92 = testMarshalErr(v92v1, h, t, "enc-map-v92") + if v != nil { + if v == nil { + v92v2 = nil + } else { + v92v2 = make(map[int64]uint64, len(v)) + } // reset map + testUnmarshalErr(v92v2, bs92, h, t, "dec-map-v92") + testDeepEqualErr(v92v1, v92v2, t, "equal-map-v92") + if v == nil { + v92v2 = nil + } else { + v92v2 = make(map[int64]uint64, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v92v2), bs92, h, t, "dec-map-v92-noaddr") // decode into non-addressable map value + testDeepEqualErr(v92v1, v92v2, t, "equal-map-v92-noaddr") + } if v == nil { v92v2 = nil } else { @@ -3959,30 +4261,34 @@ func doTestMammothMaps(t *testing.T, h Handle) { var v92v3, v92v4 typMapMapInt64Uint64 v92v3 = typMapMapInt64Uint64(v92v1) v92v4 = typMapMapInt64Uint64(v92v2) - bs92 = testMarshalErr(v92v3, h, t, "enc-map-v92-custom") - testUnmarshalErr(v92v4, bs92, h, t, "dec-map-v92-p-len") - testDeepEqualErr(v92v3, v92v4, t, "equal-map-v92-p-len") + if v != nil { + bs92 = testMarshalErr(v92v3, h, t, "enc-map-v92-custom") + testUnmarshalErr(v92v4, bs92, h, t, "dec-map-v92-p-len") + testDeepEqualErr(v92v3, v92v4, t, "equal-map-v92-p-len") + } } - for _, v := range []map[int64]int{nil, {}, {111: 0, 77: 127}} { // fmt.Printf(">>>> running mammoth map v93: %v\n", v) var v93v1, v93v2 map[int64]int + var bs93 []byte v93v1 = v - bs93 := testMarshalErr(v93v1, h, t, "enc-map-v93") - if v == nil { - v93v2 = nil - } else { - v93v2 = make(map[int64]int, len(v)) - } // reset map - testUnmarshalErr(v93v2, bs93, h, t, "dec-map-v93") - testDeepEqualErr(v93v1, v93v2, t, "equal-map-v93") - if v == nil { - v93v2 = nil - } else { - v93v2 = make(map[int64]int, len(v)) - } // reset map - testUnmarshalErr(reflect.ValueOf(v93v2), bs93, h, t, "dec-map-v93-noaddr") // decode into non-addressable map value - testDeepEqualErr(v93v1, v93v2, t, "equal-map-v93-noaddr") + bs93 = testMarshalErr(v93v1, h, t, "enc-map-v93") + if v != nil { + if v == nil { + v93v2 = nil + } else { + v93v2 = make(map[int64]int, len(v)) + } // reset map + testUnmarshalErr(v93v2, bs93, h, t, "dec-map-v93") + testDeepEqualErr(v93v1, v93v2, t, "equal-map-v93") + if v == nil { + v93v2 = nil + } else { + v93v2 = make(map[int64]int, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v93v2), bs93, h, t, "dec-map-v93-noaddr") // decode into non-addressable map value + testDeepEqualErr(v93v1, v93v2, t, "equal-map-v93-noaddr") + } if v == nil { v93v2 = nil } else { @@ -4003,30 +4309,34 @@ func doTestMammothMaps(t *testing.T, h Handle) { var v93v3, v93v4 typMapMapInt64Int v93v3 = typMapMapInt64Int(v93v1) v93v4 = typMapMapInt64Int(v93v2) - bs93 = testMarshalErr(v93v3, h, t, "enc-map-v93-custom") - testUnmarshalErr(v93v4, bs93, h, t, "dec-map-v93-p-len") - testDeepEqualErr(v93v3, v93v4, t, "equal-map-v93-p-len") + if v != nil { + bs93 = testMarshalErr(v93v3, h, t, "enc-map-v93-custom") + testUnmarshalErr(v93v4, bs93, h, t, "dec-map-v93-p-len") + testDeepEqualErr(v93v3, v93v4, t, "equal-map-v93-p-len") + } } - for _, v := range []map[int64]int64{nil, {}, {111: 0, 77: 127}} { // fmt.Printf(">>>> running mammoth map v94: %v\n", v) var v94v1, v94v2 map[int64]int64 + var bs94 []byte v94v1 = v - bs94 := testMarshalErr(v94v1, h, t, "enc-map-v94") - if v == nil { - v94v2 = nil - } else { - v94v2 = make(map[int64]int64, len(v)) - } // reset map - testUnmarshalErr(v94v2, bs94, h, t, "dec-map-v94") - testDeepEqualErr(v94v1, v94v2, t, "equal-map-v94") - if v == nil { - v94v2 = nil - } else { - v94v2 = make(map[int64]int64, len(v)) - } // reset map - testUnmarshalErr(reflect.ValueOf(v94v2), bs94, h, t, "dec-map-v94-noaddr") // decode into non-addressable map value - testDeepEqualErr(v94v1, v94v2, t, "equal-map-v94-noaddr") + bs94 = testMarshalErr(v94v1, h, t, "enc-map-v94") + if v != nil { + if v == nil { + v94v2 = nil + } else { + v94v2 = make(map[int64]int64, len(v)) + } // reset map + testUnmarshalErr(v94v2, bs94, h, t, "dec-map-v94") + testDeepEqualErr(v94v1, v94v2, t, "equal-map-v94") + if v == nil { + v94v2 = nil + } else { + v94v2 = make(map[int64]int64, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v94v2), bs94, h, t, "dec-map-v94-noaddr") // decode into non-addressable map value + testDeepEqualErr(v94v1, v94v2, t, "equal-map-v94-noaddr") + } if v == nil { v94v2 = nil } else { @@ -4047,30 +4357,34 @@ func doTestMammothMaps(t *testing.T, h Handle) { var v94v3, v94v4 typMapMapInt64Int64 v94v3 = typMapMapInt64Int64(v94v1) v94v4 = typMapMapInt64Int64(v94v2) - bs94 = testMarshalErr(v94v3, h, t, "enc-map-v94-custom") - testUnmarshalErr(v94v4, bs94, h, t, "dec-map-v94-p-len") - testDeepEqualErr(v94v3, v94v4, t, "equal-map-v94-p-len") + if v != nil { + bs94 = testMarshalErr(v94v3, h, t, "enc-map-v94-custom") + testUnmarshalErr(v94v4, bs94, h, t, "dec-map-v94-p-len") + testDeepEqualErr(v94v3, v94v4, t, "equal-map-v94-p-len") + } } - for _, v := range []map[int64]float32{nil, {}, {111: 0, 77: 11.1}} { // fmt.Printf(">>>> running mammoth map v95: %v\n", v) var v95v1, v95v2 map[int64]float32 + var bs95 []byte v95v1 = v - bs95 := testMarshalErr(v95v1, h, t, "enc-map-v95") - if v == nil { - v95v2 = nil - } else { - v95v2 = make(map[int64]float32, len(v)) - } // reset map - testUnmarshalErr(v95v2, bs95, h, t, "dec-map-v95") - testDeepEqualErr(v95v1, v95v2, t, "equal-map-v95") - if v == nil { - v95v2 = nil - } else { - v95v2 = make(map[int64]float32, len(v)) - } // reset map - testUnmarshalErr(reflect.ValueOf(v95v2), bs95, h, t, "dec-map-v95-noaddr") // decode into non-addressable map value - testDeepEqualErr(v95v1, v95v2, t, "equal-map-v95-noaddr") + bs95 = testMarshalErr(v95v1, h, t, "enc-map-v95") + if v != nil { + if v == nil { + v95v2 = nil + } else { + v95v2 = make(map[int64]float32, len(v)) + } // reset map + testUnmarshalErr(v95v2, bs95, h, t, "dec-map-v95") + testDeepEqualErr(v95v1, v95v2, t, "equal-map-v95") + if v == nil { + v95v2 = nil + } else { + v95v2 = make(map[int64]float32, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v95v2), bs95, h, t, "dec-map-v95-noaddr") // decode into non-addressable map value + testDeepEqualErr(v95v1, v95v2, t, "equal-map-v95-noaddr") + } if v == nil { v95v2 = nil } else { @@ -4091,30 +4405,34 @@ func doTestMammothMaps(t *testing.T, h Handle) { var v95v3, v95v4 typMapMapInt64Float32 v95v3 = typMapMapInt64Float32(v95v1) v95v4 = typMapMapInt64Float32(v95v2) - bs95 = testMarshalErr(v95v3, h, t, "enc-map-v95-custom") - testUnmarshalErr(v95v4, bs95, h, t, "dec-map-v95-p-len") - testDeepEqualErr(v95v3, v95v4, t, "equal-map-v95-p-len") + if v != nil { + bs95 = testMarshalErr(v95v3, h, t, "enc-map-v95-custom") + testUnmarshalErr(v95v4, bs95, h, t, "dec-map-v95-p-len") + testDeepEqualErr(v95v3, v95v4, t, "equal-map-v95-p-len") + } } - for _, v := range []map[int64]float64{nil, {}, {127: 0, 111: 22.2}} { // fmt.Printf(">>>> running mammoth map v96: %v\n", v) var v96v1, v96v2 map[int64]float64 + var bs96 []byte v96v1 = v - bs96 := testMarshalErr(v96v1, h, t, "enc-map-v96") - if v == nil { - v96v2 = nil - } else { - v96v2 = make(map[int64]float64, len(v)) - } // reset map - testUnmarshalErr(v96v2, bs96, h, t, "dec-map-v96") - testDeepEqualErr(v96v1, v96v2, t, "equal-map-v96") - if v == nil { - v96v2 = nil - } else { - v96v2 = make(map[int64]float64, len(v)) - } // reset map - testUnmarshalErr(reflect.ValueOf(v96v2), bs96, h, t, "dec-map-v96-noaddr") // decode into non-addressable map value - testDeepEqualErr(v96v1, v96v2, t, "equal-map-v96-noaddr") + bs96 = testMarshalErr(v96v1, h, t, "enc-map-v96") + if v != nil { + if v == nil { + v96v2 = nil + } else { + v96v2 = make(map[int64]float64, len(v)) + } // reset map + testUnmarshalErr(v96v2, bs96, h, t, "dec-map-v96") + testDeepEqualErr(v96v1, v96v2, t, "equal-map-v96") + if v == nil { + v96v2 = nil + } else { + v96v2 = make(map[int64]float64, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v96v2), bs96, h, t, "dec-map-v96-noaddr") // decode into non-addressable map value + testDeepEqualErr(v96v1, v96v2, t, "equal-map-v96-noaddr") + } if v == nil { v96v2 = nil } else { @@ -4135,30 +4453,34 @@ func doTestMammothMaps(t *testing.T, h Handle) { var v96v3, v96v4 typMapMapInt64Float64 v96v3 = typMapMapInt64Float64(v96v1) v96v4 = typMapMapInt64Float64(v96v2) - bs96 = testMarshalErr(v96v3, h, t, "enc-map-v96-custom") - testUnmarshalErr(v96v4, bs96, h, t, "dec-map-v96-p-len") - testDeepEqualErr(v96v3, v96v4, t, "equal-map-v96-p-len") + if v != nil { + bs96 = testMarshalErr(v96v3, h, t, "enc-map-v96-custom") + testUnmarshalErr(v96v4, bs96, h, t, "dec-map-v96-p-len") + testDeepEqualErr(v96v3, v96v4, t, "equal-map-v96-p-len") + } } - for _, v := range []map[int64]bool{nil, {}, {77: false, 127: true}} { // fmt.Printf(">>>> running mammoth map v97: %v\n", v) var v97v1, v97v2 map[int64]bool + var bs97 []byte v97v1 = v - bs97 := testMarshalErr(v97v1, h, t, "enc-map-v97") - if v == nil { - v97v2 = nil - } else { - v97v2 = make(map[int64]bool, len(v)) - } // reset map - testUnmarshalErr(v97v2, bs97, h, t, "dec-map-v97") - testDeepEqualErr(v97v1, v97v2, t, "equal-map-v97") - if v == nil { - v97v2 = nil - } else { - v97v2 = make(map[int64]bool, len(v)) - } // reset map - testUnmarshalErr(reflect.ValueOf(v97v2), bs97, h, t, "dec-map-v97-noaddr") // decode into non-addressable map value - testDeepEqualErr(v97v1, v97v2, t, "equal-map-v97-noaddr") + bs97 = testMarshalErr(v97v1, h, t, "enc-map-v97") + if v != nil { + if v == nil { + v97v2 = nil + } else { + v97v2 = make(map[int64]bool, len(v)) + } // reset map + testUnmarshalErr(v97v2, bs97, h, t, "dec-map-v97") + testDeepEqualErr(v97v1, v97v2, t, "equal-map-v97") + if v == nil { + v97v2 = nil + } else { + v97v2 = make(map[int64]bool, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v97v2), bs97, h, t, "dec-map-v97-noaddr") // decode into non-addressable map value + testDeepEqualErr(v97v1, v97v2, t, "equal-map-v97-noaddr") + } if v == nil { v97v2 = nil } else { @@ -4179,9 +4501,11 @@ func doTestMammothMaps(t *testing.T, h Handle) { var v97v3, v97v4 typMapMapInt64Bool v97v3 = typMapMapInt64Bool(v97v1) v97v4 = typMapMapInt64Bool(v97v2) - bs97 = testMarshalErr(v97v3, h, t, "enc-map-v97-custom") - testUnmarshalErr(v97v4, bs97, h, t, "dec-map-v97-p-len") - testDeepEqualErr(v97v3, v97v4, t, "equal-map-v97-p-len") + if v != nil { + bs97 = testMarshalErr(v97v3, h, t, "enc-map-v97-custom") + testUnmarshalErr(v97v4, bs97, h, t, "dec-map-v97-p-len") + testDeepEqualErr(v97v3, v97v4, t, "equal-map-v97-p-len") + } } } diff --git a/codec/msgpack.go b/codec/msgpack.go index b7488afa..3a528bca 100644 --- a/codec/msgpack.go +++ b/codec/msgpack.go @@ -432,6 +432,7 @@ type msgpackDecDriver struct { bd byte bdRead bool br bool // bytes reader + fnil bool noBuiltInTypes // noStreamingCodec // decNoSeparator @@ -448,6 +449,7 @@ func (d *msgpackDecDriver) DecodeNaked() { if !d.bdRead { d.readNextBd() } + d.fnil = false bd := d.bd n := d.d.naked() var decodeFurther bool @@ -456,6 +458,7 @@ func (d *msgpackDecDriver) DecodeNaked() { case mpNil: n.v = valueTypeNil d.bdRead = false + d.fnil = true case mpFalse: n.v = valueTypeBool n.b = false @@ -549,8 +552,8 @@ func (d *msgpackDecDriver) DecodeNaked() { // int can be decoded from msgpack type: intXXX or uintXXX func (d *msgpackDecDriver) DecodeInt64() (i int64) { - if !d.bdRead { - d.readNextBd() + if d.advanceNil() { + return } switch d.bd { case mpUint8: @@ -586,8 +589,8 @@ func (d *msgpackDecDriver) DecodeInt64() (i int64) { // uint can be decoded from msgpack type: intXXX or uintXXX func (d *msgpackDecDriver) DecodeUint64() (ui uint64) { - if !d.bdRead { - d.readNextBd() + if d.advanceNil() { + return } switch d.bd { case mpUint8: @@ -644,8 +647,8 @@ func (d *msgpackDecDriver) DecodeUint64() (ui uint64) { // float can either be decoded from msgpack type: float, double or intX func (d *msgpackDecDriver) DecodeFloat64() (f float64) { - if !d.bdRead { - d.readNextBd() + if d.advanceNil() { + return } if d.bd == mpFloat { f = float64(math.Float32frombits(bigen.Uint32(d.r.readx(4)))) @@ -660,8 +663,8 @@ func (d *msgpackDecDriver) DecodeFloat64() (f float64) { // bool can be decoded from bool, fixnum 0 or 1. func (d *msgpackDecDriver) DecodeBool() (b bool) { - if !d.bdRead { - d.readNextBd() + if d.advanceNil() { + return } if d.bd == mpFalse || d.bd == 0 { // b = false @@ -676,16 +679,13 @@ func (d *msgpackDecDriver) DecodeBool() (b bool) { } func (d *msgpackDecDriver) DecodeBytes(bs []byte, zerocopy bool) (bsOut []byte) { - if !d.bdRead { - d.readNextBd() + if d.advanceNil() { + return } bd := d.bd var clen int - if bd == mpNil { - d.bdRead = false - return - } else if bd == mpBin8 || bd == mpBin16 || bd == mpBin32 { + if bd == mpBin8 || bd == mpBin16 || bd == mpBin32 { clen = d.readContainerLen(msgpackContainerBin) // binary } else if bd == mpStr8 || bd == mpStr16 || bd == mpStr32 || (bd >= mpFixStrMin && bd <= mpFixStrMax) { @@ -735,25 +735,32 @@ func (d *msgpackDecDriver) uncacheRead() { } } +func (d *msgpackDecDriver) advanceNil() (null bool) { + d.fnil = false + if !d.bdRead { + d.readNextBd() + } + if d.bd == mpNil { + d.bdRead = false + d.fnil = true + null = true + } + return +} + +func (d *msgpackDecDriver) Nil() bool { + return d.fnil +} + func (d *msgpackDecDriver) ContainerType() (vt valueType) { if !d.bdRead { d.readNextBd() } bd := d.bd - // if bd == mpNil { - // // nil - // } else if bd == mpBin8 || bd == mpBin16 || bd == mpBin32 { - // // binary - // } else if bd == mpStr8 || bd == mpStr16 || bd == mpStr32 || - // (bd >= mpFixStrMin && bd <= mpFixStrMax) { - // // string/raw - // } else if bd == mpArray16 || bd == mpArray32 || - // (bd >= mpFixArrayMin && bd <= mpFixArrayMax) { - // // array - // } else if bd == mpMap16 || bd == mpMap32 || (bd >= mpFixMapMin && bd <= mpFixMapMax) { - // // map - // } + d.fnil = false if bd == mpNil { + d.bdRead = false + d.fnil = true return valueTypeNil } else if bd == mpBin8 || bd == mpBin16 || bd == mpBin32 { return valueTypeBytes @@ -774,22 +781,13 @@ func (d *msgpackDecDriver) ContainerType() (vt valueType) { return valueTypeUnset } -func (d *msgpackDecDriver) TryDecodeAsNil() (v bool) { - if !d.bdRead { - d.readNextBd() - } - if d.bd == mpNil { - d.bdRead = false - return true - } - return +func (d *msgpackDecDriver) TryNil() (v bool) { + return d.advanceNil() } func (d *msgpackDecDriver) readContainerLen(ct msgpackContainerType) (clen int) { bd := d.bd - if bd == mpNil { - clen = -1 // to represent nil - } else if bd == ct.b8 { + if bd == ct.b8 { clen = int(d.r.readn1()) } else if bd == ct.b16 { clen = int(bigen.Uint16(d.r.readx(2))) @@ -806,23 +804,21 @@ func (d *msgpackDecDriver) readContainerLen(ct msgpackContainerType) (clen int) } func (d *msgpackDecDriver) ReadMapStart() int { - if !d.bdRead { - d.readNextBd() + if d.advanceNil() { + return decContainerLenNil } return d.readContainerLen(msgpackContainerMap) } func (d *msgpackDecDriver) ReadArrayStart() int { - if !d.bdRead { - d.readNextBd() + if d.advanceNil() { + return decContainerLenNil } return d.readContainerLen(msgpackContainerList) } func (d *msgpackDecDriver) readExtLen() (clen int) { switch d.bd { - case mpNil: - clen = -1 // to represent nil case mpFixExt1: clen = 1 case mpFixExt2: @@ -848,15 +844,12 @@ func (d *msgpackDecDriver) readExtLen() (clen int) { func (d *msgpackDecDriver) DecodeTime() (t time.Time) { // decode time from string bytes or ext - if !d.bdRead { - d.readNextBd() + if d.advanceNil() { + return } bd := d.bd var clen int - if bd == mpNil { - d.bdRead = false - return - } else if bd == mpBin8 || bd == mpBin16 || bd == mpBin32 { + if bd == mpBin8 || bd == mpBin16 || bd == mpBin32 { clen = d.readContainerLen(msgpackContainerBin) // binary } else if bd == mpStr8 || bd == mpStr16 || bd == mpStr32 || (bd >= mpFixStrMin && bd <= mpFixStrMax) { @@ -899,13 +892,16 @@ func (d *msgpackDecDriver) decodeTime(clen int) (t time.Time) { return } -func (d *msgpackDecDriver) DecodeExt(rv interface{}, xtag uint64, ext Ext) (realxtag uint64) { +func (d *msgpackDecDriver) DecodeExt(rv interface{}, xtag uint64, ext Ext) { if xtag > 0xff { d.d.errorf("ext: tag must be <= 0xff; got: %v", xtag) return } + if d.advanceNil() { + return + } realxtag1, xbs := d.decodeExtV(ext != nil, uint8(xtag)) - realxtag = uint64(realxtag1) + realxtag := uint64(realxtag1) if ext == nil { re := rv.(*RawExt) re.Tag = realxtag @@ -915,13 +911,9 @@ func (d *msgpackDecDriver) DecodeExt(rv interface{}, xtag uint64, ext Ext) (real } else { ext.ReadExt(rv, xbs) } - return } func (d *msgpackDecDriver) decodeExtV(verifyTag bool, tag byte) (xtag byte, xbs []byte) { - if !d.bdRead { - d.readNextBd() - } xbd := d.bd if xbd == mpBin8 || xbd == mpBin16 || xbd == mpBin32 { xbs = d.DecodeBytes(nil, true) @@ -999,6 +991,7 @@ func (e *msgpackEncDriver) reset() { func (d *msgpackDecDriver) reset() { d.r, d.br = d.d.r(), d.d.bytes d.bd, d.bdRead = 0, false + d.fnil = false } //-------------------------------------------------- diff --git a/codec/shared_test.go b/codec/shared_test.go index 5aeba176..e6d89395 100644 --- a/codec/shared_test.go +++ b/codec/shared_test.go @@ -276,12 +276,13 @@ func sTestCodecDecode(bs []byte, ts interface{}, h Handle, bh *BasicHandle) (err // These are for intormational messages that do not necessarily // help with diagnosing a failure, or which are too large. func logTv(x interface{}, format string, args ...interface{}) { - if testVerbose { - if t, ok := x.(testing.TB); ok { // only available from go 1.9 - t.Helper() - } - logT(x, format, args...) + if !testVerbose { + return + } + if t, ok := x.(testing.TB); ok { // only available from go 1.9 + t.Helper() } + logT(x, format, args...) } // logT logs messages when running as go test -v @@ -304,12 +305,22 @@ func logT(x interface{}, format string, args ...interface{}) { } } -func failT(x interface{}, args ...interface{}) { - t, ok := x.(testing.TB) // only available from go 1.9 - if ok { - t.Helper() +func failTv(x testing.TB, args ...interface{}) { + x.Helper() + if testVerbose { + failTMsg(x, args...) } + x.FailNow() +} +func failT(x testing.TB, args ...interface{}) { + x.Helper() + failTMsg(x, args...) + x.FailNow() +} + +func failTMsg(x testing.TB, args ...interface{}) { + x.Helper() if len(args) > 0 { if format, ok := args[0].(string); ok { logT(x, format, args[1:]...) @@ -319,9 +330,6 @@ func failT(x interface{}, args ...interface{}) { logT(x, "%v", args) } } - if ok { - t.FailNow() - } } // --- functions below are used only by benchmarks alone diff --git a/codec/simple.go b/codec/simple.go index d69ae352..27b46d36 100644 --- a/codec/simple.go +++ b/codec/simple.go @@ -213,6 +213,7 @@ type simpleDecDriver struct { bdRead bool bd byte br bool // a bytes reader? + fnil bool // c containerState // b [scratchByteArrayLen]byte noBuiltInTypes @@ -233,12 +234,32 @@ func (d *simpleDecDriver) uncacheRead() { } } +func (d *simpleDecDriver) advanceNil() (null bool) { + d.fnil = false + if !d.bdRead { + d.readNextBd() + } + if d.bd == simpleVdNil { + d.bdRead = false + d.fnil = true + null = true + } + return +} + +func (d *simpleDecDriver) Nil() bool { + return d.fnil +} + func (d *simpleDecDriver) ContainerType() (vt valueType) { if !d.bdRead { d.readNextBd() } + d.fnil = false switch d.bd { case simpleVdNil: + d.bdRead = false + d.fnil = true return valueTypeNil case simpleVdByteArray, simpleVdByteArray + 1, simpleVdByteArray + 2, simpleVdByteArray + 3, simpleVdByteArray + 4: @@ -261,21 +282,11 @@ func (d *simpleDecDriver) ContainerType() (vt valueType) { return valueTypeUnset } -func (d *simpleDecDriver) TryDecodeAsNil() bool { - if !d.bdRead { - d.readNextBd() - } - if d.bd == simpleVdNil { - d.bdRead = false - return true - } - return false +func (d *simpleDecDriver) TryNil() bool { + return d.advanceNil() } func (d *simpleDecDriver) decCheckInteger() (ui uint64, neg bool) { - if !d.bdRead { - d.readNextBd() - } switch d.bd { case simpleVdPosInt: ui = uint64(d.r.readn1()) @@ -310,6 +321,9 @@ func (d *simpleDecDriver) decCheckInteger() (ui uint64, neg bool) { } func (d *simpleDecDriver) DecodeInt64() (i int64) { + if d.advanceNil() { + return + } ui, neg := d.decCheckInteger() i = chkOvf.SignedIntV(ui) if neg { @@ -320,6 +334,9 @@ func (d *simpleDecDriver) DecodeInt64() (i int64) { } func (d *simpleDecDriver) DecodeUint64() (ui uint64) { + if d.advanceNil() { + return + } ui, neg := d.decCheckInteger() if neg { d.d.errorf("assigning negative signed value to unsigned type") @@ -330,8 +347,8 @@ func (d *simpleDecDriver) DecodeUint64() (ui uint64) { } func (d *simpleDecDriver) DecodeFloat64() (f float64) { - if !d.bdRead { - d.readNextBd() + if d.advanceNil() { + return } if d.bd == simpleVdFloat32 { f = float64(math.Float32frombits(bigen.Uint32(d.r.readx(4)))) @@ -351,12 +368,12 @@ func (d *simpleDecDriver) DecodeFloat64() (f float64) { // bool can be decoded from bool only (single byte). func (d *simpleDecDriver) DecodeBool() (b bool) { - if !d.bdRead { - d.readNextBd() + if d.advanceNil() { + return } - if d.bd == simpleVdTrue { + if d.bd == simpleVdFalse { + } else if d.bd == simpleVdTrue { b = true - } else if d.bd == simpleVdFalse { } else { d.d.errorf("cannot decode bool - %s: %x", msgBadDesc, d.bd) return @@ -366,16 +383,16 @@ func (d *simpleDecDriver) DecodeBool() (b bool) { } func (d *simpleDecDriver) ReadMapStart() (length int) { - if !d.bdRead { - d.readNextBd() + if d.advanceNil() { + return decContainerLenNil } d.bdRead = false return d.decLen() } func (d *simpleDecDriver) ReadArrayStart() (length int) { - if !d.bdRead { - d.readNextBd() + if d.advanceNil() { + return decContainerLenNil } d.bdRead = false return d.decLen() @@ -413,11 +430,7 @@ func (d *simpleDecDriver) DecodeStringAsBytes() (s []byte) { } func (d *simpleDecDriver) DecodeBytes(bs []byte, zerocopy bool) (bsOut []byte) { - if !d.bdRead { - d.readNextBd() - } - if d.bd == simpleVdNil { - d.bdRead = false + if d.advanceNil() { return } // check if an "array" of uint8's (see ContainerType for how to infer if an array) @@ -447,11 +460,7 @@ func (d *simpleDecDriver) DecodeBytes(bs []byte, zerocopy bool) (bsOut []byte) { } func (d *simpleDecDriver) DecodeTime() (t time.Time) { - if !d.bdRead { - d.readNextBd() - } - if d.bd == simpleVdNil { - d.bdRead = false + if d.advanceNil() { return } if d.bd != simpleVdTime { @@ -467,13 +476,16 @@ func (d *simpleDecDriver) DecodeTime() (t time.Time) { return } -func (d *simpleDecDriver) DecodeExt(rv interface{}, xtag uint64, ext Ext) (realxtag uint64) { +func (d *simpleDecDriver) DecodeExt(rv interface{}, xtag uint64, ext Ext) { if xtag > 0xff { d.d.errorf("ext: tag must be <= 0xff; got: %v", xtag) return } + if d.advanceNil() { + return + } realxtag1, xbs := d.decodeExtV(ext != nil, uint8(xtag)) - realxtag = uint64(realxtag1) + realxtag := uint64(realxtag1) if ext == nil { re := rv.(*RawExt) re.Tag = realxtag @@ -483,13 +495,9 @@ func (d *simpleDecDriver) DecodeExt(rv interface{}, xtag uint64, ext Ext) (realx } else { ext.ReadExt(rv, xbs) } - return } func (d *simpleDecDriver) decodeExtV(verifyTag bool, tag byte) (xtag byte, xbs []byte) { - if !d.bdRead { - d.readNextBd() - } switch d.bd { case simpleVdExt, simpleVdExt + 1, simpleVdExt + 2, simpleVdExt + 3, simpleVdExt + 4: l := d.decLen() @@ -519,12 +527,14 @@ func (d *simpleDecDriver) DecodeNaked() { d.readNextBd() } + d.fnil = false n := d.d.naked() var decodeFurther bool switch d.bd { case simpleVdNil: n.v = valueTypeNil + d.fnil = true case simpleVdFalse: n.v = valueTypeBool n.b = false @@ -639,6 +649,7 @@ func (e *simpleEncDriver) reset() { func (d *simpleDecDriver) reset() { d.r, d.br = d.d.r(), d.d.bytes d.bd, d.bdRead = 0, false + d.fnil = false } var _ decDriver = (*simpleDecDriver)(nil) diff --git a/codec/values_codecgen_generated_test.go b/codec/values_codecgen_generated_test.go index 7086c751..383e7c3b 100644 --- a/codec/values_codecgen_generated_test.go +++ b/codec/values_codecgen_generated_test.go @@ -16,13 +16,15 @@ const ( codecSelferCcUTF819780 = 1 codecSelferCcRAW19780 = 255 // ----- value types used ---- - codecSelferValueTypeArray19780 = 10 - codecSelferValueTypeMap19780 = 9 - codecSelferValueTypeString19780 = 6 - codecSelferValueTypeInt19780 = 2 - codecSelferValueTypeUint19780 = 3 - codecSelferValueTypeFloat19780 = 4 - codecSelferBitsize19780 = uint8(32 << (^uint(0) >> 63)) + codecSelferValueTypeArray19780 = 10 + codecSelferValueTypeMap19780 = 9 + codecSelferValueTypeString19780 = 6 + codecSelferValueTypeInt19780 = 2 + codecSelferValueTypeUint19780 = 3 + codecSelferValueTypeFloat19780 = 4 + codecSelferValueTypeNil19780 = 1 + codecSelferBitsize19780 = uint8(32 << (^uint(0) >> 63)) + codecSelferDecContainerLenNil19780 = -2147483648 ) var ( @@ -34,13 +36,12 @@ type codecSelfer19780 struct{} func codecSelfer19780False() bool { return false } func init() { - if GenVersion != 13 { + if GenVersion != 14 { _, file, _, _ := runtime.Caller(0) ver := strconv.FormatInt(int64(GenVersion), 10) - panic("codecgen version mismatch: current: 13, need " + ver + ". Re-generate file: " + file) + panic("codecgen version mismatch: current: 14, need " + ver + ". Re-generate file: " + file) } if false { // reference the types, but skip this branch at build/run time - var _ byte var _ time.Time } } @@ -155,7 +156,7 @@ func (x *stringUint64T) CodecEncodeSelf(e *Encoder) { _, _, _ = h, z, r if x == nil { r.EncodeNil() - } else { // checkNil=true + } else { yysep2 := !z.EncBinary() yy2arr2 := z.EncBasicHandle().StructToArray _, _ = yysep2, yy2arr2 @@ -195,7 +196,7 @@ func (x *stringUint64T) CodecEncodeSelf(e *Encoder) { r.EncodeUint(uint64(x.U)) z.EncWriteMapEnd() } - } // checkNil=true + } } func (x *stringUint64T) CodecDecodeSelf(d *Decoder) { @@ -203,7 +204,9 @@ func (x *stringUint64T) CodecDecodeSelf(d *Decoder) { z, r := GenHelperDecoder(d) _, _, _ = h, z, r yyct2 := r.ContainerType() - if yyct2 == codecSelferValueTypeMap19780 { + if yyct2 == codecSelferValueTypeNil19780 { + *(x) = stringUint64T{} + } else if yyct2 == codecSelferValueTypeMap19780 { yyl2 := z.DecReadMapStart() if yyl2 == 0 { } else { @@ -241,17 +244,9 @@ func (x *stringUint64T) codecDecodeSelfFromMap(l int, d *Decoder) { z.DecReadMapElemValue() switch yys3 { case "S": - if r.TryDecodeAsNil() { - x.S = "" - } else { - x.S = (string)(string(r.DecodeStringAsBytes())) - } + x.S = (string)(string(r.DecodeStringAsBytes())) case "U": - if r.TryDecodeAsNil() { - x.U = 0 - } else { - x.U = (uint64)(r.DecodeUint64()) - } + x.U = (uint64)(r.DecodeUint64()) default: z.DecStructFieldNotFound(-1, yys3) } // end switch yys3 @@ -276,11 +271,7 @@ func (x *stringUint64T) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.S = "" - } else { - x.S = (string)(string(r.DecodeStringAsBytes())) - } + x.S = (string)(string(r.DecodeStringAsBytes())) yyj6++ if yyhl6 { yyb6 = yyj6 > l @@ -292,11 +283,7 @@ func (x *stringUint64T) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.U = 0 - } else { - x.U = (uint64)(r.DecodeUint64()) - } + x.U = (uint64)(r.DecodeUint64()) for { yyj6++ if yyhl6 { @@ -318,7 +305,7 @@ func (x *AnonInTestStruc) CodecEncodeSelf(e *Encoder) { _, _, _ = h, z, r if x == nil { r.EncodeNil() - } else { // checkNil=true + } else { yysep2 := !z.EncBinary() yy2arr2 := z.EncBasicHandle().StructToArray _, _ = yysep2, yy2arr2 @@ -570,7 +557,7 @@ func (x *AnonInTestStruc) CodecEncodeSelf(e *Encoder) { } // end block: if x.AMSU16E map == nil z.EncWriteMapEnd() } - } // checkNil=true + } } func (x *AnonInTestStruc) CodecDecodeSelf(d *Decoder) { @@ -578,7 +565,9 @@ func (x *AnonInTestStruc) CodecDecodeSelf(d *Decoder) { z, r := GenHelperDecoder(d) _, _, _ = h, z, r yyct2 := r.ContainerType() - if yyct2 == codecSelferValueTypeMap19780 { + if yyct2 == codecSelferValueTypeNil19780 { + *(x) = AnonInTestStruc{} + } else if yyct2 == codecSelferValueTypeMap19780 { yyl2 := z.DecReadMapStart() if yyl2 == 0 { } else { @@ -616,95 +605,35 @@ func (x *AnonInTestStruc) codecDecodeSelfFromMap(l int, d *Decoder) { z.DecReadMapElemValue() switch yys3 { case "AS": - if r.TryDecodeAsNil() { - x.AS = "" - } else { - x.AS = (string)(string(r.DecodeStringAsBytes())) - } + x.AS = (string)(string(r.DecodeStringAsBytes())) case "AI64": - if r.TryDecodeAsNil() { - x.AI64 = 0 - } else { - x.AI64 = (int64)(r.DecodeInt64()) - } + x.AI64 = (int64)(r.DecodeInt64()) case "AI16": - if r.TryDecodeAsNil() { - x.AI16 = 0 - } else { - x.AI16 = (int16)(z.C.IntV(r.DecodeInt64(), 16)) - } + x.AI16 = (int16)(z.C.IntV(r.DecodeInt64(), 16)) case "AUi64": - if r.TryDecodeAsNil() { - x.AUi64 = 0 - } else { - x.AUi64 = (uint64)(r.DecodeUint64()) - } + x.AUi64 = (uint64)(r.DecodeUint64()) case "ASslice": - if r.TryDecodeAsNil() { - x.ASslice = nil - } else { - z.F.DecSliceStringX(&x.ASslice, d) - } + z.F.DecSliceStringX(&x.ASslice, d) case "AI64slice": - if r.TryDecodeAsNil() { - x.AI64slice = nil - } else { - z.F.DecSliceInt64X(&x.AI64slice, d) - } + z.F.DecSliceInt64X(&x.AI64slice, d) case "AUi64slice": - if r.TryDecodeAsNil() { - x.AUi64slice = nil - } else { - z.F.DecSliceUint64X(&x.AUi64slice, d) - } + z.F.DecSliceUint64X(&x.AUi64slice, d) case "AF64slice": - if r.TryDecodeAsNil() { - x.AF64slice = nil - } else { - z.F.DecSliceFloat64X(&x.AF64slice, d) - } + z.F.DecSliceFloat64X(&x.AF64slice, d) case "AF32slice": - if r.TryDecodeAsNil() { - x.AF32slice = nil - } else { - z.F.DecSliceFloat32X(&x.AF32slice, d) - } + z.F.DecSliceFloat32X(&x.AF32slice, d) case "AMSU16": - if r.TryDecodeAsNil() { - x.AMSU16 = nil - } else { - h.decMapstringuint16((*map[string]uint16)(&x.AMSU16), d) - } + h.decMapstringuint16((*map[string]uint16)(&x.AMSU16), d) case "AI64arr0": - if r.TryDecodeAsNil() { - x.AI64arr0 = [0]int64{} - } else { - h.decArray0int64((*[0]int64)(&x.AI64arr0), d) - } + h.decArray0int64((*[0]int64)(&x.AI64arr0), d) case "AI64slice0": - if r.TryDecodeAsNil() { - x.AI64slice0 = nil - } else { - z.F.DecSliceInt64X(&x.AI64slice0, d) - } + z.F.DecSliceInt64X(&x.AI64slice0, d) case "AUi64sliceN": - if r.TryDecodeAsNil() { - x.AUi64sliceN = nil - } else { - z.F.DecSliceUint64X(&x.AUi64sliceN, d) - } + z.F.DecSliceUint64X(&x.AUi64sliceN, d) case "AMSU16N": - if r.TryDecodeAsNil() { - x.AMSU16N = nil - } else { - h.decMapstringuint16((*map[string]uint16)(&x.AMSU16N), d) - } + h.decMapstringuint16((*map[string]uint16)(&x.AMSU16N), d) case "AMSU16E": - if r.TryDecodeAsNil() { - x.AMSU16E = nil - } else { - h.decMapstringuint16((*map[string]uint16)(&x.AMSU16E), d) - } + h.decMapstringuint16((*map[string]uint16)(&x.AMSU16E), d) default: z.DecStructFieldNotFound(-1, yys3) } // end switch yys3 @@ -729,11 +658,7 @@ func (x *AnonInTestStruc) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.AS = "" - } else { - x.AS = (string)(string(r.DecodeStringAsBytes())) - } + x.AS = (string)(string(r.DecodeStringAsBytes())) yyj30++ if yyhl30 { yyb30 = yyj30 > l @@ -745,11 +670,7 @@ func (x *AnonInTestStruc) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.AI64 = 0 - } else { - x.AI64 = (int64)(r.DecodeInt64()) - } + x.AI64 = (int64)(r.DecodeInt64()) yyj30++ if yyhl30 { yyb30 = yyj30 > l @@ -761,11 +682,7 @@ func (x *AnonInTestStruc) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.AI16 = 0 - } else { - x.AI16 = (int16)(z.C.IntV(r.DecodeInt64(), 16)) - } + x.AI16 = (int16)(z.C.IntV(r.DecodeInt64(), 16)) yyj30++ if yyhl30 { yyb30 = yyj30 > l @@ -777,11 +694,7 @@ func (x *AnonInTestStruc) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.AUi64 = 0 - } else { - x.AUi64 = (uint64)(r.DecodeUint64()) - } + x.AUi64 = (uint64)(r.DecodeUint64()) yyj30++ if yyhl30 { yyb30 = yyj30 > l @@ -793,11 +706,7 @@ func (x *AnonInTestStruc) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.ASslice = nil - } else { - z.F.DecSliceStringX(&x.ASslice, d) - } + z.F.DecSliceStringX(&x.ASslice, d) yyj30++ if yyhl30 { yyb30 = yyj30 > l @@ -809,11 +718,7 @@ func (x *AnonInTestStruc) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.AI64slice = nil - } else { - z.F.DecSliceInt64X(&x.AI64slice, d) - } + z.F.DecSliceInt64X(&x.AI64slice, d) yyj30++ if yyhl30 { yyb30 = yyj30 > l @@ -825,11 +730,7 @@ func (x *AnonInTestStruc) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.AUi64slice = nil - } else { - z.F.DecSliceUint64X(&x.AUi64slice, d) - } + z.F.DecSliceUint64X(&x.AUi64slice, d) yyj30++ if yyhl30 { yyb30 = yyj30 > l @@ -841,11 +742,7 @@ func (x *AnonInTestStruc) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.AF64slice = nil - } else { - z.F.DecSliceFloat64X(&x.AF64slice, d) - } + z.F.DecSliceFloat64X(&x.AF64slice, d) yyj30++ if yyhl30 { yyb30 = yyj30 > l @@ -857,11 +754,7 @@ func (x *AnonInTestStruc) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.AF32slice = nil - } else { - z.F.DecSliceFloat32X(&x.AF32slice, d) - } + z.F.DecSliceFloat32X(&x.AF32slice, d) yyj30++ if yyhl30 { yyb30 = yyj30 > l @@ -873,11 +766,7 @@ func (x *AnonInTestStruc) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.AMSU16 = nil - } else { - h.decMapstringuint16((*map[string]uint16)(&x.AMSU16), d) - } + h.decMapstringuint16((*map[string]uint16)(&x.AMSU16), d) yyj30++ if yyhl30 { yyb30 = yyj30 > l @@ -889,11 +778,7 @@ func (x *AnonInTestStruc) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.AI64arr0 = [0]int64{} - } else { - h.decArray0int64((*[0]int64)(&x.AI64arr0), d) - } + h.decArray0int64((*[0]int64)(&x.AI64arr0), d) yyj30++ if yyhl30 { yyb30 = yyj30 > l @@ -905,11 +790,7 @@ func (x *AnonInTestStruc) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.AI64slice0 = nil - } else { - z.F.DecSliceInt64X(&x.AI64slice0, d) - } + z.F.DecSliceInt64X(&x.AI64slice0, d) yyj30++ if yyhl30 { yyb30 = yyj30 > l @@ -921,11 +802,7 @@ func (x *AnonInTestStruc) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.AUi64sliceN = nil - } else { - z.F.DecSliceUint64X(&x.AUi64sliceN, d) - } + z.F.DecSliceUint64X(&x.AUi64sliceN, d) yyj30++ if yyhl30 { yyb30 = yyj30 > l @@ -937,11 +814,7 @@ func (x *AnonInTestStruc) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.AMSU16N = nil - } else { - h.decMapstringuint16((*map[string]uint16)(&x.AMSU16N), d) - } + h.decMapstringuint16((*map[string]uint16)(&x.AMSU16N), d) yyj30++ if yyhl30 { yyb30 = yyj30 > l @@ -953,11 +826,7 @@ func (x *AnonInTestStruc) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.AMSU16E = nil - } else { - h.decMapstringuint16((*map[string]uint16)(&x.AMSU16E), d) - } + h.decMapstringuint16((*map[string]uint16)(&x.AMSU16E), d) for { yyj30++ if yyhl30 { @@ -979,7 +848,7 @@ func (x *testSimpleFields) CodecEncodeSelf(e *Encoder) { _, _, _ = h, z, r if x == nil { r.EncodeNil() - } else { // checkNil=true + } else { yysep2 := !z.EncBinary() yy2arr2 := z.EncBasicHandle().StructToArray _, _ = yysep2, yy2arr2 @@ -1225,7 +1094,7 @@ func (x *testSimpleFields) CodecEncodeSelf(e *Encoder) { } // end block: if x.Msi64 map == nil z.EncWriteMapEnd() } - } // checkNil=true + } } func (x *testSimpleFields) CodecDecodeSelf(d *Decoder) { @@ -1233,7 +1102,9 @@ func (x *testSimpleFields) CodecDecodeSelf(d *Decoder) { z, r := GenHelperDecoder(d) _, _, _ = h, z, r yyct2 := r.ContainerType() - if yyct2 == codecSelferValueTypeMap19780 { + if yyct2 == codecSelferValueTypeNil19780 { + *(x) = testSimpleFields{} + } else if yyct2 == codecSelferValueTypeMap19780 { yyl2 := z.DecReadMapStart() if yyl2 == 0 { } else { @@ -1271,107 +1142,39 @@ func (x *testSimpleFields) codecDecodeSelfFromMap(l int, d *Decoder) { z.DecReadMapElemValue() switch yys3 { case "S": - if r.TryDecodeAsNil() { - x.S = "" - } else { - x.S = (string)(string(r.DecodeStringAsBytes())) - } + x.S = (string)(string(r.DecodeStringAsBytes())) case "I64": - if r.TryDecodeAsNil() { - x.I64 = 0 - } else { - x.I64 = (int64)(r.DecodeInt64()) - } + x.I64 = (int64)(r.DecodeInt64()) case "I8": - if r.TryDecodeAsNil() { - x.I8 = 0 - } else { - x.I8 = (int8)(z.C.IntV(r.DecodeInt64(), 8)) - } + x.I8 = (int8)(z.C.IntV(r.DecodeInt64(), 8)) case "Ui64": - if r.TryDecodeAsNil() { - x.Ui64 = 0 - } else { - x.Ui64 = (uint64)(r.DecodeUint64()) - } + x.Ui64 = (uint64)(r.DecodeUint64()) case "Ui8": - if r.TryDecodeAsNil() { - x.Ui8 = 0 - } else { - x.Ui8 = (uint8)(z.C.UintV(r.DecodeUint64(), 8)) - } + x.Ui8 = (uint8)(z.C.UintV(r.DecodeUint64(), 8)) case "F64": - if r.TryDecodeAsNil() { - x.F64 = 0 - } else { - x.F64 = (float64)(r.DecodeFloat64()) - } + x.F64 = (float64)(r.DecodeFloat64()) case "F32": - if r.TryDecodeAsNil() { - x.F32 = 0 - } else { - x.F32 = (float32)(z.DecDecodeFloat32()) - } + x.F32 = (float32)(z.DecDecodeFloat32()) case "B": - if r.TryDecodeAsNil() { - x.B = false - } else { - x.B = (bool)(r.DecodeBool()) - } + x.B = (bool)(r.DecodeBool()) case "Sslice": - if r.TryDecodeAsNil() { - x.Sslice = nil - } else { - z.F.DecSliceStringX(&x.Sslice, d) - } + z.F.DecSliceStringX(&x.Sslice, d) case "I16slice": - if r.TryDecodeAsNil() { - x.I16slice = nil - } else { - z.F.DecSliceInt16X(&x.I16slice, d) - } + z.F.DecSliceInt16X(&x.I16slice, d) case "Ui64slice": - if r.TryDecodeAsNil() { - x.Ui64slice = nil - } else { - z.F.DecSliceUint64X(&x.Ui64slice, d) - } + z.F.DecSliceUint64X(&x.Ui64slice, d) case "Ui8slice": - if r.TryDecodeAsNil() { - x.Ui8slice = nil - } else { - x.Ui8slice = r.DecodeBytes(([]byte)(x.Ui8slice), false) - } + x.Ui8slice = r.DecodeBytes(([]byte)(x.Ui8slice), false) case "Bslice": - if r.TryDecodeAsNil() { - x.Bslice = nil - } else { - z.F.DecSliceBoolX(&x.Bslice, d) - } + z.F.DecSliceBoolX(&x.Bslice, d) case "Iptrslice": - if r.TryDecodeAsNil() { - x.Iptrslice = nil - } else { - h.decSlicePtrtoint64((*[]*int64)(&x.Iptrslice), d) - } + h.decSlicePtrtoint64((*[]*int64)(&x.Iptrslice), d) case "WrapSliceInt64": - if r.TryDecodeAsNil() { - x.WrapSliceInt64 = nil - } else { - x.WrapSliceInt64.CodecDecodeSelf(d) - } + x.WrapSliceInt64.CodecDecodeSelf(d) case "WrapSliceString": - if r.TryDecodeAsNil() { - x.WrapSliceString = nil - } else { - x.WrapSliceString.CodecDecodeSelf(d) - } + x.WrapSliceString.CodecDecodeSelf(d) case "Msi64": - if r.TryDecodeAsNil() { - x.Msi64 = nil - } else { - z.F.DecMapStringInt64X(&x.Msi64, d) - } + z.F.DecMapStringInt64X(&x.Msi64, d) default: z.DecStructFieldNotFound(-1, yys3) } // end switch yys3 @@ -1396,11 +1199,7 @@ func (x *testSimpleFields) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.S = "" - } else { - x.S = (string)(string(r.DecodeStringAsBytes())) - } + x.S = (string)(string(r.DecodeStringAsBytes())) yyj28++ if yyhl28 { yyb28 = yyj28 > l @@ -1412,11 +1211,7 @@ func (x *testSimpleFields) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.I64 = 0 - } else { - x.I64 = (int64)(r.DecodeInt64()) - } + x.I64 = (int64)(r.DecodeInt64()) yyj28++ if yyhl28 { yyb28 = yyj28 > l @@ -1428,11 +1223,7 @@ func (x *testSimpleFields) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.I8 = 0 - } else { - x.I8 = (int8)(z.C.IntV(r.DecodeInt64(), 8)) - } + x.I8 = (int8)(z.C.IntV(r.DecodeInt64(), 8)) yyj28++ if yyhl28 { yyb28 = yyj28 > l @@ -1444,11 +1235,7 @@ func (x *testSimpleFields) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.Ui64 = 0 - } else { - x.Ui64 = (uint64)(r.DecodeUint64()) - } + x.Ui64 = (uint64)(r.DecodeUint64()) yyj28++ if yyhl28 { yyb28 = yyj28 > l @@ -1460,11 +1247,7 @@ func (x *testSimpleFields) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.Ui8 = 0 - } else { - x.Ui8 = (uint8)(z.C.UintV(r.DecodeUint64(), 8)) - } + x.Ui8 = (uint8)(z.C.UintV(r.DecodeUint64(), 8)) yyj28++ if yyhl28 { yyb28 = yyj28 > l @@ -1476,11 +1259,7 @@ func (x *testSimpleFields) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.F64 = 0 - } else { - x.F64 = (float64)(r.DecodeFloat64()) - } + x.F64 = (float64)(r.DecodeFloat64()) yyj28++ if yyhl28 { yyb28 = yyj28 > l @@ -1492,11 +1271,7 @@ func (x *testSimpleFields) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.F32 = 0 - } else { - x.F32 = (float32)(z.DecDecodeFloat32()) - } + x.F32 = (float32)(z.DecDecodeFloat32()) yyj28++ if yyhl28 { yyb28 = yyj28 > l @@ -1508,11 +1283,7 @@ func (x *testSimpleFields) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.B = false - } else { - x.B = (bool)(r.DecodeBool()) - } + x.B = (bool)(r.DecodeBool()) yyj28++ if yyhl28 { yyb28 = yyj28 > l @@ -1524,11 +1295,7 @@ func (x *testSimpleFields) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.Sslice = nil - } else { - z.F.DecSliceStringX(&x.Sslice, d) - } + z.F.DecSliceStringX(&x.Sslice, d) yyj28++ if yyhl28 { yyb28 = yyj28 > l @@ -1540,11 +1307,7 @@ func (x *testSimpleFields) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.I16slice = nil - } else { - z.F.DecSliceInt16X(&x.I16slice, d) - } + z.F.DecSliceInt16X(&x.I16slice, d) yyj28++ if yyhl28 { yyb28 = yyj28 > l @@ -1556,11 +1319,7 @@ func (x *testSimpleFields) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.Ui64slice = nil - } else { - z.F.DecSliceUint64X(&x.Ui64slice, d) - } + z.F.DecSliceUint64X(&x.Ui64slice, d) yyj28++ if yyhl28 { yyb28 = yyj28 > l @@ -1572,11 +1331,7 @@ func (x *testSimpleFields) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.Ui8slice = nil - } else { - x.Ui8slice = r.DecodeBytes(([]byte)(x.Ui8slice), false) - } + x.Ui8slice = r.DecodeBytes(([]byte)(x.Ui8slice), false) yyj28++ if yyhl28 { yyb28 = yyj28 > l @@ -1588,11 +1343,7 @@ func (x *testSimpleFields) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.Bslice = nil - } else { - z.F.DecSliceBoolX(&x.Bslice, d) - } + z.F.DecSliceBoolX(&x.Bslice, d) yyj28++ if yyhl28 { yyb28 = yyj28 > l @@ -1604,11 +1355,7 @@ func (x *testSimpleFields) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.Iptrslice = nil - } else { - h.decSlicePtrtoint64((*[]*int64)(&x.Iptrslice), d) - } + h.decSlicePtrtoint64((*[]*int64)(&x.Iptrslice), d) yyj28++ if yyhl28 { yyb28 = yyj28 > l @@ -1620,11 +1367,7 @@ func (x *testSimpleFields) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.WrapSliceInt64 = nil - } else { - x.WrapSliceInt64.CodecDecodeSelf(d) - } + x.WrapSliceInt64.CodecDecodeSelf(d) yyj28++ if yyhl28 { yyb28 = yyj28 > l @@ -1636,11 +1379,7 @@ func (x *testSimpleFields) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.WrapSliceString = nil - } else { - x.WrapSliceString.CodecDecodeSelf(d) - } + x.WrapSliceString.CodecDecodeSelf(d) yyj28++ if yyhl28 { yyb28 = yyj28 > l @@ -1652,11 +1391,7 @@ func (x *testSimpleFields) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.Msi64 = nil - } else { - z.F.DecMapStringInt64X(&x.Msi64, d) - } + z.F.DecMapStringInt64X(&x.Msi64, d) for { yyj28++ if yyhl28 { @@ -1678,7 +1413,7 @@ func (x *TestStrucCommon) CodecEncodeSelf(e *Encoder) { _, _, _ = h, z, r if x == nil { r.EncodeNil() - } else { // checkNil=true + } else { yysep2 := !z.EncBinary() yy2arr2 := z.EncBasicHandle().StructToArray _, _ = yysep2, yy2arr2 @@ -2444,7 +2179,7 @@ func (x *TestStrucCommon) CodecEncodeSelf(e *Encoder) { } z.EncWriteMapEnd() } - } // checkNil=true + } } func (x *TestStrucCommon) CodecDecodeSelf(d *Decoder) { @@ -2452,7 +2187,9 @@ func (x *TestStrucCommon) CodecDecodeSelf(d *Decoder) { z, r := GenHelperDecoder(d) _, _, _ = h, z, r yyct2 := r.ContainerType() - if yyct2 == codecSelferValueTypeMap19780 { + if yyct2 == codecSelferValueTypeNil19780 { + *(x) = TestStrucCommon{} + } else if yyct2 == codecSelferValueTypeMap19780 { yyl2 := z.DecReadMapStart() if yyl2 == 0 { } else { @@ -2490,313 +2227,109 @@ func (x *TestStrucCommon) codecDecodeSelfFromMap(l int, d *Decoder) { z.DecReadMapElemValue() switch yys3 { case "S": - if r.TryDecodeAsNil() { - x.S = "" - } else { - x.S = (string)(string(r.DecodeStringAsBytes())) - } + x.S = (string)(string(r.DecodeStringAsBytes())) case "I64": - if r.TryDecodeAsNil() { - x.I64 = 0 - } else { - x.I64 = (int64)(r.DecodeInt64()) - } + x.I64 = (int64)(r.DecodeInt64()) case "I32": - if r.TryDecodeAsNil() { - x.I32 = 0 - } else { - x.I32 = (int32)(z.C.IntV(r.DecodeInt64(), 32)) - } + x.I32 = (int32)(z.C.IntV(r.DecodeInt64(), 32)) case "I16": - if r.TryDecodeAsNil() { - x.I16 = 0 - } else { - x.I16 = (int16)(z.C.IntV(r.DecodeInt64(), 16)) - } + x.I16 = (int16)(z.C.IntV(r.DecodeInt64(), 16)) case "I8": - if r.TryDecodeAsNil() { - x.I8 = 0 - } else { - x.I8 = (int8)(z.C.IntV(r.DecodeInt64(), 8)) - } + x.I8 = (int8)(z.C.IntV(r.DecodeInt64(), 8)) case "I64n": - if r.TryDecodeAsNil() { - x.I64n = 0 - } else { - x.I64n = (int64)(r.DecodeInt64()) - } + x.I64n = (int64)(r.DecodeInt64()) case "I32n": - if r.TryDecodeAsNil() { - x.I32n = 0 - } else { - x.I32n = (int32)(z.C.IntV(r.DecodeInt64(), 32)) - } + x.I32n = (int32)(z.C.IntV(r.DecodeInt64(), 32)) case "I16n": - if r.TryDecodeAsNil() { - x.I16n = 0 - } else { - x.I16n = (int16)(z.C.IntV(r.DecodeInt64(), 16)) - } + x.I16n = (int16)(z.C.IntV(r.DecodeInt64(), 16)) case "I8n": - if r.TryDecodeAsNil() { - x.I8n = 0 - } else { - x.I8n = (int8)(z.C.IntV(r.DecodeInt64(), 8)) - } + x.I8n = (int8)(z.C.IntV(r.DecodeInt64(), 8)) case "Ui64": - if r.TryDecodeAsNil() { - x.Ui64 = 0 - } else { - x.Ui64 = (uint64)(r.DecodeUint64()) - } + x.Ui64 = (uint64)(r.DecodeUint64()) case "Ui32": - if r.TryDecodeAsNil() { - x.Ui32 = 0 - } else { - x.Ui32 = (uint32)(z.C.UintV(r.DecodeUint64(), 32)) - } + x.Ui32 = (uint32)(z.C.UintV(r.DecodeUint64(), 32)) case "Ui16": - if r.TryDecodeAsNil() { - x.Ui16 = 0 - } else { - x.Ui16 = (uint16)(z.C.UintV(r.DecodeUint64(), 16)) - } + x.Ui16 = (uint16)(z.C.UintV(r.DecodeUint64(), 16)) case "Ui8": - if r.TryDecodeAsNil() { - x.Ui8 = 0 - } else { - x.Ui8 = (uint8)(z.C.UintV(r.DecodeUint64(), 8)) - } + x.Ui8 = (uint8)(z.C.UintV(r.DecodeUint64(), 8)) case "F64": - if r.TryDecodeAsNil() { - x.F64 = 0 - } else { - x.F64 = (float64)(r.DecodeFloat64()) - } + x.F64 = (float64)(r.DecodeFloat64()) case "F32": - if r.TryDecodeAsNil() { - x.F32 = 0 - } else { - x.F32 = (float32)(z.DecDecodeFloat32()) - } + x.F32 = (float32)(z.DecDecodeFloat32()) case "B": - if r.TryDecodeAsNil() { - x.B = false - } else { - x.B = (bool)(r.DecodeBool()) - } + x.B = (bool)(r.DecodeBool()) case "By": - if r.TryDecodeAsNil() { - x.By = 0 - } else { - x.By = (uint8)(z.C.UintV(r.DecodeUint64(), 8)) - } + x.By = (uint8)(z.C.UintV(r.DecodeUint64(), 8)) case "Sslice": - if r.TryDecodeAsNil() { - x.Sslice = nil - } else { - z.F.DecSliceStringX(&x.Sslice, d) - } + z.F.DecSliceStringX(&x.Sslice, d) case "I64slice": - if r.TryDecodeAsNil() { - x.I64slice = nil - } else { - z.F.DecSliceInt64X(&x.I64slice, d) - } + z.F.DecSliceInt64X(&x.I64slice, d) case "I16slice": - if r.TryDecodeAsNil() { - x.I16slice = nil - } else { - z.F.DecSliceInt16X(&x.I16slice, d) - } + z.F.DecSliceInt16X(&x.I16slice, d) case "Ui64slice": - if r.TryDecodeAsNil() { - x.Ui64slice = nil - } else { - z.F.DecSliceUint64X(&x.Ui64slice, d) - } + z.F.DecSliceUint64X(&x.Ui64slice, d) case "Ui8slice": - if r.TryDecodeAsNil() { - x.Ui8slice = nil - } else { - x.Ui8slice = r.DecodeBytes(([]byte)(x.Ui8slice), false) - } + x.Ui8slice = r.DecodeBytes(([]byte)(x.Ui8slice), false) case "Bslice": - if r.TryDecodeAsNil() { - x.Bslice = nil - } else { - z.F.DecSliceBoolX(&x.Bslice, d) - } + z.F.DecSliceBoolX(&x.Bslice, d) case "Byslice": - if r.TryDecodeAsNil() { - x.Byslice = nil - } else { - x.Byslice = r.DecodeBytes(([]byte)(x.Byslice), false) - } + x.Byslice = r.DecodeBytes(([]byte)(x.Byslice), false) case "BytesSlice": - if r.TryDecodeAsNil() { - x.BytesSlice = nil - } else { - z.F.DecSliceBytesX(&x.BytesSlice, d) - } + z.F.DecSliceBytesX(&x.BytesSlice, d) case "Iptrslice": - if r.TryDecodeAsNil() { - x.Iptrslice = nil - } else { - h.decSlicePtrtoint64((*[]*int64)(&x.Iptrslice), d) - } + h.decSlicePtrtoint64((*[]*int64)(&x.Iptrslice), d) case "WrapSliceInt64": - if r.TryDecodeAsNil() { - x.WrapSliceInt64 = nil - } else { - x.WrapSliceInt64.CodecDecodeSelf(d) - } + x.WrapSliceInt64.CodecDecodeSelf(d) case "WrapSliceString": - if r.TryDecodeAsNil() { - x.WrapSliceString = nil - } else { - x.WrapSliceString.CodecDecodeSelf(d) - } + x.WrapSliceString.CodecDecodeSelf(d) case "Msi64": - if r.TryDecodeAsNil() { - x.Msi64 = nil - } else { - z.F.DecMapStringInt64X(&x.Msi64, d) - } + z.F.DecMapStringInt64X(&x.Msi64, d) case "Msbytes": - if r.TryDecodeAsNil() { - x.Msbytes = nil - } else { - z.F.DecMapStringBytesX(&x.Msbytes, d) - } + z.F.DecMapStringBytesX(&x.Msbytes, d) case "Simplef": - if r.TryDecodeAsNil() { - x.Simplef = testSimpleFields{} - } else { - x.Simplef.CodecDecodeSelf(d) - } + x.Simplef.CodecDecodeSelf(d) case "SstrUi64T": - if r.TryDecodeAsNil() { - x.SstrUi64T = nil - } else { - h.decSlicestringUint64T((*[]stringUint64T)(&x.SstrUi64T), d) - } + h.decSlicestringUint64T((*[]stringUint64T)(&x.SstrUi64T), d) case "MstrUi64T": - if r.TryDecodeAsNil() { - x.MstrUi64T = nil - } else { - h.decMapstringPtrtostringUint64T((*map[string]*stringUint64T)(&x.MstrUi64T), d) - } + h.decMapstringPtrtostringUint64T((*map[string]*stringUint64T)(&x.MstrUi64T), d) case "AS": - if r.TryDecodeAsNil() { - x.AnonInTestStruc.AS = "" - } else { - x.AnonInTestStruc.AS = (string)(string(r.DecodeStringAsBytes())) - } + x.AnonInTestStruc.AS = (string)(string(r.DecodeStringAsBytes())) case "AI64": - if r.TryDecodeAsNil() { - x.AnonInTestStruc.AI64 = 0 - } else { - x.AnonInTestStruc.AI64 = (int64)(r.DecodeInt64()) - } + x.AnonInTestStruc.AI64 = (int64)(r.DecodeInt64()) case "AI16": - if r.TryDecodeAsNil() { - x.AnonInTestStruc.AI16 = 0 - } else { - x.AnonInTestStruc.AI16 = (int16)(z.C.IntV(r.DecodeInt64(), 16)) - } + x.AnonInTestStruc.AI16 = (int16)(z.C.IntV(r.DecodeInt64(), 16)) case "AUi64": - if r.TryDecodeAsNil() { - x.AnonInTestStruc.AUi64 = 0 - } else { - x.AnonInTestStruc.AUi64 = (uint64)(r.DecodeUint64()) - } + x.AnonInTestStruc.AUi64 = (uint64)(r.DecodeUint64()) case "ASslice": - if r.TryDecodeAsNil() { - x.AnonInTestStruc.ASslice = nil - } else { - z.F.DecSliceStringX(&x.AnonInTestStruc.ASslice, d) - } + z.F.DecSliceStringX(&x.AnonInTestStruc.ASslice, d) case "AI64slice": - if r.TryDecodeAsNil() { - x.AnonInTestStruc.AI64slice = nil - } else { - z.F.DecSliceInt64X(&x.AnonInTestStruc.AI64slice, d) - } + z.F.DecSliceInt64X(&x.AnonInTestStruc.AI64slice, d) case "AUi64slice": - if r.TryDecodeAsNil() { - x.AnonInTestStruc.AUi64slice = nil - } else { - z.F.DecSliceUint64X(&x.AnonInTestStruc.AUi64slice, d) - } + z.F.DecSliceUint64X(&x.AnonInTestStruc.AUi64slice, d) case "AF64slice": - if r.TryDecodeAsNil() { - x.AnonInTestStruc.AF64slice = nil - } else { - z.F.DecSliceFloat64X(&x.AnonInTestStruc.AF64slice, d) - } + z.F.DecSliceFloat64X(&x.AnonInTestStruc.AF64slice, d) case "AF32slice": - if r.TryDecodeAsNil() { - x.AnonInTestStruc.AF32slice = nil - } else { - z.F.DecSliceFloat32X(&x.AnonInTestStruc.AF32slice, d) - } + z.F.DecSliceFloat32X(&x.AnonInTestStruc.AF32slice, d) case "AMSU16": - if r.TryDecodeAsNil() { - x.AnonInTestStruc.AMSU16 = nil - } else { - h.decMapstringuint16((*map[string]uint16)(&x.AnonInTestStruc.AMSU16), d) - } + h.decMapstringuint16((*map[string]uint16)(&x.AnonInTestStruc.AMSU16), d) case "AI64arr0": - if r.TryDecodeAsNil() { - x.AnonInTestStruc.AI64arr0 = [0]int64{} - } else { - h.decArray0int64((*[0]int64)(&x.AnonInTestStruc.AI64arr0), d) - } + h.decArray0int64((*[0]int64)(&x.AnonInTestStruc.AI64arr0), d) case "AI64slice0": - if r.TryDecodeAsNil() { - x.AnonInTestStruc.AI64slice0 = nil - } else { - z.F.DecSliceInt64X(&x.AnonInTestStruc.AI64slice0, d) - } + z.F.DecSliceInt64X(&x.AnonInTestStruc.AI64slice0, d) case "AUi64sliceN": - if r.TryDecodeAsNil() { - x.AnonInTestStruc.AUi64sliceN = nil - } else { - z.F.DecSliceUint64X(&x.AnonInTestStruc.AUi64sliceN, d) - } + z.F.DecSliceUint64X(&x.AnonInTestStruc.AUi64sliceN, d) case "AMSU16N": - if r.TryDecodeAsNil() { - x.AnonInTestStruc.AMSU16N = nil - } else { - h.decMapstringuint16((*map[string]uint16)(&x.AnonInTestStruc.AMSU16N), d) - } + h.decMapstringuint16((*map[string]uint16)(&x.AnonInTestStruc.AMSU16N), d) case "AMSU16E": - if r.TryDecodeAsNil() { - x.AnonInTestStruc.AMSU16E = nil - } else { - h.decMapstringuint16((*map[string]uint16)(&x.AnonInTestStruc.AMSU16E), d) - } + h.decMapstringuint16((*map[string]uint16)(&x.AnonInTestStruc.AMSU16E), d) case "NotAnon": - if r.TryDecodeAsNil() { - x.NotAnon = AnonInTestStruc{} - } else { - x.NotAnon.CodecDecodeSelf(d) - } + x.NotAnon.CodecDecodeSelf(d) case "Nmap": - if r.TryDecodeAsNil() { - x.Nmap = nil - } else { - z.F.DecMapStringBoolX(&x.Nmap, d) - } + z.F.DecMapStringBoolX(&x.Nmap, d) case "Nslice": - if r.TryDecodeAsNil() { - x.Nslice = nil - } else { - x.Nslice = r.DecodeBytes(([]byte)(x.Nslice), false) - } + x.Nslice = r.DecodeBytes(([]byte)(x.Nslice), false) case "Nint64": - if r.TryDecodeAsNil() { + if r.TryNil() { if x.Nint64 != nil { // remove the if-true x.Nint64 = nil } @@ -2804,7 +2337,6 @@ func (x *TestStrucCommon) codecDecodeSelfFromMap(l int, d *Decoder) { if x.Nint64 == nil { x.Nint64 = new(int64) } - *x.Nint64 = (int64)(r.DecodeInt64()) } default: @@ -2831,11 +2363,7 @@ func (x *TestStrucCommon) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.S = "" - } else { - x.S = (string)(string(r.DecodeStringAsBytes())) - } + x.S = (string)(string(r.DecodeStringAsBytes())) yyj83++ if yyhl83 { yyb83 = yyj83 > l @@ -2847,11 +2375,7 @@ func (x *TestStrucCommon) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.I64 = 0 - } else { - x.I64 = (int64)(r.DecodeInt64()) - } + x.I64 = (int64)(r.DecodeInt64()) yyj83++ if yyhl83 { yyb83 = yyj83 > l @@ -2863,11 +2387,7 @@ func (x *TestStrucCommon) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.I32 = 0 - } else { - x.I32 = (int32)(z.C.IntV(r.DecodeInt64(), 32)) - } + x.I32 = (int32)(z.C.IntV(r.DecodeInt64(), 32)) yyj83++ if yyhl83 { yyb83 = yyj83 > l @@ -2879,11 +2399,7 @@ func (x *TestStrucCommon) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.I16 = 0 - } else { - x.I16 = (int16)(z.C.IntV(r.DecodeInt64(), 16)) - } + x.I16 = (int16)(z.C.IntV(r.DecodeInt64(), 16)) yyj83++ if yyhl83 { yyb83 = yyj83 > l @@ -2895,11 +2411,7 @@ func (x *TestStrucCommon) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.I8 = 0 - } else { - x.I8 = (int8)(z.C.IntV(r.DecodeInt64(), 8)) - } + x.I8 = (int8)(z.C.IntV(r.DecodeInt64(), 8)) yyj83++ if yyhl83 { yyb83 = yyj83 > l @@ -2911,11 +2423,7 @@ func (x *TestStrucCommon) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.I64n = 0 - } else { - x.I64n = (int64)(r.DecodeInt64()) - } + x.I64n = (int64)(r.DecodeInt64()) yyj83++ if yyhl83 { yyb83 = yyj83 > l @@ -2927,11 +2435,7 @@ func (x *TestStrucCommon) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.I32n = 0 - } else { - x.I32n = (int32)(z.C.IntV(r.DecodeInt64(), 32)) - } + x.I32n = (int32)(z.C.IntV(r.DecodeInt64(), 32)) yyj83++ if yyhl83 { yyb83 = yyj83 > l @@ -2943,11 +2447,7 @@ func (x *TestStrucCommon) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.I16n = 0 - } else { - x.I16n = (int16)(z.C.IntV(r.DecodeInt64(), 16)) - } + x.I16n = (int16)(z.C.IntV(r.DecodeInt64(), 16)) yyj83++ if yyhl83 { yyb83 = yyj83 > l @@ -2959,11 +2459,7 @@ func (x *TestStrucCommon) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.I8n = 0 - } else { - x.I8n = (int8)(z.C.IntV(r.DecodeInt64(), 8)) - } + x.I8n = (int8)(z.C.IntV(r.DecodeInt64(), 8)) yyj83++ if yyhl83 { yyb83 = yyj83 > l @@ -2975,11 +2471,7 @@ func (x *TestStrucCommon) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.Ui64 = 0 - } else { - x.Ui64 = (uint64)(r.DecodeUint64()) - } + x.Ui64 = (uint64)(r.DecodeUint64()) yyj83++ if yyhl83 { yyb83 = yyj83 > l @@ -2991,11 +2483,7 @@ func (x *TestStrucCommon) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.Ui32 = 0 - } else { - x.Ui32 = (uint32)(z.C.UintV(r.DecodeUint64(), 32)) - } + x.Ui32 = (uint32)(z.C.UintV(r.DecodeUint64(), 32)) yyj83++ if yyhl83 { yyb83 = yyj83 > l @@ -3007,11 +2495,7 @@ func (x *TestStrucCommon) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.Ui16 = 0 - } else { - x.Ui16 = (uint16)(z.C.UintV(r.DecodeUint64(), 16)) - } + x.Ui16 = (uint16)(z.C.UintV(r.DecodeUint64(), 16)) yyj83++ if yyhl83 { yyb83 = yyj83 > l @@ -3023,11 +2507,7 @@ func (x *TestStrucCommon) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.Ui8 = 0 - } else { - x.Ui8 = (uint8)(z.C.UintV(r.DecodeUint64(), 8)) - } + x.Ui8 = (uint8)(z.C.UintV(r.DecodeUint64(), 8)) yyj83++ if yyhl83 { yyb83 = yyj83 > l @@ -3039,11 +2519,7 @@ func (x *TestStrucCommon) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.F64 = 0 - } else { - x.F64 = (float64)(r.DecodeFloat64()) - } + x.F64 = (float64)(r.DecodeFloat64()) yyj83++ if yyhl83 { yyb83 = yyj83 > l @@ -3055,11 +2531,7 @@ func (x *TestStrucCommon) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.F32 = 0 - } else { - x.F32 = (float32)(z.DecDecodeFloat32()) - } + x.F32 = (float32)(z.DecDecodeFloat32()) yyj83++ if yyhl83 { yyb83 = yyj83 > l @@ -3071,11 +2543,7 @@ func (x *TestStrucCommon) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.B = false - } else { - x.B = (bool)(r.DecodeBool()) - } + x.B = (bool)(r.DecodeBool()) yyj83++ if yyhl83 { yyb83 = yyj83 > l @@ -3087,11 +2555,7 @@ func (x *TestStrucCommon) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.By = 0 - } else { - x.By = (uint8)(z.C.UintV(r.DecodeUint64(), 8)) - } + x.By = (uint8)(z.C.UintV(r.DecodeUint64(), 8)) yyj83++ if yyhl83 { yyb83 = yyj83 > l @@ -3103,11 +2567,7 @@ func (x *TestStrucCommon) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.Sslice = nil - } else { - z.F.DecSliceStringX(&x.Sslice, d) - } + z.F.DecSliceStringX(&x.Sslice, d) yyj83++ if yyhl83 { yyb83 = yyj83 > l @@ -3119,11 +2579,7 @@ func (x *TestStrucCommon) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.I64slice = nil - } else { - z.F.DecSliceInt64X(&x.I64slice, d) - } + z.F.DecSliceInt64X(&x.I64slice, d) yyj83++ if yyhl83 { yyb83 = yyj83 > l @@ -3135,11 +2591,7 @@ func (x *TestStrucCommon) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.I16slice = nil - } else { - z.F.DecSliceInt16X(&x.I16slice, d) - } + z.F.DecSliceInt16X(&x.I16slice, d) yyj83++ if yyhl83 { yyb83 = yyj83 > l @@ -3151,11 +2603,7 @@ func (x *TestStrucCommon) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.Ui64slice = nil - } else { - z.F.DecSliceUint64X(&x.Ui64slice, d) - } + z.F.DecSliceUint64X(&x.Ui64slice, d) yyj83++ if yyhl83 { yyb83 = yyj83 > l @@ -3167,11 +2615,7 @@ func (x *TestStrucCommon) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.Ui8slice = nil - } else { - x.Ui8slice = r.DecodeBytes(([]byte)(x.Ui8slice), false) - } + x.Ui8slice = r.DecodeBytes(([]byte)(x.Ui8slice), false) yyj83++ if yyhl83 { yyb83 = yyj83 > l @@ -3183,11 +2627,7 @@ func (x *TestStrucCommon) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.Bslice = nil - } else { - z.F.DecSliceBoolX(&x.Bslice, d) - } + z.F.DecSliceBoolX(&x.Bslice, d) yyj83++ if yyhl83 { yyb83 = yyj83 > l @@ -3199,11 +2639,7 @@ func (x *TestStrucCommon) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.Byslice = nil - } else { - x.Byslice = r.DecodeBytes(([]byte)(x.Byslice), false) - } + x.Byslice = r.DecodeBytes(([]byte)(x.Byslice), false) yyj83++ if yyhl83 { yyb83 = yyj83 > l @@ -3215,11 +2651,7 @@ func (x *TestStrucCommon) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.BytesSlice = nil - } else { - z.F.DecSliceBytesX(&x.BytesSlice, d) - } + z.F.DecSliceBytesX(&x.BytesSlice, d) yyj83++ if yyhl83 { yyb83 = yyj83 > l @@ -3231,11 +2663,7 @@ func (x *TestStrucCommon) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.Iptrslice = nil - } else { - h.decSlicePtrtoint64((*[]*int64)(&x.Iptrslice), d) - } + h.decSlicePtrtoint64((*[]*int64)(&x.Iptrslice), d) yyj83++ if yyhl83 { yyb83 = yyj83 > l @@ -3247,11 +2675,7 @@ func (x *TestStrucCommon) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.WrapSliceInt64 = nil - } else { - x.WrapSliceInt64.CodecDecodeSelf(d) - } + x.WrapSliceInt64.CodecDecodeSelf(d) yyj83++ if yyhl83 { yyb83 = yyj83 > l @@ -3263,11 +2687,7 @@ func (x *TestStrucCommon) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.WrapSliceString = nil - } else { - x.WrapSliceString.CodecDecodeSelf(d) - } + x.WrapSliceString.CodecDecodeSelf(d) yyj83++ if yyhl83 { yyb83 = yyj83 > l @@ -3279,11 +2699,7 @@ func (x *TestStrucCommon) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.Msi64 = nil - } else { - z.F.DecMapStringInt64X(&x.Msi64, d) - } + z.F.DecMapStringInt64X(&x.Msi64, d) yyj83++ if yyhl83 { yyb83 = yyj83 > l @@ -3295,11 +2711,7 @@ func (x *TestStrucCommon) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.Msbytes = nil - } else { - z.F.DecMapStringBytesX(&x.Msbytes, d) - } + z.F.DecMapStringBytesX(&x.Msbytes, d) yyj83++ if yyhl83 { yyb83 = yyj83 > l @@ -3311,11 +2723,7 @@ func (x *TestStrucCommon) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.Simplef = testSimpleFields{} - } else { - x.Simplef.CodecDecodeSelf(d) - } + x.Simplef.CodecDecodeSelf(d) yyj83++ if yyhl83 { yyb83 = yyj83 > l @@ -3327,11 +2735,7 @@ func (x *TestStrucCommon) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.SstrUi64T = nil - } else { - h.decSlicestringUint64T((*[]stringUint64T)(&x.SstrUi64T), d) - } + h.decSlicestringUint64T((*[]stringUint64T)(&x.SstrUi64T), d) yyj83++ if yyhl83 { yyb83 = yyj83 > l @@ -3343,11 +2747,7 @@ func (x *TestStrucCommon) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.MstrUi64T = nil - } else { - h.decMapstringPtrtostringUint64T((*map[string]*stringUint64T)(&x.MstrUi64T), d) - } + h.decMapstringPtrtostringUint64T((*map[string]*stringUint64T)(&x.MstrUi64T), d) yyj83++ if yyhl83 { yyb83 = yyj83 > l @@ -3359,11 +2759,7 @@ func (x *TestStrucCommon) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.AnonInTestStruc.AS = "" - } else { - x.AnonInTestStruc.AS = (string)(string(r.DecodeStringAsBytes())) - } + x.AnonInTestStruc.AS = (string)(string(r.DecodeStringAsBytes())) yyj83++ if yyhl83 { yyb83 = yyj83 > l @@ -3375,11 +2771,7 @@ func (x *TestStrucCommon) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.AnonInTestStruc.AI64 = 0 - } else { - x.AnonInTestStruc.AI64 = (int64)(r.DecodeInt64()) - } + x.AnonInTestStruc.AI64 = (int64)(r.DecodeInt64()) yyj83++ if yyhl83 { yyb83 = yyj83 > l @@ -3391,11 +2783,7 @@ func (x *TestStrucCommon) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.AnonInTestStruc.AI16 = 0 - } else { - x.AnonInTestStruc.AI16 = (int16)(z.C.IntV(r.DecodeInt64(), 16)) - } + x.AnonInTestStruc.AI16 = (int16)(z.C.IntV(r.DecodeInt64(), 16)) yyj83++ if yyhl83 { yyb83 = yyj83 > l @@ -3407,11 +2795,7 @@ func (x *TestStrucCommon) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.AnonInTestStruc.AUi64 = 0 - } else { - x.AnonInTestStruc.AUi64 = (uint64)(r.DecodeUint64()) - } + x.AnonInTestStruc.AUi64 = (uint64)(r.DecodeUint64()) yyj83++ if yyhl83 { yyb83 = yyj83 > l @@ -3423,11 +2807,7 @@ func (x *TestStrucCommon) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.AnonInTestStruc.ASslice = nil - } else { - z.F.DecSliceStringX(&x.AnonInTestStruc.ASslice, d) - } + z.F.DecSliceStringX(&x.AnonInTestStruc.ASslice, d) yyj83++ if yyhl83 { yyb83 = yyj83 > l @@ -3439,11 +2819,7 @@ func (x *TestStrucCommon) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.AnonInTestStruc.AI64slice = nil - } else { - z.F.DecSliceInt64X(&x.AnonInTestStruc.AI64slice, d) - } + z.F.DecSliceInt64X(&x.AnonInTestStruc.AI64slice, d) yyj83++ if yyhl83 { yyb83 = yyj83 > l @@ -3455,11 +2831,7 @@ func (x *TestStrucCommon) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.AnonInTestStruc.AUi64slice = nil - } else { - z.F.DecSliceUint64X(&x.AnonInTestStruc.AUi64slice, d) - } + z.F.DecSliceUint64X(&x.AnonInTestStruc.AUi64slice, d) yyj83++ if yyhl83 { yyb83 = yyj83 > l @@ -3471,11 +2843,7 @@ func (x *TestStrucCommon) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.AnonInTestStruc.AF64slice = nil - } else { - z.F.DecSliceFloat64X(&x.AnonInTestStruc.AF64slice, d) - } + z.F.DecSliceFloat64X(&x.AnonInTestStruc.AF64slice, d) yyj83++ if yyhl83 { yyb83 = yyj83 > l @@ -3487,11 +2855,7 @@ func (x *TestStrucCommon) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.AnonInTestStruc.AF32slice = nil - } else { - z.F.DecSliceFloat32X(&x.AnonInTestStruc.AF32slice, d) - } + z.F.DecSliceFloat32X(&x.AnonInTestStruc.AF32slice, d) yyj83++ if yyhl83 { yyb83 = yyj83 > l @@ -3503,11 +2867,7 @@ func (x *TestStrucCommon) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.AnonInTestStruc.AMSU16 = nil - } else { - h.decMapstringuint16((*map[string]uint16)(&x.AnonInTestStruc.AMSU16), d) - } + h.decMapstringuint16((*map[string]uint16)(&x.AnonInTestStruc.AMSU16), d) yyj83++ if yyhl83 { yyb83 = yyj83 > l @@ -3519,11 +2879,7 @@ func (x *TestStrucCommon) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.AnonInTestStruc.AI64arr0 = [0]int64{} - } else { - h.decArray0int64((*[0]int64)(&x.AnonInTestStruc.AI64arr0), d) - } + h.decArray0int64((*[0]int64)(&x.AnonInTestStruc.AI64arr0), d) yyj83++ if yyhl83 { yyb83 = yyj83 > l @@ -3535,11 +2891,7 @@ func (x *TestStrucCommon) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.AnonInTestStruc.AI64slice0 = nil - } else { - z.F.DecSliceInt64X(&x.AnonInTestStruc.AI64slice0, d) - } + z.F.DecSliceInt64X(&x.AnonInTestStruc.AI64slice0, d) yyj83++ if yyhl83 { yyb83 = yyj83 > l @@ -3551,11 +2903,7 @@ func (x *TestStrucCommon) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.AnonInTestStruc.AUi64sliceN = nil - } else { - z.F.DecSliceUint64X(&x.AnonInTestStruc.AUi64sliceN, d) - } + z.F.DecSliceUint64X(&x.AnonInTestStruc.AUi64sliceN, d) yyj83++ if yyhl83 { yyb83 = yyj83 > l @@ -3567,11 +2915,7 @@ func (x *TestStrucCommon) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.AnonInTestStruc.AMSU16N = nil - } else { - h.decMapstringuint16((*map[string]uint16)(&x.AnonInTestStruc.AMSU16N), d) - } + h.decMapstringuint16((*map[string]uint16)(&x.AnonInTestStruc.AMSU16N), d) yyj83++ if yyhl83 { yyb83 = yyj83 > l @@ -3583,11 +2927,7 @@ func (x *TestStrucCommon) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.AnonInTestStruc.AMSU16E = nil - } else { - h.decMapstringuint16((*map[string]uint16)(&x.AnonInTestStruc.AMSU16E), d) - } + h.decMapstringuint16((*map[string]uint16)(&x.AnonInTestStruc.AMSU16E), d) yyj83++ if yyhl83 { yyb83 = yyj83 > l @@ -3599,11 +2939,7 @@ func (x *TestStrucCommon) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.NotAnon = AnonInTestStruc{} - } else { - x.NotAnon.CodecDecodeSelf(d) - } + x.NotAnon.CodecDecodeSelf(d) yyj83++ if yyhl83 { yyb83 = yyj83 > l @@ -3615,11 +2951,7 @@ func (x *TestStrucCommon) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.Nmap = nil - } else { - z.F.DecMapStringBoolX(&x.Nmap, d) - } + z.F.DecMapStringBoolX(&x.Nmap, d) yyj83++ if yyhl83 { yyb83 = yyj83 > l @@ -3631,11 +2963,7 @@ func (x *TestStrucCommon) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.Nslice = nil - } else { - x.Nslice = r.DecodeBytes(([]byte)(x.Nslice), false) - } + x.Nslice = r.DecodeBytes(([]byte)(x.Nslice), false) yyj83++ if yyhl83 { yyb83 = yyj83 > l @@ -3647,7 +2975,7 @@ func (x *TestStrucCommon) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { + if r.TryNil() { if x.Nint64 != nil { // remove the if-true x.Nint64 = nil } @@ -3655,7 +2983,6 @@ func (x *TestStrucCommon) codecDecodeSelfFromArray(l int, d *Decoder) { if x.Nint64 == nil { x.Nint64 = new(int64) } - *x.Nint64 = (int64)(r.DecodeInt64()) } for { @@ -3679,7 +3006,7 @@ func (x *TestStruc) CodecEncodeSelf(e *Encoder) { _, _, _ = h, z, r if x == nil { r.EncodeNil() - } else { // checkNil=true + } else { yysep2 := !z.EncBinary() yy2arr2 := z.EncBasicHandle().StructToArray _, _ = yysep2, yy2arr2 @@ -4519,7 +3846,7 @@ func (x *TestStruc) CodecEncodeSelf(e *Encoder) { } z.EncWriteMapEnd() } - } // checkNil=true + } } func (x *TestStruc) CodecDecodeSelf(d *Decoder) { @@ -4527,7 +3854,9 @@ func (x *TestStruc) CodecDecodeSelf(d *Decoder) { z, r := GenHelperDecoder(d) _, _, _ = h, z, r yyct2 := r.ContainerType() - if yyct2 == codecSelferValueTypeMap19780 { + if yyct2 == codecSelferValueTypeNil19780 { + *(x) = TestStruc{} + } else if yyct2 == codecSelferValueTypeMap19780 { yyl2 := z.DecReadMapStart() if yyl2 == 0 { } else { @@ -4565,313 +3894,109 @@ func (x *TestStruc) codecDecodeSelfFromMap(l int, d *Decoder) { z.DecReadMapElemValue() switch yys3 { case "S": - if r.TryDecodeAsNil() { - x.TestStrucCommon.S = "" - } else { - x.TestStrucCommon.S = (string)(string(r.DecodeStringAsBytes())) - } + x.TestStrucCommon.S = (string)(string(r.DecodeStringAsBytes())) case "I64": - if r.TryDecodeAsNil() { - x.TestStrucCommon.I64 = 0 - } else { - x.TestStrucCommon.I64 = (int64)(r.DecodeInt64()) - } + x.TestStrucCommon.I64 = (int64)(r.DecodeInt64()) case "I32": - if r.TryDecodeAsNil() { - x.TestStrucCommon.I32 = 0 - } else { - x.TestStrucCommon.I32 = (int32)(z.C.IntV(r.DecodeInt64(), 32)) - } + x.TestStrucCommon.I32 = (int32)(z.C.IntV(r.DecodeInt64(), 32)) case "I16": - if r.TryDecodeAsNil() { - x.TestStrucCommon.I16 = 0 - } else { - x.TestStrucCommon.I16 = (int16)(z.C.IntV(r.DecodeInt64(), 16)) - } + x.TestStrucCommon.I16 = (int16)(z.C.IntV(r.DecodeInt64(), 16)) case "I8": - if r.TryDecodeAsNil() { - x.TestStrucCommon.I8 = 0 - } else { - x.TestStrucCommon.I8 = (int8)(z.C.IntV(r.DecodeInt64(), 8)) - } + x.TestStrucCommon.I8 = (int8)(z.C.IntV(r.DecodeInt64(), 8)) case "I64n": - if r.TryDecodeAsNil() { - x.TestStrucCommon.I64n = 0 - } else { - x.TestStrucCommon.I64n = (int64)(r.DecodeInt64()) - } + x.TestStrucCommon.I64n = (int64)(r.DecodeInt64()) case "I32n": - if r.TryDecodeAsNil() { - x.TestStrucCommon.I32n = 0 - } else { - x.TestStrucCommon.I32n = (int32)(z.C.IntV(r.DecodeInt64(), 32)) - } + x.TestStrucCommon.I32n = (int32)(z.C.IntV(r.DecodeInt64(), 32)) case "I16n": - if r.TryDecodeAsNil() { - x.TestStrucCommon.I16n = 0 - } else { - x.TestStrucCommon.I16n = (int16)(z.C.IntV(r.DecodeInt64(), 16)) - } + x.TestStrucCommon.I16n = (int16)(z.C.IntV(r.DecodeInt64(), 16)) case "I8n": - if r.TryDecodeAsNil() { - x.TestStrucCommon.I8n = 0 - } else { - x.TestStrucCommon.I8n = (int8)(z.C.IntV(r.DecodeInt64(), 8)) - } + x.TestStrucCommon.I8n = (int8)(z.C.IntV(r.DecodeInt64(), 8)) case "Ui64": - if r.TryDecodeAsNil() { - x.TestStrucCommon.Ui64 = 0 - } else { - x.TestStrucCommon.Ui64 = (uint64)(r.DecodeUint64()) - } + x.TestStrucCommon.Ui64 = (uint64)(r.DecodeUint64()) case "Ui32": - if r.TryDecodeAsNil() { - x.TestStrucCommon.Ui32 = 0 - } else { - x.TestStrucCommon.Ui32 = (uint32)(z.C.UintV(r.DecodeUint64(), 32)) - } + x.TestStrucCommon.Ui32 = (uint32)(z.C.UintV(r.DecodeUint64(), 32)) case "Ui16": - if r.TryDecodeAsNil() { - x.TestStrucCommon.Ui16 = 0 - } else { - x.TestStrucCommon.Ui16 = (uint16)(z.C.UintV(r.DecodeUint64(), 16)) - } + x.TestStrucCommon.Ui16 = (uint16)(z.C.UintV(r.DecodeUint64(), 16)) case "Ui8": - if r.TryDecodeAsNil() { - x.TestStrucCommon.Ui8 = 0 - } else { - x.TestStrucCommon.Ui8 = (uint8)(z.C.UintV(r.DecodeUint64(), 8)) - } + x.TestStrucCommon.Ui8 = (uint8)(z.C.UintV(r.DecodeUint64(), 8)) case "F64": - if r.TryDecodeAsNil() { - x.TestStrucCommon.F64 = 0 - } else { - x.TestStrucCommon.F64 = (float64)(r.DecodeFloat64()) - } + x.TestStrucCommon.F64 = (float64)(r.DecodeFloat64()) case "F32": - if r.TryDecodeAsNil() { - x.TestStrucCommon.F32 = 0 - } else { - x.TestStrucCommon.F32 = (float32)(z.DecDecodeFloat32()) - } + x.TestStrucCommon.F32 = (float32)(z.DecDecodeFloat32()) case "B": - if r.TryDecodeAsNil() { - x.TestStrucCommon.B = false - } else { - x.TestStrucCommon.B = (bool)(r.DecodeBool()) - } + x.TestStrucCommon.B = (bool)(r.DecodeBool()) case "By": - if r.TryDecodeAsNil() { - x.TestStrucCommon.By = 0 - } else { - x.TestStrucCommon.By = (uint8)(z.C.UintV(r.DecodeUint64(), 8)) - } + x.TestStrucCommon.By = (uint8)(z.C.UintV(r.DecodeUint64(), 8)) case "Sslice": - if r.TryDecodeAsNil() { - x.TestStrucCommon.Sslice = nil - } else { - z.F.DecSliceStringX(&x.TestStrucCommon.Sslice, d) - } + z.F.DecSliceStringX(&x.TestStrucCommon.Sslice, d) case "I64slice": - if r.TryDecodeAsNil() { - x.TestStrucCommon.I64slice = nil - } else { - z.F.DecSliceInt64X(&x.TestStrucCommon.I64slice, d) - } + z.F.DecSliceInt64X(&x.TestStrucCommon.I64slice, d) case "I16slice": - if r.TryDecodeAsNil() { - x.TestStrucCommon.I16slice = nil - } else { - z.F.DecSliceInt16X(&x.TestStrucCommon.I16slice, d) - } + z.F.DecSliceInt16X(&x.TestStrucCommon.I16slice, d) case "Ui64slice": - if r.TryDecodeAsNil() { - x.TestStrucCommon.Ui64slice = nil - } else { - z.F.DecSliceUint64X(&x.TestStrucCommon.Ui64slice, d) - } + z.F.DecSliceUint64X(&x.TestStrucCommon.Ui64slice, d) case "Ui8slice": - if r.TryDecodeAsNil() { - x.TestStrucCommon.Ui8slice = nil - } else { - x.TestStrucCommon.Ui8slice = r.DecodeBytes(([]byte)(x.TestStrucCommon.Ui8slice), false) - } + x.TestStrucCommon.Ui8slice = r.DecodeBytes(([]byte)(x.TestStrucCommon.Ui8slice), false) case "Bslice": - if r.TryDecodeAsNil() { - x.TestStrucCommon.Bslice = nil - } else { - z.F.DecSliceBoolX(&x.TestStrucCommon.Bslice, d) - } + z.F.DecSliceBoolX(&x.TestStrucCommon.Bslice, d) case "Byslice": - if r.TryDecodeAsNil() { - x.TestStrucCommon.Byslice = nil - } else { - x.TestStrucCommon.Byslice = r.DecodeBytes(([]byte)(x.TestStrucCommon.Byslice), false) - } + x.TestStrucCommon.Byslice = r.DecodeBytes(([]byte)(x.TestStrucCommon.Byslice), false) case "BytesSlice": - if r.TryDecodeAsNil() { - x.TestStrucCommon.BytesSlice = nil - } else { - z.F.DecSliceBytesX(&x.TestStrucCommon.BytesSlice, d) - } + z.F.DecSliceBytesX(&x.TestStrucCommon.BytesSlice, d) case "Iptrslice": - if r.TryDecodeAsNil() { - x.TestStrucCommon.Iptrslice = nil - } else { - h.decSlicePtrtoint64((*[]*int64)(&x.TestStrucCommon.Iptrslice), d) - } + h.decSlicePtrtoint64((*[]*int64)(&x.TestStrucCommon.Iptrslice), d) case "WrapSliceInt64": - if r.TryDecodeAsNil() { - x.TestStrucCommon.WrapSliceInt64 = nil - } else { - x.TestStrucCommon.WrapSliceInt64.CodecDecodeSelf(d) - } + x.TestStrucCommon.WrapSliceInt64.CodecDecodeSelf(d) case "WrapSliceString": - if r.TryDecodeAsNil() { - x.TestStrucCommon.WrapSliceString = nil - } else { - x.TestStrucCommon.WrapSliceString.CodecDecodeSelf(d) - } + x.TestStrucCommon.WrapSliceString.CodecDecodeSelf(d) case "Msi64": - if r.TryDecodeAsNil() { - x.TestStrucCommon.Msi64 = nil - } else { - z.F.DecMapStringInt64X(&x.TestStrucCommon.Msi64, d) - } + z.F.DecMapStringInt64X(&x.TestStrucCommon.Msi64, d) case "Msbytes": - if r.TryDecodeAsNil() { - x.TestStrucCommon.Msbytes = nil - } else { - z.F.DecMapStringBytesX(&x.TestStrucCommon.Msbytes, d) - } + z.F.DecMapStringBytesX(&x.TestStrucCommon.Msbytes, d) case "Simplef": - if r.TryDecodeAsNil() { - x.TestStrucCommon.Simplef = testSimpleFields{} - } else { - x.TestStrucCommon.Simplef.CodecDecodeSelf(d) - } + x.TestStrucCommon.Simplef.CodecDecodeSelf(d) case "SstrUi64T": - if r.TryDecodeAsNil() { - x.TestStrucCommon.SstrUi64T = nil - } else { - h.decSlicestringUint64T((*[]stringUint64T)(&x.TestStrucCommon.SstrUi64T), d) - } + h.decSlicestringUint64T((*[]stringUint64T)(&x.TestStrucCommon.SstrUi64T), d) case "MstrUi64T": - if r.TryDecodeAsNil() { - x.TestStrucCommon.MstrUi64T = nil - } else { - h.decMapstringPtrtostringUint64T((*map[string]*stringUint64T)(&x.TestStrucCommon.MstrUi64T), d) - } + h.decMapstringPtrtostringUint64T((*map[string]*stringUint64T)(&x.TestStrucCommon.MstrUi64T), d) case "AS": - if r.TryDecodeAsNil() { - x.TestStrucCommon.AnonInTestStruc.AS = "" - } else { - x.TestStrucCommon.AnonInTestStruc.AS = (string)(string(r.DecodeStringAsBytes())) - } + x.TestStrucCommon.AnonInTestStruc.AS = (string)(string(r.DecodeStringAsBytes())) case "AI64": - if r.TryDecodeAsNil() { - x.TestStrucCommon.AnonInTestStruc.AI64 = 0 - } else { - x.TestStrucCommon.AnonInTestStruc.AI64 = (int64)(r.DecodeInt64()) - } + x.TestStrucCommon.AnonInTestStruc.AI64 = (int64)(r.DecodeInt64()) case "AI16": - if r.TryDecodeAsNil() { - x.TestStrucCommon.AnonInTestStruc.AI16 = 0 - } else { - x.TestStrucCommon.AnonInTestStruc.AI16 = (int16)(z.C.IntV(r.DecodeInt64(), 16)) - } + x.TestStrucCommon.AnonInTestStruc.AI16 = (int16)(z.C.IntV(r.DecodeInt64(), 16)) case "AUi64": - if r.TryDecodeAsNil() { - x.TestStrucCommon.AnonInTestStruc.AUi64 = 0 - } else { - x.TestStrucCommon.AnonInTestStruc.AUi64 = (uint64)(r.DecodeUint64()) - } + x.TestStrucCommon.AnonInTestStruc.AUi64 = (uint64)(r.DecodeUint64()) case "ASslice": - if r.TryDecodeAsNil() { - x.TestStrucCommon.AnonInTestStruc.ASslice = nil - } else { - z.F.DecSliceStringX(&x.TestStrucCommon.AnonInTestStruc.ASslice, d) - } + z.F.DecSliceStringX(&x.TestStrucCommon.AnonInTestStruc.ASslice, d) case "AI64slice": - if r.TryDecodeAsNil() { - x.TestStrucCommon.AnonInTestStruc.AI64slice = nil - } else { - z.F.DecSliceInt64X(&x.TestStrucCommon.AnonInTestStruc.AI64slice, d) - } + z.F.DecSliceInt64X(&x.TestStrucCommon.AnonInTestStruc.AI64slice, d) case "AUi64slice": - if r.TryDecodeAsNil() { - x.TestStrucCommon.AnonInTestStruc.AUi64slice = nil - } else { - z.F.DecSliceUint64X(&x.TestStrucCommon.AnonInTestStruc.AUi64slice, d) - } + z.F.DecSliceUint64X(&x.TestStrucCommon.AnonInTestStruc.AUi64slice, d) case "AF64slice": - if r.TryDecodeAsNil() { - x.TestStrucCommon.AnonInTestStruc.AF64slice = nil - } else { - z.F.DecSliceFloat64X(&x.TestStrucCommon.AnonInTestStruc.AF64slice, d) - } + z.F.DecSliceFloat64X(&x.TestStrucCommon.AnonInTestStruc.AF64slice, d) case "AF32slice": - if r.TryDecodeAsNil() { - x.TestStrucCommon.AnonInTestStruc.AF32slice = nil - } else { - z.F.DecSliceFloat32X(&x.TestStrucCommon.AnonInTestStruc.AF32slice, d) - } + z.F.DecSliceFloat32X(&x.TestStrucCommon.AnonInTestStruc.AF32slice, d) case "AMSU16": - if r.TryDecodeAsNil() { - x.TestStrucCommon.AnonInTestStruc.AMSU16 = nil - } else { - h.decMapstringuint16((*map[string]uint16)(&x.TestStrucCommon.AnonInTestStruc.AMSU16), d) - } + h.decMapstringuint16((*map[string]uint16)(&x.TestStrucCommon.AnonInTestStruc.AMSU16), d) case "AI64arr0": - if r.TryDecodeAsNil() { - x.TestStrucCommon.AnonInTestStruc.AI64arr0 = [0]int64{} - } else { - h.decArray0int64((*[0]int64)(&x.TestStrucCommon.AnonInTestStruc.AI64arr0), d) - } + h.decArray0int64((*[0]int64)(&x.TestStrucCommon.AnonInTestStruc.AI64arr0), d) case "AI64slice0": - if r.TryDecodeAsNil() { - x.TestStrucCommon.AnonInTestStruc.AI64slice0 = nil - } else { - z.F.DecSliceInt64X(&x.TestStrucCommon.AnonInTestStruc.AI64slice0, d) - } + z.F.DecSliceInt64X(&x.TestStrucCommon.AnonInTestStruc.AI64slice0, d) case "AUi64sliceN": - if r.TryDecodeAsNil() { - x.TestStrucCommon.AnonInTestStruc.AUi64sliceN = nil - } else { - z.F.DecSliceUint64X(&x.TestStrucCommon.AnonInTestStruc.AUi64sliceN, d) - } + z.F.DecSliceUint64X(&x.TestStrucCommon.AnonInTestStruc.AUi64sliceN, d) case "AMSU16N": - if r.TryDecodeAsNil() { - x.TestStrucCommon.AnonInTestStruc.AMSU16N = nil - } else { - h.decMapstringuint16((*map[string]uint16)(&x.TestStrucCommon.AnonInTestStruc.AMSU16N), d) - } + h.decMapstringuint16((*map[string]uint16)(&x.TestStrucCommon.AnonInTestStruc.AMSU16N), d) case "AMSU16E": - if r.TryDecodeAsNil() { - x.TestStrucCommon.AnonInTestStruc.AMSU16E = nil - } else { - h.decMapstringuint16((*map[string]uint16)(&x.TestStrucCommon.AnonInTestStruc.AMSU16E), d) - } + h.decMapstringuint16((*map[string]uint16)(&x.TestStrucCommon.AnonInTestStruc.AMSU16E), d) case "NotAnon": - if r.TryDecodeAsNil() { - x.TestStrucCommon.NotAnon = AnonInTestStruc{} - } else { - x.TestStrucCommon.NotAnon.CodecDecodeSelf(d) - } + x.TestStrucCommon.NotAnon.CodecDecodeSelf(d) case "Nmap": - if r.TryDecodeAsNil() { - x.TestStrucCommon.Nmap = nil - } else { - z.F.DecMapStringBoolX(&x.TestStrucCommon.Nmap, d) - } + z.F.DecMapStringBoolX(&x.TestStrucCommon.Nmap, d) case "Nslice": - if r.TryDecodeAsNil() { - x.TestStrucCommon.Nslice = nil - } else { - x.TestStrucCommon.Nslice = r.DecodeBytes(([]byte)(x.TestStrucCommon.Nslice), false) - } + x.TestStrucCommon.Nslice = r.DecodeBytes(([]byte)(x.TestStrucCommon.Nslice), false) case "Nint64": - if r.TryDecodeAsNil() { + if r.TryNil() { if x.TestStrucCommon.Nint64 != nil { // remove the if-true x.TestStrucCommon.Nint64 = nil } @@ -4879,29 +4004,16 @@ func (x *TestStruc) codecDecodeSelfFromMap(l int, d *Decoder) { if x.TestStrucCommon.Nint64 == nil { x.TestStrucCommon.Nint64 = new(int64) } - *x.TestStrucCommon.Nint64 = (int64)(r.DecodeInt64()) } case "Mtsptr": - if r.TryDecodeAsNil() { - x.Mtsptr = nil - } else { - h.decMapstringPtrtoTestStruc((*map[string]*TestStruc)(&x.Mtsptr), d) - } + h.decMapstringPtrtoTestStruc((*map[string]*TestStruc)(&x.Mtsptr), d) case "Mts": - if r.TryDecodeAsNil() { - x.Mts = nil - } else { - h.decMapstringTestStruc((*map[string]TestStruc)(&x.Mts), d) - } + h.decMapstringTestStruc((*map[string]TestStruc)(&x.Mts), d) case "Its": - if r.TryDecodeAsNil() { - x.Its = nil - } else { - h.decSlicePtrtoTestStruc((*[]*TestStruc)(&x.Its), d) - } + h.decSlicePtrtoTestStruc((*[]*TestStruc)(&x.Its), d) case "Nteststruc": - if r.TryDecodeAsNil() { + if r.TryNil() { if x.Nteststruc != nil { // remove the if-true x.Nteststruc = nil } @@ -4909,7 +4021,6 @@ func (x *TestStruc) codecDecodeSelfFromMap(l int, d *Decoder) { if x.Nteststruc == nil { x.Nteststruc = new(TestStruc) } - x.Nteststruc.CodecDecodeSelf(d) } default: @@ -4936,11 +4047,7 @@ func (x *TestStruc) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.TestStrucCommon.S = "" - } else { - x.TestStrucCommon.S = (string)(string(r.DecodeStringAsBytes())) - } + x.TestStrucCommon.S = (string)(string(r.DecodeStringAsBytes())) yyj90++ if yyhl90 { yyb90 = yyj90 > l @@ -4952,11 +4059,7 @@ func (x *TestStruc) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.TestStrucCommon.I64 = 0 - } else { - x.TestStrucCommon.I64 = (int64)(r.DecodeInt64()) - } + x.TestStrucCommon.I64 = (int64)(r.DecodeInt64()) yyj90++ if yyhl90 { yyb90 = yyj90 > l @@ -4968,11 +4071,7 @@ func (x *TestStruc) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.TestStrucCommon.I32 = 0 - } else { - x.TestStrucCommon.I32 = (int32)(z.C.IntV(r.DecodeInt64(), 32)) - } + x.TestStrucCommon.I32 = (int32)(z.C.IntV(r.DecodeInt64(), 32)) yyj90++ if yyhl90 { yyb90 = yyj90 > l @@ -4984,11 +4083,7 @@ func (x *TestStruc) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.TestStrucCommon.I16 = 0 - } else { - x.TestStrucCommon.I16 = (int16)(z.C.IntV(r.DecodeInt64(), 16)) - } + x.TestStrucCommon.I16 = (int16)(z.C.IntV(r.DecodeInt64(), 16)) yyj90++ if yyhl90 { yyb90 = yyj90 > l @@ -5000,11 +4095,7 @@ func (x *TestStruc) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.TestStrucCommon.I8 = 0 - } else { - x.TestStrucCommon.I8 = (int8)(z.C.IntV(r.DecodeInt64(), 8)) - } + x.TestStrucCommon.I8 = (int8)(z.C.IntV(r.DecodeInt64(), 8)) yyj90++ if yyhl90 { yyb90 = yyj90 > l @@ -5016,11 +4107,7 @@ func (x *TestStruc) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.TestStrucCommon.I64n = 0 - } else { - x.TestStrucCommon.I64n = (int64)(r.DecodeInt64()) - } + x.TestStrucCommon.I64n = (int64)(r.DecodeInt64()) yyj90++ if yyhl90 { yyb90 = yyj90 > l @@ -5032,11 +4119,7 @@ func (x *TestStruc) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.TestStrucCommon.I32n = 0 - } else { - x.TestStrucCommon.I32n = (int32)(z.C.IntV(r.DecodeInt64(), 32)) - } + x.TestStrucCommon.I32n = (int32)(z.C.IntV(r.DecodeInt64(), 32)) yyj90++ if yyhl90 { yyb90 = yyj90 > l @@ -5048,11 +4131,7 @@ func (x *TestStruc) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.TestStrucCommon.I16n = 0 - } else { - x.TestStrucCommon.I16n = (int16)(z.C.IntV(r.DecodeInt64(), 16)) - } + x.TestStrucCommon.I16n = (int16)(z.C.IntV(r.DecodeInt64(), 16)) yyj90++ if yyhl90 { yyb90 = yyj90 > l @@ -5064,11 +4143,7 @@ func (x *TestStruc) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.TestStrucCommon.I8n = 0 - } else { - x.TestStrucCommon.I8n = (int8)(z.C.IntV(r.DecodeInt64(), 8)) - } + x.TestStrucCommon.I8n = (int8)(z.C.IntV(r.DecodeInt64(), 8)) yyj90++ if yyhl90 { yyb90 = yyj90 > l @@ -5080,11 +4155,7 @@ func (x *TestStruc) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.TestStrucCommon.Ui64 = 0 - } else { - x.TestStrucCommon.Ui64 = (uint64)(r.DecodeUint64()) - } + x.TestStrucCommon.Ui64 = (uint64)(r.DecodeUint64()) yyj90++ if yyhl90 { yyb90 = yyj90 > l @@ -5096,11 +4167,7 @@ func (x *TestStruc) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.TestStrucCommon.Ui32 = 0 - } else { - x.TestStrucCommon.Ui32 = (uint32)(z.C.UintV(r.DecodeUint64(), 32)) - } + x.TestStrucCommon.Ui32 = (uint32)(z.C.UintV(r.DecodeUint64(), 32)) yyj90++ if yyhl90 { yyb90 = yyj90 > l @@ -5112,11 +4179,7 @@ func (x *TestStruc) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.TestStrucCommon.Ui16 = 0 - } else { - x.TestStrucCommon.Ui16 = (uint16)(z.C.UintV(r.DecodeUint64(), 16)) - } + x.TestStrucCommon.Ui16 = (uint16)(z.C.UintV(r.DecodeUint64(), 16)) yyj90++ if yyhl90 { yyb90 = yyj90 > l @@ -5128,11 +4191,7 @@ func (x *TestStruc) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.TestStrucCommon.Ui8 = 0 - } else { - x.TestStrucCommon.Ui8 = (uint8)(z.C.UintV(r.DecodeUint64(), 8)) - } + x.TestStrucCommon.Ui8 = (uint8)(z.C.UintV(r.DecodeUint64(), 8)) yyj90++ if yyhl90 { yyb90 = yyj90 > l @@ -5144,11 +4203,7 @@ func (x *TestStruc) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.TestStrucCommon.F64 = 0 - } else { - x.TestStrucCommon.F64 = (float64)(r.DecodeFloat64()) - } + x.TestStrucCommon.F64 = (float64)(r.DecodeFloat64()) yyj90++ if yyhl90 { yyb90 = yyj90 > l @@ -5160,11 +4215,7 @@ func (x *TestStruc) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.TestStrucCommon.F32 = 0 - } else { - x.TestStrucCommon.F32 = (float32)(z.DecDecodeFloat32()) - } + x.TestStrucCommon.F32 = (float32)(z.DecDecodeFloat32()) yyj90++ if yyhl90 { yyb90 = yyj90 > l @@ -5176,11 +4227,7 @@ func (x *TestStruc) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.TestStrucCommon.B = false - } else { - x.TestStrucCommon.B = (bool)(r.DecodeBool()) - } + x.TestStrucCommon.B = (bool)(r.DecodeBool()) yyj90++ if yyhl90 { yyb90 = yyj90 > l @@ -5192,11 +4239,7 @@ func (x *TestStruc) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.TestStrucCommon.By = 0 - } else { - x.TestStrucCommon.By = (uint8)(z.C.UintV(r.DecodeUint64(), 8)) - } + x.TestStrucCommon.By = (uint8)(z.C.UintV(r.DecodeUint64(), 8)) yyj90++ if yyhl90 { yyb90 = yyj90 > l @@ -5208,11 +4251,7 @@ func (x *TestStruc) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.TestStrucCommon.Sslice = nil - } else { - z.F.DecSliceStringX(&x.TestStrucCommon.Sslice, d) - } + z.F.DecSliceStringX(&x.TestStrucCommon.Sslice, d) yyj90++ if yyhl90 { yyb90 = yyj90 > l @@ -5224,11 +4263,7 @@ func (x *TestStruc) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.TestStrucCommon.I64slice = nil - } else { - z.F.DecSliceInt64X(&x.TestStrucCommon.I64slice, d) - } + z.F.DecSliceInt64X(&x.TestStrucCommon.I64slice, d) yyj90++ if yyhl90 { yyb90 = yyj90 > l @@ -5240,11 +4275,7 @@ func (x *TestStruc) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.TestStrucCommon.I16slice = nil - } else { - z.F.DecSliceInt16X(&x.TestStrucCommon.I16slice, d) - } + z.F.DecSliceInt16X(&x.TestStrucCommon.I16slice, d) yyj90++ if yyhl90 { yyb90 = yyj90 > l @@ -5256,11 +4287,7 @@ func (x *TestStruc) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.TestStrucCommon.Ui64slice = nil - } else { - z.F.DecSliceUint64X(&x.TestStrucCommon.Ui64slice, d) - } + z.F.DecSliceUint64X(&x.TestStrucCommon.Ui64slice, d) yyj90++ if yyhl90 { yyb90 = yyj90 > l @@ -5272,11 +4299,7 @@ func (x *TestStruc) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.TestStrucCommon.Ui8slice = nil - } else { - x.TestStrucCommon.Ui8slice = r.DecodeBytes(([]byte)(x.TestStrucCommon.Ui8slice), false) - } + x.TestStrucCommon.Ui8slice = r.DecodeBytes(([]byte)(x.TestStrucCommon.Ui8slice), false) yyj90++ if yyhl90 { yyb90 = yyj90 > l @@ -5288,11 +4311,7 @@ func (x *TestStruc) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.TestStrucCommon.Bslice = nil - } else { - z.F.DecSliceBoolX(&x.TestStrucCommon.Bslice, d) - } + z.F.DecSliceBoolX(&x.TestStrucCommon.Bslice, d) yyj90++ if yyhl90 { yyb90 = yyj90 > l @@ -5304,11 +4323,7 @@ func (x *TestStruc) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.TestStrucCommon.Byslice = nil - } else { - x.TestStrucCommon.Byslice = r.DecodeBytes(([]byte)(x.TestStrucCommon.Byslice), false) - } + x.TestStrucCommon.Byslice = r.DecodeBytes(([]byte)(x.TestStrucCommon.Byslice), false) yyj90++ if yyhl90 { yyb90 = yyj90 > l @@ -5320,11 +4335,7 @@ func (x *TestStruc) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.TestStrucCommon.BytesSlice = nil - } else { - z.F.DecSliceBytesX(&x.TestStrucCommon.BytesSlice, d) - } + z.F.DecSliceBytesX(&x.TestStrucCommon.BytesSlice, d) yyj90++ if yyhl90 { yyb90 = yyj90 > l @@ -5336,11 +4347,7 @@ func (x *TestStruc) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.TestStrucCommon.Iptrslice = nil - } else { - h.decSlicePtrtoint64((*[]*int64)(&x.TestStrucCommon.Iptrslice), d) - } + h.decSlicePtrtoint64((*[]*int64)(&x.TestStrucCommon.Iptrslice), d) yyj90++ if yyhl90 { yyb90 = yyj90 > l @@ -5352,11 +4359,7 @@ func (x *TestStruc) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.TestStrucCommon.WrapSliceInt64 = nil - } else { - x.TestStrucCommon.WrapSliceInt64.CodecDecodeSelf(d) - } + x.TestStrucCommon.WrapSliceInt64.CodecDecodeSelf(d) yyj90++ if yyhl90 { yyb90 = yyj90 > l @@ -5368,11 +4371,7 @@ func (x *TestStruc) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.TestStrucCommon.WrapSliceString = nil - } else { - x.TestStrucCommon.WrapSliceString.CodecDecodeSelf(d) - } + x.TestStrucCommon.WrapSliceString.CodecDecodeSelf(d) yyj90++ if yyhl90 { yyb90 = yyj90 > l @@ -5384,11 +4383,7 @@ func (x *TestStruc) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.TestStrucCommon.Msi64 = nil - } else { - z.F.DecMapStringInt64X(&x.TestStrucCommon.Msi64, d) - } + z.F.DecMapStringInt64X(&x.TestStrucCommon.Msi64, d) yyj90++ if yyhl90 { yyb90 = yyj90 > l @@ -5400,11 +4395,7 @@ func (x *TestStruc) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.TestStrucCommon.Msbytes = nil - } else { - z.F.DecMapStringBytesX(&x.TestStrucCommon.Msbytes, d) - } + z.F.DecMapStringBytesX(&x.TestStrucCommon.Msbytes, d) yyj90++ if yyhl90 { yyb90 = yyj90 > l @@ -5416,11 +4407,7 @@ func (x *TestStruc) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.TestStrucCommon.Simplef = testSimpleFields{} - } else { - x.TestStrucCommon.Simplef.CodecDecodeSelf(d) - } + x.TestStrucCommon.Simplef.CodecDecodeSelf(d) yyj90++ if yyhl90 { yyb90 = yyj90 > l @@ -5432,11 +4419,7 @@ func (x *TestStruc) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.TestStrucCommon.SstrUi64T = nil - } else { - h.decSlicestringUint64T((*[]stringUint64T)(&x.TestStrucCommon.SstrUi64T), d) - } + h.decSlicestringUint64T((*[]stringUint64T)(&x.TestStrucCommon.SstrUi64T), d) yyj90++ if yyhl90 { yyb90 = yyj90 > l @@ -5448,11 +4431,7 @@ func (x *TestStruc) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.TestStrucCommon.MstrUi64T = nil - } else { - h.decMapstringPtrtostringUint64T((*map[string]*stringUint64T)(&x.TestStrucCommon.MstrUi64T), d) - } + h.decMapstringPtrtostringUint64T((*map[string]*stringUint64T)(&x.TestStrucCommon.MstrUi64T), d) yyj90++ if yyhl90 { yyb90 = yyj90 > l @@ -5464,11 +4443,7 @@ func (x *TestStruc) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.TestStrucCommon.AnonInTestStruc.AS = "" - } else { - x.TestStrucCommon.AnonInTestStruc.AS = (string)(string(r.DecodeStringAsBytes())) - } + x.TestStrucCommon.AnonInTestStruc.AS = (string)(string(r.DecodeStringAsBytes())) yyj90++ if yyhl90 { yyb90 = yyj90 > l @@ -5480,11 +4455,7 @@ func (x *TestStruc) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.TestStrucCommon.AnonInTestStruc.AI64 = 0 - } else { - x.TestStrucCommon.AnonInTestStruc.AI64 = (int64)(r.DecodeInt64()) - } + x.TestStrucCommon.AnonInTestStruc.AI64 = (int64)(r.DecodeInt64()) yyj90++ if yyhl90 { yyb90 = yyj90 > l @@ -5496,11 +4467,7 @@ func (x *TestStruc) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.TestStrucCommon.AnonInTestStruc.AI16 = 0 - } else { - x.TestStrucCommon.AnonInTestStruc.AI16 = (int16)(z.C.IntV(r.DecodeInt64(), 16)) - } + x.TestStrucCommon.AnonInTestStruc.AI16 = (int16)(z.C.IntV(r.DecodeInt64(), 16)) yyj90++ if yyhl90 { yyb90 = yyj90 > l @@ -5512,11 +4479,7 @@ func (x *TestStruc) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.TestStrucCommon.AnonInTestStruc.AUi64 = 0 - } else { - x.TestStrucCommon.AnonInTestStruc.AUi64 = (uint64)(r.DecodeUint64()) - } + x.TestStrucCommon.AnonInTestStruc.AUi64 = (uint64)(r.DecodeUint64()) yyj90++ if yyhl90 { yyb90 = yyj90 > l @@ -5528,11 +4491,7 @@ func (x *TestStruc) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.TestStrucCommon.AnonInTestStruc.ASslice = nil - } else { - z.F.DecSliceStringX(&x.TestStrucCommon.AnonInTestStruc.ASslice, d) - } + z.F.DecSliceStringX(&x.TestStrucCommon.AnonInTestStruc.ASslice, d) yyj90++ if yyhl90 { yyb90 = yyj90 > l @@ -5544,11 +4503,7 @@ func (x *TestStruc) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.TestStrucCommon.AnonInTestStruc.AI64slice = nil - } else { - z.F.DecSliceInt64X(&x.TestStrucCommon.AnonInTestStruc.AI64slice, d) - } + z.F.DecSliceInt64X(&x.TestStrucCommon.AnonInTestStruc.AI64slice, d) yyj90++ if yyhl90 { yyb90 = yyj90 > l @@ -5560,11 +4515,7 @@ func (x *TestStruc) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.TestStrucCommon.AnonInTestStruc.AUi64slice = nil - } else { - z.F.DecSliceUint64X(&x.TestStrucCommon.AnonInTestStruc.AUi64slice, d) - } + z.F.DecSliceUint64X(&x.TestStrucCommon.AnonInTestStruc.AUi64slice, d) yyj90++ if yyhl90 { yyb90 = yyj90 > l @@ -5576,11 +4527,7 @@ func (x *TestStruc) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.TestStrucCommon.AnonInTestStruc.AF64slice = nil - } else { - z.F.DecSliceFloat64X(&x.TestStrucCommon.AnonInTestStruc.AF64slice, d) - } + z.F.DecSliceFloat64X(&x.TestStrucCommon.AnonInTestStruc.AF64slice, d) yyj90++ if yyhl90 { yyb90 = yyj90 > l @@ -5592,11 +4539,7 @@ func (x *TestStruc) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.TestStrucCommon.AnonInTestStruc.AF32slice = nil - } else { - z.F.DecSliceFloat32X(&x.TestStrucCommon.AnonInTestStruc.AF32slice, d) - } + z.F.DecSliceFloat32X(&x.TestStrucCommon.AnonInTestStruc.AF32slice, d) yyj90++ if yyhl90 { yyb90 = yyj90 > l @@ -5608,11 +4551,7 @@ func (x *TestStruc) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.TestStrucCommon.AnonInTestStruc.AMSU16 = nil - } else { - h.decMapstringuint16((*map[string]uint16)(&x.TestStrucCommon.AnonInTestStruc.AMSU16), d) - } + h.decMapstringuint16((*map[string]uint16)(&x.TestStrucCommon.AnonInTestStruc.AMSU16), d) yyj90++ if yyhl90 { yyb90 = yyj90 > l @@ -5624,11 +4563,7 @@ func (x *TestStruc) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.TestStrucCommon.AnonInTestStruc.AI64arr0 = [0]int64{} - } else { - h.decArray0int64((*[0]int64)(&x.TestStrucCommon.AnonInTestStruc.AI64arr0), d) - } + h.decArray0int64((*[0]int64)(&x.TestStrucCommon.AnonInTestStruc.AI64arr0), d) yyj90++ if yyhl90 { yyb90 = yyj90 > l @@ -5640,11 +4575,7 @@ func (x *TestStruc) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.TestStrucCommon.AnonInTestStruc.AI64slice0 = nil - } else { - z.F.DecSliceInt64X(&x.TestStrucCommon.AnonInTestStruc.AI64slice0, d) - } + z.F.DecSliceInt64X(&x.TestStrucCommon.AnonInTestStruc.AI64slice0, d) yyj90++ if yyhl90 { yyb90 = yyj90 > l @@ -5656,11 +4587,7 @@ func (x *TestStruc) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.TestStrucCommon.AnonInTestStruc.AUi64sliceN = nil - } else { - z.F.DecSliceUint64X(&x.TestStrucCommon.AnonInTestStruc.AUi64sliceN, d) - } + z.F.DecSliceUint64X(&x.TestStrucCommon.AnonInTestStruc.AUi64sliceN, d) yyj90++ if yyhl90 { yyb90 = yyj90 > l @@ -5672,11 +4599,7 @@ func (x *TestStruc) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.TestStrucCommon.AnonInTestStruc.AMSU16N = nil - } else { - h.decMapstringuint16((*map[string]uint16)(&x.TestStrucCommon.AnonInTestStruc.AMSU16N), d) - } + h.decMapstringuint16((*map[string]uint16)(&x.TestStrucCommon.AnonInTestStruc.AMSU16N), d) yyj90++ if yyhl90 { yyb90 = yyj90 > l @@ -5688,11 +4611,7 @@ func (x *TestStruc) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.TestStrucCommon.AnonInTestStruc.AMSU16E = nil - } else { - h.decMapstringuint16((*map[string]uint16)(&x.TestStrucCommon.AnonInTestStruc.AMSU16E), d) - } + h.decMapstringuint16((*map[string]uint16)(&x.TestStrucCommon.AnonInTestStruc.AMSU16E), d) yyj90++ if yyhl90 { yyb90 = yyj90 > l @@ -5704,11 +4623,7 @@ func (x *TestStruc) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.TestStrucCommon.NotAnon = AnonInTestStruc{} - } else { - x.TestStrucCommon.NotAnon.CodecDecodeSelf(d) - } + x.TestStrucCommon.NotAnon.CodecDecodeSelf(d) yyj90++ if yyhl90 { yyb90 = yyj90 > l @@ -5720,11 +4635,7 @@ func (x *TestStruc) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.TestStrucCommon.Nmap = nil - } else { - z.F.DecMapStringBoolX(&x.TestStrucCommon.Nmap, d) - } + z.F.DecMapStringBoolX(&x.TestStrucCommon.Nmap, d) yyj90++ if yyhl90 { yyb90 = yyj90 > l @@ -5736,11 +4647,7 @@ func (x *TestStruc) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.TestStrucCommon.Nslice = nil - } else { - x.TestStrucCommon.Nslice = r.DecodeBytes(([]byte)(x.TestStrucCommon.Nslice), false) - } + x.TestStrucCommon.Nslice = r.DecodeBytes(([]byte)(x.TestStrucCommon.Nslice), false) yyj90++ if yyhl90 { yyb90 = yyj90 > l @@ -5752,7 +4659,7 @@ func (x *TestStruc) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { + if r.TryNil() { if x.TestStrucCommon.Nint64 != nil { // remove the if-true x.TestStrucCommon.Nint64 = nil } @@ -5760,7 +4667,6 @@ func (x *TestStruc) codecDecodeSelfFromArray(l int, d *Decoder) { if x.TestStrucCommon.Nint64 == nil { x.TestStrucCommon.Nint64 = new(int64) } - *x.TestStrucCommon.Nint64 = (int64)(r.DecodeInt64()) } yyj90++ @@ -5774,11 +4680,7 @@ func (x *TestStruc) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.Mtsptr = nil - } else { - h.decMapstringPtrtoTestStruc((*map[string]*TestStruc)(&x.Mtsptr), d) - } + h.decMapstringPtrtoTestStruc((*map[string]*TestStruc)(&x.Mtsptr), d) yyj90++ if yyhl90 { yyb90 = yyj90 > l @@ -5790,11 +4692,7 @@ func (x *TestStruc) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.Mts = nil - } else { - h.decMapstringTestStruc((*map[string]TestStruc)(&x.Mts), d) - } + h.decMapstringTestStruc((*map[string]TestStruc)(&x.Mts), d) yyj90++ if yyhl90 { yyb90 = yyj90 > l @@ -5806,11 +4704,7 @@ func (x *TestStruc) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.Its = nil - } else { - h.decSlicePtrtoTestStruc((*[]*TestStruc)(&x.Its), d) - } + h.decSlicePtrtoTestStruc((*[]*TestStruc)(&x.Its), d) yyj90++ if yyhl90 { yyb90 = yyj90 > l @@ -5822,7 +4716,7 @@ func (x *TestStruc) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { + if r.TryNil() { if x.Nteststruc != nil { // remove the if-true x.Nteststruc = nil } @@ -5830,7 +4724,6 @@ func (x *TestStruc) codecDecodeSelfFromArray(l int, d *Decoder) { if x.Nteststruc == nil { x.Nteststruc = new(TestStruc) } - x.Nteststruc.CodecDecodeSelf(d) } for { @@ -5854,7 +4747,7 @@ func (x *codecgenA) CodecEncodeSelf(e *Encoder) { _, _, _ = h, z, r if x == nil { r.EncodeNil() - } else { // checkNil=true + } else { yysep2 := !z.EncBinary() yy2arr2 := z.EncBasicHandle().StructToArray _, _ = yysep2, yy2arr2 @@ -5884,7 +4777,7 @@ func (x *codecgenA) CodecEncodeSelf(e *Encoder) { } // end block: if x.ZZ slice == nil z.EncWriteMapEnd() } - } // checkNil=true + } } func (x *codecgenA) CodecDecodeSelf(d *Decoder) { @@ -5892,7 +4785,9 @@ func (x *codecgenA) CodecDecodeSelf(d *Decoder) { z, r := GenHelperDecoder(d) _, _, _ = h, z, r yyct2 := r.ContainerType() - if yyct2 == codecSelferValueTypeMap19780 { + if yyct2 == codecSelferValueTypeNil19780 { + *(x) = codecgenA{} + } else if yyct2 == codecSelferValueTypeMap19780 { yyl2 := z.DecReadMapStart() if yyl2 == 0 { } else { @@ -5930,11 +4825,7 @@ func (x *codecgenA) codecDecodeSelfFromMap(l int, d *Decoder) { z.DecReadMapElemValue() switch yys3 { case "ZZ": - if r.TryDecodeAsNil() { - x.ZZ = nil - } else { - x.ZZ = r.DecodeBytes(([]byte)(x.ZZ), false) - } + x.ZZ = r.DecodeBytes(([]byte)(x.ZZ), false) default: z.DecStructFieldNotFound(-1, yys3) } // end switch yys3 @@ -5959,11 +4850,7 @@ func (x *codecgenA) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.ZZ = nil - } else { - x.ZZ = r.DecodeBytes(([]byte)(x.ZZ), false) - } + x.ZZ = r.DecodeBytes(([]byte)(x.ZZ), false) for { yyj6++ if yyhl6 { @@ -5985,7 +4872,7 @@ func (x *codecgenB) CodecEncodeSelf(e *Encoder) { _, _, _ = h, z, r if x == nil { r.EncodeNil() - } else { // checkNil=true + } else { yysep2 := !z.EncBinary() yy2arr2 := z.EncBasicHandle().StructToArray _, _ = yysep2, yy2arr2 @@ -6009,7 +4896,7 @@ func (x *codecgenB) CodecEncodeSelf(e *Encoder) { yy6.CodecEncodeSelf(e) z.EncWriteMapEnd() } - } // checkNil=true + } } func (x *codecgenB) CodecDecodeSelf(d *Decoder) { @@ -6017,7 +4904,9 @@ func (x *codecgenB) CodecDecodeSelf(d *Decoder) { z, r := GenHelperDecoder(d) _, _, _ = h, z, r yyct2 := r.ContainerType() - if yyct2 == codecSelferValueTypeMap19780 { + if yyct2 == codecSelferValueTypeNil19780 { + *(x) = codecgenB{} + } else if yyct2 == codecSelferValueTypeMap19780 { yyl2 := z.DecReadMapStart() if yyl2 == 0 { } else { @@ -6055,11 +4944,7 @@ func (x *codecgenB) codecDecodeSelfFromMap(l int, d *Decoder) { z.DecReadMapElemValue() switch yys3 { case "AA": - if r.TryDecodeAsNil() { - x.AA = codecgenA{} - } else { - x.AA.CodecDecodeSelf(d) - } + x.AA.CodecDecodeSelf(d) default: z.DecStructFieldNotFound(-1, yys3) } // end switch yys3 @@ -6084,11 +4969,7 @@ func (x *codecgenB) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.AA = codecgenA{} - } else { - x.AA.CodecDecodeSelf(d) - } + x.AA.CodecDecodeSelf(d) for { yyj5++ if yyhl5 { @@ -6110,7 +4991,7 @@ func (x *codecgenC) CodecEncodeSelf(e *Encoder) { _, _, _ = h, z, r if x == nil { r.EncodeNil() - } else { // checkNil=true + } else { yysep2 := !z.EncBinary() yy2arr2 := z.EncBasicHandle().StructToArray _, _ = yysep2, yy2arr2 @@ -6151,7 +5032,7 @@ func (x *codecgenC) CodecEncodeSelf(e *Encoder) { } z.EncWriteMapEnd() } - } // checkNil=true + } } func (x *codecgenC) CodecDecodeSelf(d *Decoder) { @@ -6159,7 +5040,9 @@ func (x *codecgenC) CodecDecodeSelf(d *Decoder) { z, r := GenHelperDecoder(d) _, _, _ = h, z, r yyct2 := r.ContainerType() - if yyct2 == codecSelferValueTypeMap19780 { + if yyct2 == codecSelferValueTypeNil19780 { + *(x) = codecgenC{} + } else if yyct2 == codecSelferValueTypeMap19780 { yyl2 := z.DecReadMapStart() if yyl2 == 0 { } else { @@ -6197,11 +5080,7 @@ func (x *codecgenC) codecDecodeSelfFromMap(l int, d *Decoder) { z.DecReadMapElemValue() switch yys3 { case "BB": - if r.TryDecodeAsNil() { - x.BB = codecgenB{} - } else { - x.BB.CodecDecodeSelf(d) - } + x.BB.CodecDecodeSelf(d) default: z.DecStructFieldNotFound(-1, yys3) } // end switch yys3 @@ -6226,11 +5105,7 @@ func (x *codecgenC) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.BB = codecgenB{} - } else { - x.BB.CodecDecodeSelf(d) - } + x.BB.CodecDecodeSelf(d) for { yyj5++ if yyhl5 { @@ -6252,7 +5127,7 @@ func (x *TestCodecgenG) CodecEncodeSelf(e *Encoder) { _, _, _ = h, z, r if x == nil { r.EncodeNil() - } else { // checkNil=true + } else { yysep2 := !z.EncBinary() yy2arr2 := z.EncBasicHandle().StructToArray _, _ = yysep2, yy2arr2 @@ -6274,7 +5149,7 @@ func (x *TestCodecgenG) CodecEncodeSelf(e *Encoder) { r.EncodeInt(int64(x.TestCodecgenG)) z.EncWriteMapEnd() } - } // checkNil=true + } } func (x *TestCodecgenG) CodecDecodeSelf(d *Decoder) { @@ -6282,7 +5157,9 @@ func (x *TestCodecgenG) CodecDecodeSelf(d *Decoder) { z, r := GenHelperDecoder(d) _, _, _ = h, z, r yyct2 := r.ContainerType() - if yyct2 == codecSelferValueTypeMap19780 { + if yyct2 == codecSelferValueTypeNil19780 { + *(x) = TestCodecgenG{} + } else if yyct2 == codecSelferValueTypeMap19780 { yyl2 := z.DecReadMapStart() if yyl2 == 0 { } else { @@ -6320,11 +5197,7 @@ func (x *TestCodecgenG) codecDecodeSelfFromMap(l int, d *Decoder) { z.DecReadMapElemValue() switch yys3 { case "TestCodecgenG": - if r.TryDecodeAsNil() { - x.TestCodecgenG = 0 - } else { - x.TestCodecgenG = (int)(z.C.IntV(r.DecodeInt64(), codecSelferBitsize19780)) - } + x.TestCodecgenG = (int)(z.C.IntV(r.DecodeInt64(), codecSelferBitsize19780)) default: z.DecStructFieldNotFound(-1, yys3) } // end switch yys3 @@ -6349,11 +5222,7 @@ func (x *TestCodecgenG) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.TestCodecgenG = 0 - } else { - x.TestCodecgenG = (int)(z.C.IntV(r.DecodeInt64(), codecSelferBitsize19780)) - } + x.TestCodecgenG = (int)(z.C.IntV(r.DecodeInt64(), codecSelferBitsize19780)) for { yyj5++ if yyhl5 { @@ -6375,7 +5244,7 @@ func (x *codecgenH) CodecEncodeSelf(e *Encoder) { _, _, _ = h, z, r if x == nil { r.EncodeNil() - } else { // checkNil=true + } else { yysep2 := !z.EncBinary() yy2arr2 := z.EncBasicHandle().StructToArray _, _ = yysep2, yy2arr2 @@ -6397,7 +5266,7 @@ func (x *codecgenH) CodecEncodeSelf(e *Encoder) { r.EncodeInt(int64(x.TestCodecgenG.TestCodecgenG)) z.EncWriteMapEnd() } - } // checkNil=true + } } func (x *codecgenH) CodecDecodeSelf(d *Decoder) { @@ -6405,7 +5274,9 @@ func (x *codecgenH) CodecDecodeSelf(d *Decoder) { z, r := GenHelperDecoder(d) _, _, _ = h, z, r yyct2 := r.ContainerType() - if yyct2 == codecSelferValueTypeMap19780 { + if yyct2 == codecSelferValueTypeNil19780 { + *(x) = codecgenH{} + } else if yyct2 == codecSelferValueTypeMap19780 { yyl2 := z.DecReadMapStart() if yyl2 == 0 { } else { @@ -6443,11 +5314,7 @@ func (x *codecgenH) codecDecodeSelfFromMap(l int, d *Decoder) { z.DecReadMapElemValue() switch yys3 { case "TestCodecgenG": - if r.TryDecodeAsNil() { - x.TestCodecgenG.TestCodecgenG = 0 - } else { - x.TestCodecgenG.TestCodecgenG = (int)(z.C.IntV(r.DecodeInt64(), codecSelferBitsize19780)) - } + x.TestCodecgenG.TestCodecgenG = (int)(z.C.IntV(r.DecodeInt64(), codecSelferBitsize19780)) default: z.DecStructFieldNotFound(-1, yys3) } // end switch yys3 @@ -6472,11 +5339,7 @@ func (x *codecgenH) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.TestCodecgenG.TestCodecgenG = 0 - } else { - x.TestCodecgenG.TestCodecgenG = (int)(z.C.IntV(r.DecodeInt64(), codecSelferBitsize19780)) - } + x.TestCodecgenG.TestCodecgenG = (int)(z.C.IntV(r.DecodeInt64(), codecSelferBitsize19780)) for { yyj5++ if yyhl5 { @@ -6498,7 +5361,7 @@ func (x *codecgenI) CodecEncodeSelf(e *Encoder) { _, _, _ = h, z, r if x == nil { r.EncodeNil() - } else { // checkNil=true + } else { yysep2 := !z.EncBinary() yy2arr2 := z.EncBasicHandle().StructToArray _, _ = yysep2, yy2arr2 @@ -6520,7 +5383,7 @@ func (x *codecgenI) CodecEncodeSelf(e *Encoder) { r.EncodeInt(int64(x.codecgenH.TestCodecgenG.TestCodecgenG)) z.EncWriteMapEnd() } - } // checkNil=true + } } func (x *codecgenI) CodecDecodeSelf(d *Decoder) { @@ -6528,7 +5391,9 @@ func (x *codecgenI) CodecDecodeSelf(d *Decoder) { z, r := GenHelperDecoder(d) _, _, _ = h, z, r yyct2 := r.ContainerType() - if yyct2 == codecSelferValueTypeMap19780 { + if yyct2 == codecSelferValueTypeNil19780 { + *(x) = codecgenI{} + } else if yyct2 == codecSelferValueTypeMap19780 { yyl2 := z.DecReadMapStart() if yyl2 == 0 { } else { @@ -6566,11 +5431,7 @@ func (x *codecgenI) codecDecodeSelfFromMap(l int, d *Decoder) { z.DecReadMapElemValue() switch yys3 { case "TestCodecgenG": - if r.TryDecodeAsNil() { - x.codecgenH.TestCodecgenG.TestCodecgenG = 0 - } else { - x.codecgenH.TestCodecgenG.TestCodecgenG = (int)(z.C.IntV(r.DecodeInt64(), codecSelferBitsize19780)) - } + x.codecgenH.TestCodecgenG.TestCodecgenG = (int)(z.C.IntV(r.DecodeInt64(), codecSelferBitsize19780)) default: z.DecStructFieldNotFound(-1, yys3) } // end switch yys3 @@ -6595,11 +5456,7 @@ func (x *codecgenI) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.codecgenH.TestCodecgenG.TestCodecgenG = 0 - } else { - x.codecgenH.TestCodecgenG.TestCodecgenG = (int)(z.C.IntV(r.DecodeInt64(), codecSelferBitsize19780)) - } + x.codecgenH.TestCodecgenG.TestCodecgenG = (int)(z.C.IntV(r.DecodeInt64(), codecSelferBitsize19780)) for { yyj5++ if yyhl5 { @@ -6621,7 +5478,7 @@ func (x *codecgenK) CodecEncodeSelf(e *Encoder) { _, _, _ = h, z, r if x == nil { r.EncodeNil() - } else { // checkNil=true + } else { yysep2 := !z.EncBinary() yy2arr2 := z.EncBasicHandle().StructToArray _, _ = yysep2, yy2arr2 @@ -6661,7 +5518,7 @@ func (x *codecgenK) CodecEncodeSelf(e *Encoder) { } z.EncWriteMapEnd() } - } // checkNil=true + } } func (x *codecgenK) CodecDecodeSelf(d *Decoder) { @@ -6669,7 +5526,9 @@ func (x *codecgenK) CodecDecodeSelf(d *Decoder) { z, r := GenHelperDecoder(d) _, _, _ = h, z, r yyct2 := r.ContainerType() - if yyct2 == codecSelferValueTypeMap19780 { + if yyct2 == codecSelferValueTypeNil19780 { + *(x) = codecgenK{} + } else if yyct2 == codecSelferValueTypeMap19780 { yyl2 := z.DecReadMapStart() if yyl2 == 0 { } else { @@ -6707,17 +5566,9 @@ func (x *codecgenK) codecDecodeSelfFromMap(l int, d *Decoder) { z.DecReadMapElemValue() switch yys3 { case "X": - if r.TryDecodeAsNil() { - x.X = 0 - } else { - x.X = (int)(z.C.IntV(r.DecodeInt64(), codecSelferBitsize19780)) - } + x.X = (int)(z.C.IntV(r.DecodeInt64(), codecSelferBitsize19780)) case "Y": - if r.TryDecodeAsNil() { - x.Y = "" - } else { - x.Y = (string)(string(r.DecodeStringAsBytes())) - } + x.Y = (string)(string(r.DecodeStringAsBytes())) default: z.DecStructFieldNotFound(-1, yys3) } // end switch yys3 @@ -6742,11 +5593,7 @@ func (x *codecgenK) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.X = 0 - } else { - x.X = (int)(z.C.IntV(r.DecodeInt64(), codecSelferBitsize19780)) - } + x.X = (int)(z.C.IntV(r.DecodeInt64(), codecSelferBitsize19780)) yyj6++ if yyhl6 { yyb6 = yyj6 > l @@ -6758,11 +5605,7 @@ func (x *codecgenK) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.Y = "" - } else { - x.Y = (string)(string(r.DecodeStringAsBytes())) - } + x.Y = (string)(string(r.DecodeStringAsBytes())) for { yyj6++ if yyhl6 { @@ -6784,7 +5627,7 @@ func (x *codecgenL) CodecEncodeSelf(e *Encoder) { _, _, _ = h, z, r if x == nil { r.EncodeNil() - } else { // checkNil=true + } else { yysep2 := !z.EncBinary() yy2arr2 := z.EncBasicHandle().StructToArray _, _ = yysep2, yy2arr2 @@ -6816,7 +5659,7 @@ func (x *codecgenL) CodecEncodeSelf(e *Encoder) { r.EncodeUint(uint64(x.Y)) z.EncWriteMapEnd() } - } // checkNil=true + } } func (x *codecgenL) CodecDecodeSelf(d *Decoder) { @@ -6824,7 +5667,9 @@ func (x *codecgenL) CodecDecodeSelf(d *Decoder) { z, r := GenHelperDecoder(d) _, _, _ = h, z, r yyct2 := r.ContainerType() - if yyct2 == codecSelferValueTypeMap19780 { + if yyct2 == codecSelferValueTypeNil19780 { + *(x) = codecgenL{} + } else if yyct2 == codecSelferValueTypeMap19780 { yyl2 := z.DecReadMapStart() if yyl2 == 0 { } else { @@ -6862,17 +5707,9 @@ func (x *codecgenL) codecDecodeSelfFromMap(l int, d *Decoder) { z.DecReadMapElemValue() switch yys3 { case "X": - if r.TryDecodeAsNil() { - x.X = 0 - } else { - x.X = (int)(z.C.IntV(r.DecodeInt64(), codecSelferBitsize19780)) - } + x.X = (int)(z.C.IntV(r.DecodeInt64(), codecSelferBitsize19780)) case "Y": - if r.TryDecodeAsNil() { - x.Y = 0 - } else { - x.Y = (uint32)(z.C.UintV(r.DecodeUint64(), 32)) - } + x.Y = (uint32)(z.C.UintV(r.DecodeUint64(), 32)) default: z.DecStructFieldNotFound(-1, yys3) } // end switch yys3 @@ -6897,11 +5734,7 @@ func (x *codecgenL) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.X = 0 - } else { - x.X = (int)(z.C.IntV(r.DecodeInt64(), codecSelferBitsize19780)) - } + x.X = (int)(z.C.IntV(r.DecodeInt64(), codecSelferBitsize19780)) yyj6++ if yyhl6 { yyb6 = yyj6 > l @@ -6913,11 +5746,7 @@ func (x *codecgenL) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.Y = 0 - } else { - x.Y = (uint32)(z.C.UintV(r.DecodeUint64(), 32)) - } + x.Y = (uint32)(z.C.UintV(r.DecodeUint64(), 32)) for { yyj6++ if yyhl6 { @@ -6939,7 +5768,7 @@ func (x *codecgenM) CodecEncodeSelf(e *Encoder) { _, _, _ = h, z, r if x == nil { r.EncodeNil() - } else { // checkNil=true + } else { yysep2 := !z.EncBinary() yy2arr2 := z.EncBasicHandle().StructToArray _, _ = yysep2, yy2arr2 @@ -6979,7 +5808,7 @@ func (x *codecgenM) CodecEncodeSelf(e *Encoder) { } z.EncWriteMapEnd() } - } // checkNil=true + } } func (x *codecgenM) CodecDecodeSelf(d *Decoder) { @@ -6987,7 +5816,9 @@ func (x *codecgenM) CodecDecodeSelf(d *Decoder) { z, r := GenHelperDecoder(d) _, _, _ = h, z, r yyct2 := r.ContainerType() - if yyct2 == codecSelferValueTypeMap19780 { + if yyct2 == codecSelferValueTypeNil19780 { + *(x) = codecgenM{} + } else if yyct2 == codecSelferValueTypeMap19780 { yyl2 := z.DecReadMapStart() if yyl2 == 0 { } else { @@ -7025,17 +5856,9 @@ func (x *codecgenM) codecDecodeSelfFromMap(l int, d *Decoder) { z.DecReadMapElemValue() switch yys3 { case "X": - if r.TryDecodeAsNil() { - x.codecgenK.X = 0 - } else { - x.codecgenK.X = (int)(z.C.IntV(r.DecodeInt64(), codecSelferBitsize19780)) - } + x.codecgenK.X = (int)(z.C.IntV(r.DecodeInt64(), codecSelferBitsize19780)) case "Y": - if r.TryDecodeAsNil() { - x.codecgenK.Y = "" - } else { - x.codecgenK.Y = (string)(string(r.DecodeStringAsBytes())) - } + x.codecgenK.Y = (string)(string(r.DecodeStringAsBytes())) default: z.DecStructFieldNotFound(-1, yys3) } // end switch yys3 @@ -7060,11 +5883,7 @@ func (x *codecgenM) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.codecgenK.X = 0 - } else { - x.codecgenK.X = (int)(z.C.IntV(r.DecodeInt64(), codecSelferBitsize19780)) - } + x.codecgenK.X = (int)(z.C.IntV(r.DecodeInt64(), codecSelferBitsize19780)) yyj6++ if yyhl6 { yyb6 = yyj6 > l @@ -7076,11 +5895,7 @@ func (x *codecgenM) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.codecgenK.Y = "" - } else { - x.codecgenK.Y = (string)(string(r.DecodeStringAsBytes())) - } + x.codecgenK.Y = (string)(string(r.DecodeStringAsBytes())) for { yyj6++ if yyhl6 { @@ -7116,9 +5931,9 @@ func (x *Aarray) CodecEncodeSelf(e *Encoder) { _, _, _ = h, z, r if x == nil { r.EncodeNil() - } else { // checkNil=true + } else { h.encAarray((*Aarray)(x), e) - } // checkNil=true + } } func (x *Aarray) CodecDecodeSelf(d *Decoder) { @@ -7152,7 +5967,7 @@ func (x *Sstructsmall) CodecEncodeSelf(e *Encoder) { _, _, _ = h, z, r if x == nil { r.EncodeNil() - } else { // checkNil=true + } else { yysep2 := !z.EncBinary() yy2arr2 := z.EncBasicHandle().StructToArray _, _ = yysep2, yy2arr2 @@ -7174,7 +5989,7 @@ func (x *Sstructsmall) CodecEncodeSelf(e *Encoder) { r.EncodeInt(int64(x.A)) z.EncWriteMapEnd() } - } // checkNil=true + } } func (x *Sstructsmall) CodecDecodeSelf(d *Decoder) { @@ -7182,7 +5997,9 @@ func (x *Sstructsmall) CodecDecodeSelf(d *Decoder) { z, r := GenHelperDecoder(d) _, _, _ = h, z, r yyct2 := r.ContainerType() - if yyct2 == codecSelferValueTypeMap19780 { + if yyct2 == codecSelferValueTypeNil19780 { + *(x) = Sstructsmall{} + } else if yyct2 == codecSelferValueTypeMap19780 { yyl2 := z.DecReadMapStart() if yyl2 == 0 { } else { @@ -7220,11 +6037,7 @@ func (x *Sstructsmall) codecDecodeSelfFromMap(l int, d *Decoder) { z.DecReadMapElemValue() switch yys3 { case "A": - if r.TryDecodeAsNil() { - x.A = 0 - } else { - x.A = (int)(z.C.IntV(r.DecodeInt64(), codecSelferBitsize19780)) - } + x.A = (int)(z.C.IntV(r.DecodeInt64(), codecSelferBitsize19780)) default: z.DecStructFieldNotFound(-1, yys3) } // end switch yys3 @@ -7249,11 +6062,7 @@ func (x *Sstructsmall) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.A = 0 - } else { - x.A = (int)(z.C.IntV(r.DecodeInt64(), codecSelferBitsize19780)) - } + x.A = (int)(z.C.IntV(r.DecodeInt64(), codecSelferBitsize19780)) for { yyj5++ if yyhl5 { @@ -7275,7 +6084,7 @@ func (x *Sstructbig) CodecEncodeSelf(e *Encoder) { _, _, _ = h, z, r if x == nil { r.EncodeNil() - } else { // checkNil=true + } else { yysep2 := !z.EncBinary() yy2arr2 := z.EncBasicHandle().StructToArray _, _ = yysep2, yy2arr2 @@ -7367,7 +6176,7 @@ func (x *Sstructbig) CodecEncodeSelf(e *Encoder) { } z.EncWriteMapEnd() } - } // checkNil=true + } } func (x *Sstructbig) CodecDecodeSelf(d *Decoder) { @@ -7375,7 +6184,9 @@ func (x *Sstructbig) CodecDecodeSelf(d *Decoder) { z, r := GenHelperDecoder(d) _, _, _ = h, z, r yyct2 := r.ContainerType() - if yyct2 == codecSelferValueTypeMap19780 { + if yyct2 == codecSelferValueTypeNil19780 { + *(x) = Sstructbig{} + } else if yyct2 == codecSelferValueTypeMap19780 { yyl2 := z.DecReadMapStart() if yyl2 == 0 { } else { @@ -7413,19 +6224,11 @@ func (x *Sstructbig) codecDecodeSelfFromMap(l int, d *Decoder) { z.DecReadMapElemValue() switch yys3 { case "A": - if r.TryDecodeAsNil() { - x.A = 0 - } else { - x.A = (int)(z.C.IntV(r.DecodeInt64(), codecSelferBitsize19780)) - } + x.A = (int)(z.C.IntV(r.DecodeInt64(), codecSelferBitsize19780)) case "B": - if r.TryDecodeAsNil() { - x.B = false - } else { - x.B = (bool)(r.DecodeBool()) - } + x.B = (bool)(r.DecodeBool()) case "Ssmallptr": - if r.TryDecodeAsNil() { + if r.TryNil() { if x.Ssmallptr != nil { // remove the if-true x.Ssmallptr = nil } @@ -7433,11 +6236,10 @@ func (x *Sstructbig) codecDecodeSelfFromMap(l int, d *Decoder) { if x.Ssmallptr == nil { x.Ssmallptr = new(Sstructsmall) } - x.Ssmallptr.CodecDecodeSelf(d) } case "Ssmall": - if r.TryDecodeAsNil() { + if r.TryNil() { if x.Ssmall != nil { // remove the if-true x.Ssmall = nil } @@ -7445,11 +6247,10 @@ func (x *Sstructbig) codecDecodeSelfFromMap(l int, d *Decoder) { if x.Ssmall == nil { x.Ssmall = new(Sstructsmall) } - x.Ssmall.CodecDecodeSelf(d) } case "Sptr": - if r.TryDecodeAsNil() { + if r.TryNil() { if x.Sptr != nil { // remove the if-true x.Sptr = nil } @@ -7457,7 +6258,6 @@ func (x *Sstructbig) codecDecodeSelfFromMap(l int, d *Decoder) { if x.Sptr == nil { x.Sptr = new(Sstructbig) } - x.Sptr.CodecDecodeSelf(d) } default: @@ -7484,11 +6284,7 @@ func (x *Sstructbig) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.A = 0 - } else { - x.A = (int)(z.C.IntV(r.DecodeInt64(), codecSelferBitsize19780)) - } + x.A = (int)(z.C.IntV(r.DecodeInt64(), codecSelferBitsize19780)) yyj9++ if yyhl9 { yyb9 = yyj9 > l @@ -7500,11 +6296,7 @@ func (x *Sstructbig) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.B = false - } else { - x.B = (bool)(r.DecodeBool()) - } + x.B = (bool)(r.DecodeBool()) yyj9++ if yyhl9 { yyb9 = yyj9 > l @@ -7516,7 +6308,7 @@ func (x *Sstructbig) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { + if r.TryNil() { if x.Ssmallptr != nil { // remove the if-true x.Ssmallptr = nil } @@ -7524,7 +6316,6 @@ func (x *Sstructbig) codecDecodeSelfFromArray(l int, d *Decoder) { if x.Ssmallptr == nil { x.Ssmallptr = new(Sstructsmall) } - x.Ssmallptr.CodecDecodeSelf(d) } yyj9++ @@ -7538,7 +6329,7 @@ func (x *Sstructbig) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { + if r.TryNil() { if x.Ssmall != nil { // remove the if-true x.Ssmall = nil } @@ -7546,7 +6337,6 @@ func (x *Sstructbig) codecDecodeSelfFromArray(l int, d *Decoder) { if x.Ssmall == nil { x.Ssmall = new(Sstructsmall) } - x.Ssmall.CodecDecodeSelf(d) } yyj9++ @@ -7560,7 +6350,7 @@ func (x *Sstructbig) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { + if r.TryNil() { if x.Sptr != nil { // remove the if-true x.Sptr = nil } @@ -7568,7 +6358,6 @@ func (x *Sstructbig) codecDecodeSelfFromArray(l int, d *Decoder) { if x.Sptr == nil { x.Sptr = new(Sstructbig) } - x.Sptr.CodecDecodeSelf(d) } for { @@ -7592,7 +6381,7 @@ func (x *SstructbigMapBySlice) CodecEncodeSelf(e *Encoder) { _, _, _ = h, z, r if x == nil { r.EncodeNil() - } else { // checkNil=true + } else { yysep2 := !z.EncBinary() yy2arr2 := z.EncBasicHandle().StructToArray _, _ = yysep2, yy2arr2 @@ -7684,7 +6473,7 @@ func (x *SstructbigMapBySlice) CodecEncodeSelf(e *Encoder) { } z.EncWriteMapEnd() } - } // checkNil=true + } } func (x *SstructbigMapBySlice) CodecDecodeSelf(d *Decoder) { @@ -7692,7 +6481,9 @@ func (x *SstructbigMapBySlice) CodecDecodeSelf(d *Decoder) { z, r := GenHelperDecoder(d) _, _, _ = h, z, r yyct2 := r.ContainerType() - if yyct2 == codecSelferValueTypeMap19780 { + if yyct2 == codecSelferValueTypeNil19780 { + *(x) = SstructbigMapBySlice{} + } else if yyct2 == codecSelferValueTypeMap19780 { yyl2 := z.DecReadMapStart() if yyl2 == 0 { } else { @@ -7730,19 +6521,11 @@ func (x *SstructbigMapBySlice) codecDecodeSelfFromMap(l int, d *Decoder) { z.DecReadMapElemValue() switch yys3 { case "A": - if r.TryDecodeAsNil() { - x.A = 0 - } else { - x.A = (int)(z.C.IntV(r.DecodeInt64(), codecSelferBitsize19780)) - } + x.A = (int)(z.C.IntV(r.DecodeInt64(), codecSelferBitsize19780)) case "B": - if r.TryDecodeAsNil() { - x.B = false - } else { - x.B = (bool)(r.DecodeBool()) - } + x.B = (bool)(r.DecodeBool()) case "Ssmallptr": - if r.TryDecodeAsNil() { + if r.TryNil() { if x.Ssmallptr != nil { // remove the if-true x.Ssmallptr = nil } @@ -7750,11 +6533,10 @@ func (x *SstructbigMapBySlice) codecDecodeSelfFromMap(l int, d *Decoder) { if x.Ssmallptr == nil { x.Ssmallptr = new(Sstructsmall) } - x.Ssmallptr.CodecDecodeSelf(d) } case "Ssmall": - if r.TryDecodeAsNil() { + if r.TryNil() { if x.Ssmall != nil { // remove the if-true x.Ssmall = nil } @@ -7762,11 +6544,10 @@ func (x *SstructbigMapBySlice) codecDecodeSelfFromMap(l int, d *Decoder) { if x.Ssmall == nil { x.Ssmall = new(Sstructsmall) } - x.Ssmall.CodecDecodeSelf(d) } case "Sptr": - if r.TryDecodeAsNil() { + if r.TryNil() { if x.Sptr != nil { // remove the if-true x.Sptr = nil } @@ -7774,7 +6555,6 @@ func (x *SstructbigMapBySlice) codecDecodeSelfFromMap(l int, d *Decoder) { if x.Sptr == nil { x.Sptr = new(Sstructbig) } - x.Sptr.CodecDecodeSelf(d) } default: @@ -7801,11 +6581,7 @@ func (x *SstructbigMapBySlice) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.A = 0 - } else { - x.A = (int)(z.C.IntV(r.DecodeInt64(), codecSelferBitsize19780)) - } + x.A = (int)(z.C.IntV(r.DecodeInt64(), codecSelferBitsize19780)) yyj9++ if yyhl9 { yyb9 = yyj9 > l @@ -7817,11 +6593,7 @@ func (x *SstructbigMapBySlice) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.B = false - } else { - x.B = (bool)(r.DecodeBool()) - } + x.B = (bool)(r.DecodeBool()) yyj9++ if yyhl9 { yyb9 = yyj9 > l @@ -7833,7 +6605,7 @@ func (x *SstructbigMapBySlice) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { + if r.TryNil() { if x.Ssmallptr != nil { // remove the if-true x.Ssmallptr = nil } @@ -7841,7 +6613,6 @@ func (x *SstructbigMapBySlice) codecDecodeSelfFromArray(l int, d *Decoder) { if x.Ssmallptr == nil { x.Ssmallptr = new(Sstructsmall) } - x.Ssmallptr.CodecDecodeSelf(d) } yyj9++ @@ -7855,7 +6626,7 @@ func (x *SstructbigMapBySlice) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { + if r.TryNil() { if x.Ssmall != nil { // remove the if-true x.Ssmall = nil } @@ -7863,7 +6634,6 @@ func (x *SstructbigMapBySlice) codecDecodeSelfFromArray(l int, d *Decoder) { if x.Ssmall == nil { x.Ssmall = new(Sstructsmall) } - x.Ssmall.CodecDecodeSelf(d) } yyj9++ @@ -7877,7 +6647,7 @@ func (x *SstructbigMapBySlice) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { + if r.TryNil() { if x.Sptr != nil { // remove the if-true x.Sptr = nil } @@ -7885,7 +6655,6 @@ func (x *SstructbigMapBySlice) codecDecodeSelfFromArray(l int, d *Decoder) { if x.Sptr == nil { x.Sptr = new(Sstructbig) } - x.Sptr.CodecDecodeSelf(d) } for { @@ -7909,7 +6678,7 @@ func (x *tLowerFirstLetter) CodecEncodeSelf(e *Encoder) { _, _, _ = h, z, r if x == nil { r.EncodeNil() - } else { // checkNil=true + } else { yysep2 := !z.EncBinary() yy2arr2 := z.EncBasicHandle().StructToArray _, _ = yysep2, yy2arr2 @@ -7949,7 +6718,7 @@ func (x *tLowerFirstLetter) CodecEncodeSelf(e *Encoder) { } z.EncWriteMapEnd() } - } // checkNil=true + } } func (x *tLowerFirstLetter) CodecDecodeSelf(d *Decoder) { @@ -7957,7 +6726,9 @@ func (x *tLowerFirstLetter) CodecDecodeSelf(d *Decoder) { z, r := GenHelperDecoder(d) _, _, _ = h, z, r yyct2 := r.ContainerType() - if yyct2 == codecSelferValueTypeMap19780 { + if yyct2 == codecSelferValueTypeNil19780 { + *(x) = tLowerFirstLetter{} + } else if yyct2 == codecSelferValueTypeMap19780 { yyl2 := z.DecReadMapStart() if yyl2 == 0 { } else { @@ -7995,17 +6766,9 @@ func (x *tLowerFirstLetter) codecDecodeSelfFromMap(l int, d *Decoder) { z.DecReadMapElemValue() switch yys3 { case "I": - if r.TryDecodeAsNil() { - x.I = 0 - } else { - x.I = (int)(z.C.IntV(r.DecodeInt64(), codecSelferBitsize19780)) - } + x.I = (int)(z.C.IntV(r.DecodeInt64(), codecSelferBitsize19780)) case "S": - if r.TryDecodeAsNil() { - x.S = "" - } else { - x.S = (string)(string(r.DecodeStringAsBytes())) - } + x.S = (string)(string(r.DecodeStringAsBytes())) default: z.DecStructFieldNotFound(-1, yys3) } // end switch yys3 @@ -8030,11 +6793,7 @@ func (x *tLowerFirstLetter) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.I = 0 - } else { - x.I = (int)(z.C.IntV(r.DecodeInt64(), codecSelferBitsize19780)) - } + x.I = (int)(z.C.IntV(r.DecodeInt64(), codecSelferBitsize19780)) yyj6++ if yyhl6 { yyb6 = yyj6 > l @@ -8046,11 +6805,7 @@ func (x *tLowerFirstLetter) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.S = "" - } else { - x.S = (string)(string(r.DecodeStringAsBytes())) - } + x.S = (string)(string(r.DecodeStringAsBytes())) for { yyj6++ if yyhl6 { @@ -8118,7 +6873,7 @@ func (x *AnonInTestStrucIntf) CodecEncodeSelf(e *Encoder) { _, _, _ = h, z, r if x == nil { r.EncodeNil() - } else { // checkNil=true + } else { yysep2 := !z.EncBinary() yy2arr2 := z.EncBasicHandle().StructToArray _, _ = yysep2, yy2arr2 @@ -8248,7 +7003,7 @@ func (x *AnonInTestStrucIntf) CodecEncodeSelf(e *Encoder) { } z.EncWriteMapEnd() } - } // checkNil=true + } } func (x *AnonInTestStrucIntf) CodecDecodeSelf(d *Decoder) { @@ -8256,7 +7011,9 @@ func (x *AnonInTestStrucIntf) CodecDecodeSelf(d *Decoder) { z, r := GenHelperDecoder(d) _, _, _ = h, z, r yyct2 := r.ContainerType() - if yyct2 == codecSelferValueTypeMap19780 { + if yyct2 == codecSelferValueTypeNil19780 { + *(x) = AnonInTestStrucIntf{} + } else if yyct2 == codecSelferValueTypeMap19780 { yyl2 := z.DecReadMapStart() if yyl2 == 0 { } else { @@ -8294,41 +7051,25 @@ func (x *AnonInTestStrucIntf) codecDecodeSelfFromMap(l int, d *Decoder) { z.DecReadMapElemValue() switch yys3 { case "Islice": - if r.TryDecodeAsNil() { - x.Islice = nil - } else { - z.F.DecSliceIntfX(&x.Islice, d) - } + z.F.DecSliceIntfX(&x.Islice, d) case "Ms": - if r.TryDecodeAsNil() { - x.Ms = nil - } else { - z.F.DecMapStringIntfX(&x.Ms, d) - } + z.F.DecMapStringIntfX(&x.Ms, d) case "Nintf": - if r.TryDecodeAsNil() { - x.Nintf = nil - } else { - z.DecFallback(&x.Nintf, true) - } + z.DecFallback(&x.Nintf, true) case "T": - if r.TryDecodeAsNil() { - x.T = time.Time{} + if !z.DecBasicHandle().TimeNotBuiltin { + x.T = r.DecodeTime() + } else if yyxt11 := z.Extension(z.I2Rtid(x.T)); yyxt11 != nil { + z.DecExtension(x.T, yyxt11) + } else if z.DecBinary() { + z.DecBinaryUnmarshal(&x.T) + } else if !z.DecBinary() && z.IsJSONHandle() { + z.DecJSONUnmarshal(&x.T) } else { - if !z.DecBasicHandle().TimeNotBuiltin { - x.T = r.DecodeTime() - } else if yyxt11 := z.Extension(z.I2Rtid(x.T)); yyxt11 != nil { - z.DecExtension(x.T, yyxt11) - } else if z.DecBinary() { - z.DecBinaryUnmarshal(&x.T) - } else if !z.DecBinary() && z.IsJSONHandle() { - z.DecJSONUnmarshal(&x.T) - } else { - z.DecFallback(&x.T, false) - } + z.DecFallback(&x.T, false) } case "Tptr": - if r.TryDecodeAsNil() { + if r.TryNil() { if x.Tptr != nil { // remove the if-true x.Tptr = nil } @@ -8336,7 +7077,6 @@ func (x *AnonInTestStrucIntf) codecDecodeSelfFromMap(l int, d *Decoder) { if x.Tptr == nil { x.Tptr = new(time.Time) } - if !z.DecBasicHandle().TimeNotBuiltin { *x.Tptr = r.DecodeTime() } else if yyxt13 := z.Extension(z.I2Rtid(x.Tptr)); yyxt13 != nil { @@ -8373,11 +7113,7 @@ func (x *AnonInTestStrucIntf) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.Islice = nil - } else { - z.F.DecSliceIntfX(&x.Islice, d) - } + z.F.DecSliceIntfX(&x.Islice, d) yyj14++ if yyhl14 { yyb14 = yyj14 > l @@ -8389,11 +7125,7 @@ func (x *AnonInTestStrucIntf) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.Ms = nil - } else { - z.F.DecMapStringIntfX(&x.Ms, d) - } + z.F.DecMapStringIntfX(&x.Ms, d) yyj14++ if yyhl14 { yyb14 = yyj14 > l @@ -8405,11 +7137,7 @@ func (x *AnonInTestStrucIntf) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.Nintf = nil - } else { - z.DecFallback(&x.Nintf, true) - } + z.DecFallback(&x.Nintf, true) yyj14++ if yyhl14 { yyb14 = yyj14 > l @@ -8421,20 +7149,16 @@ func (x *AnonInTestStrucIntf) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.T = time.Time{} + if !z.DecBasicHandle().TimeNotBuiltin { + x.T = r.DecodeTime() + } else if yyxt22 := z.Extension(z.I2Rtid(x.T)); yyxt22 != nil { + z.DecExtension(x.T, yyxt22) + } else if z.DecBinary() { + z.DecBinaryUnmarshal(&x.T) + } else if !z.DecBinary() && z.IsJSONHandle() { + z.DecJSONUnmarshal(&x.T) } else { - if !z.DecBasicHandle().TimeNotBuiltin { - x.T = r.DecodeTime() - } else if yyxt22 := z.Extension(z.I2Rtid(x.T)); yyxt22 != nil { - z.DecExtension(x.T, yyxt22) - } else if z.DecBinary() { - z.DecBinaryUnmarshal(&x.T) - } else if !z.DecBinary() && z.IsJSONHandle() { - z.DecJSONUnmarshal(&x.T) - } else { - z.DecFallback(&x.T, false) - } + z.DecFallback(&x.T, false) } yyj14++ if yyhl14 { @@ -8447,7 +7171,7 @@ func (x *AnonInTestStrucIntf) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { + if r.TryNil() { if x.Tptr != nil { // remove the if-true x.Tptr = nil } @@ -8455,7 +7179,6 @@ func (x *AnonInTestStrucIntf) codecDecodeSelfFromArray(l int, d *Decoder) { if x.Tptr == nil { x.Tptr = new(time.Time) } - if !z.DecBasicHandle().TimeNotBuiltin { *x.Tptr = r.DecodeTime() } else if yyxt24 := z.Extension(z.I2Rtid(x.Tptr)); yyxt24 != nil { @@ -8489,7 +7212,7 @@ func (x *missingFielderT1) CodecEncodeSelf(e *Encoder) { _, _, _ = h, z, r if x == nil { r.EncodeNil() - } else { // checkNil=true + } else { yysep2 := !z.EncBinary() yy2arr2 := z.EncBasicHandle().StructToArray _, _ = yysep2, yy2arr2 @@ -8529,7 +7252,7 @@ func (x *missingFielderT1) CodecEncodeSelf(e *Encoder) { r.EncodeBool(bool(x.B)) z.EncWriteMapEnd() } - } // checkNil=true + } } func (x *missingFielderT1) CodecDecodeSelf(d *Decoder) { @@ -8537,7 +7260,9 @@ func (x *missingFielderT1) CodecDecodeSelf(d *Decoder) { z, r := GenHelperDecoder(d) _, _, _ = h, z, r yyct2 := r.ContainerType() - if yyct2 == codecSelferValueTypeMap19780 { + if yyct2 == codecSelferValueTypeNil19780 { + *(x) = missingFielderT1{} + } else if yyct2 == codecSelferValueTypeMap19780 { yyl2 := z.DecReadMapStart() if yyl2 == 0 { } else { @@ -8575,17 +7300,9 @@ func (x *missingFielderT1) codecDecodeSelfFromMap(l int, d *Decoder) { z.DecReadMapElemValue() switch yys3 { case "S": - if r.TryDecodeAsNil() { - x.S = "" - } else { - x.S = (string)(string(r.DecodeStringAsBytes())) - } + x.S = (string)(string(r.DecodeStringAsBytes())) case "B": - if r.TryDecodeAsNil() { - x.B = false - } else { - x.B = (bool)(r.DecodeBool()) - } + x.B = (bool)(r.DecodeBool()) default: z.DecStructFieldNotFound(-1, yys3) } // end switch yys3 @@ -8610,11 +7327,7 @@ func (x *missingFielderT1) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.S = "" - } else { - x.S = (string)(string(r.DecodeStringAsBytes())) - } + x.S = (string)(string(r.DecodeStringAsBytes())) yyj6++ if yyhl6 { yyb6 = yyj6 > l @@ -8626,11 +7339,7 @@ func (x *missingFielderT1) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.B = false - } else { - x.B = (bool)(r.DecodeBool()) - } + x.B = (bool)(r.DecodeBool()) for { yyj6++ if yyhl6 { @@ -8652,7 +7361,7 @@ func (x *missingFielderT2) CodecEncodeSelf(e *Encoder) { _, _, _ = h, z, r if x == nil { r.EncodeNil() - } else { // checkNil=true + } else { yysep2 := !z.EncBinary() yy2arr2 := z.EncBasicHandle().StructToArray _, _ = yysep2, yy2arr2 @@ -8712,7 +7421,7 @@ func (x *missingFielderT2) CodecEncodeSelf(e *Encoder) { r.EncodeInt(int64(x.I)) z.EncWriteMapEnd() } - } // checkNil=true + } } func (x *missingFielderT2) CodecDecodeSelf(d *Decoder) { @@ -8720,7 +7429,9 @@ func (x *missingFielderT2) CodecDecodeSelf(d *Decoder) { z, r := GenHelperDecoder(d) _, _, _ = h, z, r yyct2 := r.ContainerType() - if yyct2 == codecSelferValueTypeMap19780 { + if yyct2 == codecSelferValueTypeNil19780 { + *(x) = missingFielderT2{} + } else if yyct2 == codecSelferValueTypeMap19780 { yyl2 := z.DecReadMapStart() if yyl2 == 0 { } else { @@ -8758,29 +7469,13 @@ func (x *missingFielderT2) codecDecodeSelfFromMap(l int, d *Decoder) { z.DecReadMapElemValue() switch yys3 { case "S": - if r.TryDecodeAsNil() { - x.S = "" - } else { - x.S = (string)(string(r.DecodeStringAsBytes())) - } + x.S = (string)(string(r.DecodeStringAsBytes())) case "B": - if r.TryDecodeAsNil() { - x.B = false - } else { - x.B = (bool)(r.DecodeBool()) - } + x.B = (bool)(r.DecodeBool()) case "F": - if r.TryDecodeAsNil() { - x.F = 0 - } else { - x.F = (float64)(r.DecodeFloat64()) - } + x.F = (float64)(r.DecodeFloat64()) case "I": - if r.TryDecodeAsNil() { - x.I = 0 - } else { - x.I = (int64)(r.DecodeInt64()) - } + x.I = (int64)(r.DecodeInt64()) default: z.DecStructFieldNotFound(-1, yys3) } // end switch yys3 @@ -8805,11 +7500,7 @@ func (x *missingFielderT2) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.S = "" - } else { - x.S = (string)(string(r.DecodeStringAsBytes())) - } + x.S = (string)(string(r.DecodeStringAsBytes())) yyj8++ if yyhl8 { yyb8 = yyj8 > l @@ -8821,11 +7512,7 @@ func (x *missingFielderT2) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.B = false - } else { - x.B = (bool)(r.DecodeBool()) - } + x.B = (bool)(r.DecodeBool()) yyj8++ if yyhl8 { yyb8 = yyj8 > l @@ -8837,11 +7524,7 @@ func (x *missingFielderT2) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.F = 0 - } else { - x.F = (float64)(r.DecodeFloat64()) - } + x.F = (float64)(r.DecodeFloat64()) yyj8++ if yyhl8 { yyb8 = yyj8 > l @@ -8853,11 +7536,7 @@ func (x *missingFielderT2) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.I = 0 - } else { - x.I = (int64)(r.DecodeInt64()) - } + x.I = (int64)(r.DecodeInt64()) for { yyj8++ if yyhl8 { @@ -8879,7 +7558,7 @@ func (x *testSelfExtHelper) CodecEncodeSelf(e *Encoder) { _, _, _ = h, z, r if x == nil { r.EncodeNil() - } else { // checkNil=true + } else { yysep2 := !z.EncBinary() yy2arr2 := z.EncBasicHandle().StructToArray _, _ = yysep2, yy2arr2 @@ -8929,7 +7608,7 @@ func (x *testSelfExtHelper) CodecEncodeSelf(e *Encoder) { r.EncodeBool(bool(x.B)) z.EncWriteMapEnd() } - } // checkNil=true + } } func (x *testSelfExtHelper) CodecDecodeSelf(d *Decoder) { @@ -8937,7 +7616,9 @@ func (x *testSelfExtHelper) CodecDecodeSelf(d *Decoder) { z, r := GenHelperDecoder(d) _, _, _ = h, z, r yyct2 := r.ContainerType() - if yyct2 == codecSelferValueTypeMap19780 { + if yyct2 == codecSelferValueTypeNil19780 { + *(x) = testSelfExtHelper{} + } else if yyct2 == codecSelferValueTypeMap19780 { yyl2 := z.DecReadMapStart() if yyl2 == 0 { } else { @@ -8975,23 +7656,11 @@ func (x *testSelfExtHelper) codecDecodeSelfFromMap(l int, d *Decoder) { z.DecReadMapElemValue() switch yys3 { case "S": - if r.TryDecodeAsNil() { - x.S = "" - } else { - x.S = (string)(string(r.DecodeStringAsBytes())) - } + x.S = (string)(string(r.DecodeStringAsBytes())) case "I": - if r.TryDecodeAsNil() { - x.I = 0 - } else { - x.I = (int64)(r.DecodeInt64()) - } + x.I = (int64)(r.DecodeInt64()) case "B": - if r.TryDecodeAsNil() { - x.B = false - } else { - x.B = (bool)(r.DecodeBool()) - } + x.B = (bool)(r.DecodeBool()) default: z.DecStructFieldNotFound(-1, yys3) } // end switch yys3 @@ -9016,11 +7685,7 @@ func (x *testSelfExtHelper) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.S = "" - } else { - x.S = (string)(string(r.DecodeStringAsBytes())) - } + x.S = (string)(string(r.DecodeStringAsBytes())) yyj7++ if yyhl7 { yyb7 = yyj7 > l @@ -9032,11 +7697,7 @@ func (x *testSelfExtHelper) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.I = 0 - } else { - x.I = (int64)(r.DecodeInt64()) - } + x.I = (int64)(r.DecodeInt64()) yyj7++ if yyhl7 { yyb7 = yyj7 > l @@ -9048,11 +7709,7 @@ func (x *testSelfExtHelper) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.B = false - } else { - x.B = (bool)(r.DecodeBool()) - } + x.B = (bool)(r.DecodeBool()) for { yyj7++ if yyhl7 { @@ -9074,7 +7731,7 @@ func (x *TestSelfExtImpl) CodecEncodeSelf(e *Encoder) { _, _, _ = h, z, r if x == nil { r.EncodeNil() - } else { // checkNil=true + } else { yysep2 := !z.EncBinary() yy2arr2 := z.EncBasicHandle().StructToArray _, _ = yysep2, yy2arr2 @@ -9124,7 +7781,7 @@ func (x *TestSelfExtImpl) CodecEncodeSelf(e *Encoder) { r.EncodeBool(bool(x.testSelfExtHelper.B)) z.EncWriteMapEnd() } - } // checkNil=true + } } func (x *TestSelfExtImpl) CodecDecodeSelf(d *Decoder) { @@ -9132,7 +7789,9 @@ func (x *TestSelfExtImpl) CodecDecodeSelf(d *Decoder) { z, r := GenHelperDecoder(d) _, _, _ = h, z, r yyct2 := r.ContainerType() - if yyct2 == codecSelferValueTypeMap19780 { + if yyct2 == codecSelferValueTypeNil19780 { + *(x) = TestSelfExtImpl{} + } else if yyct2 == codecSelferValueTypeMap19780 { yyl2 := z.DecReadMapStart() if yyl2 == 0 { } else { @@ -9170,23 +7829,11 @@ func (x *TestSelfExtImpl) codecDecodeSelfFromMap(l int, d *Decoder) { z.DecReadMapElemValue() switch yys3 { case "S": - if r.TryDecodeAsNil() { - x.testSelfExtHelper.S = "" - } else { - x.testSelfExtHelper.S = (string)(string(r.DecodeStringAsBytes())) - } + x.testSelfExtHelper.S = (string)(string(r.DecodeStringAsBytes())) case "I": - if r.TryDecodeAsNil() { - x.testSelfExtHelper.I = 0 - } else { - x.testSelfExtHelper.I = (int64)(r.DecodeInt64()) - } + x.testSelfExtHelper.I = (int64)(r.DecodeInt64()) case "B": - if r.TryDecodeAsNil() { - x.testSelfExtHelper.B = false - } else { - x.testSelfExtHelper.B = (bool)(r.DecodeBool()) - } + x.testSelfExtHelper.B = (bool)(r.DecodeBool()) default: z.DecStructFieldNotFound(-1, yys3) } // end switch yys3 @@ -9211,11 +7858,7 @@ func (x *TestSelfExtImpl) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.testSelfExtHelper.S = "" - } else { - x.testSelfExtHelper.S = (string)(string(r.DecodeStringAsBytes())) - } + x.testSelfExtHelper.S = (string)(string(r.DecodeStringAsBytes())) yyj7++ if yyhl7 { yyb7 = yyj7 > l @@ -9227,11 +7870,7 @@ func (x *TestSelfExtImpl) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.testSelfExtHelper.I = 0 - } else { - x.testSelfExtHelper.I = (int64)(r.DecodeInt64()) - } + x.testSelfExtHelper.I = (int64)(r.DecodeInt64()) yyj7++ if yyhl7 { yyb7 = yyj7 > l @@ -9243,11 +7882,7 @@ func (x *TestSelfExtImpl) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.testSelfExtHelper.B = false - } else { - x.testSelfExtHelper.B = (bool)(r.DecodeBool()) - } + x.testSelfExtHelper.B = (bool)(r.DecodeBool()) for { yyj7++ if yyhl7 { @@ -9269,7 +7904,7 @@ func (x *TestSelfExtImpl2) CodecEncodeSelf(e *Encoder) { _, _, _ = h, z, r if x == nil { r.EncodeNil() - } else { // checkNil=true + } else { yysep2 := !z.EncBinary() yy2arr2 := z.EncBasicHandle().StructToArray _, _ = yysep2, yy2arr2 @@ -9309,7 +7944,7 @@ func (x *TestSelfExtImpl2) CodecEncodeSelf(e *Encoder) { r.EncodeBool(bool(x.O)) z.EncWriteMapEnd() } - } // checkNil=true + } } func (x *TestSelfExtImpl2) CodecDecodeSelf(d *Decoder) { @@ -9317,7 +7952,9 @@ func (x *TestSelfExtImpl2) CodecDecodeSelf(d *Decoder) { z, r := GenHelperDecoder(d) _, _, _ = h, z, r yyct2 := r.ContainerType() - if yyct2 == codecSelferValueTypeMap19780 { + if yyct2 == codecSelferValueTypeNil19780 { + *(x) = TestSelfExtImpl2{} + } else if yyct2 == codecSelferValueTypeMap19780 { yyl2 := z.DecReadMapStart() if yyl2 == 0 { } else { @@ -9355,17 +7992,9 @@ func (x *TestSelfExtImpl2) codecDecodeSelfFromMap(l int, d *Decoder) { z.DecReadMapElemValue() switch yys3 { case "M": - if r.TryDecodeAsNil() { - x.M = "" - } else { - x.M = (string)(string(r.DecodeStringAsBytes())) - } + x.M = (string)(string(r.DecodeStringAsBytes())) case "O": - if r.TryDecodeAsNil() { - x.O = false - } else { - x.O = (bool)(r.DecodeBool()) - } + x.O = (bool)(r.DecodeBool()) default: z.DecStructFieldNotFound(-1, yys3) } // end switch yys3 @@ -9390,11 +8019,7 @@ func (x *TestSelfExtImpl2) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.M = "" - } else { - x.M = (string)(string(r.DecodeStringAsBytes())) - } + x.M = (string)(string(r.DecodeStringAsBytes())) yyj6++ if yyhl6 { yyb6 = yyj6 > l @@ -9406,11 +8031,7 @@ func (x *TestSelfExtImpl2) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.O = false - } else { - x.O = (bool)(r.DecodeBool()) - } + x.O = (bool)(r.DecodeBool()) for { yyj6++ if yyhl6 { @@ -9432,7 +8053,7 @@ func (x *TestTwoNakedInterfaces) CodecEncodeSelf(e *Encoder) { _, _, _ = h, z, r if x == nil { r.EncodeNil() - } else { // checkNil=true + } else { yysep2 := !z.EncBinary() yy2arr2 := z.EncBasicHandle().StructToArray _, _ = yysep2, yy2arr2 @@ -9464,7 +8085,7 @@ func (x *TestTwoNakedInterfaces) CodecEncodeSelf(e *Encoder) { z.EncFallback(x.B) z.EncWriteMapEnd() } - } // checkNil=true + } } func (x *TestTwoNakedInterfaces) CodecDecodeSelf(d *Decoder) { @@ -9472,7 +8093,9 @@ func (x *TestTwoNakedInterfaces) CodecDecodeSelf(d *Decoder) { z, r := GenHelperDecoder(d) _, _, _ = h, z, r yyct2 := r.ContainerType() - if yyct2 == codecSelferValueTypeMap19780 { + if yyct2 == codecSelferValueTypeNil19780 { + *(x) = TestTwoNakedInterfaces{} + } else if yyct2 == codecSelferValueTypeMap19780 { yyl2 := z.DecReadMapStart() if yyl2 == 0 { } else { @@ -9510,17 +8133,9 @@ func (x *TestTwoNakedInterfaces) codecDecodeSelfFromMap(l int, d *Decoder) { z.DecReadMapElemValue() switch yys3 { case "A": - if r.TryDecodeAsNil() { - x.A = nil - } else { - z.DecFallback(&x.A, true) - } + z.DecFallback(&x.A, true) case "B": - if r.TryDecodeAsNil() { - x.B = nil - } else { - z.DecFallback(&x.B, true) - } + z.DecFallback(&x.B, true) default: z.DecStructFieldNotFound(-1, yys3) } // end switch yys3 @@ -9545,11 +8160,7 @@ func (x *TestTwoNakedInterfaces) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.A = nil - } else { - z.DecFallback(&x.A, true) - } + z.DecFallback(&x.A, true) yyj8++ if yyhl8 { yyb8 = yyj8 > l @@ -9561,11 +8172,7 @@ func (x *TestTwoNakedInterfaces) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.B = nil - } else { - z.DecFallback(&x.B, true) - } + z.DecFallback(&x.B, true) for { yyj8++ if yyhl8 { @@ -9587,7 +8194,7 @@ func (x *TestStrucFlex) CodecEncodeSelf(e *Encoder) { _, _, _ = h, z, r if x == nil { r.EncodeNil() - } else { // checkNil=true + } else { yysep2 := !z.EncBinary() yy2arr2 := z.EncBasicHandle().StructToArray _, _ = yysep2, yy2arr2 @@ -11402,7 +10009,7 @@ func (x *TestStrucFlex) CodecEncodeSelf(e *Encoder) { } z.EncWriteMapEnd() } - } // checkNil=true + } } func (x *TestStrucFlex) CodecDecodeSelf(d *Decoder) { @@ -11410,7 +10017,9 @@ func (x *TestStrucFlex) CodecDecodeSelf(d *Decoder) { z, r := GenHelperDecoder(d) _, _, _ = h, z, r yyct2 := r.ContainerType() - if yyct2 == codecSelferValueTypeMap19780 { + if yyct2 == codecSelferValueTypeNil19780 { + *(x) = TestStrucFlex{} + } else if yyct2 == codecSelferValueTypeMap19780 { yyl2 := z.DecReadMapStart() if yyl2 == 0 { } else { @@ -11448,313 +10057,109 @@ func (x *TestStrucFlex) codecDecodeSelfFromMap(l int, d *Decoder) { z.DecReadMapElemValue() switch yys3 { case "S": - if r.TryDecodeAsNil() { - x.TestStrucCommon.S = "" - } else { - x.TestStrucCommon.S = (string)(string(r.DecodeStringAsBytes())) - } + x.TestStrucCommon.S = (string)(string(r.DecodeStringAsBytes())) case "I64": - if r.TryDecodeAsNil() { - x.TestStrucCommon.I64 = 0 - } else { - x.TestStrucCommon.I64 = (int64)(r.DecodeInt64()) - } + x.TestStrucCommon.I64 = (int64)(r.DecodeInt64()) case "I32": - if r.TryDecodeAsNil() { - x.TestStrucCommon.I32 = 0 - } else { - x.TestStrucCommon.I32 = (int32)(z.C.IntV(r.DecodeInt64(), 32)) - } + x.TestStrucCommon.I32 = (int32)(z.C.IntV(r.DecodeInt64(), 32)) case "I16": - if r.TryDecodeAsNil() { - x.TestStrucCommon.I16 = 0 - } else { - x.TestStrucCommon.I16 = (int16)(z.C.IntV(r.DecodeInt64(), 16)) - } + x.TestStrucCommon.I16 = (int16)(z.C.IntV(r.DecodeInt64(), 16)) case "I8": - if r.TryDecodeAsNil() { - x.TestStrucCommon.I8 = 0 - } else { - x.TestStrucCommon.I8 = (int8)(z.C.IntV(r.DecodeInt64(), 8)) - } + x.TestStrucCommon.I8 = (int8)(z.C.IntV(r.DecodeInt64(), 8)) case "I64n": - if r.TryDecodeAsNil() { - x.TestStrucCommon.I64n = 0 - } else { - x.TestStrucCommon.I64n = (int64)(r.DecodeInt64()) - } + x.TestStrucCommon.I64n = (int64)(r.DecodeInt64()) case "I32n": - if r.TryDecodeAsNil() { - x.TestStrucCommon.I32n = 0 - } else { - x.TestStrucCommon.I32n = (int32)(z.C.IntV(r.DecodeInt64(), 32)) - } + x.TestStrucCommon.I32n = (int32)(z.C.IntV(r.DecodeInt64(), 32)) case "I16n": - if r.TryDecodeAsNil() { - x.TestStrucCommon.I16n = 0 - } else { - x.TestStrucCommon.I16n = (int16)(z.C.IntV(r.DecodeInt64(), 16)) - } + x.TestStrucCommon.I16n = (int16)(z.C.IntV(r.DecodeInt64(), 16)) case "I8n": - if r.TryDecodeAsNil() { - x.TestStrucCommon.I8n = 0 - } else { - x.TestStrucCommon.I8n = (int8)(z.C.IntV(r.DecodeInt64(), 8)) - } + x.TestStrucCommon.I8n = (int8)(z.C.IntV(r.DecodeInt64(), 8)) case "Ui64": - if r.TryDecodeAsNil() { - x.TestStrucCommon.Ui64 = 0 - } else { - x.TestStrucCommon.Ui64 = (uint64)(r.DecodeUint64()) - } + x.TestStrucCommon.Ui64 = (uint64)(r.DecodeUint64()) case "Ui32": - if r.TryDecodeAsNil() { - x.TestStrucCommon.Ui32 = 0 - } else { - x.TestStrucCommon.Ui32 = (uint32)(z.C.UintV(r.DecodeUint64(), 32)) - } + x.TestStrucCommon.Ui32 = (uint32)(z.C.UintV(r.DecodeUint64(), 32)) case "Ui16": - if r.TryDecodeAsNil() { - x.TestStrucCommon.Ui16 = 0 - } else { - x.TestStrucCommon.Ui16 = (uint16)(z.C.UintV(r.DecodeUint64(), 16)) - } + x.TestStrucCommon.Ui16 = (uint16)(z.C.UintV(r.DecodeUint64(), 16)) case "Ui8": - if r.TryDecodeAsNil() { - x.TestStrucCommon.Ui8 = 0 - } else { - x.TestStrucCommon.Ui8 = (uint8)(z.C.UintV(r.DecodeUint64(), 8)) - } + x.TestStrucCommon.Ui8 = (uint8)(z.C.UintV(r.DecodeUint64(), 8)) case "F64": - if r.TryDecodeAsNil() { - x.TestStrucCommon.F64 = 0 - } else { - x.TestStrucCommon.F64 = (float64)(r.DecodeFloat64()) - } + x.TestStrucCommon.F64 = (float64)(r.DecodeFloat64()) case "F32": - if r.TryDecodeAsNil() { - x.TestStrucCommon.F32 = 0 - } else { - x.TestStrucCommon.F32 = (float32)(z.DecDecodeFloat32()) - } + x.TestStrucCommon.F32 = (float32)(z.DecDecodeFloat32()) case "B": - if r.TryDecodeAsNil() { - x.TestStrucCommon.B = false - } else { - x.TestStrucCommon.B = (bool)(r.DecodeBool()) - } + x.TestStrucCommon.B = (bool)(r.DecodeBool()) case "By": - if r.TryDecodeAsNil() { - x.TestStrucCommon.By = 0 - } else { - x.TestStrucCommon.By = (uint8)(z.C.UintV(r.DecodeUint64(), 8)) - } + x.TestStrucCommon.By = (uint8)(z.C.UintV(r.DecodeUint64(), 8)) case "Sslice": - if r.TryDecodeAsNil() { - x.TestStrucCommon.Sslice = nil - } else { - z.F.DecSliceStringX(&x.TestStrucCommon.Sslice, d) - } + z.F.DecSliceStringX(&x.TestStrucCommon.Sslice, d) case "I64slice": - if r.TryDecodeAsNil() { - x.TestStrucCommon.I64slice = nil - } else { - z.F.DecSliceInt64X(&x.TestStrucCommon.I64slice, d) - } + z.F.DecSliceInt64X(&x.TestStrucCommon.I64slice, d) case "I16slice": - if r.TryDecodeAsNil() { - x.TestStrucCommon.I16slice = nil - } else { - z.F.DecSliceInt16X(&x.TestStrucCommon.I16slice, d) - } + z.F.DecSliceInt16X(&x.TestStrucCommon.I16slice, d) case "Ui64slice": - if r.TryDecodeAsNil() { - x.TestStrucCommon.Ui64slice = nil - } else { - z.F.DecSliceUint64X(&x.TestStrucCommon.Ui64slice, d) - } + z.F.DecSliceUint64X(&x.TestStrucCommon.Ui64slice, d) case "Ui8slice": - if r.TryDecodeAsNil() { - x.TestStrucCommon.Ui8slice = nil - } else { - x.TestStrucCommon.Ui8slice = r.DecodeBytes(([]byte)(x.TestStrucCommon.Ui8slice), false) - } + x.TestStrucCommon.Ui8slice = r.DecodeBytes(([]byte)(x.TestStrucCommon.Ui8slice), false) case "Bslice": - if r.TryDecodeAsNil() { - x.TestStrucCommon.Bslice = nil - } else { - z.F.DecSliceBoolX(&x.TestStrucCommon.Bslice, d) - } + z.F.DecSliceBoolX(&x.TestStrucCommon.Bslice, d) case "Byslice": - if r.TryDecodeAsNil() { - x.TestStrucCommon.Byslice = nil - } else { - x.TestStrucCommon.Byslice = r.DecodeBytes(([]byte)(x.TestStrucCommon.Byslice), false) - } + x.TestStrucCommon.Byslice = r.DecodeBytes(([]byte)(x.TestStrucCommon.Byslice), false) case "BytesSlice": - if r.TryDecodeAsNil() { - x.TestStrucCommon.BytesSlice = nil - } else { - z.F.DecSliceBytesX(&x.TestStrucCommon.BytesSlice, d) - } + z.F.DecSliceBytesX(&x.TestStrucCommon.BytesSlice, d) case "Iptrslice": - if r.TryDecodeAsNil() { - x.TestStrucCommon.Iptrslice = nil - } else { - h.decSlicePtrtoint64((*[]*int64)(&x.TestStrucCommon.Iptrslice), d) - } + h.decSlicePtrtoint64((*[]*int64)(&x.TestStrucCommon.Iptrslice), d) case "WrapSliceInt64": - if r.TryDecodeAsNil() { - x.TestStrucCommon.WrapSliceInt64 = nil - } else { - x.TestStrucCommon.WrapSliceInt64.CodecDecodeSelf(d) - } + x.TestStrucCommon.WrapSliceInt64.CodecDecodeSelf(d) case "WrapSliceString": - if r.TryDecodeAsNil() { - x.TestStrucCommon.WrapSliceString = nil - } else { - x.TestStrucCommon.WrapSliceString.CodecDecodeSelf(d) - } + x.TestStrucCommon.WrapSliceString.CodecDecodeSelf(d) case "Msi64": - if r.TryDecodeAsNil() { - x.TestStrucCommon.Msi64 = nil - } else { - z.F.DecMapStringInt64X(&x.TestStrucCommon.Msi64, d) - } + z.F.DecMapStringInt64X(&x.TestStrucCommon.Msi64, d) case "Msbytes": - if r.TryDecodeAsNil() { - x.TestStrucCommon.Msbytes = nil - } else { - z.F.DecMapStringBytesX(&x.TestStrucCommon.Msbytes, d) - } + z.F.DecMapStringBytesX(&x.TestStrucCommon.Msbytes, d) case "Simplef": - if r.TryDecodeAsNil() { - x.TestStrucCommon.Simplef = testSimpleFields{} - } else { - x.TestStrucCommon.Simplef.CodecDecodeSelf(d) - } + x.TestStrucCommon.Simplef.CodecDecodeSelf(d) case "SstrUi64T": - if r.TryDecodeAsNil() { - x.TestStrucCommon.SstrUi64T = nil - } else { - h.decSlicestringUint64T((*[]stringUint64T)(&x.TestStrucCommon.SstrUi64T), d) - } + h.decSlicestringUint64T((*[]stringUint64T)(&x.TestStrucCommon.SstrUi64T), d) case "MstrUi64T": - if r.TryDecodeAsNil() { - x.TestStrucCommon.MstrUi64T = nil - } else { - h.decMapstringPtrtostringUint64T((*map[string]*stringUint64T)(&x.TestStrucCommon.MstrUi64T), d) - } + h.decMapstringPtrtostringUint64T((*map[string]*stringUint64T)(&x.TestStrucCommon.MstrUi64T), d) case "AS": - if r.TryDecodeAsNil() { - x.TestStrucCommon.AnonInTestStruc.AS = "" - } else { - x.TestStrucCommon.AnonInTestStruc.AS = (string)(string(r.DecodeStringAsBytes())) - } + x.TestStrucCommon.AnonInTestStruc.AS = (string)(string(r.DecodeStringAsBytes())) case "AI64": - if r.TryDecodeAsNil() { - x.TestStrucCommon.AnonInTestStruc.AI64 = 0 - } else { - x.TestStrucCommon.AnonInTestStruc.AI64 = (int64)(r.DecodeInt64()) - } + x.TestStrucCommon.AnonInTestStruc.AI64 = (int64)(r.DecodeInt64()) case "AI16": - if r.TryDecodeAsNil() { - x.TestStrucCommon.AnonInTestStruc.AI16 = 0 - } else { - x.TestStrucCommon.AnonInTestStruc.AI16 = (int16)(z.C.IntV(r.DecodeInt64(), 16)) - } + x.TestStrucCommon.AnonInTestStruc.AI16 = (int16)(z.C.IntV(r.DecodeInt64(), 16)) case "AUi64": - if r.TryDecodeAsNil() { - x.TestStrucCommon.AnonInTestStruc.AUi64 = 0 - } else { - x.TestStrucCommon.AnonInTestStruc.AUi64 = (uint64)(r.DecodeUint64()) - } + x.TestStrucCommon.AnonInTestStruc.AUi64 = (uint64)(r.DecodeUint64()) case "ASslice": - if r.TryDecodeAsNil() { - x.TestStrucCommon.AnonInTestStruc.ASslice = nil - } else { - z.F.DecSliceStringX(&x.TestStrucCommon.AnonInTestStruc.ASslice, d) - } + z.F.DecSliceStringX(&x.TestStrucCommon.AnonInTestStruc.ASslice, d) case "AI64slice": - if r.TryDecodeAsNil() { - x.TestStrucCommon.AnonInTestStruc.AI64slice = nil - } else { - z.F.DecSliceInt64X(&x.TestStrucCommon.AnonInTestStruc.AI64slice, d) - } + z.F.DecSliceInt64X(&x.TestStrucCommon.AnonInTestStruc.AI64slice, d) case "AUi64slice": - if r.TryDecodeAsNil() { - x.TestStrucCommon.AnonInTestStruc.AUi64slice = nil - } else { - z.F.DecSliceUint64X(&x.TestStrucCommon.AnonInTestStruc.AUi64slice, d) - } + z.F.DecSliceUint64X(&x.TestStrucCommon.AnonInTestStruc.AUi64slice, d) case "AF64slice": - if r.TryDecodeAsNil() { - x.TestStrucCommon.AnonInTestStruc.AF64slice = nil - } else { - z.F.DecSliceFloat64X(&x.TestStrucCommon.AnonInTestStruc.AF64slice, d) - } + z.F.DecSliceFloat64X(&x.TestStrucCommon.AnonInTestStruc.AF64slice, d) case "AF32slice": - if r.TryDecodeAsNil() { - x.TestStrucCommon.AnonInTestStruc.AF32slice = nil - } else { - z.F.DecSliceFloat32X(&x.TestStrucCommon.AnonInTestStruc.AF32slice, d) - } + z.F.DecSliceFloat32X(&x.TestStrucCommon.AnonInTestStruc.AF32slice, d) case "AMSU16": - if r.TryDecodeAsNil() { - x.TestStrucCommon.AnonInTestStruc.AMSU16 = nil - } else { - h.decMapstringuint16((*map[string]uint16)(&x.TestStrucCommon.AnonInTestStruc.AMSU16), d) - } + h.decMapstringuint16((*map[string]uint16)(&x.TestStrucCommon.AnonInTestStruc.AMSU16), d) case "AI64arr0": - if r.TryDecodeAsNil() { - x.TestStrucCommon.AnonInTestStruc.AI64arr0 = [0]int64{} - } else { - h.decArray0int64((*[0]int64)(&x.TestStrucCommon.AnonInTestStruc.AI64arr0), d) - } + h.decArray0int64((*[0]int64)(&x.TestStrucCommon.AnonInTestStruc.AI64arr0), d) case "AI64slice0": - if r.TryDecodeAsNil() { - x.TestStrucCommon.AnonInTestStruc.AI64slice0 = nil - } else { - z.F.DecSliceInt64X(&x.TestStrucCommon.AnonInTestStruc.AI64slice0, d) - } + z.F.DecSliceInt64X(&x.TestStrucCommon.AnonInTestStruc.AI64slice0, d) case "AUi64sliceN": - if r.TryDecodeAsNil() { - x.TestStrucCommon.AnonInTestStruc.AUi64sliceN = nil - } else { - z.F.DecSliceUint64X(&x.TestStrucCommon.AnonInTestStruc.AUi64sliceN, d) - } + z.F.DecSliceUint64X(&x.TestStrucCommon.AnonInTestStruc.AUi64sliceN, d) case "AMSU16N": - if r.TryDecodeAsNil() { - x.TestStrucCommon.AnonInTestStruc.AMSU16N = nil - } else { - h.decMapstringuint16((*map[string]uint16)(&x.TestStrucCommon.AnonInTestStruc.AMSU16N), d) - } + h.decMapstringuint16((*map[string]uint16)(&x.TestStrucCommon.AnonInTestStruc.AMSU16N), d) case "AMSU16E": - if r.TryDecodeAsNil() { - x.TestStrucCommon.AnonInTestStruc.AMSU16E = nil - } else { - h.decMapstringuint16((*map[string]uint16)(&x.TestStrucCommon.AnonInTestStruc.AMSU16E), d) - } + h.decMapstringuint16((*map[string]uint16)(&x.TestStrucCommon.AnonInTestStruc.AMSU16E), d) case "NotAnon": - if r.TryDecodeAsNil() { - x.TestStrucCommon.NotAnon = AnonInTestStruc{} - } else { - x.TestStrucCommon.NotAnon.CodecDecodeSelf(d) - } + x.TestStrucCommon.NotAnon.CodecDecodeSelf(d) case "Nmap": - if r.TryDecodeAsNil() { - x.TestStrucCommon.Nmap = nil - } else { - z.F.DecMapStringBoolX(&x.TestStrucCommon.Nmap, d) - } + z.F.DecMapStringBoolX(&x.TestStrucCommon.Nmap, d) case "Nslice": - if r.TryDecodeAsNil() { - x.TestStrucCommon.Nslice = nil - } else { - x.TestStrucCommon.Nslice = r.DecodeBytes(([]byte)(x.TestStrucCommon.Nslice), false) - } + x.TestStrucCommon.Nslice = r.DecodeBytes(([]byte)(x.TestStrucCommon.Nslice), false) case "Nint64": - if r.TryDecodeAsNil() { + if r.TryNil() { if x.TestStrucCommon.Nint64 != nil { // remove the if-true x.TestStrucCommon.Nint64 = nil } @@ -11762,107 +10167,42 @@ func (x *TestStrucFlex) codecDecodeSelfFromMap(l int, d *Decoder) { if x.TestStrucCommon.Nint64 == nil { x.TestStrucCommon.Nint64 = new(int64) } - *x.TestStrucCommon.Nint64 = (int64)(r.DecodeInt64()) } case "Chstr": - if r.TryDecodeAsNil() { - x.Chstr = nil - } else { - h.decChanstring((*chan string)(&x.Chstr), d) - } + h.decChanstring((*chan string)(&x.Chstr), d) case "Mis": - if r.TryDecodeAsNil() { - x.Mis = nil - } else { - z.F.DecMapIntStringX(&x.Mis, d) - } + z.F.DecMapIntStringX(&x.Mis, d) case "Mbu64": - if r.TryDecodeAsNil() { - x.Mbu64 = nil - } else { - h.decMapboolc3RydWN0IHt9((*map[bool]struct{})(&x.Mbu64), d) - } + h.decMapboolc3RydWN0IHt9((*map[bool]struct{})(&x.Mbu64), d) case "Miwu64s": - if r.TryDecodeAsNil() { - x.Miwu64s = nil - } else { - h.decMapintwrapUint64Slice((*map[int]wrapUint64Slice)(&x.Miwu64s), d) - } + h.decMapintwrapUint64Slice((*map[int]wrapUint64Slice)(&x.Miwu64s), d) case "Mfwss": - if r.TryDecodeAsNil() { - x.Mfwss = nil - } else { - h.decMapfloat64wrapStringSlice((*map[float64]wrapStringSlice)(&x.Mfwss), d) - } + h.decMapfloat64wrapStringSlice((*map[float64]wrapStringSlice)(&x.Mfwss), d) case "Mf32wss": - if r.TryDecodeAsNil() { - x.Mf32wss = nil - } else { - h.decMapfloat32wrapStringSlice((*map[float32]wrapStringSlice)(&x.Mf32wss), d) - } + h.decMapfloat32wrapStringSlice((*map[float32]wrapStringSlice)(&x.Mf32wss), d) case "Mui2wss": - if r.TryDecodeAsNil() { - x.Mui2wss = nil - } else { - h.decMapuint64wrapStringSlice((*map[uint64]wrapStringSlice)(&x.Mui2wss), d) - } + h.decMapuint64wrapStringSlice((*map[uint64]wrapStringSlice)(&x.Mui2wss), d) case "Msu2wss": - if r.TryDecodeAsNil() { - x.Msu2wss = nil - } else { - h.decMapstringUint64TwrapStringSlice((*map[stringUint64T]wrapStringSlice)(&x.Msu2wss), d) - } + h.decMapstringUint64TwrapStringSlice((*map[stringUint64T]wrapStringSlice)(&x.Msu2wss), d) case "Ci64": - if r.TryDecodeAsNil() { - x.Ci64 = 0 - } else { - x.Ci64.CodecDecodeSelf(d) - } + x.Ci64.CodecDecodeSelf(d) case "Swrapbytes": - if r.TryDecodeAsNil() { - x.Swrapbytes = nil - } else { - h.decSlicewrapBytes((*[]wrapBytes)(&x.Swrapbytes), d) - } + h.decSlicewrapBytes((*[]wrapBytes)(&x.Swrapbytes), d) case "Swrapuint8": - if r.TryDecodeAsNil() { - x.Swrapuint8 = nil - } else { - h.decSlicewrapUint8((*[]wrapUint8)(&x.Swrapuint8), d) - } + h.decSlicewrapUint8((*[]wrapUint8)(&x.Swrapuint8), d) case "ArrStrUi64T": - if r.TryDecodeAsNil() { - x.ArrStrUi64T = [4]stringUint64T{} - } else { - h.decArray4stringUint64T((*[4]stringUint64T)(&x.ArrStrUi64T), d) - } + h.decArray4stringUint64T((*[4]stringUint64T)(&x.ArrStrUi64T), d) case "Ui64array": - if r.TryDecodeAsNil() { - x.Ui64array = [4]uint64{} - } else { - h.decArray4uint64((*[4]uint64)(&x.Ui64array), d) - } + h.decArray4uint64((*[4]uint64)(&x.Ui64array), d) case "Ui64slicearray": - if r.TryDecodeAsNil() { - x.Ui64slicearray = nil - } else { - h.decSlicePtrtoArray4uint64((*[]*[4]uint64)(&x.Ui64slicearray), d) - } + h.decSlicePtrtoArray4uint64((*[]*[4]uint64)(&x.Ui64slicearray), d) case "SintfAarray": - if r.TryDecodeAsNil() { - x.SintfAarray = nil - } else { - z.F.DecSliceIntfX(&x.SintfAarray, d) - } + z.F.DecSliceIntfX(&x.SintfAarray, d) case "MstrUi64TSelf": - if r.TryDecodeAsNil() { - x.MstrUi64TSelf = nil - } else { - h.decMapstringUint64TPtrtostringUint64T((*map[stringUint64T]*stringUint64T)(&x.MstrUi64TSelf), d) - } + h.decMapstringUint64TPtrtostringUint64T((*map[stringUint64T]*stringUint64T)(&x.MstrUi64TSelf), d) case "Islice": - if r.TryDecodeAsNil() { + if r.TryNil() { if x.AnonInTestStrucIntf != nil { // remove the if-true x.AnonInTestStrucIntf.Islice = nil } @@ -11870,11 +10210,10 @@ func (x *TestStrucFlex) codecDecodeSelfFromMap(l int, d *Decoder) { if x.AnonInTestStrucIntf == nil { x.AnonInTestStrucIntf = new(AnonInTestStrucIntf) } - z.F.DecSliceIntfX(&x.AnonInTestStrucIntf.Islice, d) } case "Ms": - if r.TryDecodeAsNil() { + if r.TryNil() { if x.AnonInTestStrucIntf != nil { // remove the if-true x.AnonInTestStrucIntf.Ms = nil } @@ -11882,11 +10221,10 @@ func (x *TestStrucFlex) codecDecodeSelfFromMap(l int, d *Decoder) { if x.AnonInTestStrucIntf == nil { x.AnonInTestStrucIntf = new(AnonInTestStrucIntf) } - z.F.DecMapStringIntfX(&x.AnonInTestStrucIntf.Ms, d) } case "Nintf": - if r.TryDecodeAsNil() { + if r.TryNil() { if x.AnonInTestStrucIntf != nil { // remove the if-true x.AnonInTestStrucIntf.Nintf = nil } @@ -11894,11 +10232,10 @@ func (x *TestStrucFlex) codecDecodeSelfFromMap(l int, d *Decoder) { if x.AnonInTestStrucIntf == nil { x.AnonInTestStrucIntf = new(AnonInTestStrucIntf) } - z.DecFallback(&x.AnonInTestStrucIntf.Nintf, true) } case "T": - if r.TryDecodeAsNil() { + if r.TryNil() { if x.AnonInTestStrucIntf != nil { // remove the if-true x.AnonInTestStrucIntf.T = time.Time{} } @@ -11906,7 +10243,6 @@ func (x *TestStrucFlex) codecDecodeSelfFromMap(l int, d *Decoder) { if x.AnonInTestStrucIntf == nil { x.AnonInTestStrucIntf = new(AnonInTestStrucIntf) } - if !z.DecBasicHandle().TimeNotBuiltin { x.AnonInTestStrucIntf.T = r.DecodeTime() } else if yyxt121 := z.Extension(z.I2Rtid(x.AnonInTestStrucIntf.T)); yyxt121 != nil { @@ -11920,7 +10256,7 @@ func (x *TestStrucFlex) codecDecodeSelfFromMap(l int, d *Decoder) { } } case "Tptr": - if r.TryDecodeAsNil() { + if r.TryNil() { if x.AnonInTestStrucIntf != nil && x.AnonInTestStrucIntf.Tptr != nil { // remove the if-true x.AnonInTestStrucIntf.Tptr = nil } @@ -11931,7 +10267,6 @@ func (x *TestStrucFlex) codecDecodeSelfFromMap(l int, d *Decoder) { if x.AnonInTestStrucIntf.Tptr == nil { x.AnonInTestStrucIntf.Tptr = new(time.Time) } - if !z.DecBasicHandle().TimeNotBuiltin { *x.AnonInTestStrucIntf.Tptr = r.DecodeTime() } else if yyxt123 := z.Extension(z.I2Rtid(x.AnonInTestStrucIntf.Tptr)); yyxt123 != nil { @@ -11945,25 +10280,13 @@ func (x *TestStrucFlex) codecDecodeSelfFromMap(l int, d *Decoder) { } } case "Mtsptr": - if r.TryDecodeAsNil() { - x.Mtsptr = nil - } else { - h.decMapstringPtrtoTestStrucFlex((*map[string]*TestStrucFlex)(&x.Mtsptr), d) - } + h.decMapstringPtrtoTestStrucFlex((*map[string]*TestStrucFlex)(&x.Mtsptr), d) case "Mts": - if r.TryDecodeAsNil() { - x.Mts = nil - } else { - h.decMapstringTestStrucFlex((*map[string]TestStrucFlex)(&x.Mts), d) - } + h.decMapstringTestStrucFlex((*map[string]TestStrucFlex)(&x.Mts), d) case "Its": - if r.TryDecodeAsNil() { - x.Its = nil - } else { - h.decSlicePtrtoTestStrucFlex((*[]*TestStrucFlex)(&x.Its), d) - } + h.decSlicePtrtoTestStrucFlex((*[]*TestStrucFlex)(&x.Its), d) case "Nteststruc": - if r.TryDecodeAsNil() { + if r.TryNil() { if x.Nteststruc != nil { // remove the if-true x.Nteststruc = nil } @@ -11971,7 +10294,6 @@ func (x *TestStrucFlex) codecDecodeSelfFromMap(l int, d *Decoder) { if x.Nteststruc == nil { x.Nteststruc = new(TestStrucFlex) } - x.Nteststruc.CodecDecodeSelf(d) } default: @@ -11998,11 +10320,7 @@ func (x *TestStrucFlex) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.TestStrucCommon.S = "" - } else { - x.TestStrucCommon.S = (string)(string(r.DecodeStringAsBytes())) - } + x.TestStrucCommon.S = (string)(string(r.DecodeStringAsBytes())) yyj131++ if yyhl131 { yyb131 = yyj131 > l @@ -12014,11 +10332,7 @@ func (x *TestStrucFlex) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.TestStrucCommon.I64 = 0 - } else { - x.TestStrucCommon.I64 = (int64)(r.DecodeInt64()) - } + x.TestStrucCommon.I64 = (int64)(r.DecodeInt64()) yyj131++ if yyhl131 { yyb131 = yyj131 > l @@ -12030,11 +10344,7 @@ func (x *TestStrucFlex) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.TestStrucCommon.I32 = 0 - } else { - x.TestStrucCommon.I32 = (int32)(z.C.IntV(r.DecodeInt64(), 32)) - } + x.TestStrucCommon.I32 = (int32)(z.C.IntV(r.DecodeInt64(), 32)) yyj131++ if yyhl131 { yyb131 = yyj131 > l @@ -12046,11 +10356,7 @@ func (x *TestStrucFlex) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.TestStrucCommon.I16 = 0 - } else { - x.TestStrucCommon.I16 = (int16)(z.C.IntV(r.DecodeInt64(), 16)) - } + x.TestStrucCommon.I16 = (int16)(z.C.IntV(r.DecodeInt64(), 16)) yyj131++ if yyhl131 { yyb131 = yyj131 > l @@ -12062,11 +10368,7 @@ func (x *TestStrucFlex) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.TestStrucCommon.I8 = 0 - } else { - x.TestStrucCommon.I8 = (int8)(z.C.IntV(r.DecodeInt64(), 8)) - } + x.TestStrucCommon.I8 = (int8)(z.C.IntV(r.DecodeInt64(), 8)) yyj131++ if yyhl131 { yyb131 = yyj131 > l @@ -12078,11 +10380,7 @@ func (x *TestStrucFlex) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.TestStrucCommon.I64n = 0 - } else { - x.TestStrucCommon.I64n = (int64)(r.DecodeInt64()) - } + x.TestStrucCommon.I64n = (int64)(r.DecodeInt64()) yyj131++ if yyhl131 { yyb131 = yyj131 > l @@ -12094,11 +10392,7 @@ func (x *TestStrucFlex) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.TestStrucCommon.I32n = 0 - } else { - x.TestStrucCommon.I32n = (int32)(z.C.IntV(r.DecodeInt64(), 32)) - } + x.TestStrucCommon.I32n = (int32)(z.C.IntV(r.DecodeInt64(), 32)) yyj131++ if yyhl131 { yyb131 = yyj131 > l @@ -12110,11 +10404,7 @@ func (x *TestStrucFlex) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.TestStrucCommon.I16n = 0 - } else { - x.TestStrucCommon.I16n = (int16)(z.C.IntV(r.DecodeInt64(), 16)) - } + x.TestStrucCommon.I16n = (int16)(z.C.IntV(r.DecodeInt64(), 16)) yyj131++ if yyhl131 { yyb131 = yyj131 > l @@ -12126,11 +10416,7 @@ func (x *TestStrucFlex) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.TestStrucCommon.I8n = 0 - } else { - x.TestStrucCommon.I8n = (int8)(z.C.IntV(r.DecodeInt64(), 8)) - } + x.TestStrucCommon.I8n = (int8)(z.C.IntV(r.DecodeInt64(), 8)) yyj131++ if yyhl131 { yyb131 = yyj131 > l @@ -12142,11 +10428,7 @@ func (x *TestStrucFlex) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.TestStrucCommon.Ui64 = 0 - } else { - x.TestStrucCommon.Ui64 = (uint64)(r.DecodeUint64()) - } + x.TestStrucCommon.Ui64 = (uint64)(r.DecodeUint64()) yyj131++ if yyhl131 { yyb131 = yyj131 > l @@ -12158,11 +10440,7 @@ func (x *TestStrucFlex) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.TestStrucCommon.Ui32 = 0 - } else { - x.TestStrucCommon.Ui32 = (uint32)(z.C.UintV(r.DecodeUint64(), 32)) - } + x.TestStrucCommon.Ui32 = (uint32)(z.C.UintV(r.DecodeUint64(), 32)) yyj131++ if yyhl131 { yyb131 = yyj131 > l @@ -12174,11 +10452,7 @@ func (x *TestStrucFlex) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.TestStrucCommon.Ui16 = 0 - } else { - x.TestStrucCommon.Ui16 = (uint16)(z.C.UintV(r.DecodeUint64(), 16)) - } + x.TestStrucCommon.Ui16 = (uint16)(z.C.UintV(r.DecodeUint64(), 16)) yyj131++ if yyhl131 { yyb131 = yyj131 > l @@ -12190,11 +10464,7 @@ func (x *TestStrucFlex) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.TestStrucCommon.Ui8 = 0 - } else { - x.TestStrucCommon.Ui8 = (uint8)(z.C.UintV(r.DecodeUint64(), 8)) - } + x.TestStrucCommon.Ui8 = (uint8)(z.C.UintV(r.DecodeUint64(), 8)) yyj131++ if yyhl131 { yyb131 = yyj131 > l @@ -12206,11 +10476,7 @@ func (x *TestStrucFlex) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.TestStrucCommon.F64 = 0 - } else { - x.TestStrucCommon.F64 = (float64)(r.DecodeFloat64()) - } + x.TestStrucCommon.F64 = (float64)(r.DecodeFloat64()) yyj131++ if yyhl131 { yyb131 = yyj131 > l @@ -12222,11 +10488,7 @@ func (x *TestStrucFlex) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.TestStrucCommon.F32 = 0 - } else { - x.TestStrucCommon.F32 = (float32)(z.DecDecodeFloat32()) - } + x.TestStrucCommon.F32 = (float32)(z.DecDecodeFloat32()) yyj131++ if yyhl131 { yyb131 = yyj131 > l @@ -12238,11 +10500,7 @@ func (x *TestStrucFlex) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.TestStrucCommon.B = false - } else { - x.TestStrucCommon.B = (bool)(r.DecodeBool()) - } + x.TestStrucCommon.B = (bool)(r.DecodeBool()) yyj131++ if yyhl131 { yyb131 = yyj131 > l @@ -12254,11 +10512,7 @@ func (x *TestStrucFlex) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.TestStrucCommon.By = 0 - } else { - x.TestStrucCommon.By = (uint8)(z.C.UintV(r.DecodeUint64(), 8)) - } + x.TestStrucCommon.By = (uint8)(z.C.UintV(r.DecodeUint64(), 8)) yyj131++ if yyhl131 { yyb131 = yyj131 > l @@ -12270,11 +10524,7 @@ func (x *TestStrucFlex) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.TestStrucCommon.Sslice = nil - } else { - z.F.DecSliceStringX(&x.TestStrucCommon.Sslice, d) - } + z.F.DecSliceStringX(&x.TestStrucCommon.Sslice, d) yyj131++ if yyhl131 { yyb131 = yyj131 > l @@ -12286,11 +10536,7 @@ func (x *TestStrucFlex) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.TestStrucCommon.I64slice = nil - } else { - z.F.DecSliceInt64X(&x.TestStrucCommon.I64slice, d) - } + z.F.DecSliceInt64X(&x.TestStrucCommon.I64slice, d) yyj131++ if yyhl131 { yyb131 = yyj131 > l @@ -12302,11 +10548,7 @@ func (x *TestStrucFlex) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.TestStrucCommon.I16slice = nil - } else { - z.F.DecSliceInt16X(&x.TestStrucCommon.I16slice, d) - } + z.F.DecSliceInt16X(&x.TestStrucCommon.I16slice, d) yyj131++ if yyhl131 { yyb131 = yyj131 > l @@ -12318,11 +10560,7 @@ func (x *TestStrucFlex) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.TestStrucCommon.Ui64slice = nil - } else { - z.F.DecSliceUint64X(&x.TestStrucCommon.Ui64slice, d) - } + z.F.DecSliceUint64X(&x.TestStrucCommon.Ui64slice, d) yyj131++ if yyhl131 { yyb131 = yyj131 > l @@ -12334,11 +10572,7 @@ func (x *TestStrucFlex) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.TestStrucCommon.Ui8slice = nil - } else { - x.TestStrucCommon.Ui8slice = r.DecodeBytes(([]byte)(x.TestStrucCommon.Ui8slice), false) - } + x.TestStrucCommon.Ui8slice = r.DecodeBytes(([]byte)(x.TestStrucCommon.Ui8slice), false) yyj131++ if yyhl131 { yyb131 = yyj131 > l @@ -12350,11 +10584,7 @@ func (x *TestStrucFlex) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.TestStrucCommon.Bslice = nil - } else { - z.F.DecSliceBoolX(&x.TestStrucCommon.Bslice, d) - } + z.F.DecSliceBoolX(&x.TestStrucCommon.Bslice, d) yyj131++ if yyhl131 { yyb131 = yyj131 > l @@ -12366,11 +10596,7 @@ func (x *TestStrucFlex) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.TestStrucCommon.Byslice = nil - } else { - x.TestStrucCommon.Byslice = r.DecodeBytes(([]byte)(x.TestStrucCommon.Byslice), false) - } + x.TestStrucCommon.Byslice = r.DecodeBytes(([]byte)(x.TestStrucCommon.Byslice), false) yyj131++ if yyhl131 { yyb131 = yyj131 > l @@ -12382,11 +10608,7 @@ func (x *TestStrucFlex) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.TestStrucCommon.BytesSlice = nil - } else { - z.F.DecSliceBytesX(&x.TestStrucCommon.BytesSlice, d) - } + z.F.DecSliceBytesX(&x.TestStrucCommon.BytesSlice, d) yyj131++ if yyhl131 { yyb131 = yyj131 > l @@ -12398,11 +10620,7 @@ func (x *TestStrucFlex) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.TestStrucCommon.Iptrslice = nil - } else { - h.decSlicePtrtoint64((*[]*int64)(&x.TestStrucCommon.Iptrslice), d) - } + h.decSlicePtrtoint64((*[]*int64)(&x.TestStrucCommon.Iptrslice), d) yyj131++ if yyhl131 { yyb131 = yyj131 > l @@ -12414,11 +10632,7 @@ func (x *TestStrucFlex) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.TestStrucCommon.WrapSliceInt64 = nil - } else { - x.TestStrucCommon.WrapSliceInt64.CodecDecodeSelf(d) - } + x.TestStrucCommon.WrapSliceInt64.CodecDecodeSelf(d) yyj131++ if yyhl131 { yyb131 = yyj131 > l @@ -12430,11 +10644,7 @@ func (x *TestStrucFlex) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.TestStrucCommon.WrapSliceString = nil - } else { - x.TestStrucCommon.WrapSliceString.CodecDecodeSelf(d) - } + x.TestStrucCommon.WrapSliceString.CodecDecodeSelf(d) yyj131++ if yyhl131 { yyb131 = yyj131 > l @@ -12446,11 +10656,7 @@ func (x *TestStrucFlex) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.TestStrucCommon.Msi64 = nil - } else { - z.F.DecMapStringInt64X(&x.TestStrucCommon.Msi64, d) - } + z.F.DecMapStringInt64X(&x.TestStrucCommon.Msi64, d) yyj131++ if yyhl131 { yyb131 = yyj131 > l @@ -12462,11 +10668,7 @@ func (x *TestStrucFlex) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.TestStrucCommon.Msbytes = nil - } else { - z.F.DecMapStringBytesX(&x.TestStrucCommon.Msbytes, d) - } + z.F.DecMapStringBytesX(&x.TestStrucCommon.Msbytes, d) yyj131++ if yyhl131 { yyb131 = yyj131 > l @@ -12478,11 +10680,7 @@ func (x *TestStrucFlex) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.TestStrucCommon.Simplef = testSimpleFields{} - } else { - x.TestStrucCommon.Simplef.CodecDecodeSelf(d) - } + x.TestStrucCommon.Simplef.CodecDecodeSelf(d) yyj131++ if yyhl131 { yyb131 = yyj131 > l @@ -12494,11 +10692,7 @@ func (x *TestStrucFlex) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.TestStrucCommon.SstrUi64T = nil - } else { - h.decSlicestringUint64T((*[]stringUint64T)(&x.TestStrucCommon.SstrUi64T), d) - } + h.decSlicestringUint64T((*[]stringUint64T)(&x.TestStrucCommon.SstrUi64T), d) yyj131++ if yyhl131 { yyb131 = yyj131 > l @@ -12510,11 +10704,7 @@ func (x *TestStrucFlex) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.TestStrucCommon.MstrUi64T = nil - } else { - h.decMapstringPtrtostringUint64T((*map[string]*stringUint64T)(&x.TestStrucCommon.MstrUi64T), d) - } + h.decMapstringPtrtostringUint64T((*map[string]*stringUint64T)(&x.TestStrucCommon.MstrUi64T), d) yyj131++ if yyhl131 { yyb131 = yyj131 > l @@ -12526,11 +10716,7 @@ func (x *TestStrucFlex) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.TestStrucCommon.AnonInTestStruc.AS = "" - } else { - x.TestStrucCommon.AnonInTestStruc.AS = (string)(string(r.DecodeStringAsBytes())) - } + x.TestStrucCommon.AnonInTestStruc.AS = (string)(string(r.DecodeStringAsBytes())) yyj131++ if yyhl131 { yyb131 = yyj131 > l @@ -12542,11 +10728,7 @@ func (x *TestStrucFlex) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.TestStrucCommon.AnonInTestStruc.AI64 = 0 - } else { - x.TestStrucCommon.AnonInTestStruc.AI64 = (int64)(r.DecodeInt64()) - } + x.TestStrucCommon.AnonInTestStruc.AI64 = (int64)(r.DecodeInt64()) yyj131++ if yyhl131 { yyb131 = yyj131 > l @@ -12558,11 +10740,7 @@ func (x *TestStrucFlex) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.TestStrucCommon.AnonInTestStruc.AI16 = 0 - } else { - x.TestStrucCommon.AnonInTestStruc.AI16 = (int16)(z.C.IntV(r.DecodeInt64(), 16)) - } + x.TestStrucCommon.AnonInTestStruc.AI16 = (int16)(z.C.IntV(r.DecodeInt64(), 16)) yyj131++ if yyhl131 { yyb131 = yyj131 > l @@ -12574,11 +10752,7 @@ func (x *TestStrucFlex) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.TestStrucCommon.AnonInTestStruc.AUi64 = 0 - } else { - x.TestStrucCommon.AnonInTestStruc.AUi64 = (uint64)(r.DecodeUint64()) - } + x.TestStrucCommon.AnonInTestStruc.AUi64 = (uint64)(r.DecodeUint64()) yyj131++ if yyhl131 { yyb131 = yyj131 > l @@ -12590,11 +10764,7 @@ func (x *TestStrucFlex) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.TestStrucCommon.AnonInTestStruc.ASslice = nil - } else { - z.F.DecSliceStringX(&x.TestStrucCommon.AnonInTestStruc.ASslice, d) - } + z.F.DecSliceStringX(&x.TestStrucCommon.AnonInTestStruc.ASslice, d) yyj131++ if yyhl131 { yyb131 = yyj131 > l @@ -12606,11 +10776,7 @@ func (x *TestStrucFlex) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.TestStrucCommon.AnonInTestStruc.AI64slice = nil - } else { - z.F.DecSliceInt64X(&x.TestStrucCommon.AnonInTestStruc.AI64slice, d) - } + z.F.DecSliceInt64X(&x.TestStrucCommon.AnonInTestStruc.AI64slice, d) yyj131++ if yyhl131 { yyb131 = yyj131 > l @@ -12622,11 +10788,7 @@ func (x *TestStrucFlex) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.TestStrucCommon.AnonInTestStruc.AUi64slice = nil - } else { - z.F.DecSliceUint64X(&x.TestStrucCommon.AnonInTestStruc.AUi64slice, d) - } + z.F.DecSliceUint64X(&x.TestStrucCommon.AnonInTestStruc.AUi64slice, d) yyj131++ if yyhl131 { yyb131 = yyj131 > l @@ -12638,11 +10800,7 @@ func (x *TestStrucFlex) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.TestStrucCommon.AnonInTestStruc.AF64slice = nil - } else { - z.F.DecSliceFloat64X(&x.TestStrucCommon.AnonInTestStruc.AF64slice, d) - } + z.F.DecSliceFloat64X(&x.TestStrucCommon.AnonInTestStruc.AF64slice, d) yyj131++ if yyhl131 { yyb131 = yyj131 > l @@ -12654,11 +10812,7 @@ func (x *TestStrucFlex) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.TestStrucCommon.AnonInTestStruc.AF32slice = nil - } else { - z.F.DecSliceFloat32X(&x.TestStrucCommon.AnonInTestStruc.AF32slice, d) - } + z.F.DecSliceFloat32X(&x.TestStrucCommon.AnonInTestStruc.AF32slice, d) yyj131++ if yyhl131 { yyb131 = yyj131 > l @@ -12670,11 +10824,7 @@ func (x *TestStrucFlex) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.TestStrucCommon.AnonInTestStruc.AMSU16 = nil - } else { - h.decMapstringuint16((*map[string]uint16)(&x.TestStrucCommon.AnonInTestStruc.AMSU16), d) - } + h.decMapstringuint16((*map[string]uint16)(&x.TestStrucCommon.AnonInTestStruc.AMSU16), d) yyj131++ if yyhl131 { yyb131 = yyj131 > l @@ -12686,11 +10836,7 @@ func (x *TestStrucFlex) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.TestStrucCommon.AnonInTestStruc.AI64arr0 = [0]int64{} - } else { - h.decArray0int64((*[0]int64)(&x.TestStrucCommon.AnonInTestStruc.AI64arr0), d) - } + h.decArray0int64((*[0]int64)(&x.TestStrucCommon.AnonInTestStruc.AI64arr0), d) yyj131++ if yyhl131 { yyb131 = yyj131 > l @@ -12702,11 +10848,7 @@ func (x *TestStrucFlex) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.TestStrucCommon.AnonInTestStruc.AI64slice0 = nil - } else { - z.F.DecSliceInt64X(&x.TestStrucCommon.AnonInTestStruc.AI64slice0, d) - } + z.F.DecSliceInt64X(&x.TestStrucCommon.AnonInTestStruc.AI64slice0, d) yyj131++ if yyhl131 { yyb131 = yyj131 > l @@ -12718,11 +10860,7 @@ func (x *TestStrucFlex) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.TestStrucCommon.AnonInTestStruc.AUi64sliceN = nil - } else { - z.F.DecSliceUint64X(&x.TestStrucCommon.AnonInTestStruc.AUi64sliceN, d) - } + z.F.DecSliceUint64X(&x.TestStrucCommon.AnonInTestStruc.AUi64sliceN, d) yyj131++ if yyhl131 { yyb131 = yyj131 > l @@ -12734,11 +10872,7 @@ func (x *TestStrucFlex) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.TestStrucCommon.AnonInTestStruc.AMSU16N = nil - } else { - h.decMapstringuint16((*map[string]uint16)(&x.TestStrucCommon.AnonInTestStruc.AMSU16N), d) - } + h.decMapstringuint16((*map[string]uint16)(&x.TestStrucCommon.AnonInTestStruc.AMSU16N), d) yyj131++ if yyhl131 { yyb131 = yyj131 > l @@ -12750,11 +10884,7 @@ func (x *TestStrucFlex) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.TestStrucCommon.AnonInTestStruc.AMSU16E = nil - } else { - h.decMapstringuint16((*map[string]uint16)(&x.TestStrucCommon.AnonInTestStruc.AMSU16E), d) - } + h.decMapstringuint16((*map[string]uint16)(&x.TestStrucCommon.AnonInTestStruc.AMSU16E), d) yyj131++ if yyhl131 { yyb131 = yyj131 > l @@ -12766,11 +10896,7 @@ func (x *TestStrucFlex) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.TestStrucCommon.NotAnon = AnonInTestStruc{} - } else { - x.TestStrucCommon.NotAnon.CodecDecodeSelf(d) - } + x.TestStrucCommon.NotAnon.CodecDecodeSelf(d) yyj131++ if yyhl131 { yyb131 = yyj131 > l @@ -12782,11 +10908,7 @@ func (x *TestStrucFlex) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.TestStrucCommon.Nmap = nil - } else { - z.F.DecMapStringBoolX(&x.TestStrucCommon.Nmap, d) - } + z.F.DecMapStringBoolX(&x.TestStrucCommon.Nmap, d) yyj131++ if yyhl131 { yyb131 = yyj131 > l @@ -12798,11 +10920,7 @@ func (x *TestStrucFlex) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.TestStrucCommon.Nslice = nil - } else { - x.TestStrucCommon.Nslice = r.DecodeBytes(([]byte)(x.TestStrucCommon.Nslice), false) - } + x.TestStrucCommon.Nslice = r.DecodeBytes(([]byte)(x.TestStrucCommon.Nslice), false) yyj131++ if yyhl131 { yyb131 = yyj131 > l @@ -12814,7 +10932,7 @@ func (x *TestStrucFlex) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { + if r.TryNil() { if x.TestStrucCommon.Nint64 != nil { // remove the if-true x.TestStrucCommon.Nint64 = nil } @@ -12822,7 +10940,6 @@ func (x *TestStrucFlex) codecDecodeSelfFromArray(l int, d *Decoder) { if x.TestStrucCommon.Nint64 == nil { x.TestStrucCommon.Nint64 = new(int64) } - *x.TestStrucCommon.Nint64 = (int64)(r.DecodeInt64()) } yyj131++ @@ -12836,11 +10953,7 @@ func (x *TestStrucFlex) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.Chstr = nil - } else { - h.decChanstring((*chan string)(&x.Chstr), d) - } + h.decChanstring((*chan string)(&x.Chstr), d) yyj131++ if yyhl131 { yyb131 = yyj131 > l @@ -12852,11 +10965,7 @@ func (x *TestStrucFlex) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.Mis = nil - } else { - z.F.DecMapIntStringX(&x.Mis, d) - } + z.F.DecMapIntStringX(&x.Mis, d) yyj131++ if yyhl131 { yyb131 = yyj131 > l @@ -12868,11 +10977,7 @@ func (x *TestStrucFlex) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.Mbu64 = nil - } else { - h.decMapboolc3RydWN0IHt9((*map[bool]struct{})(&x.Mbu64), d) - } + h.decMapboolc3RydWN0IHt9((*map[bool]struct{})(&x.Mbu64), d) yyj131++ if yyhl131 { yyb131 = yyj131 > l @@ -12884,11 +10989,7 @@ func (x *TestStrucFlex) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.Miwu64s = nil - } else { - h.decMapintwrapUint64Slice((*map[int]wrapUint64Slice)(&x.Miwu64s), d) - } + h.decMapintwrapUint64Slice((*map[int]wrapUint64Slice)(&x.Miwu64s), d) yyj131++ if yyhl131 { yyb131 = yyj131 > l @@ -12900,11 +11001,7 @@ func (x *TestStrucFlex) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.Mfwss = nil - } else { - h.decMapfloat64wrapStringSlice((*map[float64]wrapStringSlice)(&x.Mfwss), d) - } + h.decMapfloat64wrapStringSlice((*map[float64]wrapStringSlice)(&x.Mfwss), d) yyj131++ if yyhl131 { yyb131 = yyj131 > l @@ -12916,11 +11013,7 @@ func (x *TestStrucFlex) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.Mf32wss = nil - } else { - h.decMapfloat32wrapStringSlice((*map[float32]wrapStringSlice)(&x.Mf32wss), d) - } + h.decMapfloat32wrapStringSlice((*map[float32]wrapStringSlice)(&x.Mf32wss), d) yyj131++ if yyhl131 { yyb131 = yyj131 > l @@ -12932,11 +11025,7 @@ func (x *TestStrucFlex) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.Mui2wss = nil - } else { - h.decMapuint64wrapStringSlice((*map[uint64]wrapStringSlice)(&x.Mui2wss), d) - } + h.decMapuint64wrapStringSlice((*map[uint64]wrapStringSlice)(&x.Mui2wss), d) yyj131++ if yyhl131 { yyb131 = yyj131 > l @@ -12948,11 +11037,7 @@ func (x *TestStrucFlex) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.Msu2wss = nil - } else { - h.decMapstringUint64TwrapStringSlice((*map[stringUint64T]wrapStringSlice)(&x.Msu2wss), d) - } + h.decMapstringUint64TwrapStringSlice((*map[stringUint64T]wrapStringSlice)(&x.Msu2wss), d) yyj131++ if yyhl131 { yyb131 = yyj131 > l @@ -12964,11 +11049,7 @@ func (x *TestStrucFlex) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.Ci64 = 0 - } else { - x.Ci64.CodecDecodeSelf(d) - } + x.Ci64.CodecDecodeSelf(d) yyj131++ if yyhl131 { yyb131 = yyj131 > l @@ -12980,11 +11061,7 @@ func (x *TestStrucFlex) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.Swrapbytes = nil - } else { - h.decSlicewrapBytes((*[]wrapBytes)(&x.Swrapbytes), d) - } + h.decSlicewrapBytes((*[]wrapBytes)(&x.Swrapbytes), d) yyj131++ if yyhl131 { yyb131 = yyj131 > l @@ -12996,11 +11073,7 @@ func (x *TestStrucFlex) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.Swrapuint8 = nil - } else { - h.decSlicewrapUint8((*[]wrapUint8)(&x.Swrapuint8), d) - } + h.decSlicewrapUint8((*[]wrapUint8)(&x.Swrapuint8), d) yyj131++ if yyhl131 { yyb131 = yyj131 > l @@ -13012,11 +11085,7 @@ func (x *TestStrucFlex) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.ArrStrUi64T = [4]stringUint64T{} - } else { - h.decArray4stringUint64T((*[4]stringUint64T)(&x.ArrStrUi64T), d) - } + h.decArray4stringUint64T((*[4]stringUint64T)(&x.ArrStrUi64T), d) yyj131++ if yyhl131 { yyb131 = yyj131 > l @@ -13028,11 +11097,7 @@ func (x *TestStrucFlex) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.Ui64array = [4]uint64{} - } else { - h.decArray4uint64((*[4]uint64)(&x.Ui64array), d) - } + h.decArray4uint64((*[4]uint64)(&x.Ui64array), d) yyj131++ if yyhl131 { yyb131 = yyj131 > l @@ -13044,11 +11109,7 @@ func (x *TestStrucFlex) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.Ui64slicearray = nil - } else { - h.decSlicePtrtoArray4uint64((*[]*[4]uint64)(&x.Ui64slicearray), d) - } + h.decSlicePtrtoArray4uint64((*[]*[4]uint64)(&x.Ui64slicearray), d) yyj131++ if yyhl131 { yyb131 = yyj131 > l @@ -13060,11 +11121,7 @@ func (x *TestStrucFlex) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.SintfAarray = nil - } else { - z.F.DecSliceIntfX(&x.SintfAarray, d) - } + z.F.DecSliceIntfX(&x.SintfAarray, d) yyj131++ if yyhl131 { yyb131 = yyj131 > l @@ -13076,11 +11133,7 @@ func (x *TestStrucFlex) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.MstrUi64TSelf = nil - } else { - h.decMapstringUint64TPtrtostringUint64T((*map[stringUint64T]*stringUint64T)(&x.MstrUi64TSelf), d) - } + h.decMapstringUint64TPtrtostringUint64T((*map[stringUint64T]*stringUint64T)(&x.MstrUi64TSelf), d) yyj131++ if yyhl131 { yyb131 = yyj131 > l @@ -13092,7 +11145,7 @@ func (x *TestStrucFlex) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { + if r.TryNil() { if x.AnonInTestStrucIntf != nil { // remove the if-true x.AnonInTestStrucIntf.Islice = nil } @@ -13100,7 +11153,6 @@ func (x *TestStrucFlex) codecDecodeSelfFromArray(l int, d *Decoder) { if x.AnonInTestStrucIntf == nil { x.AnonInTestStrucIntf = new(AnonInTestStrucIntf) } - z.F.DecSliceIntfX(&x.AnonInTestStrucIntf.Islice, d) } yyj131++ @@ -13114,7 +11166,7 @@ func (x *TestStrucFlex) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { + if r.TryNil() { if x.AnonInTestStrucIntf != nil { // remove the if-true x.AnonInTestStrucIntf.Ms = nil } @@ -13122,7 +11174,6 @@ func (x *TestStrucFlex) codecDecodeSelfFromArray(l int, d *Decoder) { if x.AnonInTestStrucIntf == nil { x.AnonInTestStrucIntf = new(AnonInTestStrucIntf) } - z.F.DecMapStringIntfX(&x.AnonInTestStrucIntf.Ms, d) } yyj131++ @@ -13136,7 +11187,7 @@ func (x *TestStrucFlex) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { + if r.TryNil() { if x.AnonInTestStrucIntf != nil { // remove the if-true x.AnonInTestStrucIntf.Nintf = nil } @@ -13144,7 +11195,6 @@ func (x *TestStrucFlex) codecDecodeSelfFromArray(l int, d *Decoder) { if x.AnonInTestStrucIntf == nil { x.AnonInTestStrucIntf = new(AnonInTestStrucIntf) } - z.DecFallback(&x.AnonInTestStrucIntf.Nintf, true) } yyj131++ @@ -13158,7 +11208,7 @@ func (x *TestStrucFlex) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { + if r.TryNil() { if x.AnonInTestStrucIntf != nil { // remove the if-true x.AnonInTestStrucIntf.T = time.Time{} } @@ -13166,7 +11216,6 @@ func (x *TestStrucFlex) codecDecodeSelfFromArray(l int, d *Decoder) { if x.AnonInTestStrucIntf == nil { x.AnonInTestStrucIntf = new(AnonInTestStrucIntf) } - if !z.DecBasicHandle().TimeNotBuiltin { x.AnonInTestStrucIntf.T = r.DecodeTime() } else if yyxt249 := z.Extension(z.I2Rtid(x.AnonInTestStrucIntf.T)); yyxt249 != nil { @@ -13190,7 +11239,7 @@ func (x *TestStrucFlex) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { + if r.TryNil() { if x.AnonInTestStrucIntf != nil && x.AnonInTestStrucIntf.Tptr != nil { // remove the if-true x.AnonInTestStrucIntf.Tptr = nil } @@ -13201,7 +11250,6 @@ func (x *TestStrucFlex) codecDecodeSelfFromArray(l int, d *Decoder) { if x.AnonInTestStrucIntf.Tptr == nil { x.AnonInTestStrucIntf.Tptr = new(time.Time) } - if !z.DecBasicHandle().TimeNotBuiltin { *x.AnonInTestStrucIntf.Tptr = r.DecodeTime() } else if yyxt251 := z.Extension(z.I2Rtid(x.AnonInTestStrucIntf.Tptr)); yyxt251 != nil { @@ -13225,11 +11273,7 @@ func (x *TestStrucFlex) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.Mtsptr = nil - } else { - h.decMapstringPtrtoTestStrucFlex((*map[string]*TestStrucFlex)(&x.Mtsptr), d) - } + h.decMapstringPtrtoTestStrucFlex((*map[string]*TestStrucFlex)(&x.Mtsptr), d) yyj131++ if yyhl131 { yyb131 = yyj131 > l @@ -13241,11 +11285,7 @@ func (x *TestStrucFlex) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.Mts = nil - } else { - h.decMapstringTestStrucFlex((*map[string]TestStrucFlex)(&x.Mts), d) - } + h.decMapstringTestStrucFlex((*map[string]TestStrucFlex)(&x.Mts), d) yyj131++ if yyhl131 { yyb131 = yyj131 > l @@ -13257,11 +11297,7 @@ func (x *TestStrucFlex) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { - x.Its = nil - } else { - h.decSlicePtrtoTestStrucFlex((*[]*TestStrucFlex)(&x.Its), d) - } + h.decSlicePtrtoTestStrucFlex((*[]*TestStrucFlex)(&x.Its), d) yyj131++ if yyhl131 { yyb131 = yyj131 > l @@ -13273,7 +11309,7 @@ func (x *TestStrucFlex) codecDecodeSelfFromArray(l int, d *Decoder) { return } z.DecReadArrayElem() - if r.TryDecodeAsNil() { + if r.TryNil() { if x.Nteststruc != nil { // remove the if-true x.Nteststruc = nil } @@ -13281,7 +11317,6 @@ func (x *TestStrucFlex) codecDecodeSelfFromArray(l int, d *Decoder) { if x.Nteststruc == nil { x.Nteststruc = new(TestStrucFlex) } - x.Nteststruc.CodecDecodeSelf(d) } for { @@ -13324,7 +11359,12 @@ func (x codecSelfer19780) decwrapSliceUint64(v *wrapSliceUint64, d *Decoder) { yyh1, yyl1 := z.DecSliceHelperStart() var yyc1 bool _ = yyc1 - if yyl1 == 0 { + if yyh1.IsNil { + if yyv1 != nil { + yyv1 = nil + yyc1 = true + } + } else if yyl1 == 0 { if yyv1 == nil { yyv1 = []uint64{} yyc1 = true @@ -13370,11 +11410,7 @@ func (x codecSelfer19780) decwrapSliceUint64(v *wrapSliceUint64, d *Decoder) { if yydb1 { z.DecSwallow() } else { - if r.TryDecodeAsNil() { - yyv1[yyj1] = 0 - } else { - yyv1[yyj1] = (uint64)(r.DecodeUint64()) - } + yyv1[yyj1] = (uint64)(r.DecodeUint64()) } } if yyj1 < len(yyv1) { @@ -13420,7 +11456,12 @@ func (x codecSelfer19780) decwrapSliceString(v *wrapSliceString, d *Decoder) { yyh1, yyl1 := z.DecSliceHelperStart() var yyc1 bool _ = yyc1 - if yyl1 == 0 { + if yyh1.IsNil { + if yyv1 != nil { + yyv1 = nil + yyc1 = true + } + } else if yyl1 == 0 { if yyv1 == nil { yyv1 = []string{} yyc1 = true @@ -13466,11 +11507,7 @@ func (x codecSelfer19780) decwrapSliceString(v *wrapSliceString, d *Decoder) { if yydb1 { z.DecSwallow() } else { - if r.TryDecodeAsNil() { - yyv1[yyj1] = "" - } else { - yyv1[yyj1] = (string)(string(r.DecodeStringAsBytes())) - } + yyv1[yyj1] = (string)(string(r.DecodeStringAsBytes())) } } if yyj1 < len(yyv1) { @@ -13512,7 +11549,12 @@ func (x codecSelfer19780) decwrapUint64Slice(v *wrapUint64Slice, d *Decoder) { yyh1, yyl1 := z.DecSliceHelperStart() var yyc1 bool _ = yyc1 - if yyl1 == 0 { + if yyh1.IsNil { + if yyv1 != nil { + yyv1 = nil + yyc1 = true + } + } else if yyl1 == 0 { if yyv1 == nil { yyv1 = []wrapUint64{} yyc1 = true @@ -13558,11 +11600,7 @@ func (x codecSelfer19780) decwrapUint64Slice(v *wrapUint64Slice, d *Decoder) { if yydb1 { z.DecSwallow() } else { - if r.TryDecodeAsNil() { - yyv1[yyj1] = 0 - } else { - yyv1[yyj1].CodecDecodeSelf(d) - } + yyv1[yyj1].CodecDecodeSelf(d) } } if yyj1 < len(yyv1) { @@ -13604,7 +11642,12 @@ func (x codecSelfer19780) decwrapStringSlice(v *wrapStringSlice, d *Decoder) { yyh1, yyl1 := z.DecSliceHelperStart() var yyc1 bool _ = yyc1 - if yyl1 == 0 { + if yyh1.IsNil { + if yyv1 != nil { + yyv1 = nil + yyc1 = true + } + } else if yyl1 == 0 { if yyv1 == nil { yyv1 = []wrapString{} yyc1 = true @@ -13650,11 +11693,7 @@ func (x codecSelfer19780) decwrapStringSlice(v *wrapStringSlice, d *Decoder) { if yydb1 { z.DecSwallow() } else { - if r.TryDecodeAsNil() { - yyv1[yyj1] = "" - } else { - yyv1[yyj1].CodecDecodeSelf(d) - } + yyv1[yyj1].CodecDecodeSelf(d) } } if yyj1 < len(yyv1) { @@ -13700,48 +11739,43 @@ func (x codecSelfer19780) decMapstringuint16(v *map[string]uint16, d *Decoder) { yyv1 := *v yyl1 := z.DecReadMapStart() - yybh1 := z.DecBasicHandle() - if yyv1 == nil { - yyrl1 := z.DecInferLen(yyl1, yybh1.MaxInitLen, 18) - yyv1 = make(map[string]uint16, yyrl1) - *v = yyv1 - } - var yymk1 string - var yymv1 uint16 - var yymg1, yymdn1 bool - if yybh1.MapValueReset { - } - if yyl1 != 0 { - yyhl1 := yyl1 > 0 - for yyj1 := 0; (yyhl1 && yyj1 < yyl1) || !(yyhl1 || r.CheckBreak()); yyj1++ { - z.DecReadMapElemKey() - if r.TryDecodeAsNil() { - yymk1 = "" - } else { + if yyl1 == codecSelferDecContainerLenNil19780 { + *v = nil + } else { + if yyv1 == nil { + yyrl1 := z.DecInferLen(yyl1, z.DecBasicHandle().MaxInitLen, 18) + yyv1 = make(map[string]uint16, yyrl1) + *v = yyv1 + } + var yymk1 string + var yymv1 uint16 + var yymg1, yymdn1 bool + if z.DecBasicHandle().MapValueReset { + } + if yyl1 != 0 { + yyhl1 := yyl1 > 0 + for yyj1 := 0; (yyhl1 && yyj1 < yyl1) || !(yyhl1 || r.CheckBreak()); yyj1++ { + z.DecReadMapElemKey() yymk1 = (string)(string(r.DecodeStringAsBytes())) - } - if yymg1 { - yymv1 = yyv1[yymk1] - } - z.DecReadMapElemValue() - yymdn1 = false - if r.TryDecodeAsNil() { - yymdn1 = true - } else { + if yymg1 { + yymv1 = yyv1[yymk1] + } + z.DecReadMapElemValue() + yymdn1 = false yymv1 = (uint16)(z.C.UintV(r.DecodeUint64(), 16)) - } - if yymdn1 { - if yybh1.DeleteOnNilMapValue { - delete(yyv1, yymk1) - } else { - yyv1[yymk1] = 0 + if yymdn1 { + if z.DecBasicHandle().DeleteOnNilMapValue { + delete(yyv1, yymk1) + } else { + yyv1[yymk1] = 0 + } + } else if yyv1 != nil { + yyv1[yymk1] = yymv1 } - } else if yyv1 != nil { - yyv1[yymk1] = yymv1 } - } - } // else len==0: TODO: Should we clear map entries? - z.DecReadMapEnd() + } // else len==0: TODO: Should we clear map entries? + z.DecReadMapEnd() + } } func (x codecSelfer19780) encArray0int64(v *[0]int64, e *Encoder) { @@ -13783,11 +11817,7 @@ func (x codecSelfer19780) decArray0int64(v *[0]int64, d *Decoder) { if yydb1 { z.DecSwallow() } else { - if r.TryDecodeAsNil() { - yyv1[yyj1] = 0 - } else { - yyv1[yyj1] = (int64)(r.DecodeInt64()) - } + yyv1[yyj1] = (int64)(r.DecodeInt64()) } } } @@ -13807,10 +11837,10 @@ func (x codecSelfer19780) encSlicePtrtoint64(v []*int64, e *Encoder) { z.EncWriteArrayElem() if yyv1 == nil { r.EncodeNil() - } else { // checkNil=true + } else { yy2 := *yyv1 r.EncodeInt(int64(yy2)) - } // checkNil=true + } } z.EncWriteArrayEnd() } @@ -13824,7 +11854,12 @@ func (x codecSelfer19780) decSlicePtrtoint64(v *[]*int64, d *Decoder) { yyh1, yyl1 := z.DecSliceHelperStart() var yyc1 bool _ = yyc1 - if yyl1 == 0 { + if yyh1.IsNil { + if yyv1 != nil { + yyv1 = nil + yyc1 = true + } + } else if yyl1 == 0 { if yyv1 == nil { yyv1 = []*int64{} yyc1 = true @@ -13870,7 +11905,7 @@ func (x codecSelfer19780) decSlicePtrtoint64(v *[]*int64, d *Decoder) { if yydb1 { z.DecSwallow() } else { - if r.TryDecodeAsNil() { + if r.TryNil() { yyv1[yyj1] = nil } else { if yyv1[yyj1] == nil { @@ -13920,7 +11955,12 @@ func (x codecSelfer19780) decSlicestringUint64T(v *[]stringUint64T, d *Decoder) yyh1, yyl1 := z.DecSliceHelperStart() var yyc1 bool _ = yyc1 - if yyl1 == 0 { + if yyh1.IsNil { + if yyv1 != nil { + yyv1 = nil + yyc1 = true + } + } else if yyl1 == 0 { if yyv1 == nil { yyv1 = []stringUint64T{} yyc1 = true @@ -13966,11 +12006,7 @@ func (x codecSelfer19780) decSlicestringUint64T(v *[]stringUint64T, d *Decoder) if yydb1 { z.DecSwallow() } else { - if r.TryDecodeAsNil() { - yyv1[yyj1] = stringUint64T{} - } else { - yyv1[yyj1].CodecDecodeSelf(d) - } + yyv1[yyj1].CodecDecodeSelf(d) } } if yyj1 < len(yyv1) { @@ -14006,9 +12042,9 @@ func (x codecSelfer19780) encMapstringPtrtostringUint64T(v map[string]*stringUin z.EncWriteMapElemValue() if yyv1 == nil { r.EncodeNil() - } else { // checkNil=true + } else { yyv1.CodecEncodeSelf(e) - } // checkNil=true + } } z.EncWriteMapEnd() } @@ -14020,58 +12056,57 @@ func (x codecSelfer19780) decMapstringPtrtostringUint64T(v *map[string]*stringUi yyv1 := *v yyl1 := z.DecReadMapStart() - yybh1 := z.DecBasicHandle() - if yyv1 == nil { - yyrl1 := z.DecInferLen(yyl1, yybh1.MaxInitLen, 24) - yyv1 = make(map[string]*stringUint64T, yyrl1) - *v = yyv1 - } - var yymk1 string - var yymv1 *stringUint64T - var yymg1, yymdn1, yyms1, yymok1 bool - if yybh1.MapValueReset { - yymg1 = true - } - if yyl1 != 0 { - yyhl1 := yyl1 > 0 - for yyj1 := 0; (yyhl1 && yyj1 < yyl1) || !(yyhl1 || r.CheckBreak()); yyj1++ { - z.DecReadMapElemKey() - if r.TryDecodeAsNil() { - yymk1 = "" - } else { + if yyl1 == codecSelferDecContainerLenNil19780 { + *v = nil + } else { + if yyv1 == nil { + yyrl1 := z.DecInferLen(yyl1, z.DecBasicHandle().MaxInitLen, 24) + yyv1 = make(map[string]*stringUint64T, yyrl1) + *v = yyv1 + } + var yymk1 string + var yymv1 *stringUint64T + var yymg1, yymdn1, yyms1, yymok1 bool + if z.DecBasicHandle().MapValueReset { + yymg1 = true + } + if yyl1 != 0 { + yyhl1 := yyl1 > 0 + for yyj1 := 0; (yyhl1 && yyj1 < yyl1) || !(yyhl1 || r.CheckBreak()); yyj1++ { + z.DecReadMapElemKey() yymk1 = (string)(string(r.DecodeStringAsBytes())) - } - yyms1 = true - if yymg1 { - yymv1, yymok1 = yyv1[yymk1] - if yymok1 { - yyms1 = false - } - } else { - yymv1 = nil - } - z.DecReadMapElemValue() - yymdn1 = false - if r.TryDecodeAsNil() { - yymdn1 = true - } else { - if yymv1 == nil { - yymv1 = new(stringUint64T) + yyms1 = true + if yymg1 { + yymv1, yymok1 = yyv1[yymk1] + if yymok1 { + yyms1 = false + } + } else { + yymv1 = nil } - yymv1.CodecDecodeSelf(d) - } - if yymdn1 { - if yybh1.DeleteOnNilMapValue { - delete(yyv1, yymk1) + z.DecReadMapElemValue() + yymdn1 = false + if r.TryNil() { + yymdn1 = true } else { - yyv1[yymk1] = nil + if yymv1 == nil { + yymv1 = new(stringUint64T) + } + yymv1.CodecDecodeSelf(d) + } + if yymdn1 { + if z.DecBasicHandle().DeleteOnNilMapValue { + delete(yyv1, yymk1) + } else { + yyv1[yymk1] = nil + } + } else if yyms1 && yyv1 != nil { + yyv1[yymk1] = yymv1 } - } else if yyms1 && yyv1 != nil { - yyv1[yymk1] = yymv1 } - } - } // else len==0: TODO: Should we clear map entries? - z.DecReadMapEnd() + } // else len==0: TODO: Should we clear map entries? + z.DecReadMapEnd() + } } func (x codecSelfer19780) encMapstringPtrtoTestStruc(v map[string]*TestStruc, e *Encoder) { @@ -14093,9 +12128,9 @@ func (x codecSelfer19780) encMapstringPtrtoTestStruc(v map[string]*TestStruc, e z.EncWriteMapElemValue() if yyv1 == nil { r.EncodeNil() - } else { // checkNil=true + } else { yyv1.CodecEncodeSelf(e) - } // checkNil=true + } } z.EncWriteMapEnd() } @@ -14107,58 +12142,57 @@ func (x codecSelfer19780) decMapstringPtrtoTestStruc(v *map[string]*TestStruc, d yyv1 := *v yyl1 := z.DecReadMapStart() - yybh1 := z.DecBasicHandle() - if yyv1 == nil { - yyrl1 := z.DecInferLen(yyl1, yybh1.MaxInitLen, 24) - yyv1 = make(map[string]*TestStruc, yyrl1) - *v = yyv1 - } - var yymk1 string - var yymv1 *TestStruc - var yymg1, yymdn1, yyms1, yymok1 bool - if yybh1.MapValueReset { - yymg1 = true - } - if yyl1 != 0 { - yyhl1 := yyl1 > 0 - for yyj1 := 0; (yyhl1 && yyj1 < yyl1) || !(yyhl1 || r.CheckBreak()); yyj1++ { - z.DecReadMapElemKey() - if r.TryDecodeAsNil() { - yymk1 = "" - } else { + if yyl1 == codecSelferDecContainerLenNil19780 { + *v = nil + } else { + if yyv1 == nil { + yyrl1 := z.DecInferLen(yyl1, z.DecBasicHandle().MaxInitLen, 24) + yyv1 = make(map[string]*TestStruc, yyrl1) + *v = yyv1 + } + var yymk1 string + var yymv1 *TestStruc + var yymg1, yymdn1, yyms1, yymok1 bool + if z.DecBasicHandle().MapValueReset { + yymg1 = true + } + if yyl1 != 0 { + yyhl1 := yyl1 > 0 + for yyj1 := 0; (yyhl1 && yyj1 < yyl1) || !(yyhl1 || r.CheckBreak()); yyj1++ { + z.DecReadMapElemKey() yymk1 = (string)(string(r.DecodeStringAsBytes())) - } - yyms1 = true - if yymg1 { - yymv1, yymok1 = yyv1[yymk1] - if yymok1 { - yyms1 = false - } - } else { - yymv1 = nil - } - z.DecReadMapElemValue() - yymdn1 = false - if r.TryDecodeAsNil() { - yymdn1 = true - } else { - if yymv1 == nil { - yymv1 = new(TestStruc) + yyms1 = true + if yymg1 { + yymv1, yymok1 = yyv1[yymk1] + if yymok1 { + yyms1 = false + } + } else { + yymv1 = nil } - yymv1.CodecDecodeSelf(d) - } - if yymdn1 { - if yybh1.DeleteOnNilMapValue { - delete(yyv1, yymk1) + z.DecReadMapElemValue() + yymdn1 = false + if r.TryNil() { + yymdn1 = true } else { - yyv1[yymk1] = nil + if yymv1 == nil { + yymv1 = new(TestStruc) + } + yymv1.CodecDecodeSelf(d) + } + if yymdn1 { + if z.DecBasicHandle().DeleteOnNilMapValue { + delete(yyv1, yymk1) + } else { + yyv1[yymk1] = nil + } + } else if yyms1 && yyv1 != nil { + yyv1[yymk1] = yymv1 } - } else if yyms1 && yyv1 != nil { - yyv1[yymk1] = yymv1 } - } - } // else len==0: TODO: Should we clear map entries? - z.DecReadMapEnd() + } // else len==0: TODO: Should we clear map entries? + z.DecReadMapEnd() + } } func (x codecSelfer19780) encMapstringTestStruc(v map[string]TestStruc, e *Encoder) { @@ -14191,51 +12225,46 @@ func (x codecSelfer19780) decMapstringTestStruc(v *map[string]TestStruc, d *Deco yyv1 := *v yyl1 := z.DecReadMapStart() - yybh1 := z.DecBasicHandle() - if yyv1 == nil { - yyrl1 := z.DecInferLen(yyl1, yybh1.MaxInitLen, 1224) - yyv1 = make(map[string]TestStruc, yyrl1) - *v = yyv1 - } - var yymk1 string - var yymv1 TestStruc - var yymg1, yymdn1 bool - if yybh1.MapValueReset { - yymg1 = true - } - if yyl1 != 0 { - yyhl1 := yyl1 > 0 - for yyj1 := 0; (yyhl1 && yyj1 < yyl1) || !(yyhl1 || r.CheckBreak()); yyj1++ { - z.DecReadMapElemKey() - if r.TryDecodeAsNil() { - yymk1 = "" - } else { + if yyl1 == codecSelferDecContainerLenNil19780 { + *v = nil + } else { + if yyv1 == nil { + yyrl1 := z.DecInferLen(yyl1, z.DecBasicHandle().MaxInitLen, 1224) + yyv1 = make(map[string]TestStruc, yyrl1) + *v = yyv1 + } + var yymk1 string + var yymv1 TestStruc + var yymg1, yymdn1 bool + if z.DecBasicHandle().MapValueReset { + yymg1 = true + } + if yyl1 != 0 { + yyhl1 := yyl1 > 0 + for yyj1 := 0; (yyhl1 && yyj1 < yyl1) || !(yyhl1 || r.CheckBreak()); yyj1++ { + z.DecReadMapElemKey() yymk1 = (string)(string(r.DecodeStringAsBytes())) - } - if yymg1 { - yymv1 = yyv1[yymk1] - } else { - yymv1 = TestStruc{} - } - z.DecReadMapElemValue() - yymdn1 = false - if r.TryDecodeAsNil() { - yymdn1 = true - } else { - yymv1.CodecDecodeSelf(d) - } - if yymdn1 { - if yybh1.DeleteOnNilMapValue { - delete(yyv1, yymk1) + if yymg1 { + yymv1 = yyv1[yymk1] } else { - yyv1[yymk1] = TestStruc{} + yymv1 = TestStruc{} + } + z.DecReadMapElemValue() + yymdn1 = false + yymv1.CodecDecodeSelf(d) + if yymdn1 { + if z.DecBasicHandle().DeleteOnNilMapValue { + delete(yyv1, yymk1) + } else { + yyv1[yymk1] = TestStruc{} + } + } else if yyv1 != nil { + yyv1[yymk1] = yymv1 } - } else if yyv1 != nil { - yyv1[yymk1] = yymv1 } - } - } // else len==0: TODO: Should we clear map entries? - z.DecReadMapEnd() + } // else len==0: TODO: Should we clear map entries? + z.DecReadMapEnd() + } } func (x codecSelfer19780) encSlicePtrtoTestStruc(v []*TestStruc, e *Encoder) { @@ -14251,9 +12280,9 @@ func (x codecSelfer19780) encSlicePtrtoTestStruc(v []*TestStruc, e *Encoder) { z.EncWriteArrayElem() if yyv1 == nil { r.EncodeNil() - } else { // checkNil=true + } else { yyv1.CodecEncodeSelf(e) - } // checkNil=true + } } z.EncWriteArrayEnd() } @@ -14267,7 +12296,12 @@ func (x codecSelfer19780) decSlicePtrtoTestStruc(v *[]*TestStruc, d *Decoder) { yyh1, yyl1 := z.DecSliceHelperStart() var yyc1 bool _ = yyc1 - if yyl1 == 0 { + if yyh1.IsNil { + if yyv1 != nil { + yyv1 = nil + yyc1 = true + } + } else if yyl1 == 0 { if yyv1 == nil { yyv1 = []*TestStruc{} yyc1 = true @@ -14313,7 +12347,7 @@ func (x codecSelfer19780) decSlicePtrtoTestStruc(v *[]*TestStruc, d *Decoder) { if yydb1 { z.DecSwallow() } else { - if r.TryDecodeAsNil() { + if r.TryNil() { yyv1[yyj1] = nil } else { if yyv1[yyj1] == nil { @@ -14380,11 +12414,7 @@ func (x codecSelfer19780) decAarray(v *Aarray, d *Decoder) { if yydb1 { z.DecSwallow() } else { - if r.TryDecodeAsNil() { - yyv1[yyj1] = "" - } else { - yyv1[yyj1] = (string)(string(r.DecodeStringAsBytes())) - } + yyv1[yyj1] = (string)(string(r.DecodeStringAsBytes())) } } } @@ -14471,7 +12501,12 @@ func (x codecSelfer19780) decChanstring(v *chan string, d *Decoder) { yyh1, yyl1 := z.DecSliceHelperStart() var yyc1 bool _ = yyc1 - if yyl1 == 0 { + if yyh1.IsNil { + if yyv1 != nil { + yyv1 = nil + yyc1 = true + } + } else if yyl1 == 0 { if yyv1 == nil { yyv1 = make(chan string, 0) yyc1 = true @@ -14493,11 +12528,7 @@ func (x codecSelfer19780) decChanstring(v *chan string, d *Decoder) { } yyh1.ElemContainerState(yyj1) var yyvcx1 string - if r.TryDecodeAsNil() { - yyvcx1 = "" - } else { - yyvcx1 = (string)(string(r.DecodeStringAsBytes())) - } + yyvcx1 = (string)(string(r.DecodeStringAsBytes())) yyv1 <- yyvcx1 // println(">>>> sending ", yyvcx1, " into ", yyv1) // TODO: remove this } @@ -14534,51 +12565,46 @@ func (x codecSelfer19780) decMapboolc3RydWN0IHt9(v *map[bool]struct{}, d *Decode yyv1 := *v yyl1 := z.DecReadMapStart() - yybh1 := z.DecBasicHandle() - if yyv1 == nil { - yyrl1 := z.DecInferLen(yyl1, yybh1.MaxInitLen, 1) - yyv1 = make(map[bool]struct{}, yyrl1) - *v = yyv1 - } - var yymk1 bool - var yymv1 struct{} - var yymg1, yymdn1 bool - if yybh1.MapValueReset { - yymg1 = true - } - if yyl1 != 0 { - yyhl1 := yyl1 > 0 - for yyj1 := 0; (yyhl1 && yyj1 < yyl1) || !(yyhl1 || r.CheckBreak()); yyj1++ { - z.DecReadMapElemKey() - if r.TryDecodeAsNil() { - yymk1 = false - } else { + if yyl1 == codecSelferDecContainerLenNil19780 { + *v = nil + } else { + if yyv1 == nil { + yyrl1 := z.DecInferLen(yyl1, z.DecBasicHandle().MaxInitLen, 1) + yyv1 = make(map[bool]struct{}, yyrl1) + *v = yyv1 + } + var yymk1 bool + var yymv1 struct{} + var yymg1, yymdn1 bool + if z.DecBasicHandle().MapValueReset { + yymg1 = true + } + if yyl1 != 0 { + yyhl1 := yyl1 > 0 + for yyj1 := 0; (yyhl1 && yyj1 < yyl1) || !(yyhl1 || r.CheckBreak()); yyj1++ { + z.DecReadMapElemKey() yymk1 = (bool)(r.DecodeBool()) - } - if yymg1 { - yymv1 = yyv1[yymk1] - } else { - yymv1 = struct{}{} - } - z.DecReadMapElemValue() - yymdn1 = false - if r.TryDecodeAsNil() { - yymdn1 = true - } else { - z.DecFallback(&yymv1, false) - } - if yymdn1 { - if yybh1.DeleteOnNilMapValue { - delete(yyv1, yymk1) + if yymg1 { + yymv1 = yyv1[yymk1] } else { - yyv1[yymk1] = struct{}{} + yymv1 = struct{}{} + } + z.DecReadMapElemValue() + yymdn1 = false + z.DecFallback(&yymv1, false) + if yymdn1 { + if z.DecBasicHandle().DeleteOnNilMapValue { + delete(yyv1, yymk1) + } else { + yyv1[yymk1] = struct{}{} + } + } else if yyv1 != nil { + yyv1[yymk1] = yymv1 } - } else if yyv1 != nil { - yyv1[yymk1] = yymv1 } - } - } // else len==0: TODO: Should we clear map entries? - z.DecReadMapEnd() + } // else len==0: TODO: Should we clear map entries? + z.DecReadMapEnd() + } } func (x codecSelfer19780) encMapintwrapUint64Slice(v map[int]wrapUint64Slice, e *Encoder) { @@ -14606,51 +12632,46 @@ func (x codecSelfer19780) decMapintwrapUint64Slice(v *map[int]wrapUint64Slice, d yyv1 := *v yyl1 := z.DecReadMapStart() - yybh1 := z.DecBasicHandle() - if yyv1 == nil { - yyrl1 := z.DecInferLen(yyl1, yybh1.MaxInitLen, 32) - yyv1 = make(map[int]wrapUint64Slice, yyrl1) - *v = yyv1 - } - var yymk1 int - var yymv1 wrapUint64Slice - var yymg1, yymdn1 bool - if yybh1.MapValueReset { - yymg1 = true - } - if yyl1 != 0 { - yyhl1 := yyl1 > 0 - for yyj1 := 0; (yyhl1 && yyj1 < yyl1) || !(yyhl1 || r.CheckBreak()); yyj1++ { - z.DecReadMapElemKey() - if r.TryDecodeAsNil() { - yymk1 = 0 - } else { + if yyl1 == codecSelferDecContainerLenNil19780 { + *v = nil + } else { + if yyv1 == nil { + yyrl1 := z.DecInferLen(yyl1, z.DecBasicHandle().MaxInitLen, 32) + yyv1 = make(map[int]wrapUint64Slice, yyrl1) + *v = yyv1 + } + var yymk1 int + var yymv1 wrapUint64Slice + var yymg1, yymdn1 bool + if z.DecBasicHandle().MapValueReset { + yymg1 = true + } + if yyl1 != 0 { + yyhl1 := yyl1 > 0 + for yyj1 := 0; (yyhl1 && yyj1 < yyl1) || !(yyhl1 || r.CheckBreak()); yyj1++ { + z.DecReadMapElemKey() yymk1 = (int)(z.C.IntV(r.DecodeInt64(), codecSelferBitsize19780)) - } - if yymg1 { - yymv1 = yyv1[yymk1] - } else { - yymv1 = nil - } - z.DecReadMapElemValue() - yymdn1 = false - if r.TryDecodeAsNil() { - yymdn1 = true - } else { - yymv1.CodecDecodeSelf(d) - } - if yymdn1 { - if yybh1.DeleteOnNilMapValue { - delete(yyv1, yymk1) + if yymg1 { + yymv1 = yyv1[yymk1] } else { - yyv1[yymk1] = nil + yymv1 = nil + } + z.DecReadMapElemValue() + yymdn1 = false + yymv1.CodecDecodeSelf(d) + if yymdn1 { + if z.DecBasicHandle().DeleteOnNilMapValue { + delete(yyv1, yymk1) + } else { + yyv1[yymk1] = nil + } + } else if yyv1 != nil { + yyv1[yymk1] = yymv1 } - } else if yyv1 != nil { - yyv1[yymk1] = yymv1 } - } - } // else len==0: TODO: Should we clear map entries? - z.DecReadMapEnd() + } // else len==0: TODO: Should we clear map entries? + z.DecReadMapEnd() + } } func (x codecSelfer19780) encMapfloat64wrapStringSlice(v map[float64]wrapStringSlice, e *Encoder) { @@ -14678,51 +12699,46 @@ func (x codecSelfer19780) decMapfloat64wrapStringSlice(v *map[float64]wrapString yyv1 := *v yyl1 := z.DecReadMapStart() - yybh1 := z.DecBasicHandle() - if yyv1 == nil { - yyrl1 := z.DecInferLen(yyl1, yybh1.MaxInitLen, 32) - yyv1 = make(map[float64]wrapStringSlice, yyrl1) - *v = yyv1 - } - var yymk1 float64 - var yymv1 wrapStringSlice - var yymg1, yymdn1 bool - if yybh1.MapValueReset { - yymg1 = true - } - if yyl1 != 0 { - yyhl1 := yyl1 > 0 - for yyj1 := 0; (yyhl1 && yyj1 < yyl1) || !(yyhl1 || r.CheckBreak()); yyj1++ { - z.DecReadMapElemKey() - if r.TryDecodeAsNil() { - yymk1 = 0 - } else { + if yyl1 == codecSelferDecContainerLenNil19780 { + *v = nil + } else { + if yyv1 == nil { + yyrl1 := z.DecInferLen(yyl1, z.DecBasicHandle().MaxInitLen, 32) + yyv1 = make(map[float64]wrapStringSlice, yyrl1) + *v = yyv1 + } + var yymk1 float64 + var yymv1 wrapStringSlice + var yymg1, yymdn1 bool + if z.DecBasicHandle().MapValueReset { + yymg1 = true + } + if yyl1 != 0 { + yyhl1 := yyl1 > 0 + for yyj1 := 0; (yyhl1 && yyj1 < yyl1) || !(yyhl1 || r.CheckBreak()); yyj1++ { + z.DecReadMapElemKey() yymk1 = (float64)(r.DecodeFloat64()) - } - if yymg1 { - yymv1 = yyv1[yymk1] - } else { - yymv1 = nil - } - z.DecReadMapElemValue() - yymdn1 = false - if r.TryDecodeAsNil() { - yymdn1 = true - } else { - yymv1.CodecDecodeSelf(d) - } - if yymdn1 { - if yybh1.DeleteOnNilMapValue { - delete(yyv1, yymk1) + if yymg1 { + yymv1 = yyv1[yymk1] } else { - yyv1[yymk1] = nil + yymv1 = nil + } + z.DecReadMapElemValue() + yymdn1 = false + yymv1.CodecDecodeSelf(d) + if yymdn1 { + if z.DecBasicHandle().DeleteOnNilMapValue { + delete(yyv1, yymk1) + } else { + yyv1[yymk1] = nil + } + } else if yyv1 != nil { + yyv1[yymk1] = yymv1 } - } else if yyv1 != nil { - yyv1[yymk1] = yymv1 } - } - } // else len==0: TODO: Should we clear map entries? - z.DecReadMapEnd() + } // else len==0: TODO: Should we clear map entries? + z.DecReadMapEnd() + } } func (x codecSelfer19780) encMapfloat32wrapStringSlice(v map[float32]wrapStringSlice, e *Encoder) { @@ -14750,51 +12766,46 @@ func (x codecSelfer19780) decMapfloat32wrapStringSlice(v *map[float32]wrapString yyv1 := *v yyl1 := z.DecReadMapStart() - yybh1 := z.DecBasicHandle() - if yyv1 == nil { - yyrl1 := z.DecInferLen(yyl1, yybh1.MaxInitLen, 28) - yyv1 = make(map[float32]wrapStringSlice, yyrl1) - *v = yyv1 - } - var yymk1 float32 - var yymv1 wrapStringSlice - var yymg1, yymdn1 bool - if yybh1.MapValueReset { - yymg1 = true - } - if yyl1 != 0 { - yyhl1 := yyl1 > 0 - for yyj1 := 0; (yyhl1 && yyj1 < yyl1) || !(yyhl1 || r.CheckBreak()); yyj1++ { - z.DecReadMapElemKey() - if r.TryDecodeAsNil() { - yymk1 = 0 - } else { + if yyl1 == codecSelferDecContainerLenNil19780 { + *v = nil + } else { + if yyv1 == nil { + yyrl1 := z.DecInferLen(yyl1, z.DecBasicHandle().MaxInitLen, 28) + yyv1 = make(map[float32]wrapStringSlice, yyrl1) + *v = yyv1 + } + var yymk1 float32 + var yymv1 wrapStringSlice + var yymg1, yymdn1 bool + if z.DecBasicHandle().MapValueReset { + yymg1 = true + } + if yyl1 != 0 { + yyhl1 := yyl1 > 0 + for yyj1 := 0; (yyhl1 && yyj1 < yyl1) || !(yyhl1 || r.CheckBreak()); yyj1++ { + z.DecReadMapElemKey() yymk1 = (float32)(z.DecDecodeFloat32()) - } - if yymg1 { - yymv1 = yyv1[yymk1] - } else { - yymv1 = nil - } - z.DecReadMapElemValue() - yymdn1 = false - if r.TryDecodeAsNil() { - yymdn1 = true - } else { - yymv1.CodecDecodeSelf(d) - } - if yymdn1 { - if yybh1.DeleteOnNilMapValue { - delete(yyv1, yymk1) + if yymg1 { + yymv1 = yyv1[yymk1] } else { - yyv1[yymk1] = nil + yymv1 = nil + } + z.DecReadMapElemValue() + yymdn1 = false + yymv1.CodecDecodeSelf(d) + if yymdn1 { + if z.DecBasicHandle().DeleteOnNilMapValue { + delete(yyv1, yymk1) + } else { + yyv1[yymk1] = nil + } + } else if yyv1 != nil { + yyv1[yymk1] = yymv1 } - } else if yyv1 != nil { - yyv1[yymk1] = yymv1 } - } - } // else len==0: TODO: Should we clear map entries? - z.DecReadMapEnd() + } // else len==0: TODO: Should we clear map entries? + z.DecReadMapEnd() + } } func (x codecSelfer19780) encMapuint64wrapStringSlice(v map[uint64]wrapStringSlice, e *Encoder) { @@ -14822,51 +12833,46 @@ func (x codecSelfer19780) decMapuint64wrapStringSlice(v *map[uint64]wrapStringSl yyv1 := *v yyl1 := z.DecReadMapStart() - yybh1 := z.DecBasicHandle() - if yyv1 == nil { - yyrl1 := z.DecInferLen(yyl1, yybh1.MaxInitLen, 32) - yyv1 = make(map[uint64]wrapStringSlice, yyrl1) - *v = yyv1 - } - var yymk1 uint64 - var yymv1 wrapStringSlice - var yymg1, yymdn1 bool - if yybh1.MapValueReset { - yymg1 = true - } - if yyl1 != 0 { - yyhl1 := yyl1 > 0 - for yyj1 := 0; (yyhl1 && yyj1 < yyl1) || !(yyhl1 || r.CheckBreak()); yyj1++ { - z.DecReadMapElemKey() - if r.TryDecodeAsNil() { - yymk1 = 0 - } else { + if yyl1 == codecSelferDecContainerLenNil19780 { + *v = nil + } else { + if yyv1 == nil { + yyrl1 := z.DecInferLen(yyl1, z.DecBasicHandle().MaxInitLen, 32) + yyv1 = make(map[uint64]wrapStringSlice, yyrl1) + *v = yyv1 + } + var yymk1 uint64 + var yymv1 wrapStringSlice + var yymg1, yymdn1 bool + if z.DecBasicHandle().MapValueReset { + yymg1 = true + } + if yyl1 != 0 { + yyhl1 := yyl1 > 0 + for yyj1 := 0; (yyhl1 && yyj1 < yyl1) || !(yyhl1 || r.CheckBreak()); yyj1++ { + z.DecReadMapElemKey() yymk1 = (uint64)(r.DecodeUint64()) - } - if yymg1 { - yymv1 = yyv1[yymk1] - } else { - yymv1 = nil - } - z.DecReadMapElemValue() - yymdn1 = false - if r.TryDecodeAsNil() { - yymdn1 = true - } else { - yymv1.CodecDecodeSelf(d) - } - if yymdn1 { - if yybh1.DeleteOnNilMapValue { - delete(yyv1, yymk1) + if yymg1 { + yymv1 = yyv1[yymk1] } else { - yyv1[yymk1] = nil + yymv1 = nil + } + z.DecReadMapElemValue() + yymdn1 = false + yymv1.CodecDecodeSelf(d) + if yymdn1 { + if z.DecBasicHandle().DeleteOnNilMapValue { + delete(yyv1, yymk1) + } else { + yyv1[yymk1] = nil + } + } else if yyv1 != nil { + yyv1[yymk1] = yymv1 } - } else if yyv1 != nil { - yyv1[yymk1] = yymv1 } - } - } // else len==0: TODO: Should we clear map entries? - z.DecReadMapEnd() + } // else len==0: TODO: Should we clear map entries? + z.DecReadMapEnd() + } } func (x codecSelfer19780) encMapstringUint64TwrapStringSlice(v map[stringUint64T]wrapStringSlice, e *Encoder) { @@ -14895,51 +12901,46 @@ func (x codecSelfer19780) decMapstringUint64TwrapStringSlice(v *map[stringUint64 yyv1 := *v yyl1 := z.DecReadMapStart() - yybh1 := z.DecBasicHandle() - if yyv1 == nil { - yyrl1 := z.DecInferLen(yyl1, yybh1.MaxInitLen, 48) - yyv1 = make(map[stringUint64T]wrapStringSlice, yyrl1) - *v = yyv1 - } - var yymk1 stringUint64T - var yymv1 wrapStringSlice - var yymg1, yymdn1 bool - if yybh1.MapValueReset { - yymg1 = true - } - if yyl1 != 0 { - yyhl1 := yyl1 > 0 - for yyj1 := 0; (yyhl1 && yyj1 < yyl1) || !(yyhl1 || r.CheckBreak()); yyj1++ { - z.DecReadMapElemKey() - if r.TryDecodeAsNil() { - yymk1 = stringUint64T{} - } else { + if yyl1 == codecSelferDecContainerLenNil19780 { + *v = nil + } else { + if yyv1 == nil { + yyrl1 := z.DecInferLen(yyl1, z.DecBasicHandle().MaxInitLen, 48) + yyv1 = make(map[stringUint64T]wrapStringSlice, yyrl1) + *v = yyv1 + } + var yymk1 stringUint64T + var yymv1 wrapStringSlice + var yymg1, yymdn1 bool + if z.DecBasicHandle().MapValueReset { + yymg1 = true + } + if yyl1 != 0 { + yyhl1 := yyl1 > 0 + for yyj1 := 0; (yyhl1 && yyj1 < yyl1) || !(yyhl1 || r.CheckBreak()); yyj1++ { + z.DecReadMapElemKey() yymk1.CodecDecodeSelf(d) - } - if yymg1 { - yymv1 = yyv1[yymk1] - } else { - yymv1 = nil - } - z.DecReadMapElemValue() - yymdn1 = false - if r.TryDecodeAsNil() { - yymdn1 = true - } else { - yymv1.CodecDecodeSelf(d) - } - if yymdn1 { - if yybh1.DeleteOnNilMapValue { - delete(yyv1, yymk1) + if yymg1 { + yymv1 = yyv1[yymk1] } else { - yyv1[yymk1] = nil + yymv1 = nil + } + z.DecReadMapElemValue() + yymdn1 = false + yymv1.CodecDecodeSelf(d) + if yymdn1 { + if z.DecBasicHandle().DeleteOnNilMapValue { + delete(yyv1, yymk1) + } else { + yyv1[yymk1] = nil + } + } else if yyv1 != nil { + yyv1[yymk1] = yymv1 } - } else if yyv1 != nil { - yyv1[yymk1] = yymv1 } - } - } // else len==0: TODO: Should we clear map entries? - z.DecReadMapEnd() + } // else len==0: TODO: Should we clear map entries? + z.DecReadMapEnd() + } } func (x codecSelfer19780) encSlicewrapBytes(v []wrapBytes, e *Encoder) { @@ -14967,7 +12968,12 @@ func (x codecSelfer19780) decSlicewrapBytes(v *[]wrapBytes, d *Decoder) { yyh1, yyl1 := z.DecSliceHelperStart() var yyc1 bool _ = yyc1 - if yyl1 == 0 { + if yyh1.IsNil { + if yyv1 != nil { + yyv1 = nil + yyc1 = true + } + } else if yyl1 == 0 { if yyv1 == nil { yyv1 = []wrapBytes{} yyc1 = true @@ -15013,11 +13019,7 @@ func (x codecSelfer19780) decSlicewrapBytes(v *[]wrapBytes, d *Decoder) { if yydb1 { z.DecSwallow() } else { - if r.TryDecodeAsNil() { - yyv1[yyj1] = nil - } else { - yyv1[yyj1].CodecDecodeSelf(d) - } + yyv1[yyj1].CodecDecodeSelf(d) } } if yyj1 < len(yyv1) { @@ -15059,7 +13061,12 @@ func (x codecSelfer19780) decSlicewrapUint8(v *[]wrapUint8, d *Decoder) { yyh1, yyl1 := z.DecSliceHelperStart() var yyc1 bool _ = yyc1 - if yyl1 == 0 { + if yyh1.IsNil { + if yyv1 != nil { + yyv1 = nil + yyc1 = true + } + } else if yyl1 == 0 { if yyv1 == nil { yyv1 = []wrapUint8{} yyc1 = true @@ -15105,11 +13112,7 @@ func (x codecSelfer19780) decSlicewrapUint8(v *[]wrapUint8, d *Decoder) { if yydb1 { z.DecSwallow() } else { - if r.TryDecodeAsNil() { - yyv1[yyj1] = 0 - } else { - yyv1[yyj1].CodecDecodeSelf(d) - } + yyv1[yyj1].CodecDecodeSelf(d) } } if yyj1 < len(yyv1) { @@ -15166,11 +13169,7 @@ func (x codecSelfer19780) decArray4stringUint64T(v *[4]stringUint64T, d *Decoder if yydb1 { z.DecSwallow() } else { - if r.TryDecodeAsNil() { - yyv1[yyj1] = stringUint64T{} - } else { - yyv1[yyj1].CodecDecodeSelf(d) - } + yyv1[yyj1].CodecDecodeSelf(d) } } } @@ -15216,11 +13215,7 @@ func (x codecSelfer19780) decArray4uint64(v *[4]uint64, d *Decoder) { if yydb1 { z.DecSwallow() } else { - if r.TryDecodeAsNil() { - yyv1[yyj1] = 0 - } else { - yyv1[yyj1] = (uint64)(r.DecodeUint64()) - } + yyv1[yyj1] = (uint64)(r.DecodeUint64()) } } } @@ -15240,9 +13235,9 @@ func (x codecSelfer19780) encSlicePtrtoArray4uint64(v []*[4]uint64, e *Encoder) z.EncWriteArrayElem() if yyv1 == nil { r.EncodeNil() - } else { // checkNil=true + } else { h.encArray4uint64((*[4]uint64)(yyv1), e) - } // checkNil=true + } } z.EncWriteArrayEnd() } @@ -15256,7 +13251,12 @@ func (x codecSelfer19780) decSlicePtrtoArray4uint64(v *[]*[4]uint64, d *Decoder) yyh1, yyl1 := z.DecSliceHelperStart() var yyc1 bool _ = yyc1 - if yyl1 == 0 { + if yyh1.IsNil { + if yyv1 != nil { + yyv1 = nil + yyc1 = true + } + } else if yyl1 == 0 { if yyv1 == nil { yyv1 = []*[4]uint64{} yyc1 = true @@ -15302,7 +13302,7 @@ func (x codecSelfer19780) decSlicePtrtoArray4uint64(v *[]*[4]uint64, d *Decoder) if yydb1 { z.DecSwallow() } else { - if r.TryDecodeAsNil() { + if r.TryNil() { yyv1[yyj1] = nil } else { if yyv1[yyj1] == nil { @@ -15342,9 +13342,9 @@ func (x codecSelfer19780) encMapstringUint64TPtrtostringUint64T(v map[stringUint z.EncWriteMapElemValue() if yyv1 == nil { r.EncodeNil() - } else { // checkNil=true + } else { yyv1.CodecEncodeSelf(e) - } // checkNil=true + } } z.EncWriteMapEnd() } @@ -15356,58 +13356,57 @@ func (x codecSelfer19780) decMapstringUint64TPtrtostringUint64T(v *map[stringUin yyv1 := *v yyl1 := z.DecReadMapStart() - yybh1 := z.DecBasicHandle() - if yyv1 == nil { - yyrl1 := z.DecInferLen(yyl1, yybh1.MaxInitLen, 32) - yyv1 = make(map[stringUint64T]*stringUint64T, yyrl1) - *v = yyv1 - } - var yymk1 stringUint64T - var yymv1 *stringUint64T - var yymg1, yymdn1, yyms1, yymok1 bool - if yybh1.MapValueReset { - yymg1 = true - } - if yyl1 != 0 { - yyhl1 := yyl1 > 0 - for yyj1 := 0; (yyhl1 && yyj1 < yyl1) || !(yyhl1 || r.CheckBreak()); yyj1++ { - z.DecReadMapElemKey() - if r.TryDecodeAsNil() { - yymk1 = stringUint64T{} - } else { + if yyl1 == codecSelferDecContainerLenNil19780 { + *v = nil + } else { + if yyv1 == nil { + yyrl1 := z.DecInferLen(yyl1, z.DecBasicHandle().MaxInitLen, 32) + yyv1 = make(map[stringUint64T]*stringUint64T, yyrl1) + *v = yyv1 + } + var yymk1 stringUint64T + var yymv1 *stringUint64T + var yymg1, yymdn1, yyms1, yymok1 bool + if z.DecBasicHandle().MapValueReset { + yymg1 = true + } + if yyl1 != 0 { + yyhl1 := yyl1 > 0 + for yyj1 := 0; (yyhl1 && yyj1 < yyl1) || !(yyhl1 || r.CheckBreak()); yyj1++ { + z.DecReadMapElemKey() yymk1.CodecDecodeSelf(d) - } - yyms1 = true - if yymg1 { - yymv1, yymok1 = yyv1[yymk1] - if yymok1 { - yyms1 = false - } - } else { - yymv1 = nil - } - z.DecReadMapElemValue() - yymdn1 = false - if r.TryDecodeAsNil() { - yymdn1 = true - } else { - if yymv1 == nil { - yymv1 = new(stringUint64T) + yyms1 = true + if yymg1 { + yymv1, yymok1 = yyv1[yymk1] + if yymok1 { + yyms1 = false + } + } else { + yymv1 = nil } - yymv1.CodecDecodeSelf(d) - } - if yymdn1 { - if yybh1.DeleteOnNilMapValue { - delete(yyv1, yymk1) + z.DecReadMapElemValue() + yymdn1 = false + if r.TryNil() { + yymdn1 = true } else { - yyv1[yymk1] = nil + if yymv1 == nil { + yymv1 = new(stringUint64T) + } + yymv1.CodecDecodeSelf(d) + } + if yymdn1 { + if z.DecBasicHandle().DeleteOnNilMapValue { + delete(yyv1, yymk1) + } else { + yyv1[yymk1] = nil + } + } else if yyms1 && yyv1 != nil { + yyv1[yymk1] = yymv1 } - } else if yyms1 && yyv1 != nil { - yyv1[yymk1] = yymv1 } - } - } // else len==0: TODO: Should we clear map entries? - z.DecReadMapEnd() + } // else len==0: TODO: Should we clear map entries? + z.DecReadMapEnd() + } } func (x codecSelfer19780) encMapstringPtrtoTestStrucFlex(v map[string]*TestStrucFlex, e *Encoder) { @@ -15429,9 +13428,9 @@ func (x codecSelfer19780) encMapstringPtrtoTestStrucFlex(v map[string]*TestStruc z.EncWriteMapElemValue() if yyv1 == nil { r.EncodeNil() - } else { // checkNil=true + } else { yyv1.CodecEncodeSelf(e) - } // checkNil=true + } } z.EncWriteMapEnd() } @@ -15443,58 +13442,57 @@ func (x codecSelfer19780) decMapstringPtrtoTestStrucFlex(v *map[string]*TestStru yyv1 := *v yyl1 := z.DecReadMapStart() - yybh1 := z.DecBasicHandle() - if yyv1 == nil { - yyrl1 := z.DecInferLen(yyl1, yybh1.MaxInitLen, 24) - yyv1 = make(map[string]*TestStrucFlex, yyrl1) - *v = yyv1 - } - var yymk1 string - var yymv1 *TestStrucFlex - var yymg1, yymdn1, yyms1, yymok1 bool - if yybh1.MapValueReset { - yymg1 = true - } - if yyl1 != 0 { - yyhl1 := yyl1 > 0 - for yyj1 := 0; (yyhl1 && yyj1 < yyl1) || !(yyhl1 || r.CheckBreak()); yyj1++ { - z.DecReadMapElemKey() - if r.TryDecodeAsNil() { - yymk1 = "" - } else { + if yyl1 == codecSelferDecContainerLenNil19780 { + *v = nil + } else { + if yyv1 == nil { + yyrl1 := z.DecInferLen(yyl1, z.DecBasicHandle().MaxInitLen, 24) + yyv1 = make(map[string]*TestStrucFlex, yyrl1) + *v = yyv1 + } + var yymk1 string + var yymv1 *TestStrucFlex + var yymg1, yymdn1, yyms1, yymok1 bool + if z.DecBasicHandle().MapValueReset { + yymg1 = true + } + if yyl1 != 0 { + yyhl1 := yyl1 > 0 + for yyj1 := 0; (yyhl1 && yyj1 < yyl1) || !(yyhl1 || r.CheckBreak()); yyj1++ { + z.DecReadMapElemKey() yymk1 = (string)(string(r.DecodeStringAsBytes())) - } - yyms1 = true - if yymg1 { - yymv1, yymok1 = yyv1[yymk1] - if yymok1 { - yyms1 = false - } - } else { - yymv1 = nil - } - z.DecReadMapElemValue() - yymdn1 = false - if r.TryDecodeAsNil() { - yymdn1 = true - } else { - if yymv1 == nil { - yymv1 = new(TestStrucFlex) + yyms1 = true + if yymg1 { + yymv1, yymok1 = yyv1[yymk1] + if yymok1 { + yyms1 = false + } + } else { + yymv1 = nil } - yymv1.CodecDecodeSelf(d) - } - if yymdn1 { - if yybh1.DeleteOnNilMapValue { - delete(yyv1, yymk1) + z.DecReadMapElemValue() + yymdn1 = false + if r.TryNil() { + yymdn1 = true } else { - yyv1[yymk1] = nil + if yymv1 == nil { + yymv1 = new(TestStrucFlex) + } + yymv1.CodecDecodeSelf(d) + } + if yymdn1 { + if z.DecBasicHandle().DeleteOnNilMapValue { + delete(yyv1, yymk1) + } else { + yyv1[yymk1] = nil + } + } else if yyms1 && yyv1 != nil { + yyv1[yymk1] = yymv1 } - } else if yyms1 && yyv1 != nil { - yyv1[yymk1] = yymv1 } - } - } // else len==0: TODO: Should we clear map entries? - z.DecReadMapEnd() + } // else len==0: TODO: Should we clear map entries? + z.DecReadMapEnd() + } } func (x codecSelfer19780) encMapstringTestStrucFlex(v map[string]TestStrucFlex, e *Encoder) { @@ -15527,51 +13525,46 @@ func (x codecSelfer19780) decMapstringTestStrucFlex(v *map[string]TestStrucFlex, yyv1 := *v yyl1 := z.DecReadMapStart() - yybh1 := z.DecBasicHandle() - if yyv1 == nil { - yyrl1 := z.DecInferLen(yyl1, yybh1.MaxInitLen, 1536) - yyv1 = make(map[string]TestStrucFlex, yyrl1) - *v = yyv1 - } - var yymk1 string - var yymv1 TestStrucFlex - var yymg1, yymdn1 bool - if yybh1.MapValueReset { - yymg1 = true - } - if yyl1 != 0 { - yyhl1 := yyl1 > 0 - for yyj1 := 0; (yyhl1 && yyj1 < yyl1) || !(yyhl1 || r.CheckBreak()); yyj1++ { - z.DecReadMapElemKey() - if r.TryDecodeAsNil() { - yymk1 = "" - } else { + if yyl1 == codecSelferDecContainerLenNil19780 { + *v = nil + } else { + if yyv1 == nil { + yyrl1 := z.DecInferLen(yyl1, z.DecBasicHandle().MaxInitLen, 1536) + yyv1 = make(map[string]TestStrucFlex, yyrl1) + *v = yyv1 + } + var yymk1 string + var yymv1 TestStrucFlex + var yymg1, yymdn1 bool + if z.DecBasicHandle().MapValueReset { + yymg1 = true + } + if yyl1 != 0 { + yyhl1 := yyl1 > 0 + for yyj1 := 0; (yyhl1 && yyj1 < yyl1) || !(yyhl1 || r.CheckBreak()); yyj1++ { + z.DecReadMapElemKey() yymk1 = (string)(string(r.DecodeStringAsBytes())) - } - if yymg1 { - yymv1 = yyv1[yymk1] - } else { - yymv1 = TestStrucFlex{} - } - z.DecReadMapElemValue() - yymdn1 = false - if r.TryDecodeAsNil() { - yymdn1 = true - } else { - yymv1.CodecDecodeSelf(d) - } - if yymdn1 { - if yybh1.DeleteOnNilMapValue { - delete(yyv1, yymk1) + if yymg1 { + yymv1 = yyv1[yymk1] } else { - yyv1[yymk1] = TestStrucFlex{} + yymv1 = TestStrucFlex{} + } + z.DecReadMapElemValue() + yymdn1 = false + yymv1.CodecDecodeSelf(d) + if yymdn1 { + if z.DecBasicHandle().DeleteOnNilMapValue { + delete(yyv1, yymk1) + } else { + yyv1[yymk1] = TestStrucFlex{} + } + } else if yyv1 != nil { + yyv1[yymk1] = yymv1 } - } else if yyv1 != nil { - yyv1[yymk1] = yymv1 } - } - } // else len==0: TODO: Should we clear map entries? - z.DecReadMapEnd() + } // else len==0: TODO: Should we clear map entries? + z.DecReadMapEnd() + } } func (x codecSelfer19780) encSlicePtrtoTestStrucFlex(v []*TestStrucFlex, e *Encoder) { @@ -15587,9 +13580,9 @@ func (x codecSelfer19780) encSlicePtrtoTestStrucFlex(v []*TestStrucFlex, e *Enco z.EncWriteArrayElem() if yyv1 == nil { r.EncodeNil() - } else { // checkNil=true + } else { yyv1.CodecEncodeSelf(e) - } // checkNil=true + } } z.EncWriteArrayEnd() } @@ -15603,7 +13596,12 @@ func (x codecSelfer19780) decSlicePtrtoTestStrucFlex(v *[]*TestStrucFlex, d *Dec yyh1, yyl1 := z.DecSliceHelperStart() var yyc1 bool _ = yyc1 - if yyl1 == 0 { + if yyh1.IsNil { + if yyv1 != nil { + yyv1 = nil + yyc1 = true + } + } else if yyl1 == 0 { if yyv1 == nil { yyv1 = []*TestStrucFlex{} yyc1 = true @@ -15649,7 +13647,7 @@ func (x codecSelfer19780) decSlicePtrtoTestStrucFlex(v *[]*TestStrucFlex, d *Dec if yydb1 { z.DecSwallow() } else { - if r.TryDecodeAsNil() { + if r.TryNil() { yyv1[yyj1] = nil } else { if yyv1[yyj1] == nil {