diff options
Diffstat (limited to 'vendor/github.com/ugorji/go/codec/gen-helper.go.tmpl')
-rw-r--r-- | vendor/github.com/ugorji/go/codec/gen-helper.go.tmpl | 50 |
1 files changed, 37 insertions, 13 deletions
diff --git a/vendor/github.com/ugorji/go/codec/gen-helper.go.tmpl b/vendor/github.com/ugorji/go/codec/gen-helper.go.tmpl index 1f1339684..bf824ebdd 100644 --- a/vendor/github.com/ugorji/go/codec/gen-helper.go.tmpl +++ b/vendor/github.com/ugorji/go/codec/gen-helper.go.tmpl @@ -73,6 +73,10 @@ func (f genHelperEncoder) EncBasicHandle() *BasicHandle { return f.e.h } // FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* +func (f genHelperEncoder) EncWr() *encWr { + return f.e.w() +} +// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* func (f genHelperEncoder) EncBinary() bool { return f.e.be // f.e.hh.isBinaryEncoding() } @@ -111,10 +115,7 @@ func (f genHelperEncoder) Extension(v interface{}) (xfn *extTypeTagFn) { func (f genHelperEncoder) EncExtension(v interface{}, xfFn *extTypeTagFn) { f.e.e.EncodeExt(v, xfFn.rt, xfFn.tag, xfFn.ext) } -// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* -func (f genHelperEncoder) WriteStr(s string) { - f.e.w().writestr(s) -} + // FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* func (f genHelperEncoder) EncWriteMapStart(length int) { f.e.mapStart(length) } // FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* @@ -136,9 +137,15 @@ func (f genHelperEncoder) EncEncodeComplex128(v complex128) { f.e.encodeComplex1 // FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* func (f genHelperEncoder) EncEncode(v interface{}) { f.e.encode(v) } // FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* +func (f genHelperEncoder) EncFnGivenAddr(v interface{}) *codecFn { return f.e.h.fn(reflect.TypeOf(v).Elem()) } +// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* +func (f genHelperEncoder) EncEncodeNumBoolStrKindGivenAddr(v interface{}, encFn *codecFn) { + f.e.encodeValueNonNil(reflect.ValueOf(v).Elem(), encFn) +} +// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* func (f genHelperEncoder) EncEncodeMapNonNil(v interface{}) { if skipFastpathTypeSwitchInDirectCall || !fastpathEncodeTypeSwitch(v, f.e) { - f.e.encodeValue(reflect.ValueOf(v), nil) + f.e.encodeValueNonNil(reflect.ValueOf(v), nil) } } @@ -205,12 +212,6 @@ func (f genHelperDecoder) DecRaw() []byte { return f.d.rawBytes() } func (f genHelperDecoder) IsJSONHandle() bool { return f.d.js } -{{/* -// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* -func (f genHelperDecoder) I2Rtid(v interface{}) uintptr { - return i2rtid(v) -} -*/ -}} // FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* func (f genHelperDecoder) Extension(v interface{}) (xfn *extTypeTagFn) { return f.d.h.getExtForI(v) @@ -242,8 +243,31 @@ func (f genHelperDecoder) DecReadMapElemValue() { f.d.mapElemValue() } // FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* func (f genHelperDecoder) DecDecodeFloat32() float32 { return f.d.decodeFloat32() } // FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* -func (f genHelperDecoder) DecCheckBreak() bool { return f.d.checkBreak() } -// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* func (f genHelperDecoder) DecStringZC(v []byte) string { return f.d.stringZC(v) } // FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* func (f genHelperDecoder) DecodeBytesInto(v []byte) []byte { return f.d.decodeBytesInto(v) } +// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* +func (f genHelperDecoder) DecContainerNext(j, containerLen int, hasLen bool) bool { + // return f.d.containerNext(j, containerLen, hasLen) + // rewriting so it can be inlined + if hasLen { + return j < containerLen + } + return !f.d.checkBreak() +} + +{{/* +// MARKER: remove WriteStr, as it cannot be inlined as of 20230201. +// Instead, generated code calls (*encWr).WriteStr directly. + +// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* +// func (f genHelperEncoder) WriteStr(s string) { +// f.e.encWr.writestr(s) +// } + +// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* +func (f genHelperDecoder) I2Rtid(v interface{}) uintptr { + return i2rtid(v) +} + +*/ -}} |