diff --git a/encode.go b/encode.go index 3da7b4f..16f1a12 100644 --- a/encode.go +++ b/encode.go @@ -6,8 +6,6 @@ import ( "github.com/goccy/go-json/internal/encoder" "github.com/goccy/go-json/internal/encoder/vm" - "github.com/goccy/go-json/internal/encoder/vm_escaped" - "github.com/goccy/go-json/internal/encoder/vm_escaped_indent" "github.com/goccy/go-json/internal/encoder/vm_indent" ) @@ -172,8 +170,8 @@ func marshalIndent(v interface{}, prefix, indent string, optFuncs ...EncodeOptio func encode(ctx *encoder.RuntimeContext, v interface{}) ([]byte, error) { b := ctx.Buf[:0] if v == nil { - b = encoder.AppendNull(b) - b = encoder.AppendComma(b) + b = encoder.AppendNull(ctx, b) + b = encoder.AppendComma(ctx, b) return b, nil } header := (*emptyInterface)(unsafe.Pointer(&v)) @@ -186,13 +184,7 @@ func encode(ctx *encoder.RuntimeContext, v interface{}) ([]byte, error) { } p := uintptr(header.ptr) - var code *encoder.Opcode - if ctx.Option.HTMLEscape { - code = codeSet.EscapeKeyCode - } else { - code = codeSet.NoescapeKeyCode - } - ctx.Init(code, p, codeSet.CodeLength) + ctx.Init(p, codeSet.CodeLength) ctx.KeepRefs = append(ctx.KeepRefs, header.ptr) buf, err := encodeRunCode(ctx, b, codeSet) @@ -206,8 +198,8 @@ func encode(ctx *encoder.RuntimeContext, v interface{}) ([]byte, error) { func encodeNoEscape(ctx *encoder.RuntimeContext, v interface{}) ([]byte, error) { b := ctx.Buf[:0] if v == nil { - b = encoder.AppendNull(b) - b = encoder.AppendComma(b) + b = encoder.AppendNull(ctx, b) + b = encoder.AppendComma(ctx, b) return b, nil } header := (*emptyInterface)(unsafe.Pointer(&v)) @@ -219,14 +211,8 @@ func encodeNoEscape(ctx *encoder.RuntimeContext, v interface{}) ([]byte, error) return nil, err } - var code *encoder.Opcode - if ctx.Option.HTMLEscape { - code = codeSet.EscapeKeyCode - } else { - code = codeSet.NoescapeKeyCode - } p := uintptr(header.ptr) - ctx.Init(code, p, codeSet.CodeLength) + ctx.Init(p, codeSet.CodeLength) buf, err := encodeRunCode(ctx, b, codeSet) if err != nil { return nil, err @@ -239,8 +225,8 @@ func encodeNoEscape(ctx *encoder.RuntimeContext, v interface{}) ([]byte, error) func encodeIndent(ctx *encoder.RuntimeContext, v interface{}, prefix, indent string) ([]byte, error) { b := ctx.Buf[:0] if v == nil { - b = encoder.AppendNull(b) - b = encoder.AppendCommaIndent(b) + b = encoder.AppendNull(ctx, b) + b = encoder.AppendCommaIndent(ctx, b) return b, nil } header := (*emptyInterface)(unsafe.Pointer(&v)) @@ -252,14 +238,8 @@ func encodeIndent(ctx *encoder.RuntimeContext, v interface{}, prefix, indent str return nil, err } - var code *encoder.Opcode - if ctx.Option.HTMLEscape { - code = codeSet.EscapeKeyCode - } else { - code = codeSet.NoescapeKeyCode - } p := uintptr(header.ptr) - ctx.Init(code, p, codeSet.CodeLength) + ctx.Init(p, codeSet.CodeLength) buf, err := encodeRunIndentCode(ctx, b, codeSet, prefix, indent) ctx.KeepRefs = append(ctx.KeepRefs, header.ptr) @@ -274,40 +254,20 @@ func encodeIndent(ctx *encoder.RuntimeContext, v interface{}, prefix, indent str func encodeRunCode(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]byte, error) { if ctx.Option.Debug { - return encodeDebugRunCode(ctx, b, codeSet) - } - if ctx.Option.HTMLEscape { - return vm_escaped.Run(ctx, b, codeSet) + return vm.DebugRun(ctx, b, codeSet) } return vm.Run(ctx, b, codeSet) } -func encodeDebugRunCode(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]byte, error) { - if ctx.Option.HTMLEscape { - return vm_escaped.DebugRun(ctx, b, codeSet) - } - return vm.DebugRun(ctx, b, codeSet) -} - func encodeRunIndentCode(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, prefix, indent string) ([]byte, error) { ctx.Prefix = []byte(prefix) ctx.IndentStr = []byte(indent) if ctx.Option.Debug { - return encodeDebugRunIndentCode(ctx, b, codeSet) - } - if ctx.Option.HTMLEscape { - return vm_escaped_indent.Run(ctx, b, codeSet) + return vm_indent.DebugRun(ctx, b, codeSet) } return vm_indent.Run(ctx, b, codeSet) } -func encodeDebugRunIndentCode(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]byte, error) { - if ctx.Option.HTMLEscape { - return vm_escaped_indent.DebugRun(ctx, b, codeSet) - } - return vm_indent.DebugRun(ctx, b, codeSet) -} - func initOption(opt *EncodeOption) { opt.HTMLEscape = false opt.Indent = false diff --git a/internal/cmd/generator/main.go b/internal/cmd/generator/main.go index e778be2..908e4fb 100644 --- a/internal/cmd/generator/main.go +++ b/internal/cmd/generator/main.go @@ -286,7 +286,7 @@ func generateVM() error { if err != nil { return err } - for _, pkg := range []string{"vm", "vm_indent", "vm_escaped", "vm_escaped_indent"} { + for _, pkg := range []string{"vm", "vm_indent"} { f.Name.Name = pkg var buf bytes.Buffer printer.Fprint(&buf, fset, f) diff --git a/internal/cmd/generator/vm.go.tmpl b/internal/cmd/generator/vm.go.tmpl index b68a306..6c1bda1 100644 --- a/internal/cmd/generator/vm.go.tmpl +++ b/internal/cmd/generator/vm.go.tmpl @@ -13,7 +13,12 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b recursiveLevel := 0 ptrOffset := uintptr(0) ctxptr := ctx.Ptr() - code := ctx.Code + var code *encoder.Opcode + if ctx.Option.HTMLEscape { + code = codeSet.EscapeKeyCode + } else { + code = codeSet.NoescapeKeyCode + } for { switch code.Op { @@ -26,8 +31,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b case encoder.OpIntPtr: p := loadNPtr(ctxptr, code.Idx, code.PtrNum) if p == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) code = code.Next break } @@ -35,13 +40,13 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b fallthrough case encoder.OpInt: b = appendInt(b, ptrToUint64(load(ctxptr, code.Idx)), code) - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpUintPtr: p := loadNPtr(ctxptr, code.Idx, code.PtrNum) if p == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) code = code.Next break } @@ -49,39 +54,39 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b fallthrough case encoder.OpUint: b = appendUint(b, ptrToUint64(load(ctxptr, code.Idx)), code) - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpIntString: b = append(b, '"') b = appendInt(b, ptrToUint64(load(ctxptr, code.Idx)), code) b = append(b, '"') - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpUintString: b = append(b, '"') b = appendUint(b, ptrToUint64(load(ctxptr, code.Idx)), code) b = append(b, '"') - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpFloat32Ptr: p := loadNPtr(ctxptr, code.Idx, code.PtrNum) if p == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) code = code.Next break } store(ctxptr, code.Idx, p) fallthrough case encoder.OpFloat32: - b = appendFloat32(b, ptrToFloat32(load(ctxptr, code.Idx))) - b = appendComma(b) + b = appendFloat32(ctx, b, ptrToFloat32(load(ctxptr, code.Idx))) + b = appendComma(ctx, b) code = code.Next case encoder.OpFloat64Ptr: p := loadNPtr(ctxptr, code.Idx, code.PtrNum) if p == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) code = code.Next break } @@ -92,73 +97,73 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b if math.IsInf(v, 0) || math.IsNaN(v) { return nil, errUnsupportedFloat(v) } - b = appendFloat64(b, v) - b = appendComma(b) + b = appendFloat64(ctx, b, v) + b = appendComma(ctx, b) code = code.Next case encoder.OpStringPtr: p := loadNPtr(ctxptr, code.Idx, code.PtrNum) if p == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) code = code.Next break } store(ctxptr, code.Idx, p) fallthrough case encoder.OpString: - b = appendString(b, ptrToString(load(ctxptr, code.Idx))) - b = appendComma(b) + b = appendString(ctx, b, ptrToString(load(ctxptr, code.Idx))) + b = appendComma(ctx, b) code = code.Next case encoder.OpBoolPtr: p := loadNPtr(ctxptr, code.Idx, code.PtrNum) if p == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) code = code.Next break } store(ctxptr, code.Idx, p) fallthrough case encoder.OpBool: - b = appendBool(b, ptrToBool(load(ctxptr, code.Idx))) - b = appendComma(b) + b = appendBool(ctx, b, ptrToBool(load(ctxptr, code.Idx))) + b = appendComma(ctx, b) code = code.Next case encoder.OpBytesPtr: p := loadNPtr(ctxptr, code.Idx, code.PtrNum) if p == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) code = code.Next break } store(ctxptr, code.Idx, p) fallthrough case encoder.OpBytes: - b = appendByteSlice(b, ptrToBytes(load(ctxptr, code.Idx))) - b = appendComma(b) + b = appendByteSlice(ctx, b, ptrToBytes(load(ctxptr, code.Idx))) + b = appendComma(ctx, b) code = code.Next case encoder.OpNumberPtr: p := loadNPtr(ctxptr, code.Idx, code.PtrNum) if p == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) code = code.Next break } store(ctxptr, code.Idx, p) fallthrough case encoder.OpNumber: - bb, err := appendNumber(b, ptrToNumber(load(ctxptr, code.Idx))) + bb, err := appendNumber(ctx, b, ptrToNumber(load(ctxptr, code.Idx))) if err != nil { return nil, err } - b = appendComma(bb) + b = appendComma(ctx, bb) code = code.Next case encoder.OpInterfacePtr: p := loadNPtr(ctxptr, code.Idx, code.PtrNum) if p == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) code = code.Next break } @@ -167,8 +172,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b case encoder.OpInterface: p := load(ctxptr, code.Idx) if p == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) code = code.Next break } @@ -180,8 +185,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b ctx.SeenPtr = append(ctx.SeenPtr, p) iface := (*emptyInterface)(ptrToUnsafePtr(p)) if iface.ptr == nil { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) code = code.Next break } @@ -197,8 +202,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b case encoder.OpMarshalJSONPtr: p := load(ctxptr, code.Idx) if p == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) code = code.Next break } @@ -207,8 +212,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b case encoder.OpMarshalJSON: p := load(ctxptr, code.Idx) if p == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) code = code.Next break } @@ -219,13 +224,13 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b if err != nil { return nil, err } - b = appendComma(bb) + b = appendComma(ctx, bb) code = code.Next case encoder.OpMarshalTextPtr: p := load(ctxptr, code.Idx) if p == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) code = code.Next break } @@ -235,24 +240,24 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 { b = append(b, `""`...) - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next break } if (code.Flags&encoder.IsNilableTypeFlags) != 0 && (code.Flags&encoder.IndirectFlags) != 0 { p = ptrToPtr(p) } - bb, err := appendMarshalText(code, b, ptrToInterface(code, p)) + bb, err := appendMarshalText(ctx, code, b, ptrToInterface(code, p)) if err != nil { return nil, err } - b = appendComma(bb) + b = appendComma(ctx, bb) code = code.Next case encoder.OpSlicePtr: p := loadNPtr(ctxptr, code.Idx, code.PtrNum) if p == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) code = code.End.Next break } @@ -262,8 +267,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) slice := ptrToSlice(p) if p == 0 || slice.Data == nil { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) code = code.End.Next break } @@ -275,7 +280,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b code = code.Next store(ctxptr, code.Idx, uintptr(slice.Data)) } else { - b = appendEmptyArray(b) + b = appendEmptyArray(ctx, b) code = code.End.Next } case encoder.OpSliceElem: @@ -296,8 +301,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b case encoder.OpArrayPtr: p := loadNPtr(ctxptr, code.Idx, code.PtrNum) if p == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) code = code.End.Next break } @@ -306,8 +311,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b case encoder.OpArray: p := load(ctxptr, code.Idx) if p == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) code = code.End.Next break } @@ -317,7 +322,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b code = code.Next store(ctxptr, code.Idx, p) } else { - b = appendEmptyArray(b) + b = appendEmptyArray(ctx, b) code = code.End.Next } case encoder.OpArrayElem: @@ -337,8 +342,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b case encoder.OpMapPtr: p := loadNPtr(ctxptr, code.Idx, code.PtrNum) if p == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) code = code.End.Next break } @@ -347,19 +352,19 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b case encoder.OpMap: p := load(ctxptr, code.Idx) if p == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) code = code.End.Next break } uptr := ptrToUnsafePtr(p) mlen := maplen(uptr) if mlen <= 0 { - b = appendEmptyObject(b) + b = appendEmptyObject(ctx, b) code = code.End.Next break } - b = appendStructHead(b) + b = appendStructHead(ctx, b) iter := mapiterinit(code.Type, uptr) ctx.KeepRefs = append(ctx.KeepRefs, iter) store(ctxptr, code.ElemIdx, 0) @@ -410,7 +415,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b } case encoder.OpMapValue: if ctx.Option.UnorderedMap { - b = appendColon(b) + b = appendColon(ctx, b) } else { ptr := load(ctxptr, code.End.MapPos) mapCtx := (*encoder.MapContext)(ptrToUnsafePtr(ptr)) @@ -509,8 +514,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -521,14 +526,14 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 && ((code.Flags&encoder.IndirectFlags) != 0 || code.Next.Op == encoder.OpStructEnd) { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) + b = appendStructHead(ctx, b) } if (code.Flags&encoder.AnonymousKeyFlags) == 0 && len(code.Key) > 0 { b = appendStructKey(ctx, code, b) @@ -540,8 +545,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -552,14 +557,14 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 && ((code.Flags&encoder.IndirectFlags) != 0 || code.Next.Op == encoder.OpStructEnd) { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) + b = appendStructHead(ctx, b) } p += uintptr(code.Offset) if p == 0 || (ptrToPtr(p) == 0 && (code.Flags&encoder.IsNextOpPtrTypeFlags) != 0) { @@ -574,8 +579,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -587,26 +592,26 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) + b = appendStructHead(ctx, b) } b = appendStructKey(ctx, code, b) b = appendInt(b, ptrToUint64(p+uintptr(code.Offset)), code) - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructPtrHeadOmitEmptyInt: if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -618,14 +623,14 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) + b = appendStructHead(ctx, b) } u64 := ptrToUint64(p + uintptr(code.Offset)) v := u64 & ((1 << code.NumBitSize) - 1) @@ -634,7 +639,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b } else { b = appendStructKey(ctx, code, b) b = appendInt(b, u64, code) - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next } case encoder.OpStructPtrHeadIntString: @@ -642,8 +647,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -655,28 +660,28 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) + b = appendStructHead(ctx, b) } b = appendStructKey(ctx, code, b) b = append(b, '"') b = appendInt(b, ptrToUint64(p+uintptr(code.Offset)), code) b = append(b, '"') - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructPtrHeadOmitEmptyIntString: if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -688,14 +693,14 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) + b = appendStructHead(ctx, b) } u64 := ptrToUint64(p + uintptr(code.Offset)) v := u64 & ((1 << code.NumBitSize) - 1) @@ -706,15 +711,15 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b b = append(b, '"') b = appendInt(b, u64, code) b = append(b, '"') - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next } case encoder.OpStructPtrHeadIntPtr: p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -725,32 +730,32 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) + b = appendStructHead(ctx, b) } b = appendStructKey(ctx, code, b) if (code.Flags & encoder.IndirectFlags) != 0 { p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p == 0 { - b = appendNull(b) + b = appendNull(ctx, b) } else { b = appendInt(b, ptrToUint64(p), code) } - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructPtrHeadOmitEmptyIntPtr: p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -761,14 +766,14 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) + b = appendStructHead(ctx, b) } if (code.Flags & encoder.IndirectFlags) != 0 { p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) @@ -776,15 +781,15 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b if p != 0 { b = appendStructKey(ctx, code, b) b = appendInt(b, ptrToUint64(p), code) - b = appendComma(b) + b = appendComma(ctx, b) } code = code.Next case encoder.OpStructPtrHeadIntPtrString: p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -795,34 +800,34 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) + b = appendStructHead(ctx, b) } b = appendStructKey(ctx, code, b) if (code.Flags & encoder.IndirectFlags) != 0 { p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p == 0 { - b = appendNull(b) + b = appendNull(ctx, b) } else { b = append(b, '"') b = appendInt(b, ptrToUint64(p), code) b = append(b, '"') } - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructPtrHeadOmitEmptyIntPtrString: p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -833,14 +838,14 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) + b = appendStructHead(ctx, b) } if (code.Flags & encoder.IndirectFlags) != 0 { p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) @@ -850,7 +855,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b b = append(b, '"') b = appendInt(b, ptrToUint64(p), code) b = append(b, '"') - b = appendComma(b) + b = appendComma(ctx, b) } code = code.Next case encoder.OpStructPtrHeadUint: @@ -858,8 +863,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -871,26 +876,26 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) + b = appendStructHead(ctx, b) } b = appendStructKey(ctx, code, b) b = appendUint(b, ptrToUint64(p+uintptr(code.Offset)), code) - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructPtrHeadOmitEmptyUint: if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -902,14 +907,14 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) + b = appendStructHead(ctx, b) } u64 := ptrToUint64(p + uintptr(code.Offset)) v := u64 & ((1 << code.NumBitSize) - 1) @@ -918,7 +923,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b } else { b = appendStructKey(ctx, code, b) b = appendUint(b, u64, code) - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next } case encoder.OpStructPtrHeadUintString: @@ -926,8 +931,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -939,28 +944,28 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) + b = appendStructHead(ctx, b) } b = appendStructKey(ctx, code, b) b = append(b, '"') b = appendUint(b, ptrToUint64(p+uintptr(code.Offset)), code) b = append(b, '"') - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructPtrHeadOmitEmptyUintString: if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -972,14 +977,14 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) + b = appendStructHead(ctx, b) } u64 := ptrToUint64(p + uintptr(code.Offset)) v := u64 & ((1 << code.NumBitSize) - 1) @@ -990,15 +995,15 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b b = append(b, '"') b = appendUint(b, u64, code) b = append(b, '"') - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next } case encoder.OpStructPtrHeadUintPtr: p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -1009,32 +1014,32 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) + b = appendStructHead(ctx, b) } b = appendStructKey(ctx, code, b) if (code.Flags & encoder.IndirectFlags) != 0 { p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p == 0 { - b = appendNull(b) + b = appendNull(ctx, b) } else { b = appendUint(b, ptrToUint64(p), code) } - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructPtrHeadOmitEmptyUintPtr: p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -1045,14 +1050,14 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) + b = appendStructHead(ctx, b) } if (code.Flags & encoder.IndirectFlags) != 0 { p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) @@ -1060,15 +1065,15 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b if p != 0 { b = appendStructKey(ctx, code, b) b = appendUint(b, ptrToUint64(p), code) - b = appendComma(b) + b = appendComma(ctx, b) } code = code.Next case encoder.OpStructPtrHeadUintPtrString: p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -1079,34 +1084,34 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) + b = appendStructHead(ctx, b) } b = appendStructKey(ctx, code, b) if (code.Flags & encoder.IndirectFlags) != 0 { p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p == 0 { - b = appendNull(b) + b = appendNull(ctx, b) } else { b = append(b, '"') b = appendUint(b, ptrToUint64(p), code) b = append(b, '"') } - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructPtrHeadOmitEmptyUintPtrString: p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -1117,14 +1122,14 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) + b = appendStructHead(ctx, b) } if (code.Flags & encoder.IndirectFlags) != 0 { p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) @@ -1134,7 +1139,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b b = append(b, '"') b = appendUint(b, ptrToUint64(p), code) b = append(b, '"') - b = appendComma(b) + b = appendComma(ctx, b) } code = code.Next case encoder.OpStructPtrHeadFloat32: @@ -1142,8 +1147,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -1155,26 +1160,26 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) + b = appendStructHead(ctx, b) } b = appendStructKey(ctx, code, b) - b = appendFloat32(b, ptrToFloat32(p+uintptr(code.Offset))) - b = appendComma(b) + b = appendFloat32(ctx, b, ptrToFloat32(p+uintptr(code.Offset))) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructPtrHeadOmitEmptyFloat32: if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -1186,22 +1191,22 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) + b = appendStructHead(ctx, b) } v := ptrToFloat32(p + uintptr(code.Offset)) if v == 0 { code = code.NextField } else { b = appendStructKey(ctx, code, b) - b = appendFloat32(b, v) - b = appendComma(b) + b = appendFloat32(ctx, b, v) + b = appendComma(ctx, b) code = code.Next } case encoder.OpStructPtrHeadFloat32String: @@ -1209,8 +1214,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -1222,28 +1227,28 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) + b = appendStructHead(ctx, b) } b = appendStructKey(ctx, code, b) b = append(b, '"') - b = appendFloat32(b, ptrToFloat32(p+uintptr(code.Offset))) + b = appendFloat32(ctx, b, ptrToFloat32(p+uintptr(code.Offset))) b = append(b, '"') - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructPtrHeadOmitEmptyFloat32String: if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -1255,14 +1260,14 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) + b = appendStructHead(ctx, b) } v := ptrToFloat32(p + uintptr(code.Offset)) if v == 0 { @@ -1270,17 +1275,17 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b } else { b = appendStructKey(ctx, code, b) b = append(b, '"') - b = appendFloat32(b, v) + b = appendFloat32(ctx, b, v) b = append(b, '"') - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next } case encoder.OpStructPtrHeadFloat32Ptr: p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -1291,32 +1296,32 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) + b = appendStructHead(ctx, b) } b = appendStructKey(ctx, code, b) if (code.Flags & encoder.IndirectFlags) != 0 { p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p == 0 { - b = appendNull(b) + b = appendNull(ctx, b) } else { - b = appendFloat32(b, ptrToFloat32(p)) + b = appendFloat32(ctx, b, ptrToFloat32(p)) } - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructPtrHeadOmitEmptyFloat32Ptr: p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -1327,30 +1332,30 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) + b = appendStructHead(ctx, b) } if (code.Flags & encoder.IndirectFlags) != 0 { p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p != 0 { b = appendStructKey(ctx, code, b) - b = appendFloat32(b, ptrToFloat32(p)) - b = appendComma(b) + b = appendFloat32(ctx, b, ptrToFloat32(p)) + b = appendComma(ctx, b) } code = code.Next case encoder.OpStructPtrHeadFloat32PtrString: p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -1361,34 +1366,34 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) + b = appendStructHead(ctx, b) } b = appendStructKey(ctx, code, b) if (code.Flags & encoder.IndirectFlags) != 0 { p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p == 0 { - b = appendNull(b) + b = appendNull(ctx, b) } else { b = append(b, '"') - b = appendFloat32(b, ptrToFloat32(p)) + b = appendFloat32(ctx, b, ptrToFloat32(p)) b = append(b, '"') } - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructPtrHeadOmitEmptyFloat32PtrString: p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -1399,14 +1404,14 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) + b = appendStructHead(ctx, b) } if (code.Flags & encoder.IndirectFlags) != 0 { p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) @@ -1414,9 +1419,9 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b if p != 0 { b = appendStructKey(ctx, code, b) b = append(b, '"') - b = appendFloat32(b, ptrToFloat32(p)) + b = appendFloat32(ctx, b, ptrToFloat32(p)) b = append(b, '"') - b = appendComma(b) + b = appendComma(ctx, b) } code = code.Next case encoder.OpStructPtrHeadFloat64: @@ -1424,8 +1429,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -1437,8 +1442,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -1448,19 +1453,19 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b return nil, errUnsupportedFloat(v) } if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) + b = appendStructHead(ctx, b) } b = appendStructKey(ctx, code, b) - b = appendFloat64(b, v) - b = appendComma(b) + b = appendFloat64(ctx, b, v) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructPtrHeadOmitEmptyFloat64: if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -1472,14 +1477,14 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) + b = appendStructHead(ctx, b) } v := ptrToFloat64(p + uintptr(code.Offset)) if v == 0 { @@ -1489,8 +1494,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b return nil, errUnsupportedFloat(v) } b = appendStructKey(ctx, code, b) - b = appendFloat64(b, v) - b = appendComma(b) + b = appendFloat64(ctx, b, v) + b = appendComma(ctx, b) code = code.Next } case encoder.OpStructPtrHeadFloat64String: @@ -1498,8 +1503,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -1511,14 +1516,14 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) + b = appendStructHead(ctx, b) } v := ptrToFloat64(p + uintptr(code.Offset)) if math.IsInf(v, 0) || math.IsNaN(v) { @@ -1526,17 +1531,17 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b } b = appendStructKey(ctx, code, b) b = append(b, '"') - b = appendFloat64(b, v) + b = appendFloat64(ctx, b, v) b = append(b, '"') - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructPtrHeadOmitEmptyFloat64String: if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -1548,14 +1553,14 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) + b = appendStructHead(ctx, b) } v := ptrToFloat64(p + uintptr(code.Offset)) if v == 0 { @@ -1566,17 +1571,17 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b } b = appendStructKey(ctx, code, b) b = append(b, '"') - b = appendFloat64(b, v) + b = appendFloat64(ctx, b, v) b = append(b, '"') - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next } case encoder.OpStructPtrHeadFloat64Ptr: p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -1587,36 +1592,36 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) + b = appendStructHead(ctx, b) } b = appendStructKey(ctx, code, b) if (code.Flags & encoder.IndirectFlags) != 0 { p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p == 0 { - b = appendNull(b) + b = appendNull(ctx, b) } else { v := ptrToFloat64(p) if math.IsInf(v, 0) || math.IsNaN(v) { return nil, errUnsupportedFloat(v) } - b = appendFloat64(b, v) + b = appendFloat64(ctx, b, v) } - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructPtrHeadOmitEmptyFloat64Ptr: p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -1627,14 +1632,14 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) + b = appendStructHead(ctx, b) } if (code.Flags & encoder.IndirectFlags) != 0 { p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) @@ -1645,16 +1650,16 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b if math.IsInf(v, 0) || math.IsNaN(v) { return nil, errUnsupportedFloat(v) } - b = appendFloat64(b, v) - b = appendComma(b) + b = appendFloat64(ctx, b, v) + b = appendComma(ctx, b) } code = code.Next case encoder.OpStructPtrHeadFloat64PtrString: p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -1665,38 +1670,38 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) + b = appendStructHead(ctx, b) } b = appendStructKey(ctx, code, b) if (code.Flags & encoder.IndirectFlags) != 0 { p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p == 0 { - b = appendNull(b) + b = appendNull(ctx, b) } else { b = append(b, '"') v := ptrToFloat64(p) if math.IsInf(v, 0) || math.IsNaN(v) { return nil, errUnsupportedFloat(v) } - b = appendFloat64(b, v) + b = appendFloat64(ctx, b, v) b = append(b, '"') } - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructPtrHeadOmitEmptyFloat64PtrString: p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -1707,14 +1712,14 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) + b = appendStructHead(ctx, b) } if (code.Flags & encoder.IndirectFlags) != 0 { p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) @@ -1726,9 +1731,9 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b if math.IsInf(v, 0) || math.IsNaN(v) { return nil, errUnsupportedFloat(v) } - b = appendFloat64(b, v) + b = appendFloat64(ctx, b, v) b = append(b, '"') - b = appendComma(b) + b = appendComma(ctx, b) } code = code.Next case encoder.OpStructPtrHeadString: @@ -1736,8 +1741,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -1749,26 +1754,26 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) + b = appendStructHead(ctx, b) } b = appendStructKey(ctx, code, b) - b = appendString(b, ptrToString(p+uintptr(code.Offset))) - b = appendComma(b) + b = appendString(ctx, b, ptrToString(p+uintptr(code.Offset))) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructPtrHeadOmitEmptyString: if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -1780,22 +1785,22 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) + b = appendStructHead(ctx, b) } v := ptrToString(p + uintptr(code.Offset)) if v == "" { code = code.NextField } else { b = appendStructKey(ctx, code, b) - b = appendString(b, v) - b = appendComma(b) + b = appendString(ctx, b, v) + b = appendComma(ctx, b) code = code.Next } case encoder.OpStructPtrHeadStringString: @@ -1803,8 +1808,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -1816,26 +1821,26 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) + b = appendStructHead(ctx, b) } b = appendStructKey(ctx, code, b) - b = appendString(b, string(appendString([]byte{}, ptrToString(p+uintptr(code.Offset))))) - b = appendComma(b) + b = appendString(ctx, b, string(appendString(ctx, []byte{}, ptrToString(p+uintptr(code.Offset))))) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructPtrHeadOmitEmptyStringString: if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -1847,30 +1852,30 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) + b = appendStructHead(ctx, b) } v := ptrToString(p + uintptr(code.Offset)) if v == "" { code = code.NextField } else { b = appendStructKey(ctx, code, b) - b = appendString(b, string(appendString([]byte{}, v))) - b = appendComma(b) + b = appendString(ctx, b, string(appendString(ctx, []byte{}, v))) + b = appendComma(ctx, b) code = code.Next } case encoder.OpStructPtrHeadStringPtr: p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -1881,32 +1886,32 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) + b = appendStructHead(ctx, b) } b = appendStructKey(ctx, code, b) if (code.Flags & encoder.IndirectFlags) != 0 { p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p == 0 { - b = appendNull(b) + b = appendNull(ctx, b) } else { - b = appendString(b, ptrToString(p)) + b = appendString(ctx, b, ptrToString(p)) } - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructPtrHeadOmitEmptyStringPtr: p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -1917,30 +1922,30 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) + b = appendStructHead(ctx, b) } if (code.Flags & encoder.IndirectFlags) != 0 { p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p != 0 { b = appendStructKey(ctx, code, b) - b = appendString(b, ptrToString(p)) - b = appendComma(b) + b = appendString(ctx, b, ptrToString(p)) + b = appendComma(ctx, b) } code = code.Next case encoder.OpStructPtrHeadStringPtrString: p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -1951,32 +1956,32 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) + b = appendStructHead(ctx, b) } b = appendStructKey(ctx, code, b) if (code.Flags & encoder.IndirectFlags) != 0 { p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p == 0 { - b = appendNull(b) + b = appendNull(ctx, b) } else { - b = appendString(b, string(appendString([]byte{}, ptrToString(p)))) + b = appendString(ctx, b, string(appendString(ctx, []byte{}, ptrToString(p)))) } - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructPtrHeadOmitEmptyStringPtrString: p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -1987,22 +1992,22 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) + b = appendStructHead(ctx, b) } if (code.Flags & encoder.IndirectFlags) != 0 { p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p != 0 { b = appendStructKey(ctx, code, b) - b = appendString(b, string(appendString([]byte{}, ptrToString(p)))) - b = appendComma(b) + b = appendString(ctx, b, string(appendString(ctx, []byte{}, ptrToString(p)))) + b = appendComma(ctx, b) } code = code.Next case encoder.OpStructPtrHeadBool: @@ -2010,8 +2015,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -2023,26 +2028,26 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) + b = appendStructHead(ctx, b) } b = appendStructKey(ctx, code, b) - b = appendBool(b, ptrToBool(p+uintptr(code.Offset))) - b = appendComma(b) + b = appendBool(ctx, b, ptrToBool(p+uintptr(code.Offset))) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructPtrHeadOmitEmptyBool: if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -2054,20 +2059,20 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) + b = appendStructHead(ctx, b) } v := ptrToBool(p + uintptr(code.Offset)) if v { b = appendStructKey(ctx, code, b) - b = appendBool(b, v) - b = appendComma(b) + b = appendBool(ctx, b, v) + b = appendComma(ctx, b) code = code.Next } else { code = code.NextField @@ -2077,8 +2082,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -2090,28 +2095,28 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) + b = appendStructHead(ctx, b) } b = appendStructKey(ctx, code, b) b = append(b, '"') - b = appendBool(b, ptrToBool(p+uintptr(code.Offset))) + b = appendBool(ctx, b, ptrToBool(p+uintptr(code.Offset))) b = append(b, '"') - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructPtrHeadOmitEmptyBoolString: if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -2123,22 +2128,22 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) + b = appendStructHead(ctx, b) } v := ptrToBool(p + uintptr(code.Offset)) if v { b = appendStructKey(ctx, code, b) b = append(b, '"') - b = appendBool(b, v) + b = appendBool(ctx, b, v) b = append(b, '"') - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next } else { code = code.NextField @@ -2147,8 +2152,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -2159,32 +2164,32 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) + b = appendStructHead(ctx, b) } b = appendStructKey(ctx, code, b) if (code.Flags & encoder.IndirectFlags) != 0 { p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p == 0 { - b = appendNull(b) + b = appendNull(ctx, b) } else { - b = appendBool(b, ptrToBool(p)) + b = appendBool(ctx, b, ptrToBool(p)) } - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructPtrHeadOmitEmptyBoolPtr: p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -2195,30 +2200,30 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) + b = appendStructHead(ctx, b) } if (code.Flags & encoder.IndirectFlags) != 0 { p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p != 0 { b = appendStructKey(ctx, code, b) - b = appendBool(b, ptrToBool(p)) - b = appendComma(b) + b = appendBool(ctx, b, ptrToBool(p)) + b = appendComma(ctx, b) } code = code.Next case encoder.OpStructPtrHeadBoolPtrString: p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -2229,34 +2234,34 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) + b = appendStructHead(ctx, b) } b = appendStructKey(ctx, code, b) if (code.Flags & encoder.IndirectFlags) != 0 { p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p == 0 { - b = appendNull(b) + b = appendNull(ctx, b) } else { b = append(b, '"') - b = appendBool(b, ptrToBool(p)) + b = appendBool(ctx, b, ptrToBool(p)) b = append(b, '"') } - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructPtrHeadOmitEmptyBoolPtrString: p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -2267,14 +2272,14 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) + b = appendStructHead(ctx, b) } if (code.Flags & encoder.IndirectFlags) != 0 { p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) @@ -2282,9 +2287,9 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b if p != 0 { b = appendStructKey(ctx, code, b) b = append(b, '"') - b = appendBool(b, ptrToBool(p)) + b = appendBool(ctx, b, ptrToBool(p)) b = append(b, '"') - b = appendComma(b) + b = appendComma(ctx, b) } code = code.Next case encoder.OpStructPtrHeadBytes: @@ -2292,8 +2297,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -2305,26 +2310,26 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) + b = appendStructHead(ctx, b) } b = appendStructKey(ctx, code, b) - b = appendByteSlice(b, ptrToBytes(p+uintptr(code.Offset))) - b = appendComma(b) + b = appendByteSlice(ctx, b, ptrToBytes(p+uintptr(code.Offset))) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructPtrHeadOmitEmptyBytes: if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -2336,30 +2341,30 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) + b = appendStructHead(ctx, b) } v := ptrToBytes(p + uintptr(code.Offset)) if len(v) == 0 { code = code.NextField } else { b = appendStructKey(ctx, code, b) - b = appendByteSlice(b, v) - b = appendComma(b) + b = appendByteSlice(ctx, b, v) + b = appendComma(ctx, b) code = code.Next } case encoder.OpStructPtrHeadBytesPtr: p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -2370,32 +2375,32 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) + b = appendStructHead(ctx, b) } b = appendStructKey(ctx, code, b) if (code.Flags & encoder.IndirectFlags) != 0 { p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p == 0 { - b = appendNull(b) + b = appendNull(ctx, b) } else { - b = appendByteSlice(b, ptrToBytes(p)) + b = appendByteSlice(ctx, b, ptrToBytes(p)) } - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructPtrHeadOmitEmptyBytesPtr: p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -2406,22 +2411,22 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) + b = appendStructHead(ctx, b) } if (code.Flags & encoder.IndirectFlags) != 0 { p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p != 0 { b = appendStructKey(ctx, code, b) - b = appendByteSlice(b, ptrToBytes(p)) - b = appendComma(b) + b = appendByteSlice(ctx, b, ptrToBytes(p)) + b = appendComma(ctx, b) } code = code.Next case encoder.OpStructPtrHeadNumber: @@ -2429,8 +2434,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -2442,29 +2447,29 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) + b = appendStructHead(ctx, b) } b = appendStructKey(ctx, code, b) - bb, err := appendNumber(b, ptrToNumber(p+uintptr(code.Offset))) + bb, err := appendNumber(ctx, b, ptrToNumber(p+uintptr(code.Offset))) if err != nil { return nil, err } - b = appendComma(bb) + b = appendComma(ctx, bb) code = code.Next case encoder.OpStructPtrHeadOmitEmptyNumber: if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -2476,25 +2481,25 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) + b = appendStructHead(ctx, b) } v := ptrToNumber(p + uintptr(code.Offset)) if v == "" { code = code.NextField } else { b = appendStructKey(ctx, code, b) - bb, err := appendNumber(b, v) + bb, err := appendNumber(ctx, b, v) if err != nil { return nil, err } - b = appendComma(bb) + b = appendComma(ctx, bb) code = code.Next } case encoder.OpStructPtrHeadNumberString: @@ -2502,8 +2507,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -2515,31 +2520,31 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) + b = appendStructHead(ctx, b) } b = appendStructKey(ctx, code, b) b = append(b, '"') - bb, err := appendNumber(b, ptrToNumber(p+uintptr(code.Offset))) + bb, err := appendNumber(ctx, b, ptrToNumber(p+uintptr(code.Offset))) if err != nil { return nil, err } b = append(bb, '"') - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructPtrHeadOmitEmptyNumberString: if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -2551,14 +2556,14 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) + b = appendStructHead(ctx, b) } v := ptrToNumber(p + uintptr(code.Offset)) if v == "" { @@ -2566,20 +2571,20 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b } else { b = appendStructKey(ctx, code, b) b = append(b, '"') - bb, err := appendNumber(b, v) + bb, err := appendNumber(ctx, b, v) if err != nil { return nil, err } b = append(bb, '"') - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next } case encoder.OpStructPtrHeadNumberPtr: p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -2590,36 +2595,36 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) + b = appendStructHead(ctx, b) } b = appendStructKey(ctx, code, b) if (code.Flags & encoder.IndirectFlags) != 0 { p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p == 0 { - b = appendNull(b) + b = appendNull(ctx, b) } else { - bb, err := appendNumber(b, ptrToNumber(p)) + bb, err := appendNumber(ctx, b, ptrToNumber(p)) if err != nil { return nil, err } b = bb } - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructPtrHeadOmitEmptyNumberPtr: p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -2630,33 +2635,33 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) + b = appendStructHead(ctx, b) } if (code.Flags & encoder.IndirectFlags) != 0 { p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p != 0 { b = appendStructKey(ctx, code, b) - bb, err := appendNumber(b, ptrToNumber(p)) + bb, err := appendNumber(ctx, b, ptrToNumber(p)) if err != nil { return nil, err } - b = appendComma(bb) + b = appendComma(ctx, bb) } code = code.Next case encoder.OpStructPtrHeadNumberPtrString: p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -2667,37 +2672,37 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) + b = appendStructHead(ctx, b) } b = appendStructKey(ctx, code, b) if (code.Flags & encoder.IndirectFlags) != 0 { p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p == 0 { - b = appendNull(b) + b = appendNull(ctx, b) } else { b = append(b, '"') - bb, err := appendNumber(b, ptrToNumber(p)) + bb, err := appendNumber(ctx, b, ptrToNumber(p)) if err != nil { return nil, err } b = append(bb, '"') } - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructPtrHeadOmitEmptyNumberPtrString: p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -2708,14 +2713,14 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) + b = appendStructHead(ctx, b) } if (code.Flags & encoder.IndirectFlags) != 0 { p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) @@ -2723,12 +2728,12 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b if p != 0 { b = appendStructKey(ctx, code, b) b = append(b, '"') - bb, err := appendNumber(b, ptrToNumber(p)) + bb, err := appendNumber(ctx, b, ptrToNumber(p)) if err != nil { return nil, err } b = append(bb, '"') - b = appendComma(b) + b = appendComma(ctx, b) } code = code.Next case encoder.OpStructPtrHeadArray, encoder.OpStructPtrHeadSlice: @@ -2736,8 +2741,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -2749,14 +2754,14 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) + b = appendStructHead(ctx, b) } b = appendStructKey(ctx, code, b) p += uintptr(code.Offset) @@ -2767,8 +2772,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -2780,14 +2785,14 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) + b = appendStructHead(ctx, b) } p += uintptr(code.Offset) b = appendStructKey(ctx, code, b) @@ -2798,8 +2803,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -2811,14 +2816,14 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) + b = appendStructHead(ctx, b) } p += uintptr(code.Offset) slice := ptrToSlice(p) @@ -2833,8 +2838,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -2845,22 +2850,22 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) + b = appendStructHead(ctx, b) } b = appendStructKey(ctx, code, b) if (code.Flags & encoder.IndirectFlags) != 0 { p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) code = code.NextField } else { code = code.Next @@ -2870,8 +2875,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -2882,14 +2887,14 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) + b = appendStructHead(ctx, b) } if (code.Flags & encoder.IndirectFlags) != 0 { p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) @@ -2905,8 +2910,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -2917,14 +2922,14 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) + b = appendStructHead(ctx, b) } b = appendStructKey(ctx, code, b) if p != 0 && (code.Flags&encoder.IndirectFlags) != 0 { @@ -2936,8 +2941,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -2948,14 +2953,14 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) + b = appendStructHead(ctx, b) } if p != 0 && (code.Flags&encoder.IndirectFlags) != 0 { p = ptrToPtr(p + uintptr(code.Offset)) @@ -2971,8 +2976,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -2983,26 +2988,26 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) + b = appendStructHead(ctx, b) } b = appendStructKey(ctx, code, b) if p == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) code = code.NextField break } p = ptrToPtr(p + uintptr(code.Offset)) if p == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) code = code.NextField } else { if (code.Flags & encoder.IndirectFlags) != 0 { @@ -3015,8 +3020,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -3027,14 +3032,14 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) + b = appendStructHead(ctx, b) } if p == 0 { code = code.NextField @@ -3055,8 +3060,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -3069,14 +3074,14 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) + b = appendStructHead(ctx, b) } b = appendStructKey(ctx, code, b) if (code.Flags & encoder.IsNilableTypeFlags) != 0 { @@ -3085,7 +3090,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b } } if p == 0 && (code.Flags&encoder.NilCheckFlags) != 0 { - b = appendNull(b) + b = appendNull(ctx, b) } else { bb, err := appendMarshalJSON(ctx, code, b, ptrToInterface(code, p)) if err != nil { @@ -3093,14 +3098,14 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b } b = bb } - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructPtrHeadOmitEmptyMarshalJSON: p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -3113,14 +3118,14 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) + b = appendStructHead(ctx, b) } if (code.Flags & encoder.IsNilableTypeFlags) != 0 { if (code.Flags&encoder.IndirectFlags) != 0 || code.Op == encoder.OpStructPtrHeadOmitEmptyMarshalJSON { @@ -3137,15 +3142,15 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b return nil, err } b = bb - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next } case encoder.OpStructPtrHeadMarshalJSONPtr: p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -3156,21 +3161,21 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) + b = appendStructHead(ctx, b) } b = appendStructKey(ctx, code, b) if (code.Flags & encoder.IndirectFlags) != 0 { p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p == 0 { - b = appendNull(b) + b = appendNull(ctx, b) } else { bb, err := appendMarshalJSON(ctx, code, b, ptrToInterface(code, p)) if err != nil { @@ -3178,14 +3183,14 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b } b = bb } - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructPtrHeadOmitEmptyMarshalJSONPtr: p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -3196,8 +3201,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -3206,7 +3211,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) + b = appendStructHead(ctx, b) } if p == 0 { code = code.NextField @@ -3217,15 +3222,15 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b return nil, err } b = bb - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next } case encoder.OpStructPtrHeadMarshalText: p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -3238,14 +3243,14 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) + b = appendStructHead(ctx, b) } b = appendStructKey(ctx, code, b) if (code.Flags & encoder.IsNilableTypeFlags) != 0 { @@ -3254,22 +3259,22 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b } } if p == 0 && (code.Flags&encoder.NilCheckFlags) != 0 { - b = appendNull(b) + b = appendNull(ctx, b) } else { - bb, err := appendMarshalText(code, b, ptrToInterface(code, p)) + bb, err := appendMarshalText(ctx, code, b, ptrToInterface(code, p)) if err != nil { return nil, err } b = bb } - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructPtrHeadOmitEmptyMarshalText: p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -3282,14 +3287,14 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) + b = appendStructHead(ctx, b) } if (code.Flags & encoder.IsNilableTypeFlags) != 0 { if (code.Flags&encoder.IndirectFlags) != 0 || code.Op == encoder.OpStructPtrHeadOmitEmptyMarshalText { @@ -3300,20 +3305,20 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b code = code.NextField } else { b = appendStructKey(ctx, code, b) - bb, err := appendMarshalText(code, b, ptrToInterface(code, p)) + bb, err := appendMarshalText(ctx, code, b, ptrToInterface(code, p)) if err != nil { return nil, err } b = bb - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next } case encoder.OpStructPtrHeadMarshalTextPtr: p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -3324,36 +3329,36 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) + b = appendStructHead(ctx, b) } b = appendStructKey(ctx, code, b) if (code.Flags & encoder.IndirectFlags) != 0 { p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p == 0 { - b = appendNull(b) + b = appendNull(ctx, b) } else { - bb, err := appendMarshalText(code, b, ptrToInterface(code, p)) + bb, err := appendMarshalText(ctx, code, b, ptrToInterface(code, p)) if err != nil { return nil, err } b = bb } - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructPtrHeadOmitEmptyMarshalTextPtr: p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -3364,8 +3369,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -3374,18 +3379,18 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) + b = appendStructHead(ctx, b) } if p == 0 { code = code.NextField } else { b = appendStructKey(ctx, code, b) - bb, err := appendMarshalText(code, b, ptrToInterface(code, p)) + bb, err := appendMarshalText(ctx, code, b, ptrToInterface(code, p)) if err != nil { return nil, err } b = bb - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next } case encoder.OpStructField: @@ -3409,7 +3414,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) b = appendInt(b, ptrToUint64(p+uintptr(code.Offset)), code) - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructFieldOmitEmptyInt: p := load(ctxptr, code.Idx) @@ -3418,7 +3423,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b if v != 0 { b = appendStructKey(ctx, code, b) b = appendInt(b, u64, code) - b = appendComma(b) + b = appendComma(ctx, b) } code = code.Next case encoder.OpStructFieldIntString: @@ -3427,7 +3432,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b b = append(b, '"') b = appendInt(b, ptrToUint64(p+uintptr(code.Offset)), code) b = append(b, '"') - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructFieldOmitEmptyIntString: p := load(ctxptr, code.Idx) @@ -3438,7 +3443,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b b = append(b, '"') b = appendInt(b, u64, code) b = append(b, '"') - b = appendComma(b) + b = appendComma(ctx, b) } code = code.Next case encoder.OpStructFieldIntPtr: @@ -3446,11 +3451,11 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) b = appendStructKey(ctx, code, b) if p == 0 { - b = appendNull(b) + b = appendNull(ctx, b) } else { b = appendInt(b, ptrToUint64(p), code) } - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructFieldOmitEmptyIntPtr: p := load(ctxptr, code.Idx) @@ -3458,7 +3463,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b if p != 0 { b = appendStructKey(ctx, code, b) b = appendInt(b, ptrToUint64(p), code) - b = appendComma(b) + b = appendComma(ctx, b) } code = code.Next case encoder.OpStructFieldIntPtrString: @@ -3466,13 +3471,13 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) b = appendStructKey(ctx, code, b) if p == 0 { - b = appendNull(b) + b = appendNull(ctx, b) } else { b = append(b, '"') b = appendInt(b, ptrToUint64(p), code) b = append(b, '"') } - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructFieldOmitEmptyIntPtrString: p := load(ctxptr, code.Idx) @@ -3482,14 +3487,14 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b b = append(b, '"') b = appendInt(b, ptrToUint64(p), code) b = append(b, '"') - b = appendComma(b) + b = appendComma(ctx, b) } code = code.Next case encoder.OpStructFieldUint: p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) b = appendUint(b, ptrToUint64(p+uintptr(code.Offset)), code) - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructFieldOmitEmptyUint: p := load(ctxptr, code.Idx) @@ -3498,7 +3503,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b if v != 0 { b = appendStructKey(ctx, code, b) b = appendUint(b, u64, code) - b = appendComma(b) + b = appendComma(ctx, b) } code = code.Next case encoder.OpStructFieldUintString: @@ -3507,7 +3512,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b b = append(b, '"') b = appendUint(b, ptrToUint64(p+uintptr(code.Offset)), code) b = append(b, '"') - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructFieldOmitEmptyUintString: p := load(ctxptr, code.Idx) @@ -3518,7 +3523,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b b = append(b, '"') b = appendUint(b, u64, code) b = append(b, '"') - b = appendComma(b) + b = appendComma(ctx, b) } code = code.Next case encoder.OpStructFieldUintPtr: @@ -3526,11 +3531,11 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) b = appendStructKey(ctx, code, b) if p == 0 { - b = appendNull(b) + b = appendNull(ctx, b) } else { b = appendUint(b, ptrToUint64(p), code) } - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructFieldOmitEmptyUintPtr: p := load(ctxptr, code.Idx) @@ -3538,7 +3543,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b if p != 0 { b = appendStructKey(ctx, code, b) b = appendUint(b, ptrToUint64(p), code) - b = appendComma(b) + b = appendComma(ctx, b) } code = code.Next case encoder.OpStructFieldUintPtrString: @@ -3546,13 +3551,13 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) b = appendStructKey(ctx, code, b) if p == 0 { - b = appendNull(b) + b = appendNull(ctx, b) } else { b = append(b, '"') b = appendUint(b, ptrToUint64(p), code) b = append(b, '"') } - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructFieldOmitEmptyUintPtrString: p := load(ctxptr, code.Idx) @@ -3562,31 +3567,31 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b b = append(b, '"') b = appendUint(b, ptrToUint64(p), code) b = append(b, '"') - b = appendComma(b) + b = appendComma(ctx, b) } code = code.Next case encoder.OpStructFieldFloat32: p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) - b = appendFloat32(b, ptrToFloat32(p+uintptr(code.Offset))) - b = appendComma(b) + b = appendFloat32(ctx, b, ptrToFloat32(p+uintptr(code.Offset))) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructFieldOmitEmptyFloat32: p := load(ctxptr, code.Idx) v := ptrToFloat32(p + uintptr(code.Offset)) if v != 0 { b = appendStructKey(ctx, code, b) - b = appendFloat32(b, v) - b = appendComma(b) + b = appendFloat32(ctx, b, v) + b = appendComma(ctx, b) } code = code.Next case encoder.OpStructFieldFloat32String: p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) b = append(b, '"') - b = appendFloat32(b, ptrToFloat32(p+uintptr(code.Offset))) + b = appendFloat32(ctx, b, ptrToFloat32(p+uintptr(code.Offset))) b = append(b, '"') - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructFieldOmitEmptyFloat32String: p := load(ctxptr, code.Idx) @@ -3594,9 +3599,9 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b if v != 0 { b = appendStructKey(ctx, code, b) b = append(b, '"') - b = appendFloat32(b, v) + b = appendFloat32(ctx, b, v) b = append(b, '"') - b = appendComma(b) + b = appendComma(ctx, b) } code = code.Next case encoder.OpStructFieldFloat32Ptr: @@ -3604,19 +3609,19 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) b = appendStructKey(ctx, code, b) if p == 0 { - b = appendNull(b) + b = appendNull(ctx, b) } else { - b = appendFloat32(b, ptrToFloat32(p)) + b = appendFloat32(ctx, b, ptrToFloat32(p)) } - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructFieldOmitEmptyFloat32Ptr: p := load(ctxptr, code.Idx) p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p != 0 { b = appendStructKey(ctx, code, b) - b = appendFloat32(b, ptrToFloat32(p)) - b = appendComma(b) + b = appendFloat32(ctx, b, ptrToFloat32(p)) + b = appendComma(ctx, b) } code = code.Next case encoder.OpStructFieldFloat32PtrString: @@ -3624,13 +3629,13 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) b = appendStructKey(ctx, code, b) if p == 0 { - b = appendNull(b) + b = appendNull(ctx, b) } else { b = append(b, '"') - b = appendFloat32(b, ptrToFloat32(p)) + b = appendFloat32(ctx, b, ptrToFloat32(p)) b = append(b, '"') } - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructFieldOmitEmptyFloat32PtrString: p := load(ctxptr, code.Idx) @@ -3638,9 +3643,9 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b if p != 0 { b = appendStructKey(ctx, code, b) b = append(b, '"') - b = appendFloat32(b, ptrToFloat32(p)) + b = appendFloat32(ctx, b, ptrToFloat32(p)) b = append(b, '"') - b = appendComma(b) + b = appendComma(ctx, b) } code = code.Next case encoder.OpStructFieldFloat64: @@ -3650,8 +3655,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b if math.IsInf(v, 0) || math.IsNaN(v) { return nil, errUnsupportedFloat(v) } - b = appendFloat64(b, v) - b = appendComma(b) + b = appendFloat64(ctx, b, v) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructFieldOmitEmptyFloat64: p := load(ctxptr, code.Idx) @@ -3661,8 +3666,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b return nil, errUnsupportedFloat(v) } b = appendStructKey(ctx, code, b) - b = appendFloat64(b, v) - b = appendComma(b) + b = appendFloat64(ctx, b, v) + b = appendComma(ctx, b) } code = code.Next case encoder.OpStructFieldFloat64String: @@ -3673,9 +3678,9 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b } b = appendStructKey(ctx, code, b) b = append(b, '"') - b = appendFloat64(b, v) + b = appendFloat64(ctx, b, v) b = append(b, '"') - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructFieldOmitEmptyFloat64String: p := load(ctxptr, code.Idx) @@ -3686,9 +3691,9 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b } b = appendStructKey(ctx, code, b) b = append(b, '"') - b = appendFloat64(b, v) + b = appendFloat64(ctx, b, v) b = append(b, '"') - b = appendComma(b) + b = appendComma(ctx, b) } code = code.Next case encoder.OpStructFieldFloat64Ptr: @@ -3696,8 +3701,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) b = appendStructKey(ctx, code, b) if p == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) code = code.Next break } @@ -3705,8 +3710,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b if math.IsInf(v, 0) || math.IsNaN(v) { return nil, errUnsupportedFloat(v) } - b = appendFloat64(b, v) - b = appendComma(b) + b = appendFloat64(ctx, b, v) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructFieldOmitEmptyFloat64Ptr: p := load(ctxptr, code.Idx) @@ -3717,8 +3722,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b if math.IsInf(v, 0) || math.IsNaN(v) { return nil, errUnsupportedFloat(v) } - b = appendFloat64(b, v) - b = appendComma(b) + b = appendFloat64(ctx, b, v) + b = appendComma(ctx, b) } code = code.Next case encoder.OpStructFieldFloat64PtrString: @@ -3726,17 +3731,17 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) b = appendStructKey(ctx, code, b) if p == 0 { - b = appendNull(b) + b = appendNull(ctx, b) } else { v := ptrToFloat64(p) if math.IsInf(v, 0) || math.IsNaN(v) { return nil, errUnsupportedFloat(v) } b = append(b, '"') - b = appendFloat64(b, v) + b = appendFloat64(ctx, b, v) b = append(b, '"') } - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructFieldOmitEmptyFloat64PtrString: p := load(ctxptr, code.Idx) @@ -3748,40 +3753,40 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b if math.IsInf(v, 0) || math.IsNaN(v) { return nil, errUnsupportedFloat(v) } - b = appendFloat64(b, v) + b = appendFloat64(ctx, b, v) b = append(b, '"') - b = appendComma(b) + b = appendComma(ctx, b) } code = code.Next case encoder.OpStructFieldString: p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) - b = appendString(b, ptrToString(p+uintptr(code.Offset))) - b = appendComma(b) + b = appendString(ctx, b, ptrToString(p+uintptr(code.Offset))) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructFieldOmitEmptyString: p := load(ctxptr, code.Idx) v := ptrToString(p + uintptr(code.Offset)) if v != "" { b = appendStructKey(ctx, code, b) - b = appendString(b, v) - b = appendComma(b) + b = appendString(ctx, b, v) + b = appendComma(ctx, b) } code = code.Next case encoder.OpStructFieldStringString: p := load(ctxptr, code.Idx) s := ptrToString(p + uintptr(code.Offset)) b = appendStructKey(ctx, code, b) - b = appendString(b, string(appendString([]byte{}, s))) - b = appendComma(b) + b = appendString(ctx, b, string(appendString(ctx, []byte{}, s))) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructFieldOmitEmptyStringString: p := load(ctxptr, code.Idx) v := ptrToString(p + uintptr(code.Offset)) if v != "" { b = appendStructKey(ctx, code, b) - b = appendString(b, string(appendString([]byte{}, v))) - b = appendComma(b) + b = appendString(ctx, b, string(appendString(ctx, []byte{}, v))) + b = appendComma(ctx, b) } code = code.Next case encoder.OpStructFieldStringPtr: @@ -3789,19 +3794,19 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) b = appendStructKey(ctx, code, b) if p == 0 { - b = appendNull(b) + b = appendNull(ctx, b) } else { - b = appendString(b, ptrToString(p)) + b = appendString(ctx, b, ptrToString(p)) } - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructFieldOmitEmptyStringPtr: p := load(ctxptr, code.Idx) p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p != 0 { b = appendStructKey(ctx, code, b) - b = appendString(b, ptrToString(p)) - b = appendComma(b) + b = appendString(ctx, b, ptrToString(p)) + b = appendComma(ctx, b) } code = code.Next case encoder.OpStructFieldStringPtrString: @@ -3809,43 +3814,43 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) b = appendStructKey(ctx, code, b) if p == 0 { - b = appendNull(b) + b = appendNull(ctx, b) } else { - b = appendString(b, string(appendString([]byte{}, ptrToString(p)))) + b = appendString(ctx, b, string(appendString(ctx, []byte{}, ptrToString(p)))) } - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructFieldOmitEmptyStringPtrString: p := load(ctxptr, code.Idx) p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p != 0 { b = appendStructKey(ctx, code, b) - b = appendString(b, string(appendString([]byte{}, ptrToString(p)))) - b = appendComma(b) + b = appendString(ctx, b, string(appendString(ctx, []byte{}, ptrToString(p)))) + b = appendComma(ctx, b) } code = code.Next case encoder.OpStructFieldBool: p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) - b = appendBool(b, ptrToBool(p+uintptr(code.Offset))) - b = appendComma(b) + b = appendBool(ctx, b, ptrToBool(p+uintptr(code.Offset))) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructFieldOmitEmptyBool: p := load(ctxptr, code.Idx) v := ptrToBool(p + uintptr(code.Offset)) if v { b = appendStructKey(ctx, code, b) - b = appendBool(b, v) - b = appendComma(b) + b = appendBool(ctx, b, v) + b = appendComma(ctx, b) } code = code.Next case encoder.OpStructFieldBoolString: p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) b = append(b, '"') - b = appendBool(b, ptrToBool(p+uintptr(code.Offset))) + b = appendBool(ctx, b, ptrToBool(p+uintptr(code.Offset))) b = append(b, '"') - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructFieldOmitEmptyBoolString: p := load(ctxptr, code.Idx) @@ -3853,9 +3858,9 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b if v { b = appendStructKey(ctx, code, b) b = append(b, '"') - b = appendBool(b, v) + b = appendBool(ctx, b, v) b = append(b, '"') - b = appendComma(b) + b = appendComma(ctx, b) } code = code.Next case encoder.OpStructFieldBoolPtr: @@ -3863,19 +3868,19 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) b = appendStructKey(ctx, code, b) if p == 0 { - b = appendNull(b) + b = appendNull(ctx, b) } else { - b = appendBool(b, ptrToBool(p)) + b = appendBool(ctx, b, ptrToBool(p)) } - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructFieldOmitEmptyBoolPtr: p := load(ctxptr, code.Idx) p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p != 0 { b = appendStructKey(ctx, code, b) - b = appendBool(b, ptrToBool(p)) - b = appendComma(b) + b = appendBool(ctx, b, ptrToBool(p)) + b = appendComma(ctx, b) } code = code.Next case encoder.OpStructFieldBoolPtrString: @@ -3883,13 +3888,13 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) b = appendStructKey(ctx, code, b) if p == 0 { - b = appendNull(b) + b = appendNull(ctx, b) } else { b = append(b, '"') - b = appendBool(b, ptrToBool(p)) + b = appendBool(ctx, b, ptrToBool(p)) b = append(b, '"') } - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructFieldOmitEmptyBoolPtrString: p := load(ctxptr, code.Idx) @@ -3897,24 +3902,24 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b if p != 0 { b = appendStructKey(ctx, code, b) b = append(b, '"') - b = appendBool(b, ptrToBool(p)) + b = appendBool(ctx, b, ptrToBool(p)) b = append(b, '"') - b = appendComma(b) + b = appendComma(ctx, b) } code = code.Next case encoder.OpStructFieldBytes: p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) - b = appendByteSlice(b, ptrToBytes(p+uintptr(code.Offset))) - b = appendComma(b) + b = appendByteSlice(ctx, b, ptrToBytes(p+uintptr(code.Offset))) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructFieldOmitEmptyBytes: p := load(ctxptr, code.Idx) v := ptrToBytes(p + uintptr(code.Offset)) if len(v) > 0 { b = appendStructKey(ctx, code, b) - b = appendByteSlice(b, v) - b = appendComma(b) + b = appendByteSlice(ctx, b, v) + b = appendComma(ctx, b) } code = code.Next case encoder.OpStructFieldBytesPtr: @@ -3922,52 +3927,52 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) b = appendStructKey(ctx, code, b) if p == 0 { - b = appendNull(b) + b = appendNull(ctx, b) } else { - b = appendByteSlice(b, ptrToBytes(p)) + b = appendByteSlice(ctx, b, ptrToBytes(p)) } - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructFieldOmitEmptyBytesPtr: p := load(ctxptr, code.Idx) p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p != 0 { b = appendStructKey(ctx, code, b) - b = appendByteSlice(b, ptrToBytes(p)) - b = appendComma(b) + b = appendByteSlice(ctx, b, ptrToBytes(p)) + b = appendComma(ctx, b) } code = code.Next case encoder.OpStructFieldNumber: p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) - bb, err := appendNumber(b, ptrToNumber(p+uintptr(code.Offset))) + bb, err := appendNumber(ctx, b, ptrToNumber(p+uintptr(code.Offset))) if err != nil { return nil, err } - b = appendComma(bb) + b = appendComma(ctx, bb) code = code.Next case encoder.OpStructFieldOmitEmptyNumber: p := load(ctxptr, code.Idx) v := ptrToNumber(p + uintptr(code.Offset)) if v != "" { b = appendStructKey(ctx, code, b) - bb, err := appendNumber(b, v) + bb, err := appendNumber(ctx, b, v) if err != nil { return nil, err } - b = appendComma(bb) + b = appendComma(ctx, bb) } code = code.Next case encoder.OpStructFieldNumberString: p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) b = append(b, '"') - bb, err := appendNumber(b, ptrToNumber(p+uintptr(code.Offset))) + bb, err := appendNumber(ctx, b, ptrToNumber(p+uintptr(code.Offset))) if err != nil { return nil, err } b = append(bb, '"') - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructFieldOmitEmptyNumberString: p := load(ctxptr, code.Idx) @@ -3975,12 +3980,12 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b if v != "" { b = appendStructKey(ctx, code, b) b = append(b, '"') - bb, err := appendNumber(b, v) + bb, err := appendNumber(ctx, b, v) if err != nil { return nil, err } b = append(bb, '"') - b = appendComma(b) + b = appendComma(ctx, b) } code = code.Next case encoder.OpStructFieldNumberPtr: @@ -3988,26 +3993,26 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) b = appendStructKey(ctx, code, b) if p == 0 { - b = appendNull(b) + b = appendNull(ctx, b) } else { - bb, err := appendNumber(b, ptrToNumber(p)) + bb, err := appendNumber(ctx, b, ptrToNumber(p)) if err != nil { return nil, err } b = bb } - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructFieldOmitEmptyNumberPtr: p := load(ctxptr, code.Idx) p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p != 0 { b = appendStructKey(ctx, code, b) - bb, err := appendNumber(b, ptrToNumber(p)) + bb, err := appendNumber(ctx, b, ptrToNumber(p)) if err != nil { return nil, err } - b = appendComma(bb) + b = appendComma(ctx, bb) } code = code.Next case encoder.OpStructFieldNumberPtrString: @@ -4015,16 +4020,16 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) b = appendStructKey(ctx, code, b) if p == 0 { - b = appendNull(b) + b = appendNull(ctx, b) } else { b = append(b, '"') - bb, err := appendNumber(b, ptrToNumber(p)) + bb, err := appendNumber(ctx, b, ptrToNumber(p)) if err != nil { return nil, err } b = append(bb, '"') } - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructFieldOmitEmptyNumberPtrString: p := load(ctxptr, code.Idx) @@ -4032,12 +4037,12 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b if p != 0 { b = appendStructKey(ctx, code, b) b = append(b, '"') - bb, err := appendNumber(b, ptrToNumber(p)) + bb, err := appendNumber(ctx, b, ptrToNumber(p)) if err != nil { return nil, err } b = append(bb, '"') - b = appendComma(b) + b = appendComma(ctx, b) } code = code.Next case encoder.OpStructFieldMarshalJSON: @@ -4048,7 +4053,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p = ptrToPtr(p) } if p == 0 && (code.Flags&encoder.NilCheckFlags) != 0 { - b = appendNull(b) + b = appendNull(ctx, b) } else { bb, err := appendMarshalJSON(ctx, code, b, ptrToInterface(code, p)) if err != nil { @@ -4056,7 +4061,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b } b = bb } - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructFieldOmitEmptyMarshalJSON: p := load(ctxptr, code.Idx) @@ -4078,14 +4083,14 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b if err != nil { return nil, err } - b = appendComma(bb) + b = appendComma(ctx, bb) code = code.Next case encoder.OpStructFieldMarshalJSONPtr: p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p == 0 { - b = appendNull(b) + b = appendNull(ctx, b) } else { bb, err := appendMarshalJSON(ctx, code, b, ptrToInterface(code, p)) if err != nil { @@ -4093,7 +4098,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b } b = bb } - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructFieldOmitEmptyMarshalJSONPtr: p := load(ctxptr, code.Idx) @@ -4104,7 +4109,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b if err != nil { return nil, err } - b = appendComma(bb) + b = appendComma(ctx, bb) } code = code.Next case encoder.OpStructFieldMarshalText: @@ -4115,15 +4120,15 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p = ptrToPtr(p) } if p == 0 && (code.Flags&encoder.NilCheckFlags) != 0 { - b = appendNull(b) + b = appendNull(ctx, b) } else { - bb, err := appendMarshalText(code, b, ptrToInterface(code, p)) + bb, err := appendMarshalText(ctx, code, b, ptrToInterface(code, p)) if err != nil { return nil, err } b = bb } - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructFieldOmitEmptyMarshalText: p := load(ctxptr, code.Idx) @@ -4136,37 +4141,37 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b break } b = appendStructKey(ctx, code, b) - bb, err := appendMarshalText(code, b, ptrToInterface(code, p)) + bb, err := appendMarshalText(ctx, code, b, ptrToInterface(code, p)) if err != nil { return nil, err } - b = appendComma(bb) + b = appendComma(ctx, bb) code = code.Next case encoder.OpStructFieldMarshalTextPtr: p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p == 0 { - b = appendNull(b) + b = appendNull(ctx, b) } else { - bb, err := appendMarshalText(code, b, ptrToInterface(code, p)) + bb, err := appendMarshalText(ctx, code, b, ptrToInterface(code, p)) if err != nil { return nil, err } b = bb } - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructFieldOmitEmptyMarshalTextPtr: p := load(ctxptr, code.Idx) p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p != 0 { b = appendStructKey(ctx, code, b) - bb, err := appendMarshalText(code, b, ptrToInterface(code, p)) + bb, err := appendMarshalText(ctx, code, b, ptrToInterface(code, p)) if err != nil { return nil, err } - b = appendComma(bb) + b = appendComma(ctx, bb) } code = code.Next case encoder.OpStructFieldArray: @@ -4334,7 +4339,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p == 0 { - b = appendNull(b) + b = appendNull(ctx, b) } else { b = appendInt(b, ptrToUint64(p), code) } @@ -4356,7 +4361,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p == 0 { - b = appendNull(b) + b = appendNull(ctx, b) } else { b = append(b, '"') b = appendInt(b, ptrToUint64(p), code) @@ -4422,7 +4427,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p == 0 { - b = appendNull(b) + b = appendNull(ctx, b) } else { b = appendUint(b, ptrToUint64(p), code) } @@ -4444,7 +4449,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p == 0 { - b = appendNull(b) + b = appendNull(ctx, b) } else { b = append(b, '"') b = appendUint(b, ptrToUint64(p), code) @@ -4468,7 +4473,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b case encoder.OpStructEndFloat32: p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) - b = appendFloat32(b, ptrToFloat32(p+uintptr(code.Offset))) + b = appendFloat32(ctx, b, ptrToFloat32(p+uintptr(code.Offset))) b = appendStructEnd(ctx, code, b) code = code.Next case encoder.OpStructEndOmitEmptyFloat32: @@ -4476,7 +4481,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b v := ptrToFloat32(p + uintptr(code.Offset)) if v != 0 { b = appendStructKey(ctx, code, b) - b = appendFloat32(b, v) + b = appendFloat32(ctx, b, v) b = appendStructEnd(ctx, code, b) } else { b = appendStructEndSkipLast(ctx, code, b) @@ -4486,7 +4491,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) b = append(b, '"') - b = appendFloat32(b, ptrToFloat32(p+uintptr(code.Offset))) + b = appendFloat32(ctx, b, ptrToFloat32(p+uintptr(code.Offset))) b = append(b, '"') b = appendStructEnd(ctx, code, b) code = code.Next @@ -4496,7 +4501,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b if v != 0 { b = appendStructKey(ctx, code, b) b = append(b, '"') - b = appendFloat32(b, v) + b = appendFloat32(ctx, b, v) b = append(b, '"') b = appendStructEnd(ctx, code, b) } else { @@ -4508,9 +4513,9 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p == 0 { - b = appendNull(b) + b = appendNull(ctx, b) } else { - b = appendFloat32(b, ptrToFloat32(p)) + b = appendFloat32(ctx, b, ptrToFloat32(p)) } b = appendStructEnd(ctx, code, b) code = code.Next @@ -4519,7 +4524,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p != 0 { b = appendStructKey(ctx, code, b) - b = appendFloat32(b, ptrToFloat32(p)) + b = appendFloat32(ctx, b, ptrToFloat32(p)) b = appendStructEnd(ctx, code, b) } else { b = appendStructEndSkipLast(ctx, code, b) @@ -4530,10 +4535,10 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p == 0 { - b = appendNull(b) + b = appendNull(ctx, b) } else { b = append(b, '"') - b = appendFloat32(b, ptrToFloat32(p)) + b = appendFloat32(ctx, b, ptrToFloat32(p)) b = append(b, '"') } b = appendStructEnd(ctx, code, b) @@ -4544,7 +4549,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b if p != 0 { b = appendStructKey(ctx, code, b) b = append(b, '"') - b = appendFloat32(b, ptrToFloat32(p)) + b = appendFloat32(ctx, b, ptrToFloat32(p)) b = append(b, '"') b = appendStructEnd(ctx, code, b) } else { @@ -4558,7 +4563,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b return nil, errUnsupportedFloat(v) } b = appendStructKey(ctx, code, b) - b = appendFloat64(b, v) + b = appendFloat64(ctx, b, v) b = appendStructEnd(ctx, code, b) code = code.Next case encoder.OpStructEndOmitEmptyFloat64: @@ -4569,7 +4574,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b return nil, errUnsupportedFloat(v) } b = appendStructKey(ctx, code, b) - b = appendFloat64(b, v) + b = appendFloat64(ctx, b, v) b = appendStructEnd(ctx, code, b) } else { b = appendStructEndSkipLast(ctx, code, b) @@ -4583,7 +4588,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b } b = appendStructKey(ctx, code, b) b = append(b, '"') - b = appendFloat64(b, v) + b = appendFloat64(ctx, b, v) b = append(b, '"') b = appendStructEnd(ctx, code, b) code = code.Next @@ -4596,7 +4601,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b } b = appendStructKey(ctx, code, b) b = append(b, '"') - b = appendFloat64(b, v) + b = appendFloat64(ctx, b, v) b = append(b, '"') b = appendStructEnd(ctx, code, b) } else { @@ -4608,7 +4613,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p == 0 { - b = appendNull(b) + b = appendNull(ctx, b) b = appendStructEnd(ctx, code, b) code = code.Next break @@ -4617,7 +4622,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b if math.IsInf(v, 0) || math.IsNaN(v) { return nil, errUnsupportedFloat(v) } - b = appendFloat64(b, v) + b = appendFloat64(ctx, b, v) b = appendStructEnd(ctx, code, b) code = code.Next case encoder.OpStructEndOmitEmptyFloat64Ptr: @@ -4629,7 +4634,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b if math.IsInf(v, 0) || math.IsNaN(v) { return nil, errUnsupportedFloat(v) } - b = appendFloat64(b, v) + b = appendFloat64(ctx, b, v) b = appendStructEnd(ctx, code, b) } else { b = appendStructEndSkipLast(ctx, code, b) @@ -4640,14 +4645,14 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p == 0 { - b = appendNull(b) + b = appendNull(ctx, b) } else { b = append(b, '"') v := ptrToFloat64(p) if math.IsInf(v, 0) || math.IsNaN(v) { return nil, errUnsupportedFloat(v) } - b = appendFloat64(b, v) + b = appendFloat64(ctx, b, v) b = append(b, '"') } b = appendStructEnd(ctx, code, b) @@ -4662,7 +4667,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b return nil, errUnsupportedFloat(v) } b = append(b, '"') - b = appendFloat64(b, v) + b = appendFloat64(ctx, b, v) b = append(b, '"') b = appendStructEnd(ctx, code, b) } else { @@ -4672,7 +4677,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b case encoder.OpStructEndString: p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) - b = appendString(b, ptrToString(p+uintptr(code.Offset))) + b = appendString(ctx, b, ptrToString(p+uintptr(code.Offset))) b = appendStructEnd(ctx, code, b) code = code.Next case encoder.OpStructEndOmitEmptyString: @@ -4680,7 +4685,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b v := ptrToString(p + uintptr(code.Offset)) if v != "" { b = appendStructKey(ctx, code, b) - b = appendString(b, v) + b = appendString(ctx, b, v) b = appendStructEnd(ctx, code, b) } else { b = appendStructEndSkipLast(ctx, code, b) @@ -4690,7 +4695,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) s := ptrToString(p + uintptr(code.Offset)) - b = appendString(b, string(appendString([]byte{}, s))) + b = appendString(ctx, b, string(appendString(ctx, []byte{}, s))) b = appendStructEnd(ctx, code, b) code = code.Next case encoder.OpStructEndOmitEmptyStringString: @@ -4698,7 +4703,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b v := ptrToString(p + uintptr(code.Offset)) if v != "" { b = appendStructKey(ctx, code, b) - b = appendString(b, string(appendString([]byte{}, v))) + b = appendString(ctx, b, string(appendString(ctx, []byte{}, v))) b = appendStructEnd(ctx, code, b) } else { b = appendStructEndSkipLast(ctx, code, b) @@ -4709,9 +4714,9 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p == 0 { - b = appendNull(b) + b = appendNull(ctx, b) } else { - b = appendString(b, ptrToString(p)) + b = appendString(ctx, b, ptrToString(p)) } b = appendStructEnd(ctx, code, b) code = code.Next @@ -4720,7 +4725,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p != 0 { b = appendStructKey(ctx, code, b) - b = appendString(b, ptrToString(p)) + b = appendString(ctx, b, ptrToString(p)) b = appendStructEnd(ctx, code, b) } else { b = appendStructEndSkipLast(ctx, code, b) @@ -4731,9 +4736,9 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p == 0 { - b = appendNull(b) + b = appendNull(ctx, b) } else { - b = appendString(b, string(appendString([]byte{}, ptrToString(p)))) + b = appendString(ctx, b, string(appendString(ctx, []byte{}, ptrToString(p)))) } b = appendStructEnd(ctx, code, b) code = code.Next @@ -4742,7 +4747,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p != 0 { b = appendStructKey(ctx, code, b) - b = appendString(b, string(appendString([]byte{}, ptrToString(p)))) + b = appendString(ctx, b, string(appendString(ctx, []byte{}, ptrToString(p)))) b = appendStructEnd(ctx, code, b) } else { b = appendStructEndSkipLast(ctx, code, b) @@ -4751,7 +4756,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b case encoder.OpStructEndBool: p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) - b = appendBool(b, ptrToBool(p+uintptr(code.Offset))) + b = appendBool(ctx, b, ptrToBool(p+uintptr(code.Offset))) b = appendStructEnd(ctx, code, b) code = code.Next case encoder.OpStructEndOmitEmptyBool: @@ -4759,7 +4764,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b v := ptrToBool(p + uintptr(code.Offset)) if v { b = appendStructKey(ctx, code, b) - b = appendBool(b, v) + b = appendBool(ctx, b, v) b = appendStructEnd(ctx, code, b) } else { b = appendStructEndSkipLast(ctx, code, b) @@ -4769,7 +4774,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) b = append(b, '"') - b = appendBool(b, ptrToBool(p+uintptr(code.Offset))) + b = appendBool(ctx, b, ptrToBool(p+uintptr(code.Offset))) b = append(b, '"') b = appendStructEnd(ctx, code, b) code = code.Next @@ -4779,7 +4784,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b if v { b = appendStructKey(ctx, code, b) b = append(b, '"') - b = appendBool(b, v) + b = appendBool(ctx, b, v) b = append(b, '"') b = appendStructEnd(ctx, code, b) } else { @@ -4791,9 +4796,9 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p == 0 { - b = appendNull(b) + b = appendNull(ctx, b) } else { - b = appendBool(b, ptrToBool(p)) + b = appendBool(ctx, b, ptrToBool(p)) } b = appendStructEnd(ctx, code, b) code = code.Next @@ -4802,7 +4807,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p != 0 { b = appendStructKey(ctx, code, b) - b = appendBool(b, ptrToBool(p)) + b = appendBool(ctx, b, ptrToBool(p)) b = appendStructEnd(ctx, code, b) } else { b = appendStructEndSkipLast(ctx, code, b) @@ -4813,10 +4818,10 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p == 0 { - b = appendNull(b) + b = appendNull(ctx, b) } else { b = append(b, '"') - b = appendBool(b, ptrToBool(p)) + b = appendBool(ctx, b, ptrToBool(p)) b = append(b, '"') } b = appendStructEnd(ctx, code, b) @@ -4827,7 +4832,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b if p != 0 { b = appendStructKey(ctx, code, b) b = append(b, '"') - b = appendBool(b, ptrToBool(p)) + b = appendBool(ctx, b, ptrToBool(p)) b = append(b, '"') b = appendStructEnd(ctx, code, b) } else { @@ -4837,7 +4842,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b case encoder.OpStructEndBytes: p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) - b = appendByteSlice(b, ptrToBytes(p+uintptr(code.Offset))) + b = appendByteSlice(ctx, b, ptrToBytes(p+uintptr(code.Offset))) b = appendStructEnd(ctx, code, b) code = code.Next case encoder.OpStructEndOmitEmptyBytes: @@ -4845,7 +4850,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b v := ptrToBytes(p + uintptr(code.Offset)) if len(v) > 0 { b = appendStructKey(ctx, code, b) - b = appendByteSlice(b, v) + b = appendByteSlice(ctx, b, v) b = appendStructEnd(ctx, code, b) } else { b = appendStructEndSkipLast(ctx, code, b) @@ -4856,9 +4861,9 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p == 0 { - b = appendNull(b) + b = appendNull(ctx, b) } else { - b = appendByteSlice(b, ptrToBytes(p)) + b = appendByteSlice(ctx, b, ptrToBytes(p)) } b = appendStructEnd(ctx, code, b) code = code.Next @@ -4867,7 +4872,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p != 0 { b = appendStructKey(ctx, code, b) - b = appendByteSlice(b, ptrToBytes(p)) + b = appendByteSlice(ctx, b, ptrToBytes(p)) b = appendStructEnd(ctx, code, b) } else { b = appendStructEndSkipLast(ctx, code, b) @@ -4876,7 +4881,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b case encoder.OpStructEndNumber: p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) - bb, err := appendNumber(b, ptrToNumber(p+uintptr(code.Offset))) + bb, err := appendNumber(ctx, b, ptrToNumber(p+uintptr(code.Offset))) if err != nil { return nil, err } @@ -4887,7 +4892,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b v := ptrToNumber(p + uintptr(code.Offset)) if v != "" { b = appendStructKey(ctx, code, b) - bb, err := appendNumber(b, v) + bb, err := appendNumber(ctx, b, v) if err != nil { return nil, err } @@ -4900,7 +4905,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) b = append(b, '"') - bb, err := appendNumber(b, ptrToNumber(p+uintptr(code.Offset))) + bb, err := appendNumber(ctx, b, ptrToNumber(p+uintptr(code.Offset))) if err != nil { return nil, err } @@ -4913,7 +4918,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b if v != "" { b = appendStructKey(ctx, code, b) b = append(b, '"') - bb, err := appendNumber(b, v) + bb, err := appendNumber(ctx, b, v) if err != nil { return nil, err } @@ -4928,9 +4933,9 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p == 0 { - b = appendNull(b) + b = appendNull(ctx, b) } else { - bb, err := appendNumber(b, ptrToNumber(p)) + bb, err := appendNumber(ctx, b, ptrToNumber(p)) if err != nil { return nil, err } @@ -4943,7 +4948,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p != 0 { b = appendStructKey(ctx, code, b) - bb, err := appendNumber(b, ptrToNumber(p)) + bb, err := appendNumber(ctx, b, ptrToNumber(p)) if err != nil { return nil, err } @@ -4957,10 +4962,10 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p == 0 { - b = appendNull(b) + b = appendNull(ctx, b) } else { b = append(b, '"') - bb, err := appendNumber(b, ptrToNumber(p)) + bb, err := appendNumber(ctx, b, ptrToNumber(p)) if err != nil { return nil, err } @@ -4974,7 +4979,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b if p != 0 { b = appendStructKey(ctx, code, b) b = append(b, '"') - bb, err := appendNumber(b, ptrToNumber(p)) + bb, err := appendNumber(ctx, b, ptrToNumber(p)) if err != nil { return nil, err } diff --git a/internal/encoder/compiler.go b/internal/encoder/compiler.go index 36b555e..ea05f3f 100644 --- a/internal/encoder/compiler.go +++ b/internal/encoder/compiler.go @@ -1456,7 +1456,8 @@ func compileStruct(ctx *compileContext, isPtr bool) (*Opcode, error) { } var key string if ctx.escapeKey { - key = fmt.Sprintf(`%s:`, string(AppendEscapedString([]byte{}, tag.Key))) + rctx := &RuntimeContext{Option: &Option{HTMLEscape: true}} + key = fmt.Sprintf(`%s:`, string(AppendString(rctx, []byte{}, tag.Key))) } else { key = fmt.Sprintf(`"%s":`, tag.Key) } diff --git a/internal/encoder/context.go b/internal/encoder/context.go index e917134..ffc1d8b 100644 --- a/internal/encoder/context.go +++ b/internal/encoder/context.go @@ -112,11 +112,10 @@ type RuntimeContext struct { BaseIndent uint32 Prefix []byte IndentStr []byte - Code *Opcode Option *Option } -func (c *RuntimeContext) Init(code *Opcode, p uintptr, codelen int) { +func (c *RuntimeContext) Init(p uintptr, codelen int) { if len(c.Ptrs) < codelen { c.Ptrs = make([]uintptr, codelen) } @@ -124,7 +123,6 @@ func (c *RuntimeContext) Init(code *Opcode, p uintptr, codelen int) { c.KeepRefs = c.KeepRefs[:0] c.SeenPtr = c.SeenPtr[:0] c.BaseIndent = 0 - c.Code = code } func (c *RuntimeContext) Ptr() uintptr { diff --git a/internal/encoder/encoder.go b/internal/encoder/encoder.go index 4ab4c4d..0a737c9 100644 --- a/internal/encoder/encoder.go +++ b/internal/encoder/encoder.go @@ -269,7 +269,7 @@ func MapIterNext(it unsafe.Pointer) //go:noescape func MapLen(m unsafe.Pointer) int -func AppendByteSlice(b []byte, src []byte) []byte { +func AppendByteSlice(_ *RuntimeContext, b []byte, src []byte) []byte { if src == nil { return append(b, `null`...) } @@ -287,7 +287,7 @@ func AppendByteSlice(b []byte, src []byte) []byte { return append(append(b, buf...), '"') } -func AppendFloat32(b []byte, v float32) []byte { +func AppendFloat32(_ *RuntimeContext, b []byte, v float32) []byte { f64 := float64(v) abs := math.Abs(f64) fmt := byte('f') @@ -301,7 +301,7 @@ func AppendFloat32(b []byte, v float32) []byte { return strconv.AppendFloat(b, f64, fmt, -1, 32) } -func AppendFloat64(b []byte, v float64) []byte { +func AppendFloat64(_ *RuntimeContext, b []byte, v float64) []byte { abs := math.Abs(v) fmt := byte('f') // Note: Must use float32 comparisons for underlying float32 value to get precise cutoffs right. @@ -313,7 +313,7 @@ func AppendFloat64(b []byte, v float64) []byte { return strconv.AppendFloat(b, v, fmt, -1, 64) } -func AppendBool(b []byte, v bool) []byte { +func AppendBool(_ *RuntimeContext, b []byte, v bool) []byte { if v { return append(b, "true"...) } @@ -340,7 +340,7 @@ var ( } ) -func AppendNumber(b []byte, n json.Number) ([]byte, error) { +func AppendNumber(_ *RuntimeContext, b []byte, n json.Number) ([]byte, error) { if len(n) == 0 { return append(b, '0'), nil } @@ -353,7 +353,7 @@ func AppendNumber(b []byte, n json.Number) ([]byte, error) { return b, nil } -func AppendMarshalJSON(ctx *RuntimeContext, code *Opcode, b []byte, v interface{}, escape bool) ([]byte, error) { +func AppendMarshalJSON(ctx *RuntimeContext, code *Opcode, b []byte, v interface{}) ([]byte, error) { rv := reflect.ValueOf(v) // convert by dynamic interface type if (code.Flags & AddrForMarshalerFlags) != 0 { if rv.CanAddr() { @@ -367,7 +367,7 @@ func AppendMarshalJSON(ctx *RuntimeContext, code *Opcode, b []byte, v interface{ v = rv.Interface() marshaler, ok := v.(json.Marshaler) if !ok { - return AppendNull(b), nil + return AppendNull(ctx, b), nil } bb, err := marshaler.MarshalJSON() if err != nil { @@ -375,7 +375,7 @@ func AppendMarshalJSON(ctx *RuntimeContext, code *Opcode, b []byte, v interface{ } marshalBuf := ctx.MarshalBuf[:0] marshalBuf = append(append(marshalBuf, bb...), nul) - compactedBuf, err := compact(b, marshalBuf, escape) + compactedBuf, err := compact(b, marshalBuf, ctx.Option.HTMLEscape) if err != nil { return nil, &errors.MarshalerError{Type: reflect.TypeOf(v), Err: err} } @@ -383,7 +383,7 @@ func AppendMarshalJSON(ctx *RuntimeContext, code *Opcode, b []byte, v interface{ return compactedBuf, nil } -func AppendMarshalJSONIndent(ctx *RuntimeContext, code *Opcode, b []byte, v interface{}, escape bool) ([]byte, error) { +func AppendMarshalJSONIndent(ctx *RuntimeContext, code *Opcode, b []byte, v interface{}) ([]byte, error) { rv := reflect.ValueOf(v) // convert by dynamic interface type if (code.Flags & AddrForMarshalerFlags) != 0 { if rv.CanAddr() { @@ -397,7 +397,7 @@ func AppendMarshalJSONIndent(ctx *RuntimeContext, code *Opcode, b []byte, v inte v = rv.Interface() marshaler, ok := v.(json.Marshaler) if !ok { - return AppendNull(b), nil + return AppendNull(ctx, b), nil } bb, err := marshaler.MarshalJSON() if err != nil { @@ -410,7 +410,7 @@ func AppendMarshalJSONIndent(ctx *RuntimeContext, code *Opcode, b []byte, v inte marshalBuf, string(ctx.Prefix)+strings.Repeat(string(ctx.IndentStr), int(ctx.BaseIndent+code.Indent)), string(ctx.IndentStr), - escape, + ctx.Option.HTMLEscape, ) if err != nil { return nil, &errors.MarshalerError{Type: reflect.TypeOf(v), Err: err} @@ -419,7 +419,7 @@ func AppendMarshalJSONIndent(ctx *RuntimeContext, code *Opcode, b []byte, v inte return indentedBuf, nil } -func AppendMarshalText(code *Opcode, b []byte, v interface{}, escape bool) ([]byte, error) { +func AppendMarshalText(ctx *RuntimeContext, code *Opcode, b []byte, v interface{}) ([]byte, error) { rv := reflect.ValueOf(v) // convert by dynamic interface type if (code.Flags & AddrForMarshalerFlags) != 0 { if rv.CanAddr() { @@ -433,19 +433,16 @@ func AppendMarshalText(code *Opcode, b []byte, v interface{}, escape bool) ([]by v = rv.Interface() marshaler, ok := v.(encoding.TextMarshaler) if !ok { - return AppendNull(b), nil + return AppendNull(ctx, b), nil } bytes, err := marshaler.MarshalText() if err != nil { return nil, &errors.MarshalerError{Type: reflect.TypeOf(v), Err: err} } - if escape { - return AppendEscapedString(b, *(*string)(unsafe.Pointer(&bytes))), nil - } - return AppendString(b, *(*string)(unsafe.Pointer(&bytes))), nil + return AppendString(ctx, b, *(*string)(unsafe.Pointer(&bytes))), nil } -func AppendMarshalTextIndent(code *Opcode, b []byte, v interface{}, escape bool) ([]byte, error) { +func AppendMarshalTextIndent(ctx *RuntimeContext, code *Opcode, b []byte, v interface{}) ([]byte, error) { rv := reflect.ValueOf(v) // convert by dynamic interface type if (code.Flags & AddrForMarshalerFlags) != 0 { if rv.CanAddr() { @@ -459,31 +456,28 @@ func AppendMarshalTextIndent(code *Opcode, b []byte, v interface{}, escape bool) v = rv.Interface() marshaler, ok := v.(encoding.TextMarshaler) if !ok { - return AppendNull(b), nil + return AppendNull(ctx, b), nil } bytes, err := marshaler.MarshalText() if err != nil { return nil, &errors.MarshalerError{Type: reflect.TypeOf(v), Err: err} } - if escape { - return AppendEscapedString(b, *(*string)(unsafe.Pointer(&bytes))), nil - } - return AppendString(b, *(*string)(unsafe.Pointer(&bytes))), nil + return AppendString(ctx, b, *(*string)(unsafe.Pointer(&bytes))), nil } -func AppendNull(b []byte) []byte { +func AppendNull(_ *RuntimeContext, b []byte) []byte { return append(b, "null"...) } -func AppendComma(b []byte) []byte { +func AppendComma(_ *RuntimeContext, b []byte) []byte { return append(b, ',') } -func AppendCommaIndent(b []byte) []byte { +func AppendCommaIndent(_ *RuntimeContext, b []byte) []byte { return append(b, ',', '\n') } -func AppendStructEnd(b []byte) []byte { +func AppendStructEnd(_ *RuntimeContext, b []byte) []byte { return append(b, '}', ',') } diff --git a/internal/encoder/string.go b/internal/encoder/string.go index 26da31a..da2c26d 100644 --- a/internal/encoder/string.go +++ b/internal/encoder/string.go @@ -405,7 +405,10 @@ func stringToUint64Slice(s string) []uint64 { })) } -func AppendEscapedString(buf []byte, s string) []byte { +func AppendString(ctx *RuntimeContext, buf []byte, s string) []byte { + if !ctx.Option.HTMLEscape { + return appendString(buf, s) + } valLen := len(s) if valLen == 0 { return append(buf, `""`...) @@ -531,7 +534,7 @@ ESCAPE_END: return append(append(buf, s[i:]...), '"') } -func AppendString(buf []byte, s string) []byte { +func appendString(buf []byte, s string) []byte { valLen := len(s) if valLen == 0 { return append(buf, `""`...) diff --git a/internal/encoder/vm/debug_vm.go b/internal/encoder/vm/debug_vm.go index 5891c55..7bd8d12 100644 --- a/internal/encoder/vm/debug_vm.go +++ b/internal/encoder/vm/debug_vm.go @@ -8,13 +8,20 @@ import ( func DebugRun(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]byte, error) { defer func() { + var code *encoder.Opcode + if ctx.Option.HTMLEscape { + code = codeSet.EscapeKeyCode + } else { + code = codeSet.NoescapeKeyCode + } + if err := recover(); err != nil { fmt.Println("=============[DEBUG]===============") fmt.Println("* [TYPE]") fmt.Println(codeSet.Type) fmt.Printf("\n") fmt.Println("* [ALL OPCODE]") - fmt.Println(ctx.Code.Dump()) + fmt.Println(code.Dump()) fmt.Printf("\n") fmt.Println("* [CONTEXT]") fmt.Printf("%+v\n", ctx) diff --git a/internal/encoder/vm/hack.go b/internal/encoder/vm/hack.go index ec24ee3..27bf348 100644 --- a/internal/encoder/vm/hack.go +++ b/internal/encoder/vm/hack.go @@ -2,8 +2,8 @@ package vm import ( // HACK: compile order - // `vm`, `vm_escaped`, `vm_indent`, `vm_escaped_indent` packages uses a lot of memory to compile, + // `vm`, `vm_indent` packages uses a lot of memory to compile, // so forcibly make dependencies and avoid compiling in concurrent. - // dependency order: vm => vm_escaped => vm_indent => vm_escaped_indent - _ "github.com/goccy/go-json/internal/encoder/vm_escaped" + // dependency order: vm => vm_indent + _ "github.com/goccy/go-json/internal/encoder/vm_indent" ) diff --git a/internal/encoder/vm/util.go b/internal/encoder/vm/util.go index f0d29c2..7e358e2 100644 --- a/internal/encoder/vm/util.go +++ b/internal/encoder/vm/util.go @@ -90,22 +90,22 @@ func ptrToInterface(code *encoder.Opcode, p uintptr) interface{} { })) } -func appendBool(b []byte, v bool) []byte { +func appendBool(_ *encoder.RuntimeContext, b []byte, v bool) []byte { if v { return append(b, "true"...) } return append(b, "false"...) } -func appendNull(b []byte) []byte { +func appendNull(_ *encoder.RuntimeContext, b []byte) []byte { return append(b, "null"...) } -func appendComma(b []byte) []byte { +func appendComma(_ *encoder.RuntimeContext, b []byte) []byte { return append(b, ',') } -func appendColon(b []byte) []byte { +func appendColon(_ *encoder.RuntimeContext, b []byte) []byte { last := len(b) - 1 b[last] = ':' return b @@ -146,7 +146,6 @@ func appendInterface(ctx *encoder.RuntimeContext, codeSet *encoder.OpcodeSet, _ newPtrs[0] = uintptr(iface.ptr) ctx.Ptrs = newPtrs - ctx.Code = ifaceCodeSet.NoescapeKeyCode bb, err := Run(ctx, b, ifaceCodeSet) if err != nil { @@ -158,11 +157,11 @@ func appendInterface(ctx *encoder.RuntimeContext, codeSet *encoder.OpcodeSet, _ } func appendMarshalJSON(ctx *encoder.RuntimeContext, code *encoder.Opcode, b []byte, v interface{}) ([]byte, error) { - return encoder.AppendMarshalJSON(ctx, code, b, v, false) + return encoder.AppendMarshalJSON(ctx, code, b, v) } -func appendMarshalText(code *encoder.Opcode, b []byte, v interface{}) ([]byte, error) { - return encoder.AppendMarshalText(code, b, v, false) +func appendMarshalText(ctx *encoder.RuntimeContext, code *encoder.Opcode, b []byte, v interface{}) ([]byte, error) { + return encoder.AppendMarshalText(ctx, code, b, v) } func appendArrayHead(_ *encoder.RuntimeContext, _ *encoder.Opcode, b []byte) []byte { @@ -175,11 +174,11 @@ func appendArrayEnd(_ *encoder.RuntimeContext, _ *encoder.Opcode, b []byte) []by return append(b, ',') } -func appendEmptyArray(b []byte) []byte { +func appendEmptyArray(_ *encoder.RuntimeContext, b []byte) []byte { return append(b, '[', ']', ',') } -func appendEmptyObject(b []byte) []byte { +func appendEmptyObject(_ *encoder.RuntimeContext, b []byte) []byte { return append(b, '{', '}', ',') } @@ -189,7 +188,7 @@ func appendObjectEnd(_ *encoder.RuntimeContext, _ *encoder.Opcode, b []byte) []b return append(b, ',') } -func appendStructHead(b []byte) []byte { +func appendStructHead(_ *encoder.RuntimeContext, b []byte) []byte { return append(b, '{') } @@ -205,7 +204,7 @@ func appendStructEndSkipLast(ctx *encoder.RuntimeContext, code *encoder.Opcode, last := len(b) - 1 if b[last] == ',' { b[last] = '}' - return appendComma(b) + return appendComma(ctx, b) } return appendStructEnd(ctx, code, b) } diff --git a/internal/encoder/vm/vm.go b/internal/encoder/vm/vm.go index b68a306..6c1bda1 100644 --- a/internal/encoder/vm/vm.go +++ b/internal/encoder/vm/vm.go @@ -13,7 +13,12 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b recursiveLevel := 0 ptrOffset := uintptr(0) ctxptr := ctx.Ptr() - code := ctx.Code + var code *encoder.Opcode + if ctx.Option.HTMLEscape { + code = codeSet.EscapeKeyCode + } else { + code = codeSet.NoescapeKeyCode + } for { switch code.Op { @@ -26,8 +31,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b case encoder.OpIntPtr: p := loadNPtr(ctxptr, code.Idx, code.PtrNum) if p == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) code = code.Next break } @@ -35,13 +40,13 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b fallthrough case encoder.OpInt: b = appendInt(b, ptrToUint64(load(ctxptr, code.Idx)), code) - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpUintPtr: p := loadNPtr(ctxptr, code.Idx, code.PtrNum) if p == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) code = code.Next break } @@ -49,39 +54,39 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b fallthrough case encoder.OpUint: b = appendUint(b, ptrToUint64(load(ctxptr, code.Idx)), code) - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpIntString: b = append(b, '"') b = appendInt(b, ptrToUint64(load(ctxptr, code.Idx)), code) b = append(b, '"') - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpUintString: b = append(b, '"') b = appendUint(b, ptrToUint64(load(ctxptr, code.Idx)), code) b = append(b, '"') - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpFloat32Ptr: p := loadNPtr(ctxptr, code.Idx, code.PtrNum) if p == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) code = code.Next break } store(ctxptr, code.Idx, p) fallthrough case encoder.OpFloat32: - b = appendFloat32(b, ptrToFloat32(load(ctxptr, code.Idx))) - b = appendComma(b) + b = appendFloat32(ctx, b, ptrToFloat32(load(ctxptr, code.Idx))) + b = appendComma(ctx, b) code = code.Next case encoder.OpFloat64Ptr: p := loadNPtr(ctxptr, code.Idx, code.PtrNum) if p == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) code = code.Next break } @@ -92,73 +97,73 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b if math.IsInf(v, 0) || math.IsNaN(v) { return nil, errUnsupportedFloat(v) } - b = appendFloat64(b, v) - b = appendComma(b) + b = appendFloat64(ctx, b, v) + b = appendComma(ctx, b) code = code.Next case encoder.OpStringPtr: p := loadNPtr(ctxptr, code.Idx, code.PtrNum) if p == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) code = code.Next break } store(ctxptr, code.Idx, p) fallthrough case encoder.OpString: - b = appendString(b, ptrToString(load(ctxptr, code.Idx))) - b = appendComma(b) + b = appendString(ctx, b, ptrToString(load(ctxptr, code.Idx))) + b = appendComma(ctx, b) code = code.Next case encoder.OpBoolPtr: p := loadNPtr(ctxptr, code.Idx, code.PtrNum) if p == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) code = code.Next break } store(ctxptr, code.Idx, p) fallthrough case encoder.OpBool: - b = appendBool(b, ptrToBool(load(ctxptr, code.Idx))) - b = appendComma(b) + b = appendBool(ctx, b, ptrToBool(load(ctxptr, code.Idx))) + b = appendComma(ctx, b) code = code.Next case encoder.OpBytesPtr: p := loadNPtr(ctxptr, code.Idx, code.PtrNum) if p == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) code = code.Next break } store(ctxptr, code.Idx, p) fallthrough case encoder.OpBytes: - b = appendByteSlice(b, ptrToBytes(load(ctxptr, code.Idx))) - b = appendComma(b) + b = appendByteSlice(ctx, b, ptrToBytes(load(ctxptr, code.Idx))) + b = appendComma(ctx, b) code = code.Next case encoder.OpNumberPtr: p := loadNPtr(ctxptr, code.Idx, code.PtrNum) if p == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) code = code.Next break } store(ctxptr, code.Idx, p) fallthrough case encoder.OpNumber: - bb, err := appendNumber(b, ptrToNumber(load(ctxptr, code.Idx))) + bb, err := appendNumber(ctx, b, ptrToNumber(load(ctxptr, code.Idx))) if err != nil { return nil, err } - b = appendComma(bb) + b = appendComma(ctx, bb) code = code.Next case encoder.OpInterfacePtr: p := loadNPtr(ctxptr, code.Idx, code.PtrNum) if p == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) code = code.Next break } @@ -167,8 +172,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b case encoder.OpInterface: p := load(ctxptr, code.Idx) if p == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) code = code.Next break } @@ -180,8 +185,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b ctx.SeenPtr = append(ctx.SeenPtr, p) iface := (*emptyInterface)(ptrToUnsafePtr(p)) if iface.ptr == nil { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) code = code.Next break } @@ -197,8 +202,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b case encoder.OpMarshalJSONPtr: p := load(ctxptr, code.Idx) if p == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) code = code.Next break } @@ -207,8 +212,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b case encoder.OpMarshalJSON: p := load(ctxptr, code.Idx) if p == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) code = code.Next break } @@ -219,13 +224,13 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b if err != nil { return nil, err } - b = appendComma(bb) + b = appendComma(ctx, bb) code = code.Next case encoder.OpMarshalTextPtr: p := load(ctxptr, code.Idx) if p == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) code = code.Next break } @@ -235,24 +240,24 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 { b = append(b, `""`...) - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next break } if (code.Flags&encoder.IsNilableTypeFlags) != 0 && (code.Flags&encoder.IndirectFlags) != 0 { p = ptrToPtr(p) } - bb, err := appendMarshalText(code, b, ptrToInterface(code, p)) + bb, err := appendMarshalText(ctx, code, b, ptrToInterface(code, p)) if err != nil { return nil, err } - b = appendComma(bb) + b = appendComma(ctx, bb) code = code.Next case encoder.OpSlicePtr: p := loadNPtr(ctxptr, code.Idx, code.PtrNum) if p == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) code = code.End.Next break } @@ -262,8 +267,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) slice := ptrToSlice(p) if p == 0 || slice.Data == nil { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) code = code.End.Next break } @@ -275,7 +280,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b code = code.Next store(ctxptr, code.Idx, uintptr(slice.Data)) } else { - b = appendEmptyArray(b) + b = appendEmptyArray(ctx, b) code = code.End.Next } case encoder.OpSliceElem: @@ -296,8 +301,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b case encoder.OpArrayPtr: p := loadNPtr(ctxptr, code.Idx, code.PtrNum) if p == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) code = code.End.Next break } @@ -306,8 +311,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b case encoder.OpArray: p := load(ctxptr, code.Idx) if p == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) code = code.End.Next break } @@ -317,7 +322,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b code = code.Next store(ctxptr, code.Idx, p) } else { - b = appendEmptyArray(b) + b = appendEmptyArray(ctx, b) code = code.End.Next } case encoder.OpArrayElem: @@ -337,8 +342,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b case encoder.OpMapPtr: p := loadNPtr(ctxptr, code.Idx, code.PtrNum) if p == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) code = code.End.Next break } @@ -347,19 +352,19 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b case encoder.OpMap: p := load(ctxptr, code.Idx) if p == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) code = code.End.Next break } uptr := ptrToUnsafePtr(p) mlen := maplen(uptr) if mlen <= 0 { - b = appendEmptyObject(b) + b = appendEmptyObject(ctx, b) code = code.End.Next break } - b = appendStructHead(b) + b = appendStructHead(ctx, b) iter := mapiterinit(code.Type, uptr) ctx.KeepRefs = append(ctx.KeepRefs, iter) store(ctxptr, code.ElemIdx, 0) @@ -410,7 +415,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b } case encoder.OpMapValue: if ctx.Option.UnorderedMap { - b = appendColon(b) + b = appendColon(ctx, b) } else { ptr := load(ctxptr, code.End.MapPos) mapCtx := (*encoder.MapContext)(ptrToUnsafePtr(ptr)) @@ -509,8 +514,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -521,14 +526,14 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 && ((code.Flags&encoder.IndirectFlags) != 0 || code.Next.Op == encoder.OpStructEnd) { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) + b = appendStructHead(ctx, b) } if (code.Flags&encoder.AnonymousKeyFlags) == 0 && len(code.Key) > 0 { b = appendStructKey(ctx, code, b) @@ -540,8 +545,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -552,14 +557,14 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 && ((code.Flags&encoder.IndirectFlags) != 0 || code.Next.Op == encoder.OpStructEnd) { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) + b = appendStructHead(ctx, b) } p += uintptr(code.Offset) if p == 0 || (ptrToPtr(p) == 0 && (code.Flags&encoder.IsNextOpPtrTypeFlags) != 0) { @@ -574,8 +579,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -587,26 +592,26 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) + b = appendStructHead(ctx, b) } b = appendStructKey(ctx, code, b) b = appendInt(b, ptrToUint64(p+uintptr(code.Offset)), code) - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructPtrHeadOmitEmptyInt: if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -618,14 +623,14 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) + b = appendStructHead(ctx, b) } u64 := ptrToUint64(p + uintptr(code.Offset)) v := u64 & ((1 << code.NumBitSize) - 1) @@ -634,7 +639,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b } else { b = appendStructKey(ctx, code, b) b = appendInt(b, u64, code) - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next } case encoder.OpStructPtrHeadIntString: @@ -642,8 +647,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -655,28 +660,28 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) + b = appendStructHead(ctx, b) } b = appendStructKey(ctx, code, b) b = append(b, '"') b = appendInt(b, ptrToUint64(p+uintptr(code.Offset)), code) b = append(b, '"') - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructPtrHeadOmitEmptyIntString: if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -688,14 +693,14 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) + b = appendStructHead(ctx, b) } u64 := ptrToUint64(p + uintptr(code.Offset)) v := u64 & ((1 << code.NumBitSize) - 1) @@ -706,15 +711,15 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b b = append(b, '"') b = appendInt(b, u64, code) b = append(b, '"') - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next } case encoder.OpStructPtrHeadIntPtr: p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -725,32 +730,32 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) + b = appendStructHead(ctx, b) } b = appendStructKey(ctx, code, b) if (code.Flags & encoder.IndirectFlags) != 0 { p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p == 0 { - b = appendNull(b) + b = appendNull(ctx, b) } else { b = appendInt(b, ptrToUint64(p), code) } - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructPtrHeadOmitEmptyIntPtr: p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -761,14 +766,14 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) + b = appendStructHead(ctx, b) } if (code.Flags & encoder.IndirectFlags) != 0 { p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) @@ -776,15 +781,15 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b if p != 0 { b = appendStructKey(ctx, code, b) b = appendInt(b, ptrToUint64(p), code) - b = appendComma(b) + b = appendComma(ctx, b) } code = code.Next case encoder.OpStructPtrHeadIntPtrString: p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -795,34 +800,34 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) + b = appendStructHead(ctx, b) } b = appendStructKey(ctx, code, b) if (code.Flags & encoder.IndirectFlags) != 0 { p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p == 0 { - b = appendNull(b) + b = appendNull(ctx, b) } else { b = append(b, '"') b = appendInt(b, ptrToUint64(p), code) b = append(b, '"') } - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructPtrHeadOmitEmptyIntPtrString: p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -833,14 +838,14 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) + b = appendStructHead(ctx, b) } if (code.Flags & encoder.IndirectFlags) != 0 { p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) @@ -850,7 +855,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b b = append(b, '"') b = appendInt(b, ptrToUint64(p), code) b = append(b, '"') - b = appendComma(b) + b = appendComma(ctx, b) } code = code.Next case encoder.OpStructPtrHeadUint: @@ -858,8 +863,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -871,26 +876,26 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) + b = appendStructHead(ctx, b) } b = appendStructKey(ctx, code, b) b = appendUint(b, ptrToUint64(p+uintptr(code.Offset)), code) - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructPtrHeadOmitEmptyUint: if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -902,14 +907,14 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) + b = appendStructHead(ctx, b) } u64 := ptrToUint64(p + uintptr(code.Offset)) v := u64 & ((1 << code.NumBitSize) - 1) @@ -918,7 +923,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b } else { b = appendStructKey(ctx, code, b) b = appendUint(b, u64, code) - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next } case encoder.OpStructPtrHeadUintString: @@ -926,8 +931,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -939,28 +944,28 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) + b = appendStructHead(ctx, b) } b = appendStructKey(ctx, code, b) b = append(b, '"') b = appendUint(b, ptrToUint64(p+uintptr(code.Offset)), code) b = append(b, '"') - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructPtrHeadOmitEmptyUintString: if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -972,14 +977,14 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) + b = appendStructHead(ctx, b) } u64 := ptrToUint64(p + uintptr(code.Offset)) v := u64 & ((1 << code.NumBitSize) - 1) @@ -990,15 +995,15 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b b = append(b, '"') b = appendUint(b, u64, code) b = append(b, '"') - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next } case encoder.OpStructPtrHeadUintPtr: p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -1009,32 +1014,32 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) + b = appendStructHead(ctx, b) } b = appendStructKey(ctx, code, b) if (code.Flags & encoder.IndirectFlags) != 0 { p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p == 0 { - b = appendNull(b) + b = appendNull(ctx, b) } else { b = appendUint(b, ptrToUint64(p), code) } - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructPtrHeadOmitEmptyUintPtr: p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -1045,14 +1050,14 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) + b = appendStructHead(ctx, b) } if (code.Flags & encoder.IndirectFlags) != 0 { p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) @@ -1060,15 +1065,15 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b if p != 0 { b = appendStructKey(ctx, code, b) b = appendUint(b, ptrToUint64(p), code) - b = appendComma(b) + b = appendComma(ctx, b) } code = code.Next case encoder.OpStructPtrHeadUintPtrString: p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -1079,34 +1084,34 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) + b = appendStructHead(ctx, b) } b = appendStructKey(ctx, code, b) if (code.Flags & encoder.IndirectFlags) != 0 { p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p == 0 { - b = appendNull(b) + b = appendNull(ctx, b) } else { b = append(b, '"') b = appendUint(b, ptrToUint64(p), code) b = append(b, '"') } - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructPtrHeadOmitEmptyUintPtrString: p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -1117,14 +1122,14 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) + b = appendStructHead(ctx, b) } if (code.Flags & encoder.IndirectFlags) != 0 { p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) @@ -1134,7 +1139,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b b = append(b, '"') b = appendUint(b, ptrToUint64(p), code) b = append(b, '"') - b = appendComma(b) + b = appendComma(ctx, b) } code = code.Next case encoder.OpStructPtrHeadFloat32: @@ -1142,8 +1147,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -1155,26 +1160,26 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) + b = appendStructHead(ctx, b) } b = appendStructKey(ctx, code, b) - b = appendFloat32(b, ptrToFloat32(p+uintptr(code.Offset))) - b = appendComma(b) + b = appendFloat32(ctx, b, ptrToFloat32(p+uintptr(code.Offset))) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructPtrHeadOmitEmptyFloat32: if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -1186,22 +1191,22 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) + b = appendStructHead(ctx, b) } v := ptrToFloat32(p + uintptr(code.Offset)) if v == 0 { code = code.NextField } else { b = appendStructKey(ctx, code, b) - b = appendFloat32(b, v) - b = appendComma(b) + b = appendFloat32(ctx, b, v) + b = appendComma(ctx, b) code = code.Next } case encoder.OpStructPtrHeadFloat32String: @@ -1209,8 +1214,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -1222,28 +1227,28 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) + b = appendStructHead(ctx, b) } b = appendStructKey(ctx, code, b) b = append(b, '"') - b = appendFloat32(b, ptrToFloat32(p+uintptr(code.Offset))) + b = appendFloat32(ctx, b, ptrToFloat32(p+uintptr(code.Offset))) b = append(b, '"') - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructPtrHeadOmitEmptyFloat32String: if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -1255,14 +1260,14 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) + b = appendStructHead(ctx, b) } v := ptrToFloat32(p + uintptr(code.Offset)) if v == 0 { @@ -1270,17 +1275,17 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b } else { b = appendStructKey(ctx, code, b) b = append(b, '"') - b = appendFloat32(b, v) + b = appendFloat32(ctx, b, v) b = append(b, '"') - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next } case encoder.OpStructPtrHeadFloat32Ptr: p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -1291,32 +1296,32 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) + b = appendStructHead(ctx, b) } b = appendStructKey(ctx, code, b) if (code.Flags & encoder.IndirectFlags) != 0 { p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p == 0 { - b = appendNull(b) + b = appendNull(ctx, b) } else { - b = appendFloat32(b, ptrToFloat32(p)) + b = appendFloat32(ctx, b, ptrToFloat32(p)) } - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructPtrHeadOmitEmptyFloat32Ptr: p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -1327,30 +1332,30 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) + b = appendStructHead(ctx, b) } if (code.Flags & encoder.IndirectFlags) != 0 { p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p != 0 { b = appendStructKey(ctx, code, b) - b = appendFloat32(b, ptrToFloat32(p)) - b = appendComma(b) + b = appendFloat32(ctx, b, ptrToFloat32(p)) + b = appendComma(ctx, b) } code = code.Next case encoder.OpStructPtrHeadFloat32PtrString: p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -1361,34 +1366,34 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) + b = appendStructHead(ctx, b) } b = appendStructKey(ctx, code, b) if (code.Flags & encoder.IndirectFlags) != 0 { p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p == 0 { - b = appendNull(b) + b = appendNull(ctx, b) } else { b = append(b, '"') - b = appendFloat32(b, ptrToFloat32(p)) + b = appendFloat32(ctx, b, ptrToFloat32(p)) b = append(b, '"') } - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructPtrHeadOmitEmptyFloat32PtrString: p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -1399,14 +1404,14 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) + b = appendStructHead(ctx, b) } if (code.Flags & encoder.IndirectFlags) != 0 { p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) @@ -1414,9 +1419,9 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b if p != 0 { b = appendStructKey(ctx, code, b) b = append(b, '"') - b = appendFloat32(b, ptrToFloat32(p)) + b = appendFloat32(ctx, b, ptrToFloat32(p)) b = append(b, '"') - b = appendComma(b) + b = appendComma(ctx, b) } code = code.Next case encoder.OpStructPtrHeadFloat64: @@ -1424,8 +1429,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -1437,8 +1442,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -1448,19 +1453,19 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b return nil, errUnsupportedFloat(v) } if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) + b = appendStructHead(ctx, b) } b = appendStructKey(ctx, code, b) - b = appendFloat64(b, v) - b = appendComma(b) + b = appendFloat64(ctx, b, v) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructPtrHeadOmitEmptyFloat64: if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -1472,14 +1477,14 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) + b = appendStructHead(ctx, b) } v := ptrToFloat64(p + uintptr(code.Offset)) if v == 0 { @@ -1489,8 +1494,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b return nil, errUnsupportedFloat(v) } b = appendStructKey(ctx, code, b) - b = appendFloat64(b, v) - b = appendComma(b) + b = appendFloat64(ctx, b, v) + b = appendComma(ctx, b) code = code.Next } case encoder.OpStructPtrHeadFloat64String: @@ -1498,8 +1503,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -1511,14 +1516,14 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) + b = appendStructHead(ctx, b) } v := ptrToFloat64(p + uintptr(code.Offset)) if math.IsInf(v, 0) || math.IsNaN(v) { @@ -1526,17 +1531,17 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b } b = appendStructKey(ctx, code, b) b = append(b, '"') - b = appendFloat64(b, v) + b = appendFloat64(ctx, b, v) b = append(b, '"') - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructPtrHeadOmitEmptyFloat64String: if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -1548,14 +1553,14 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) + b = appendStructHead(ctx, b) } v := ptrToFloat64(p + uintptr(code.Offset)) if v == 0 { @@ -1566,17 +1571,17 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b } b = appendStructKey(ctx, code, b) b = append(b, '"') - b = appendFloat64(b, v) + b = appendFloat64(ctx, b, v) b = append(b, '"') - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next } case encoder.OpStructPtrHeadFloat64Ptr: p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -1587,36 +1592,36 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) + b = appendStructHead(ctx, b) } b = appendStructKey(ctx, code, b) if (code.Flags & encoder.IndirectFlags) != 0 { p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p == 0 { - b = appendNull(b) + b = appendNull(ctx, b) } else { v := ptrToFloat64(p) if math.IsInf(v, 0) || math.IsNaN(v) { return nil, errUnsupportedFloat(v) } - b = appendFloat64(b, v) + b = appendFloat64(ctx, b, v) } - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructPtrHeadOmitEmptyFloat64Ptr: p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -1627,14 +1632,14 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) + b = appendStructHead(ctx, b) } if (code.Flags & encoder.IndirectFlags) != 0 { p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) @@ -1645,16 +1650,16 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b if math.IsInf(v, 0) || math.IsNaN(v) { return nil, errUnsupportedFloat(v) } - b = appendFloat64(b, v) - b = appendComma(b) + b = appendFloat64(ctx, b, v) + b = appendComma(ctx, b) } code = code.Next case encoder.OpStructPtrHeadFloat64PtrString: p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -1665,38 +1670,38 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) + b = appendStructHead(ctx, b) } b = appendStructKey(ctx, code, b) if (code.Flags & encoder.IndirectFlags) != 0 { p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p == 0 { - b = appendNull(b) + b = appendNull(ctx, b) } else { b = append(b, '"') v := ptrToFloat64(p) if math.IsInf(v, 0) || math.IsNaN(v) { return nil, errUnsupportedFloat(v) } - b = appendFloat64(b, v) + b = appendFloat64(ctx, b, v) b = append(b, '"') } - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructPtrHeadOmitEmptyFloat64PtrString: p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -1707,14 +1712,14 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) + b = appendStructHead(ctx, b) } if (code.Flags & encoder.IndirectFlags) != 0 { p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) @@ -1726,9 +1731,9 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b if math.IsInf(v, 0) || math.IsNaN(v) { return nil, errUnsupportedFloat(v) } - b = appendFloat64(b, v) + b = appendFloat64(ctx, b, v) b = append(b, '"') - b = appendComma(b) + b = appendComma(ctx, b) } code = code.Next case encoder.OpStructPtrHeadString: @@ -1736,8 +1741,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -1749,26 +1754,26 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) + b = appendStructHead(ctx, b) } b = appendStructKey(ctx, code, b) - b = appendString(b, ptrToString(p+uintptr(code.Offset))) - b = appendComma(b) + b = appendString(ctx, b, ptrToString(p+uintptr(code.Offset))) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructPtrHeadOmitEmptyString: if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -1780,22 +1785,22 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) + b = appendStructHead(ctx, b) } v := ptrToString(p + uintptr(code.Offset)) if v == "" { code = code.NextField } else { b = appendStructKey(ctx, code, b) - b = appendString(b, v) - b = appendComma(b) + b = appendString(ctx, b, v) + b = appendComma(ctx, b) code = code.Next } case encoder.OpStructPtrHeadStringString: @@ -1803,8 +1808,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -1816,26 +1821,26 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) + b = appendStructHead(ctx, b) } b = appendStructKey(ctx, code, b) - b = appendString(b, string(appendString([]byte{}, ptrToString(p+uintptr(code.Offset))))) - b = appendComma(b) + b = appendString(ctx, b, string(appendString(ctx, []byte{}, ptrToString(p+uintptr(code.Offset))))) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructPtrHeadOmitEmptyStringString: if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -1847,30 +1852,30 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) + b = appendStructHead(ctx, b) } v := ptrToString(p + uintptr(code.Offset)) if v == "" { code = code.NextField } else { b = appendStructKey(ctx, code, b) - b = appendString(b, string(appendString([]byte{}, v))) - b = appendComma(b) + b = appendString(ctx, b, string(appendString(ctx, []byte{}, v))) + b = appendComma(ctx, b) code = code.Next } case encoder.OpStructPtrHeadStringPtr: p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -1881,32 +1886,32 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) + b = appendStructHead(ctx, b) } b = appendStructKey(ctx, code, b) if (code.Flags & encoder.IndirectFlags) != 0 { p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p == 0 { - b = appendNull(b) + b = appendNull(ctx, b) } else { - b = appendString(b, ptrToString(p)) + b = appendString(ctx, b, ptrToString(p)) } - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructPtrHeadOmitEmptyStringPtr: p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -1917,30 +1922,30 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) + b = appendStructHead(ctx, b) } if (code.Flags & encoder.IndirectFlags) != 0 { p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p != 0 { b = appendStructKey(ctx, code, b) - b = appendString(b, ptrToString(p)) - b = appendComma(b) + b = appendString(ctx, b, ptrToString(p)) + b = appendComma(ctx, b) } code = code.Next case encoder.OpStructPtrHeadStringPtrString: p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -1951,32 +1956,32 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) + b = appendStructHead(ctx, b) } b = appendStructKey(ctx, code, b) if (code.Flags & encoder.IndirectFlags) != 0 { p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p == 0 { - b = appendNull(b) + b = appendNull(ctx, b) } else { - b = appendString(b, string(appendString([]byte{}, ptrToString(p)))) + b = appendString(ctx, b, string(appendString(ctx, []byte{}, ptrToString(p)))) } - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructPtrHeadOmitEmptyStringPtrString: p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -1987,22 +1992,22 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) + b = appendStructHead(ctx, b) } if (code.Flags & encoder.IndirectFlags) != 0 { p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p != 0 { b = appendStructKey(ctx, code, b) - b = appendString(b, string(appendString([]byte{}, ptrToString(p)))) - b = appendComma(b) + b = appendString(ctx, b, string(appendString(ctx, []byte{}, ptrToString(p)))) + b = appendComma(ctx, b) } code = code.Next case encoder.OpStructPtrHeadBool: @@ -2010,8 +2015,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -2023,26 +2028,26 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) + b = appendStructHead(ctx, b) } b = appendStructKey(ctx, code, b) - b = appendBool(b, ptrToBool(p+uintptr(code.Offset))) - b = appendComma(b) + b = appendBool(ctx, b, ptrToBool(p+uintptr(code.Offset))) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructPtrHeadOmitEmptyBool: if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -2054,20 +2059,20 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) + b = appendStructHead(ctx, b) } v := ptrToBool(p + uintptr(code.Offset)) if v { b = appendStructKey(ctx, code, b) - b = appendBool(b, v) - b = appendComma(b) + b = appendBool(ctx, b, v) + b = appendComma(ctx, b) code = code.Next } else { code = code.NextField @@ -2077,8 +2082,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -2090,28 +2095,28 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) + b = appendStructHead(ctx, b) } b = appendStructKey(ctx, code, b) b = append(b, '"') - b = appendBool(b, ptrToBool(p+uintptr(code.Offset))) + b = appendBool(ctx, b, ptrToBool(p+uintptr(code.Offset))) b = append(b, '"') - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructPtrHeadOmitEmptyBoolString: if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -2123,22 +2128,22 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) + b = appendStructHead(ctx, b) } v := ptrToBool(p + uintptr(code.Offset)) if v { b = appendStructKey(ctx, code, b) b = append(b, '"') - b = appendBool(b, v) + b = appendBool(ctx, b, v) b = append(b, '"') - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next } else { code = code.NextField @@ -2147,8 +2152,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -2159,32 +2164,32 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) + b = appendStructHead(ctx, b) } b = appendStructKey(ctx, code, b) if (code.Flags & encoder.IndirectFlags) != 0 { p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p == 0 { - b = appendNull(b) + b = appendNull(ctx, b) } else { - b = appendBool(b, ptrToBool(p)) + b = appendBool(ctx, b, ptrToBool(p)) } - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructPtrHeadOmitEmptyBoolPtr: p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -2195,30 +2200,30 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) + b = appendStructHead(ctx, b) } if (code.Flags & encoder.IndirectFlags) != 0 { p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p != 0 { b = appendStructKey(ctx, code, b) - b = appendBool(b, ptrToBool(p)) - b = appendComma(b) + b = appendBool(ctx, b, ptrToBool(p)) + b = appendComma(ctx, b) } code = code.Next case encoder.OpStructPtrHeadBoolPtrString: p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -2229,34 +2234,34 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) + b = appendStructHead(ctx, b) } b = appendStructKey(ctx, code, b) if (code.Flags & encoder.IndirectFlags) != 0 { p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p == 0 { - b = appendNull(b) + b = appendNull(ctx, b) } else { b = append(b, '"') - b = appendBool(b, ptrToBool(p)) + b = appendBool(ctx, b, ptrToBool(p)) b = append(b, '"') } - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructPtrHeadOmitEmptyBoolPtrString: p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -2267,14 +2272,14 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) + b = appendStructHead(ctx, b) } if (code.Flags & encoder.IndirectFlags) != 0 { p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) @@ -2282,9 +2287,9 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b if p != 0 { b = appendStructKey(ctx, code, b) b = append(b, '"') - b = appendBool(b, ptrToBool(p)) + b = appendBool(ctx, b, ptrToBool(p)) b = append(b, '"') - b = appendComma(b) + b = appendComma(ctx, b) } code = code.Next case encoder.OpStructPtrHeadBytes: @@ -2292,8 +2297,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -2305,26 +2310,26 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) + b = appendStructHead(ctx, b) } b = appendStructKey(ctx, code, b) - b = appendByteSlice(b, ptrToBytes(p+uintptr(code.Offset))) - b = appendComma(b) + b = appendByteSlice(ctx, b, ptrToBytes(p+uintptr(code.Offset))) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructPtrHeadOmitEmptyBytes: if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -2336,30 +2341,30 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) + b = appendStructHead(ctx, b) } v := ptrToBytes(p + uintptr(code.Offset)) if len(v) == 0 { code = code.NextField } else { b = appendStructKey(ctx, code, b) - b = appendByteSlice(b, v) - b = appendComma(b) + b = appendByteSlice(ctx, b, v) + b = appendComma(ctx, b) code = code.Next } case encoder.OpStructPtrHeadBytesPtr: p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -2370,32 +2375,32 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) + b = appendStructHead(ctx, b) } b = appendStructKey(ctx, code, b) if (code.Flags & encoder.IndirectFlags) != 0 { p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p == 0 { - b = appendNull(b) + b = appendNull(ctx, b) } else { - b = appendByteSlice(b, ptrToBytes(p)) + b = appendByteSlice(ctx, b, ptrToBytes(p)) } - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructPtrHeadOmitEmptyBytesPtr: p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -2406,22 +2411,22 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) + b = appendStructHead(ctx, b) } if (code.Flags & encoder.IndirectFlags) != 0 { p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p != 0 { b = appendStructKey(ctx, code, b) - b = appendByteSlice(b, ptrToBytes(p)) - b = appendComma(b) + b = appendByteSlice(ctx, b, ptrToBytes(p)) + b = appendComma(ctx, b) } code = code.Next case encoder.OpStructPtrHeadNumber: @@ -2429,8 +2434,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -2442,29 +2447,29 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) + b = appendStructHead(ctx, b) } b = appendStructKey(ctx, code, b) - bb, err := appendNumber(b, ptrToNumber(p+uintptr(code.Offset))) + bb, err := appendNumber(ctx, b, ptrToNumber(p+uintptr(code.Offset))) if err != nil { return nil, err } - b = appendComma(bb) + b = appendComma(ctx, bb) code = code.Next case encoder.OpStructPtrHeadOmitEmptyNumber: if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -2476,25 +2481,25 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) + b = appendStructHead(ctx, b) } v := ptrToNumber(p + uintptr(code.Offset)) if v == "" { code = code.NextField } else { b = appendStructKey(ctx, code, b) - bb, err := appendNumber(b, v) + bb, err := appendNumber(ctx, b, v) if err != nil { return nil, err } - b = appendComma(bb) + b = appendComma(ctx, bb) code = code.Next } case encoder.OpStructPtrHeadNumberString: @@ -2502,8 +2507,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -2515,31 +2520,31 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) + b = appendStructHead(ctx, b) } b = appendStructKey(ctx, code, b) b = append(b, '"') - bb, err := appendNumber(b, ptrToNumber(p+uintptr(code.Offset))) + bb, err := appendNumber(ctx, b, ptrToNumber(p+uintptr(code.Offset))) if err != nil { return nil, err } b = append(bb, '"') - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructPtrHeadOmitEmptyNumberString: if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -2551,14 +2556,14 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) + b = appendStructHead(ctx, b) } v := ptrToNumber(p + uintptr(code.Offset)) if v == "" { @@ -2566,20 +2571,20 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b } else { b = appendStructKey(ctx, code, b) b = append(b, '"') - bb, err := appendNumber(b, v) + bb, err := appendNumber(ctx, b, v) if err != nil { return nil, err } b = append(bb, '"') - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next } case encoder.OpStructPtrHeadNumberPtr: p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -2590,36 +2595,36 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) + b = appendStructHead(ctx, b) } b = appendStructKey(ctx, code, b) if (code.Flags & encoder.IndirectFlags) != 0 { p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p == 0 { - b = appendNull(b) + b = appendNull(ctx, b) } else { - bb, err := appendNumber(b, ptrToNumber(p)) + bb, err := appendNumber(ctx, b, ptrToNumber(p)) if err != nil { return nil, err } b = bb } - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructPtrHeadOmitEmptyNumberPtr: p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -2630,33 +2635,33 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) + b = appendStructHead(ctx, b) } if (code.Flags & encoder.IndirectFlags) != 0 { p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p != 0 { b = appendStructKey(ctx, code, b) - bb, err := appendNumber(b, ptrToNumber(p)) + bb, err := appendNumber(ctx, b, ptrToNumber(p)) if err != nil { return nil, err } - b = appendComma(bb) + b = appendComma(ctx, bb) } code = code.Next case encoder.OpStructPtrHeadNumberPtrString: p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -2667,37 +2672,37 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) + b = appendStructHead(ctx, b) } b = appendStructKey(ctx, code, b) if (code.Flags & encoder.IndirectFlags) != 0 { p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p == 0 { - b = appendNull(b) + b = appendNull(ctx, b) } else { b = append(b, '"') - bb, err := appendNumber(b, ptrToNumber(p)) + bb, err := appendNumber(ctx, b, ptrToNumber(p)) if err != nil { return nil, err } b = append(bb, '"') } - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructPtrHeadOmitEmptyNumberPtrString: p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -2708,14 +2713,14 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) + b = appendStructHead(ctx, b) } if (code.Flags & encoder.IndirectFlags) != 0 { p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) @@ -2723,12 +2728,12 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b if p != 0 { b = appendStructKey(ctx, code, b) b = append(b, '"') - bb, err := appendNumber(b, ptrToNumber(p)) + bb, err := appendNumber(ctx, b, ptrToNumber(p)) if err != nil { return nil, err } b = append(bb, '"') - b = appendComma(b) + b = appendComma(ctx, b) } code = code.Next case encoder.OpStructPtrHeadArray, encoder.OpStructPtrHeadSlice: @@ -2736,8 +2741,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -2749,14 +2754,14 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) + b = appendStructHead(ctx, b) } b = appendStructKey(ctx, code, b) p += uintptr(code.Offset) @@ -2767,8 +2772,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -2780,14 +2785,14 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) + b = appendStructHead(ctx, b) } p += uintptr(code.Offset) b = appendStructKey(ctx, code, b) @@ -2798,8 +2803,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -2811,14 +2816,14 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) + b = appendStructHead(ctx, b) } p += uintptr(code.Offset) slice := ptrToSlice(p) @@ -2833,8 +2838,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -2845,22 +2850,22 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) + b = appendStructHead(ctx, b) } b = appendStructKey(ctx, code, b) if (code.Flags & encoder.IndirectFlags) != 0 { p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) code = code.NextField } else { code = code.Next @@ -2870,8 +2875,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -2882,14 +2887,14 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) + b = appendStructHead(ctx, b) } if (code.Flags & encoder.IndirectFlags) != 0 { p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) @@ -2905,8 +2910,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -2917,14 +2922,14 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) + b = appendStructHead(ctx, b) } b = appendStructKey(ctx, code, b) if p != 0 && (code.Flags&encoder.IndirectFlags) != 0 { @@ -2936,8 +2941,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -2948,14 +2953,14 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) + b = appendStructHead(ctx, b) } if p != 0 && (code.Flags&encoder.IndirectFlags) != 0 { p = ptrToPtr(p + uintptr(code.Offset)) @@ -2971,8 +2976,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -2983,26 +2988,26 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) + b = appendStructHead(ctx, b) } b = appendStructKey(ctx, code, b) if p == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) code = code.NextField break } p = ptrToPtr(p + uintptr(code.Offset)) if p == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) code = code.NextField } else { if (code.Flags & encoder.IndirectFlags) != 0 { @@ -3015,8 +3020,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -3027,14 +3032,14 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) + b = appendStructHead(ctx, b) } if p == 0 { code = code.NextField @@ -3055,8 +3060,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -3069,14 +3074,14 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) + b = appendStructHead(ctx, b) } b = appendStructKey(ctx, code, b) if (code.Flags & encoder.IsNilableTypeFlags) != 0 { @@ -3085,7 +3090,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b } } if p == 0 && (code.Flags&encoder.NilCheckFlags) != 0 { - b = appendNull(b) + b = appendNull(ctx, b) } else { bb, err := appendMarshalJSON(ctx, code, b, ptrToInterface(code, p)) if err != nil { @@ -3093,14 +3098,14 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b } b = bb } - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructPtrHeadOmitEmptyMarshalJSON: p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -3113,14 +3118,14 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) + b = appendStructHead(ctx, b) } if (code.Flags & encoder.IsNilableTypeFlags) != 0 { if (code.Flags&encoder.IndirectFlags) != 0 || code.Op == encoder.OpStructPtrHeadOmitEmptyMarshalJSON { @@ -3137,15 +3142,15 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b return nil, err } b = bb - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next } case encoder.OpStructPtrHeadMarshalJSONPtr: p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -3156,21 +3161,21 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) + b = appendStructHead(ctx, b) } b = appendStructKey(ctx, code, b) if (code.Flags & encoder.IndirectFlags) != 0 { p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p == 0 { - b = appendNull(b) + b = appendNull(ctx, b) } else { bb, err := appendMarshalJSON(ctx, code, b, ptrToInterface(code, p)) if err != nil { @@ -3178,14 +3183,14 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b } b = bb } - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructPtrHeadOmitEmptyMarshalJSONPtr: p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -3196,8 +3201,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -3206,7 +3211,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) + b = appendStructHead(ctx, b) } if p == 0 { code = code.NextField @@ -3217,15 +3222,15 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b return nil, err } b = bb - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next } case encoder.OpStructPtrHeadMarshalText: p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -3238,14 +3243,14 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) + b = appendStructHead(ctx, b) } b = appendStructKey(ctx, code, b) if (code.Flags & encoder.IsNilableTypeFlags) != 0 { @@ -3254,22 +3259,22 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b } } if p == 0 && (code.Flags&encoder.NilCheckFlags) != 0 { - b = appendNull(b) + b = appendNull(ctx, b) } else { - bb, err := appendMarshalText(code, b, ptrToInterface(code, p)) + bb, err := appendMarshalText(ctx, code, b, ptrToInterface(code, p)) if err != nil { return nil, err } b = bb } - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructPtrHeadOmitEmptyMarshalText: p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -3282,14 +3287,14 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) + b = appendStructHead(ctx, b) } if (code.Flags & encoder.IsNilableTypeFlags) != 0 { if (code.Flags&encoder.IndirectFlags) != 0 || code.Op == encoder.OpStructPtrHeadOmitEmptyMarshalText { @@ -3300,20 +3305,20 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b code = code.NextField } else { b = appendStructKey(ctx, code, b) - bb, err := appendMarshalText(code, b, ptrToInterface(code, p)) + bb, err := appendMarshalText(ctx, code, b, ptrToInterface(code, p)) if err != nil { return nil, err } b = bb - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next } case encoder.OpStructPtrHeadMarshalTextPtr: p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -3324,36 +3329,36 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) + b = appendStructHead(ctx, b) } b = appendStructKey(ctx, code, b) if (code.Flags & encoder.IndirectFlags) != 0 { p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p == 0 { - b = appendNull(b) + b = appendNull(ctx, b) } else { - bb, err := appendMarshalText(code, b, ptrToInterface(code, p)) + bb, err := appendMarshalText(ctx, code, b, ptrToInterface(code, p)) if err != nil { return nil, err } b = bb } - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructPtrHeadOmitEmptyMarshalTextPtr: p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -3364,8 +3369,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -3374,18 +3379,18 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) + b = appendStructHead(ctx, b) } if p == 0 { code = code.NextField } else { b = appendStructKey(ctx, code, b) - bb, err := appendMarshalText(code, b, ptrToInterface(code, p)) + bb, err := appendMarshalText(ctx, code, b, ptrToInterface(code, p)) if err != nil { return nil, err } b = bb - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next } case encoder.OpStructField: @@ -3409,7 +3414,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) b = appendInt(b, ptrToUint64(p+uintptr(code.Offset)), code) - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructFieldOmitEmptyInt: p := load(ctxptr, code.Idx) @@ -3418,7 +3423,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b if v != 0 { b = appendStructKey(ctx, code, b) b = appendInt(b, u64, code) - b = appendComma(b) + b = appendComma(ctx, b) } code = code.Next case encoder.OpStructFieldIntString: @@ -3427,7 +3432,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b b = append(b, '"') b = appendInt(b, ptrToUint64(p+uintptr(code.Offset)), code) b = append(b, '"') - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructFieldOmitEmptyIntString: p := load(ctxptr, code.Idx) @@ -3438,7 +3443,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b b = append(b, '"') b = appendInt(b, u64, code) b = append(b, '"') - b = appendComma(b) + b = appendComma(ctx, b) } code = code.Next case encoder.OpStructFieldIntPtr: @@ -3446,11 +3451,11 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) b = appendStructKey(ctx, code, b) if p == 0 { - b = appendNull(b) + b = appendNull(ctx, b) } else { b = appendInt(b, ptrToUint64(p), code) } - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructFieldOmitEmptyIntPtr: p := load(ctxptr, code.Idx) @@ -3458,7 +3463,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b if p != 0 { b = appendStructKey(ctx, code, b) b = appendInt(b, ptrToUint64(p), code) - b = appendComma(b) + b = appendComma(ctx, b) } code = code.Next case encoder.OpStructFieldIntPtrString: @@ -3466,13 +3471,13 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) b = appendStructKey(ctx, code, b) if p == 0 { - b = appendNull(b) + b = appendNull(ctx, b) } else { b = append(b, '"') b = appendInt(b, ptrToUint64(p), code) b = append(b, '"') } - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructFieldOmitEmptyIntPtrString: p := load(ctxptr, code.Idx) @@ -3482,14 +3487,14 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b b = append(b, '"') b = appendInt(b, ptrToUint64(p), code) b = append(b, '"') - b = appendComma(b) + b = appendComma(ctx, b) } code = code.Next case encoder.OpStructFieldUint: p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) b = appendUint(b, ptrToUint64(p+uintptr(code.Offset)), code) - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructFieldOmitEmptyUint: p := load(ctxptr, code.Idx) @@ -3498,7 +3503,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b if v != 0 { b = appendStructKey(ctx, code, b) b = appendUint(b, u64, code) - b = appendComma(b) + b = appendComma(ctx, b) } code = code.Next case encoder.OpStructFieldUintString: @@ -3507,7 +3512,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b b = append(b, '"') b = appendUint(b, ptrToUint64(p+uintptr(code.Offset)), code) b = append(b, '"') - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructFieldOmitEmptyUintString: p := load(ctxptr, code.Idx) @@ -3518,7 +3523,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b b = append(b, '"') b = appendUint(b, u64, code) b = append(b, '"') - b = appendComma(b) + b = appendComma(ctx, b) } code = code.Next case encoder.OpStructFieldUintPtr: @@ -3526,11 +3531,11 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) b = appendStructKey(ctx, code, b) if p == 0 { - b = appendNull(b) + b = appendNull(ctx, b) } else { b = appendUint(b, ptrToUint64(p), code) } - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructFieldOmitEmptyUintPtr: p := load(ctxptr, code.Idx) @@ -3538,7 +3543,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b if p != 0 { b = appendStructKey(ctx, code, b) b = appendUint(b, ptrToUint64(p), code) - b = appendComma(b) + b = appendComma(ctx, b) } code = code.Next case encoder.OpStructFieldUintPtrString: @@ -3546,13 +3551,13 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) b = appendStructKey(ctx, code, b) if p == 0 { - b = appendNull(b) + b = appendNull(ctx, b) } else { b = append(b, '"') b = appendUint(b, ptrToUint64(p), code) b = append(b, '"') } - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructFieldOmitEmptyUintPtrString: p := load(ctxptr, code.Idx) @@ -3562,31 +3567,31 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b b = append(b, '"') b = appendUint(b, ptrToUint64(p), code) b = append(b, '"') - b = appendComma(b) + b = appendComma(ctx, b) } code = code.Next case encoder.OpStructFieldFloat32: p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) - b = appendFloat32(b, ptrToFloat32(p+uintptr(code.Offset))) - b = appendComma(b) + b = appendFloat32(ctx, b, ptrToFloat32(p+uintptr(code.Offset))) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructFieldOmitEmptyFloat32: p := load(ctxptr, code.Idx) v := ptrToFloat32(p + uintptr(code.Offset)) if v != 0 { b = appendStructKey(ctx, code, b) - b = appendFloat32(b, v) - b = appendComma(b) + b = appendFloat32(ctx, b, v) + b = appendComma(ctx, b) } code = code.Next case encoder.OpStructFieldFloat32String: p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) b = append(b, '"') - b = appendFloat32(b, ptrToFloat32(p+uintptr(code.Offset))) + b = appendFloat32(ctx, b, ptrToFloat32(p+uintptr(code.Offset))) b = append(b, '"') - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructFieldOmitEmptyFloat32String: p := load(ctxptr, code.Idx) @@ -3594,9 +3599,9 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b if v != 0 { b = appendStructKey(ctx, code, b) b = append(b, '"') - b = appendFloat32(b, v) + b = appendFloat32(ctx, b, v) b = append(b, '"') - b = appendComma(b) + b = appendComma(ctx, b) } code = code.Next case encoder.OpStructFieldFloat32Ptr: @@ -3604,19 +3609,19 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) b = appendStructKey(ctx, code, b) if p == 0 { - b = appendNull(b) + b = appendNull(ctx, b) } else { - b = appendFloat32(b, ptrToFloat32(p)) + b = appendFloat32(ctx, b, ptrToFloat32(p)) } - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructFieldOmitEmptyFloat32Ptr: p := load(ctxptr, code.Idx) p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p != 0 { b = appendStructKey(ctx, code, b) - b = appendFloat32(b, ptrToFloat32(p)) - b = appendComma(b) + b = appendFloat32(ctx, b, ptrToFloat32(p)) + b = appendComma(ctx, b) } code = code.Next case encoder.OpStructFieldFloat32PtrString: @@ -3624,13 +3629,13 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) b = appendStructKey(ctx, code, b) if p == 0 { - b = appendNull(b) + b = appendNull(ctx, b) } else { b = append(b, '"') - b = appendFloat32(b, ptrToFloat32(p)) + b = appendFloat32(ctx, b, ptrToFloat32(p)) b = append(b, '"') } - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructFieldOmitEmptyFloat32PtrString: p := load(ctxptr, code.Idx) @@ -3638,9 +3643,9 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b if p != 0 { b = appendStructKey(ctx, code, b) b = append(b, '"') - b = appendFloat32(b, ptrToFloat32(p)) + b = appendFloat32(ctx, b, ptrToFloat32(p)) b = append(b, '"') - b = appendComma(b) + b = appendComma(ctx, b) } code = code.Next case encoder.OpStructFieldFloat64: @@ -3650,8 +3655,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b if math.IsInf(v, 0) || math.IsNaN(v) { return nil, errUnsupportedFloat(v) } - b = appendFloat64(b, v) - b = appendComma(b) + b = appendFloat64(ctx, b, v) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructFieldOmitEmptyFloat64: p := load(ctxptr, code.Idx) @@ -3661,8 +3666,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b return nil, errUnsupportedFloat(v) } b = appendStructKey(ctx, code, b) - b = appendFloat64(b, v) - b = appendComma(b) + b = appendFloat64(ctx, b, v) + b = appendComma(ctx, b) } code = code.Next case encoder.OpStructFieldFloat64String: @@ -3673,9 +3678,9 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b } b = appendStructKey(ctx, code, b) b = append(b, '"') - b = appendFloat64(b, v) + b = appendFloat64(ctx, b, v) b = append(b, '"') - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructFieldOmitEmptyFloat64String: p := load(ctxptr, code.Idx) @@ -3686,9 +3691,9 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b } b = appendStructKey(ctx, code, b) b = append(b, '"') - b = appendFloat64(b, v) + b = appendFloat64(ctx, b, v) b = append(b, '"') - b = appendComma(b) + b = appendComma(ctx, b) } code = code.Next case encoder.OpStructFieldFloat64Ptr: @@ -3696,8 +3701,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) b = appendStructKey(ctx, code, b) if p == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) code = code.Next break } @@ -3705,8 +3710,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b if math.IsInf(v, 0) || math.IsNaN(v) { return nil, errUnsupportedFloat(v) } - b = appendFloat64(b, v) - b = appendComma(b) + b = appendFloat64(ctx, b, v) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructFieldOmitEmptyFloat64Ptr: p := load(ctxptr, code.Idx) @@ -3717,8 +3722,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b if math.IsInf(v, 0) || math.IsNaN(v) { return nil, errUnsupportedFloat(v) } - b = appendFloat64(b, v) - b = appendComma(b) + b = appendFloat64(ctx, b, v) + b = appendComma(ctx, b) } code = code.Next case encoder.OpStructFieldFloat64PtrString: @@ -3726,17 +3731,17 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) b = appendStructKey(ctx, code, b) if p == 0 { - b = appendNull(b) + b = appendNull(ctx, b) } else { v := ptrToFloat64(p) if math.IsInf(v, 0) || math.IsNaN(v) { return nil, errUnsupportedFloat(v) } b = append(b, '"') - b = appendFloat64(b, v) + b = appendFloat64(ctx, b, v) b = append(b, '"') } - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructFieldOmitEmptyFloat64PtrString: p := load(ctxptr, code.Idx) @@ -3748,40 +3753,40 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b if math.IsInf(v, 0) || math.IsNaN(v) { return nil, errUnsupportedFloat(v) } - b = appendFloat64(b, v) + b = appendFloat64(ctx, b, v) b = append(b, '"') - b = appendComma(b) + b = appendComma(ctx, b) } code = code.Next case encoder.OpStructFieldString: p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) - b = appendString(b, ptrToString(p+uintptr(code.Offset))) - b = appendComma(b) + b = appendString(ctx, b, ptrToString(p+uintptr(code.Offset))) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructFieldOmitEmptyString: p := load(ctxptr, code.Idx) v := ptrToString(p + uintptr(code.Offset)) if v != "" { b = appendStructKey(ctx, code, b) - b = appendString(b, v) - b = appendComma(b) + b = appendString(ctx, b, v) + b = appendComma(ctx, b) } code = code.Next case encoder.OpStructFieldStringString: p := load(ctxptr, code.Idx) s := ptrToString(p + uintptr(code.Offset)) b = appendStructKey(ctx, code, b) - b = appendString(b, string(appendString([]byte{}, s))) - b = appendComma(b) + b = appendString(ctx, b, string(appendString(ctx, []byte{}, s))) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructFieldOmitEmptyStringString: p := load(ctxptr, code.Idx) v := ptrToString(p + uintptr(code.Offset)) if v != "" { b = appendStructKey(ctx, code, b) - b = appendString(b, string(appendString([]byte{}, v))) - b = appendComma(b) + b = appendString(ctx, b, string(appendString(ctx, []byte{}, v))) + b = appendComma(ctx, b) } code = code.Next case encoder.OpStructFieldStringPtr: @@ -3789,19 +3794,19 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) b = appendStructKey(ctx, code, b) if p == 0 { - b = appendNull(b) + b = appendNull(ctx, b) } else { - b = appendString(b, ptrToString(p)) + b = appendString(ctx, b, ptrToString(p)) } - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructFieldOmitEmptyStringPtr: p := load(ctxptr, code.Idx) p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p != 0 { b = appendStructKey(ctx, code, b) - b = appendString(b, ptrToString(p)) - b = appendComma(b) + b = appendString(ctx, b, ptrToString(p)) + b = appendComma(ctx, b) } code = code.Next case encoder.OpStructFieldStringPtrString: @@ -3809,43 +3814,43 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) b = appendStructKey(ctx, code, b) if p == 0 { - b = appendNull(b) + b = appendNull(ctx, b) } else { - b = appendString(b, string(appendString([]byte{}, ptrToString(p)))) + b = appendString(ctx, b, string(appendString(ctx, []byte{}, ptrToString(p)))) } - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructFieldOmitEmptyStringPtrString: p := load(ctxptr, code.Idx) p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p != 0 { b = appendStructKey(ctx, code, b) - b = appendString(b, string(appendString([]byte{}, ptrToString(p)))) - b = appendComma(b) + b = appendString(ctx, b, string(appendString(ctx, []byte{}, ptrToString(p)))) + b = appendComma(ctx, b) } code = code.Next case encoder.OpStructFieldBool: p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) - b = appendBool(b, ptrToBool(p+uintptr(code.Offset))) - b = appendComma(b) + b = appendBool(ctx, b, ptrToBool(p+uintptr(code.Offset))) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructFieldOmitEmptyBool: p := load(ctxptr, code.Idx) v := ptrToBool(p + uintptr(code.Offset)) if v { b = appendStructKey(ctx, code, b) - b = appendBool(b, v) - b = appendComma(b) + b = appendBool(ctx, b, v) + b = appendComma(ctx, b) } code = code.Next case encoder.OpStructFieldBoolString: p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) b = append(b, '"') - b = appendBool(b, ptrToBool(p+uintptr(code.Offset))) + b = appendBool(ctx, b, ptrToBool(p+uintptr(code.Offset))) b = append(b, '"') - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructFieldOmitEmptyBoolString: p := load(ctxptr, code.Idx) @@ -3853,9 +3858,9 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b if v { b = appendStructKey(ctx, code, b) b = append(b, '"') - b = appendBool(b, v) + b = appendBool(ctx, b, v) b = append(b, '"') - b = appendComma(b) + b = appendComma(ctx, b) } code = code.Next case encoder.OpStructFieldBoolPtr: @@ -3863,19 +3868,19 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) b = appendStructKey(ctx, code, b) if p == 0 { - b = appendNull(b) + b = appendNull(ctx, b) } else { - b = appendBool(b, ptrToBool(p)) + b = appendBool(ctx, b, ptrToBool(p)) } - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructFieldOmitEmptyBoolPtr: p := load(ctxptr, code.Idx) p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p != 0 { b = appendStructKey(ctx, code, b) - b = appendBool(b, ptrToBool(p)) - b = appendComma(b) + b = appendBool(ctx, b, ptrToBool(p)) + b = appendComma(ctx, b) } code = code.Next case encoder.OpStructFieldBoolPtrString: @@ -3883,13 +3888,13 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) b = appendStructKey(ctx, code, b) if p == 0 { - b = appendNull(b) + b = appendNull(ctx, b) } else { b = append(b, '"') - b = appendBool(b, ptrToBool(p)) + b = appendBool(ctx, b, ptrToBool(p)) b = append(b, '"') } - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructFieldOmitEmptyBoolPtrString: p := load(ctxptr, code.Idx) @@ -3897,24 +3902,24 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b if p != 0 { b = appendStructKey(ctx, code, b) b = append(b, '"') - b = appendBool(b, ptrToBool(p)) + b = appendBool(ctx, b, ptrToBool(p)) b = append(b, '"') - b = appendComma(b) + b = appendComma(ctx, b) } code = code.Next case encoder.OpStructFieldBytes: p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) - b = appendByteSlice(b, ptrToBytes(p+uintptr(code.Offset))) - b = appendComma(b) + b = appendByteSlice(ctx, b, ptrToBytes(p+uintptr(code.Offset))) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructFieldOmitEmptyBytes: p := load(ctxptr, code.Idx) v := ptrToBytes(p + uintptr(code.Offset)) if len(v) > 0 { b = appendStructKey(ctx, code, b) - b = appendByteSlice(b, v) - b = appendComma(b) + b = appendByteSlice(ctx, b, v) + b = appendComma(ctx, b) } code = code.Next case encoder.OpStructFieldBytesPtr: @@ -3922,52 +3927,52 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) b = appendStructKey(ctx, code, b) if p == 0 { - b = appendNull(b) + b = appendNull(ctx, b) } else { - b = appendByteSlice(b, ptrToBytes(p)) + b = appendByteSlice(ctx, b, ptrToBytes(p)) } - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructFieldOmitEmptyBytesPtr: p := load(ctxptr, code.Idx) p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p != 0 { b = appendStructKey(ctx, code, b) - b = appendByteSlice(b, ptrToBytes(p)) - b = appendComma(b) + b = appendByteSlice(ctx, b, ptrToBytes(p)) + b = appendComma(ctx, b) } code = code.Next case encoder.OpStructFieldNumber: p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) - bb, err := appendNumber(b, ptrToNumber(p+uintptr(code.Offset))) + bb, err := appendNumber(ctx, b, ptrToNumber(p+uintptr(code.Offset))) if err != nil { return nil, err } - b = appendComma(bb) + b = appendComma(ctx, bb) code = code.Next case encoder.OpStructFieldOmitEmptyNumber: p := load(ctxptr, code.Idx) v := ptrToNumber(p + uintptr(code.Offset)) if v != "" { b = appendStructKey(ctx, code, b) - bb, err := appendNumber(b, v) + bb, err := appendNumber(ctx, b, v) if err != nil { return nil, err } - b = appendComma(bb) + b = appendComma(ctx, bb) } code = code.Next case encoder.OpStructFieldNumberString: p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) b = append(b, '"') - bb, err := appendNumber(b, ptrToNumber(p+uintptr(code.Offset))) + bb, err := appendNumber(ctx, b, ptrToNumber(p+uintptr(code.Offset))) if err != nil { return nil, err } b = append(bb, '"') - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructFieldOmitEmptyNumberString: p := load(ctxptr, code.Idx) @@ -3975,12 +3980,12 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b if v != "" { b = appendStructKey(ctx, code, b) b = append(b, '"') - bb, err := appendNumber(b, v) + bb, err := appendNumber(ctx, b, v) if err != nil { return nil, err } b = append(bb, '"') - b = appendComma(b) + b = appendComma(ctx, b) } code = code.Next case encoder.OpStructFieldNumberPtr: @@ -3988,26 +3993,26 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) b = appendStructKey(ctx, code, b) if p == 0 { - b = appendNull(b) + b = appendNull(ctx, b) } else { - bb, err := appendNumber(b, ptrToNumber(p)) + bb, err := appendNumber(ctx, b, ptrToNumber(p)) if err != nil { return nil, err } b = bb } - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructFieldOmitEmptyNumberPtr: p := load(ctxptr, code.Idx) p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p != 0 { b = appendStructKey(ctx, code, b) - bb, err := appendNumber(b, ptrToNumber(p)) + bb, err := appendNumber(ctx, b, ptrToNumber(p)) if err != nil { return nil, err } - b = appendComma(bb) + b = appendComma(ctx, bb) } code = code.Next case encoder.OpStructFieldNumberPtrString: @@ -4015,16 +4020,16 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) b = appendStructKey(ctx, code, b) if p == 0 { - b = appendNull(b) + b = appendNull(ctx, b) } else { b = append(b, '"') - bb, err := appendNumber(b, ptrToNumber(p)) + bb, err := appendNumber(ctx, b, ptrToNumber(p)) if err != nil { return nil, err } b = append(bb, '"') } - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructFieldOmitEmptyNumberPtrString: p := load(ctxptr, code.Idx) @@ -4032,12 +4037,12 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b if p != 0 { b = appendStructKey(ctx, code, b) b = append(b, '"') - bb, err := appendNumber(b, ptrToNumber(p)) + bb, err := appendNumber(ctx, b, ptrToNumber(p)) if err != nil { return nil, err } b = append(bb, '"') - b = appendComma(b) + b = appendComma(ctx, b) } code = code.Next case encoder.OpStructFieldMarshalJSON: @@ -4048,7 +4053,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p = ptrToPtr(p) } if p == 0 && (code.Flags&encoder.NilCheckFlags) != 0 { - b = appendNull(b) + b = appendNull(ctx, b) } else { bb, err := appendMarshalJSON(ctx, code, b, ptrToInterface(code, p)) if err != nil { @@ -4056,7 +4061,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b } b = bb } - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructFieldOmitEmptyMarshalJSON: p := load(ctxptr, code.Idx) @@ -4078,14 +4083,14 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b if err != nil { return nil, err } - b = appendComma(bb) + b = appendComma(ctx, bb) code = code.Next case encoder.OpStructFieldMarshalJSONPtr: p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p == 0 { - b = appendNull(b) + b = appendNull(ctx, b) } else { bb, err := appendMarshalJSON(ctx, code, b, ptrToInterface(code, p)) if err != nil { @@ -4093,7 +4098,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b } b = bb } - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructFieldOmitEmptyMarshalJSONPtr: p := load(ctxptr, code.Idx) @@ -4104,7 +4109,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b if err != nil { return nil, err } - b = appendComma(bb) + b = appendComma(ctx, bb) } code = code.Next case encoder.OpStructFieldMarshalText: @@ -4115,15 +4120,15 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p = ptrToPtr(p) } if p == 0 && (code.Flags&encoder.NilCheckFlags) != 0 { - b = appendNull(b) + b = appendNull(ctx, b) } else { - bb, err := appendMarshalText(code, b, ptrToInterface(code, p)) + bb, err := appendMarshalText(ctx, code, b, ptrToInterface(code, p)) if err != nil { return nil, err } b = bb } - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructFieldOmitEmptyMarshalText: p := load(ctxptr, code.Idx) @@ -4136,37 +4141,37 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b break } b = appendStructKey(ctx, code, b) - bb, err := appendMarshalText(code, b, ptrToInterface(code, p)) + bb, err := appendMarshalText(ctx, code, b, ptrToInterface(code, p)) if err != nil { return nil, err } - b = appendComma(bb) + b = appendComma(ctx, bb) code = code.Next case encoder.OpStructFieldMarshalTextPtr: p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p == 0 { - b = appendNull(b) + b = appendNull(ctx, b) } else { - bb, err := appendMarshalText(code, b, ptrToInterface(code, p)) + bb, err := appendMarshalText(ctx, code, b, ptrToInterface(code, p)) if err != nil { return nil, err } b = bb } - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructFieldOmitEmptyMarshalTextPtr: p := load(ctxptr, code.Idx) p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p != 0 { b = appendStructKey(ctx, code, b) - bb, err := appendMarshalText(code, b, ptrToInterface(code, p)) + bb, err := appendMarshalText(ctx, code, b, ptrToInterface(code, p)) if err != nil { return nil, err } - b = appendComma(bb) + b = appendComma(ctx, bb) } code = code.Next case encoder.OpStructFieldArray: @@ -4334,7 +4339,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p == 0 { - b = appendNull(b) + b = appendNull(ctx, b) } else { b = appendInt(b, ptrToUint64(p), code) } @@ -4356,7 +4361,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p == 0 { - b = appendNull(b) + b = appendNull(ctx, b) } else { b = append(b, '"') b = appendInt(b, ptrToUint64(p), code) @@ -4422,7 +4427,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p == 0 { - b = appendNull(b) + b = appendNull(ctx, b) } else { b = appendUint(b, ptrToUint64(p), code) } @@ -4444,7 +4449,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p == 0 { - b = appendNull(b) + b = appendNull(ctx, b) } else { b = append(b, '"') b = appendUint(b, ptrToUint64(p), code) @@ -4468,7 +4473,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b case encoder.OpStructEndFloat32: p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) - b = appendFloat32(b, ptrToFloat32(p+uintptr(code.Offset))) + b = appendFloat32(ctx, b, ptrToFloat32(p+uintptr(code.Offset))) b = appendStructEnd(ctx, code, b) code = code.Next case encoder.OpStructEndOmitEmptyFloat32: @@ -4476,7 +4481,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b v := ptrToFloat32(p + uintptr(code.Offset)) if v != 0 { b = appendStructKey(ctx, code, b) - b = appendFloat32(b, v) + b = appendFloat32(ctx, b, v) b = appendStructEnd(ctx, code, b) } else { b = appendStructEndSkipLast(ctx, code, b) @@ -4486,7 +4491,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) b = append(b, '"') - b = appendFloat32(b, ptrToFloat32(p+uintptr(code.Offset))) + b = appendFloat32(ctx, b, ptrToFloat32(p+uintptr(code.Offset))) b = append(b, '"') b = appendStructEnd(ctx, code, b) code = code.Next @@ -4496,7 +4501,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b if v != 0 { b = appendStructKey(ctx, code, b) b = append(b, '"') - b = appendFloat32(b, v) + b = appendFloat32(ctx, b, v) b = append(b, '"') b = appendStructEnd(ctx, code, b) } else { @@ -4508,9 +4513,9 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p == 0 { - b = appendNull(b) + b = appendNull(ctx, b) } else { - b = appendFloat32(b, ptrToFloat32(p)) + b = appendFloat32(ctx, b, ptrToFloat32(p)) } b = appendStructEnd(ctx, code, b) code = code.Next @@ -4519,7 +4524,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p != 0 { b = appendStructKey(ctx, code, b) - b = appendFloat32(b, ptrToFloat32(p)) + b = appendFloat32(ctx, b, ptrToFloat32(p)) b = appendStructEnd(ctx, code, b) } else { b = appendStructEndSkipLast(ctx, code, b) @@ -4530,10 +4535,10 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p == 0 { - b = appendNull(b) + b = appendNull(ctx, b) } else { b = append(b, '"') - b = appendFloat32(b, ptrToFloat32(p)) + b = appendFloat32(ctx, b, ptrToFloat32(p)) b = append(b, '"') } b = appendStructEnd(ctx, code, b) @@ -4544,7 +4549,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b if p != 0 { b = appendStructKey(ctx, code, b) b = append(b, '"') - b = appendFloat32(b, ptrToFloat32(p)) + b = appendFloat32(ctx, b, ptrToFloat32(p)) b = append(b, '"') b = appendStructEnd(ctx, code, b) } else { @@ -4558,7 +4563,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b return nil, errUnsupportedFloat(v) } b = appendStructKey(ctx, code, b) - b = appendFloat64(b, v) + b = appendFloat64(ctx, b, v) b = appendStructEnd(ctx, code, b) code = code.Next case encoder.OpStructEndOmitEmptyFloat64: @@ -4569,7 +4574,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b return nil, errUnsupportedFloat(v) } b = appendStructKey(ctx, code, b) - b = appendFloat64(b, v) + b = appendFloat64(ctx, b, v) b = appendStructEnd(ctx, code, b) } else { b = appendStructEndSkipLast(ctx, code, b) @@ -4583,7 +4588,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b } b = appendStructKey(ctx, code, b) b = append(b, '"') - b = appendFloat64(b, v) + b = appendFloat64(ctx, b, v) b = append(b, '"') b = appendStructEnd(ctx, code, b) code = code.Next @@ -4596,7 +4601,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b } b = appendStructKey(ctx, code, b) b = append(b, '"') - b = appendFloat64(b, v) + b = appendFloat64(ctx, b, v) b = append(b, '"') b = appendStructEnd(ctx, code, b) } else { @@ -4608,7 +4613,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p == 0 { - b = appendNull(b) + b = appendNull(ctx, b) b = appendStructEnd(ctx, code, b) code = code.Next break @@ -4617,7 +4622,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b if math.IsInf(v, 0) || math.IsNaN(v) { return nil, errUnsupportedFloat(v) } - b = appendFloat64(b, v) + b = appendFloat64(ctx, b, v) b = appendStructEnd(ctx, code, b) code = code.Next case encoder.OpStructEndOmitEmptyFloat64Ptr: @@ -4629,7 +4634,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b if math.IsInf(v, 0) || math.IsNaN(v) { return nil, errUnsupportedFloat(v) } - b = appendFloat64(b, v) + b = appendFloat64(ctx, b, v) b = appendStructEnd(ctx, code, b) } else { b = appendStructEndSkipLast(ctx, code, b) @@ -4640,14 +4645,14 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p == 0 { - b = appendNull(b) + b = appendNull(ctx, b) } else { b = append(b, '"') v := ptrToFloat64(p) if math.IsInf(v, 0) || math.IsNaN(v) { return nil, errUnsupportedFloat(v) } - b = appendFloat64(b, v) + b = appendFloat64(ctx, b, v) b = append(b, '"') } b = appendStructEnd(ctx, code, b) @@ -4662,7 +4667,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b return nil, errUnsupportedFloat(v) } b = append(b, '"') - b = appendFloat64(b, v) + b = appendFloat64(ctx, b, v) b = append(b, '"') b = appendStructEnd(ctx, code, b) } else { @@ -4672,7 +4677,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b case encoder.OpStructEndString: p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) - b = appendString(b, ptrToString(p+uintptr(code.Offset))) + b = appendString(ctx, b, ptrToString(p+uintptr(code.Offset))) b = appendStructEnd(ctx, code, b) code = code.Next case encoder.OpStructEndOmitEmptyString: @@ -4680,7 +4685,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b v := ptrToString(p + uintptr(code.Offset)) if v != "" { b = appendStructKey(ctx, code, b) - b = appendString(b, v) + b = appendString(ctx, b, v) b = appendStructEnd(ctx, code, b) } else { b = appendStructEndSkipLast(ctx, code, b) @@ -4690,7 +4695,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) s := ptrToString(p + uintptr(code.Offset)) - b = appendString(b, string(appendString([]byte{}, s))) + b = appendString(ctx, b, string(appendString(ctx, []byte{}, s))) b = appendStructEnd(ctx, code, b) code = code.Next case encoder.OpStructEndOmitEmptyStringString: @@ -4698,7 +4703,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b v := ptrToString(p + uintptr(code.Offset)) if v != "" { b = appendStructKey(ctx, code, b) - b = appendString(b, string(appendString([]byte{}, v))) + b = appendString(ctx, b, string(appendString(ctx, []byte{}, v))) b = appendStructEnd(ctx, code, b) } else { b = appendStructEndSkipLast(ctx, code, b) @@ -4709,9 +4714,9 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p == 0 { - b = appendNull(b) + b = appendNull(ctx, b) } else { - b = appendString(b, ptrToString(p)) + b = appendString(ctx, b, ptrToString(p)) } b = appendStructEnd(ctx, code, b) code = code.Next @@ -4720,7 +4725,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p != 0 { b = appendStructKey(ctx, code, b) - b = appendString(b, ptrToString(p)) + b = appendString(ctx, b, ptrToString(p)) b = appendStructEnd(ctx, code, b) } else { b = appendStructEndSkipLast(ctx, code, b) @@ -4731,9 +4736,9 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p == 0 { - b = appendNull(b) + b = appendNull(ctx, b) } else { - b = appendString(b, string(appendString([]byte{}, ptrToString(p)))) + b = appendString(ctx, b, string(appendString(ctx, []byte{}, ptrToString(p)))) } b = appendStructEnd(ctx, code, b) code = code.Next @@ -4742,7 +4747,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p != 0 { b = appendStructKey(ctx, code, b) - b = appendString(b, string(appendString([]byte{}, ptrToString(p)))) + b = appendString(ctx, b, string(appendString(ctx, []byte{}, ptrToString(p)))) b = appendStructEnd(ctx, code, b) } else { b = appendStructEndSkipLast(ctx, code, b) @@ -4751,7 +4756,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b case encoder.OpStructEndBool: p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) - b = appendBool(b, ptrToBool(p+uintptr(code.Offset))) + b = appendBool(ctx, b, ptrToBool(p+uintptr(code.Offset))) b = appendStructEnd(ctx, code, b) code = code.Next case encoder.OpStructEndOmitEmptyBool: @@ -4759,7 +4764,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b v := ptrToBool(p + uintptr(code.Offset)) if v { b = appendStructKey(ctx, code, b) - b = appendBool(b, v) + b = appendBool(ctx, b, v) b = appendStructEnd(ctx, code, b) } else { b = appendStructEndSkipLast(ctx, code, b) @@ -4769,7 +4774,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) b = append(b, '"') - b = appendBool(b, ptrToBool(p+uintptr(code.Offset))) + b = appendBool(ctx, b, ptrToBool(p+uintptr(code.Offset))) b = append(b, '"') b = appendStructEnd(ctx, code, b) code = code.Next @@ -4779,7 +4784,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b if v { b = appendStructKey(ctx, code, b) b = append(b, '"') - b = appendBool(b, v) + b = appendBool(ctx, b, v) b = append(b, '"') b = appendStructEnd(ctx, code, b) } else { @@ -4791,9 +4796,9 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p == 0 { - b = appendNull(b) + b = appendNull(ctx, b) } else { - b = appendBool(b, ptrToBool(p)) + b = appendBool(ctx, b, ptrToBool(p)) } b = appendStructEnd(ctx, code, b) code = code.Next @@ -4802,7 +4807,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p != 0 { b = appendStructKey(ctx, code, b) - b = appendBool(b, ptrToBool(p)) + b = appendBool(ctx, b, ptrToBool(p)) b = appendStructEnd(ctx, code, b) } else { b = appendStructEndSkipLast(ctx, code, b) @@ -4813,10 +4818,10 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p == 0 { - b = appendNull(b) + b = appendNull(ctx, b) } else { b = append(b, '"') - b = appendBool(b, ptrToBool(p)) + b = appendBool(ctx, b, ptrToBool(p)) b = append(b, '"') } b = appendStructEnd(ctx, code, b) @@ -4827,7 +4832,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b if p != 0 { b = appendStructKey(ctx, code, b) b = append(b, '"') - b = appendBool(b, ptrToBool(p)) + b = appendBool(ctx, b, ptrToBool(p)) b = append(b, '"') b = appendStructEnd(ctx, code, b) } else { @@ -4837,7 +4842,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b case encoder.OpStructEndBytes: p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) - b = appendByteSlice(b, ptrToBytes(p+uintptr(code.Offset))) + b = appendByteSlice(ctx, b, ptrToBytes(p+uintptr(code.Offset))) b = appendStructEnd(ctx, code, b) code = code.Next case encoder.OpStructEndOmitEmptyBytes: @@ -4845,7 +4850,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b v := ptrToBytes(p + uintptr(code.Offset)) if len(v) > 0 { b = appendStructKey(ctx, code, b) - b = appendByteSlice(b, v) + b = appendByteSlice(ctx, b, v) b = appendStructEnd(ctx, code, b) } else { b = appendStructEndSkipLast(ctx, code, b) @@ -4856,9 +4861,9 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p == 0 { - b = appendNull(b) + b = appendNull(ctx, b) } else { - b = appendByteSlice(b, ptrToBytes(p)) + b = appendByteSlice(ctx, b, ptrToBytes(p)) } b = appendStructEnd(ctx, code, b) code = code.Next @@ -4867,7 +4872,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p != 0 { b = appendStructKey(ctx, code, b) - b = appendByteSlice(b, ptrToBytes(p)) + b = appendByteSlice(ctx, b, ptrToBytes(p)) b = appendStructEnd(ctx, code, b) } else { b = appendStructEndSkipLast(ctx, code, b) @@ -4876,7 +4881,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b case encoder.OpStructEndNumber: p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) - bb, err := appendNumber(b, ptrToNumber(p+uintptr(code.Offset))) + bb, err := appendNumber(ctx, b, ptrToNumber(p+uintptr(code.Offset))) if err != nil { return nil, err } @@ -4887,7 +4892,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b v := ptrToNumber(p + uintptr(code.Offset)) if v != "" { b = appendStructKey(ctx, code, b) - bb, err := appendNumber(b, v) + bb, err := appendNumber(ctx, b, v) if err != nil { return nil, err } @@ -4900,7 +4905,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) b = append(b, '"') - bb, err := appendNumber(b, ptrToNumber(p+uintptr(code.Offset))) + bb, err := appendNumber(ctx, b, ptrToNumber(p+uintptr(code.Offset))) if err != nil { return nil, err } @@ -4913,7 +4918,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b if v != "" { b = appendStructKey(ctx, code, b) b = append(b, '"') - bb, err := appendNumber(b, v) + bb, err := appendNumber(ctx, b, v) if err != nil { return nil, err } @@ -4928,9 +4933,9 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p == 0 { - b = appendNull(b) + b = appendNull(ctx, b) } else { - bb, err := appendNumber(b, ptrToNumber(p)) + bb, err := appendNumber(ctx, b, ptrToNumber(p)) if err != nil { return nil, err } @@ -4943,7 +4948,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p != 0 { b = appendStructKey(ctx, code, b) - bb, err := appendNumber(b, ptrToNumber(p)) + bb, err := appendNumber(ctx, b, ptrToNumber(p)) if err != nil { return nil, err } @@ -4957,10 +4962,10 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p == 0 { - b = appendNull(b) + b = appendNull(ctx, b) } else { b = append(b, '"') - bb, err := appendNumber(b, ptrToNumber(p)) + bb, err := appendNumber(ctx, b, ptrToNumber(p)) if err != nil { return nil, err } @@ -4974,7 +4979,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b if p != 0 { b = appendStructKey(ctx, code, b) b = append(b, '"') - bb, err := appendNumber(b, ptrToNumber(p)) + bb, err := appendNumber(ctx, b, ptrToNumber(p)) if err != nil { return nil, err } diff --git a/internal/encoder/vm_escaped/debug_vm.go b/internal/encoder/vm_escaped/debug_vm.go deleted file mode 100644 index b10f588..0000000 --- a/internal/encoder/vm_escaped/debug_vm.go +++ /dev/null @@ -1,27 +0,0 @@ -package vm_escaped - -import ( - "fmt" - - "github.com/goccy/go-json/internal/encoder" -) - -func DebugRun(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]byte, error) { - defer func() { - if err := recover(); err != nil { - fmt.Println("=============[DEBUG]===============") - fmt.Println("* [TYPE]") - fmt.Println(codeSet.Type) - fmt.Printf("\n") - fmt.Println("* [ALL OPCODE]") - fmt.Println(ctx.Code.Dump()) - fmt.Printf("\n") - fmt.Println("* [CONTEXT]") - fmt.Printf("%+v\n", ctx) - fmt.Println("===================================") - panic(err) - } - }() - - return Run(ctx, b, codeSet) -} diff --git a/internal/encoder/vm_escaped/hack.go b/internal/encoder/vm_escaped/hack.go deleted file mode 100644 index 3ac51dd..0000000 --- a/internal/encoder/vm_escaped/hack.go +++ /dev/null @@ -1,9 +0,0 @@ -package vm_escaped - -import ( - // HACK: compile order - // `vm`, `vm_escaped`, `vm_indent`, `vm_escaped_indent` packages uses a lot of memory to compile, - // so forcibly make dependencies and avoid compiling in concurrent. - // dependency order: vm => vm_escaped => vm_indent => vm_escaped_indent - _ "github.com/goccy/go-json/internal/encoder/vm_indent" -) diff --git a/internal/encoder/vm_escaped/util.go b/internal/encoder/vm_escaped/util.go deleted file mode 100644 index 5f1a77c..0000000 --- a/internal/encoder/vm_escaped/util.go +++ /dev/null @@ -1,216 +0,0 @@ -package vm_escaped - -import ( - "encoding/json" - "fmt" - "unsafe" - - "github.com/goccy/go-json/internal/encoder" - "github.com/goccy/go-json/internal/runtime" -) - -const uintptrSize = 4 << (^uintptr(0) >> 63) - -var ( - appendInt = encoder.AppendInt - appendUint = encoder.AppendUint - appendFloat32 = encoder.AppendFloat32 - appendFloat64 = encoder.AppendFloat64 - appendString = encoder.AppendEscapedString - appendByteSlice = encoder.AppendByteSlice - appendNumber = encoder.AppendNumber - errUnsupportedValue = encoder.ErrUnsupportedValue - errUnsupportedFloat = encoder.ErrUnsupportedFloat - mapiterinit = encoder.MapIterInit - mapiterkey = encoder.MapIterKey - mapitervalue = encoder.MapIterValue - mapiternext = encoder.MapIterNext - maplen = encoder.MapLen -) - -type emptyInterface struct { - typ *runtime.Type - ptr unsafe.Pointer -} - -func errUnimplementedOp(op encoder.OpType) error { - return fmt.Errorf("encoder (escaped): opcode %s has not been implemented", op) -} - -func load(base uintptr, idx uint32) uintptr { - addr := base + uintptr(idx) - return **(**uintptr)(unsafe.Pointer(&addr)) -} - -func store(base uintptr, idx uint32, p uintptr) { - addr := base + uintptr(idx) - **(**uintptr)(unsafe.Pointer(&addr)) = p -} - -func loadNPtr(base uintptr, idx uint32, ptrNum uint8) uintptr { - addr := base + uintptr(idx) - p := **(**uintptr)(unsafe.Pointer(&addr)) - for i := uint8(0); i < ptrNum; i++ { - if p == 0 { - return 0 - } - p = ptrToPtr(p) - } - return p -} - -func ptrToUint64(p uintptr) uint64 { return **(**uint64)(unsafe.Pointer(&p)) } -func ptrToFloat32(p uintptr) float32 { return **(**float32)(unsafe.Pointer(&p)) } -func ptrToFloat64(p uintptr) float64 { return **(**float64)(unsafe.Pointer(&p)) } -func ptrToBool(p uintptr) bool { return **(**bool)(unsafe.Pointer(&p)) } -func ptrToBytes(p uintptr) []byte { return **(**[]byte)(unsafe.Pointer(&p)) } -func ptrToNumber(p uintptr) json.Number { return **(**json.Number)(unsafe.Pointer(&p)) } -func ptrToString(p uintptr) string { return **(**string)(unsafe.Pointer(&p)) } -func ptrToSlice(p uintptr) *runtime.SliceHeader { return *(**runtime.SliceHeader)(unsafe.Pointer(&p)) } -func ptrToPtr(p uintptr) uintptr { - return uintptr(**(**unsafe.Pointer)(unsafe.Pointer(&p))) -} -func ptrToNPtr(p uintptr, ptrNum uint8) uintptr { - for i := uint8(0); i < ptrNum; i++ { - if p == 0 { - return 0 - } - p = ptrToPtr(p) - } - return p -} - -func ptrToUnsafePtr(p uintptr) unsafe.Pointer { - return *(*unsafe.Pointer)(unsafe.Pointer(&p)) -} -func ptrToInterface(code *encoder.Opcode, p uintptr) interface{} { - return *(*interface{})(unsafe.Pointer(&emptyInterface{ - typ: code.Type, - ptr: *(*unsafe.Pointer)(unsafe.Pointer(&p)), - })) -} - -func appendBool(b []byte, v bool) []byte { - if v { - return append(b, "true"...) - } - return append(b, "false"...) -} - -func appendNull(b []byte) []byte { - return append(b, "null"...) -} - -func appendComma(b []byte) []byte { - return append(b, ',') -} - -func appendColon(b []byte) []byte { - last := len(b) - 1 - b[last] = ':' - return b -} - -func appendMapKeyValue(_ *encoder.RuntimeContext, _ *encoder.Opcode, b, key, value []byte) []byte { - b = append(b, key...) - b[len(b)-1] = ':' - return append(b, value...) -} - -func appendMapEnd(_ *encoder.RuntimeContext, _ *encoder.Opcode, b []byte) []byte { - b[len(b)-1] = '}' - b = append(b, ',') - return b -} - -func appendInterface(ctx *encoder.RuntimeContext, codeSet *encoder.OpcodeSet, _ *encoder.Opcode, b []byte, iface *emptyInterface, ptrOffset uintptr) ([]byte, error) { - ctx.KeepRefs = append(ctx.KeepRefs, unsafe.Pointer(iface)) - ifaceCodeSet, err := encoder.CompileToGetCodeSet(uintptr(unsafe.Pointer(iface.typ))) - if err != nil { - return nil, err - } - - totalLength := uintptr(codeSet.CodeLength) - nextTotalLength := uintptr(ifaceCodeSet.CodeLength) - - curlen := uintptr(len(ctx.Ptrs)) - offsetNum := ptrOffset / uintptrSize - - newLen := offsetNum + totalLength + nextTotalLength - if curlen < newLen { - ctx.Ptrs = append(ctx.Ptrs, make([]uintptr, newLen-curlen)...) - } - oldPtrs := ctx.Ptrs - - newPtrs := ctx.Ptrs[(ptrOffset+totalLength*uintptrSize)/uintptrSize:] - newPtrs[0] = uintptr(iface.ptr) - - ctx.Ptrs = newPtrs - ctx.Code = ifaceCodeSet.EscapeKeyCode - - bb, err := Run(ctx, b, ifaceCodeSet) - if err != nil { - return nil, err - } - - ctx.Ptrs = oldPtrs - return bb, nil -} - -func appendMarshalJSON(ctx *encoder.RuntimeContext, code *encoder.Opcode, b []byte, v interface{}) ([]byte, error) { - return encoder.AppendMarshalJSON(ctx, code, b, v, true) -} - -func appendMarshalText(code *encoder.Opcode, b []byte, v interface{}) ([]byte, error) { - return encoder.AppendMarshalText(code, b, v, true) -} - -func appendArrayHead(_ *encoder.RuntimeContext, _ *encoder.Opcode, b []byte) []byte { - return append(b, '[') -} - -func appendArrayEnd(_ *encoder.RuntimeContext, _ *encoder.Opcode, b []byte) []byte { - last := len(b) - 1 - b[last] = ']' - return append(b, ',') -} - -func appendEmptyArray(b []byte) []byte { - return append(b, '[', ']', ',') -} - -func appendEmptyObject(b []byte) []byte { - return append(b, '{', '}', ',') -} - -func appendObjectEnd(_ *encoder.RuntimeContext, _ *encoder.Opcode, b []byte) []byte { - last := len(b) - 1 - b[last] = '}' - return append(b, ',') -} - -func appendStructHead(b []byte) []byte { - return append(b, '{') -} - -func appendStructKey(_ *encoder.RuntimeContext, code *encoder.Opcode, b []byte) []byte { - return append(b, code.Key...) -} - -func appendStructEnd(_ *encoder.RuntimeContext, _ *encoder.Opcode, b []byte) []byte { - return append(b, '}', ',') -} - -func appendStructEndSkipLast(ctx *encoder.RuntimeContext, code *encoder.Opcode, b []byte) []byte { - last := len(b) - 1 - if b[last] == ',' { - b[last] = '}' - return appendComma(b) - } - return appendStructEnd(ctx, code, b) -} - -func restoreIndent(_ *encoder.RuntimeContext, _ *encoder.Opcode, _ uintptr) {} -func storeIndent(_ uintptr, _ *encoder.Opcode, _ uintptr) {} -func appendMapKeyIndent(_ *encoder.RuntimeContext, _ *encoder.Opcode, b []byte) []byte { return b } -func appendArrayElemIndent(_ *encoder.RuntimeContext, _ *encoder.Opcode, b []byte) []byte { return b } diff --git a/internal/encoder/vm_escaped/vm.go b/internal/encoder/vm_escaped/vm.go deleted file mode 100644 index ae8ca01..0000000 --- a/internal/encoder/vm_escaped/vm.go +++ /dev/null @@ -1,4993 +0,0 @@ -// Code generated by internal/cmd/generator. DO NOT EDIT! -package vm_escaped - -import ( - "math" - "sort" - "unsafe" - - "github.com/goccy/go-json/internal/encoder" -) - -func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]byte, error) { - recursiveLevel := 0 - ptrOffset := uintptr(0) - ctxptr := ctx.Ptr() - code := ctx.Code - - for { - switch code.Op { - default: - return nil, errUnimplementedOp(code.Op) - case encoder.OpPtr: - p := load(ctxptr, code.Idx) - code = code.Next - store(ctxptr, code.Idx, ptrToPtr(p)) - case encoder.OpIntPtr: - p := loadNPtr(ctxptr, code.Idx, code.PtrNum) - if p == 0 { - b = appendNull(b) - b = appendComma(b) - code = code.Next - break - } - store(ctxptr, code.Idx, p) - fallthrough - case encoder.OpInt: - b = appendInt(b, ptrToUint64(load(ctxptr, code.Idx)), code) - b = appendComma(b) - code = code.Next - case encoder.OpUintPtr: - p := loadNPtr(ctxptr, code.Idx, code.PtrNum) - if p == 0 { - b = appendNull(b) - b = appendComma(b) - code = code.Next - break - } - store(ctxptr, code.Idx, p) - fallthrough - case encoder.OpUint: - b = appendUint(b, ptrToUint64(load(ctxptr, code.Idx)), code) - b = appendComma(b) - code = code.Next - case encoder.OpIntString: - b = append(b, '"') - b = appendInt(b, ptrToUint64(load(ctxptr, code.Idx)), code) - b = append(b, '"') - b = appendComma(b) - code = code.Next - case encoder.OpUintString: - b = append(b, '"') - b = appendUint(b, ptrToUint64(load(ctxptr, code.Idx)), code) - b = append(b, '"') - b = appendComma(b) - code = code.Next - case encoder.OpFloat32Ptr: - p := loadNPtr(ctxptr, code.Idx, code.PtrNum) - if p == 0 { - b = appendNull(b) - b = appendComma(b) - code = code.Next - break - } - store(ctxptr, code.Idx, p) - fallthrough - case encoder.OpFloat32: - b = appendFloat32(b, ptrToFloat32(load(ctxptr, code.Idx))) - b = appendComma(b) - code = code.Next - case encoder.OpFloat64Ptr: - p := loadNPtr(ctxptr, code.Idx, code.PtrNum) - if p == 0 { - b = appendNull(b) - b = appendComma(b) - code = code.Next - break - } - store(ctxptr, code.Idx, p) - fallthrough - case encoder.OpFloat64: - v := ptrToFloat64(load(ctxptr, code.Idx)) - if math.IsInf(v, 0) || math.IsNaN(v) { - return nil, errUnsupportedFloat(v) - } - b = appendFloat64(b, v) - b = appendComma(b) - code = code.Next - case encoder.OpStringPtr: - p := loadNPtr(ctxptr, code.Idx, code.PtrNum) - if p == 0 { - b = appendNull(b) - b = appendComma(b) - code = code.Next - break - } - store(ctxptr, code.Idx, p) - fallthrough - case encoder.OpString: - b = appendString(b, ptrToString(load(ctxptr, code.Idx))) - b = appendComma(b) - code = code.Next - case encoder.OpBoolPtr: - p := loadNPtr(ctxptr, code.Idx, code.PtrNum) - if p == 0 { - b = appendNull(b) - b = appendComma(b) - code = code.Next - break - } - store(ctxptr, code.Idx, p) - fallthrough - case encoder.OpBool: - b = appendBool(b, ptrToBool(load(ctxptr, code.Idx))) - b = appendComma(b) - code = code.Next - case encoder.OpBytesPtr: - p := loadNPtr(ctxptr, code.Idx, code.PtrNum) - if p == 0 { - b = appendNull(b) - b = appendComma(b) - code = code.Next - break - } - store(ctxptr, code.Idx, p) - fallthrough - case encoder.OpBytes: - b = appendByteSlice(b, ptrToBytes(load(ctxptr, code.Idx))) - b = appendComma(b) - code = code.Next - case encoder.OpNumberPtr: - p := loadNPtr(ctxptr, code.Idx, code.PtrNum) - if p == 0 { - b = appendNull(b) - b = appendComma(b) - code = code.Next - break - } - store(ctxptr, code.Idx, p) - fallthrough - case encoder.OpNumber: - bb, err := appendNumber(b, ptrToNumber(load(ctxptr, code.Idx))) - if err != nil { - return nil, err - } - b = appendComma(bb) - code = code.Next - case encoder.OpInterfacePtr: - p := loadNPtr(ctxptr, code.Idx, code.PtrNum) - if p == 0 { - b = appendNull(b) - b = appendComma(b) - code = code.Next - break - } - store(ctxptr, code.Idx, p) - fallthrough - case encoder.OpInterface: - p := load(ctxptr, code.Idx) - if p == 0 { - b = appendNull(b) - b = appendComma(b) - code = code.Next - break - } - for _, seen := range ctx.SeenPtr { - if p == seen { - return nil, errUnsupportedValue(code, p) - } - } - ctx.SeenPtr = append(ctx.SeenPtr, p) - iface := (*emptyInterface)(ptrToUnsafePtr(p)) - if iface.ptr == nil { - b = appendNull(b) - b = appendComma(b) - code = code.Next - break - } - bb, err := appendInterface(ctx, codeSet, code, b, iface, ptrOffset) - if err != nil { - return nil, err - } - ctxptr = ctx.Ptr() - ctx.SeenPtr = ctx.SeenPtr[:len(ctx.SeenPtr)-1] - - b = bb - code = code.Next - case encoder.OpMarshalJSONPtr: - p := load(ctxptr, code.Idx) - if p == 0 { - b = appendNull(b) - b = appendComma(b) - code = code.Next - break - } - store(ctxptr, code.Idx, ptrToPtr(p)) - fallthrough - case encoder.OpMarshalJSON: - p := load(ctxptr, code.Idx) - if p == 0 { - b = appendNull(b) - b = appendComma(b) - code = code.Next - break - } - if (code.Flags&encoder.IsNilableTypeFlags) != 0 && (code.Flags&encoder.IndirectFlags) != 0 { - p = ptrToPtr(p) - } - bb, err := appendMarshalJSON(ctx, code, b, ptrToInterface(code, p)) - if err != nil { - return nil, err - } - b = appendComma(bb) - code = code.Next - case encoder.OpMarshalTextPtr: - p := load(ctxptr, code.Idx) - if p == 0 { - b = appendNull(b) - b = appendComma(b) - code = code.Next - break - } - store(ctxptr, code.Idx, ptrToPtr(p)) - fallthrough - case encoder.OpMarshalText: - p := load(ctxptr, code.Idx) - if p == 0 { - b = append(b, `""`...) - b = appendComma(b) - code = code.Next - break - } - if (code.Flags&encoder.IsNilableTypeFlags) != 0 && (code.Flags&encoder.IndirectFlags) != 0 { - p = ptrToPtr(p) - } - bb, err := appendMarshalText(code, b, ptrToInterface(code, p)) - if err != nil { - return nil, err - } - b = appendComma(bb) - code = code.Next - case encoder.OpSlicePtr: - p := loadNPtr(ctxptr, code.Idx, code.PtrNum) - if p == 0 { - b = appendNull(b) - b = appendComma(b) - code = code.End.Next - break - } - store(ctxptr, code.Idx, p) - fallthrough - case encoder.OpSlice: - p := load(ctxptr, code.Idx) - slice := ptrToSlice(p) - if p == 0 || slice.Data == nil { - b = appendNull(b) - b = appendComma(b) - code = code.End.Next - break - } - store(ctxptr, code.ElemIdx, 0) - store(ctxptr, code.Length, uintptr(slice.Len)) - store(ctxptr, code.Idx, uintptr(slice.Data)) - if slice.Len > 0 { - b = appendArrayHead(ctx, code, b) - code = code.Next - store(ctxptr, code.Idx, uintptr(slice.Data)) - } else { - b = appendEmptyArray(b) - code = code.End.Next - } - case encoder.OpSliceElem: - idx := load(ctxptr, code.ElemIdx) - length := load(ctxptr, code.Length) - idx++ - if idx < length { - b = appendArrayElemIndent(ctx, code, b) - store(ctxptr, code.ElemIdx, idx) - data := load(ctxptr, code.Idx) - size := uintptr(code.Size) - code = code.Next - store(ctxptr, code.Idx, data+idx*size) - } else { - b = appendArrayEnd(ctx, code, b) - code = code.End.Next - } - case encoder.OpArrayPtr: - p := loadNPtr(ctxptr, code.Idx, code.PtrNum) - if p == 0 { - b = appendNull(b) - b = appendComma(b) - code = code.End.Next - break - } - store(ctxptr, code.Idx, p) - fallthrough - case encoder.OpArray: - p := load(ctxptr, code.Idx) - if p == 0 { - b = appendNull(b) - b = appendComma(b) - code = code.End.Next - break - } - if code.Length > 0 { - b = appendArrayHead(ctx, code, b) - store(ctxptr, code.ElemIdx, 0) - code = code.Next - store(ctxptr, code.Idx, p) - } else { - b = appendEmptyArray(b) - code = code.End.Next - } - case encoder.OpArrayElem: - idx := load(ctxptr, code.ElemIdx) - idx++ - if idx < uintptr(code.Length) { - b = appendArrayElemIndent(ctx, code, b) - store(ctxptr, code.ElemIdx, idx) - p := load(ctxptr, code.Idx) - size := uintptr(code.Size) - code = code.Next - store(ctxptr, code.Idx, p+idx*size) - } else { - b = appendArrayEnd(ctx, code, b) - code = code.End.Next - } - case encoder.OpMapPtr: - p := loadNPtr(ctxptr, code.Idx, code.PtrNum) - if p == 0 { - b = appendNull(b) - b = appendComma(b) - code = code.End.Next - break - } - store(ctxptr, code.Idx, p) - fallthrough - case encoder.OpMap: - p := load(ctxptr, code.Idx) - if p == 0 { - b = appendNull(b) - b = appendComma(b) - code = code.End.Next - break - } - uptr := ptrToUnsafePtr(p) - mlen := maplen(uptr) - if mlen <= 0 { - b = appendEmptyObject(b) - code = code.End.Next - break - } - b = appendStructHead(b) - iter := mapiterinit(code.Type, uptr) - ctx.KeepRefs = append(ctx.KeepRefs, iter) - store(ctxptr, code.ElemIdx, 0) - store(ctxptr, code.Length, uintptr(mlen)) - store(ctxptr, code.MapIter, uintptr(iter)) - if ctx.Option.UnorderedMap { - b = appendMapKeyIndent(ctx, code.Next, b) - } else { - mapCtx := encoder.NewMapContext(mlen) - mapCtx.Pos = append(mapCtx.Pos, len(b)) - ctx.KeepRefs = append(ctx.KeepRefs, unsafe.Pointer(mapCtx)) - store(ctxptr, code.End.MapPos, uintptr(unsafe.Pointer(mapCtx))) - } - key := mapiterkey(iter) - store(ctxptr, code.Next.Idx, uintptr(key)) - code = code.Next - case encoder.OpMapKey: - idx := load(ctxptr, code.ElemIdx) - length := load(ctxptr, code.Length) - idx++ - if ctx.Option.UnorderedMap { - if idx < length { - b = appendMapKeyIndent(ctx, code, b) - store(ctxptr, code.ElemIdx, idx) - ptr := load(ctxptr, code.MapIter) - iter := ptrToUnsafePtr(ptr) - key := mapiterkey(iter) - store(ctxptr, code.Next.Idx, uintptr(key)) - code = code.Next - } else { - b = appendObjectEnd(ctx, code, b) - code = code.End.Next - } - } else { - ptr := load(ctxptr, code.End.MapPos) - mapCtx := (*encoder.MapContext)(ptrToUnsafePtr(ptr)) - mapCtx.Pos = append(mapCtx.Pos, len(b)) - if idx < length { - ptr := load(ctxptr, code.MapIter) - iter := ptrToUnsafePtr(ptr) - store(ctxptr, code.ElemIdx, idx) - key := mapiterkey(iter) - store(ctxptr, code.Next.Idx, uintptr(key)) - code = code.Next - } else { - code = code.End - } - } - case encoder.OpMapValue: - if ctx.Option.UnorderedMap { - b = appendColon(b) - } else { - ptr := load(ctxptr, code.End.MapPos) - mapCtx := (*encoder.MapContext)(ptrToUnsafePtr(ptr)) - mapCtx.Pos = append(mapCtx.Pos, len(b)) - } - ptr := load(ctxptr, code.MapIter) - iter := ptrToUnsafePtr(ptr) - value := mapitervalue(iter) - store(ctxptr, code.Next.Idx, uintptr(value)) - mapiternext(iter) - code = code.Next - case encoder.OpMapEnd: - // this operation only used by sorted map. - length := int(load(ctxptr, code.Length)) - ptr := load(ctxptr, code.MapPos) - mapCtx := (*encoder.MapContext)(ptrToUnsafePtr(ptr)) - pos := mapCtx.Pos - for i := 0; i < length; i++ { - startKey := pos[i*2] - startValue := pos[i*2+1] - var endValue int - if i+1 < length { - endValue = pos[i*2+2] - } else { - endValue = len(b) - } - mapCtx.Slice.Items = append(mapCtx.Slice.Items, encoder.MapItem{ - Key: b[startKey:startValue], - Value: b[startValue:endValue], - }) - } - sort.Sort(mapCtx.Slice) - buf := mapCtx.Buf - for _, item := range mapCtx.Slice.Items { - buf = appendMapKeyValue(ctx, code, buf, item.Key, item.Value) - } - buf = appendMapEnd(ctx, code, buf) - b = b[:pos[0]] - b = append(b, buf...) - mapCtx.Buf = buf - encoder.ReleaseMapContext(mapCtx) - code = code.Next - case encoder.OpRecursivePtr: - p := load(ctxptr, code.Idx) - if p == 0 { - code = code.Next - break - } - store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) - fallthrough - case encoder.OpRecursive: - ptr := load(ctxptr, code.Idx) - if ptr != 0 { - if recursiveLevel > encoder.StartDetectingCyclesAfter { - for _, seen := range ctx.SeenPtr { - if ptr == seen { - return nil, errUnsupportedValue(code, ptr) - } - } - } - } - ctx.SeenPtr = append(ctx.SeenPtr, ptr) - c := code.Jmp.Code - curlen := uintptr(len(ctx.Ptrs)) - offsetNum := ptrOffset / uintptrSize - oldOffset := ptrOffset - ptrOffset += code.Jmp.CurLen * uintptrSize - oldBaseIndent := ctx.BaseIndent - ctx.BaseIndent += code.Indent - 1 - - newLen := offsetNum + code.Jmp.CurLen + code.Jmp.NextLen - if curlen < newLen { - ctx.Ptrs = append(ctx.Ptrs, make([]uintptr, newLen-curlen)...) - } - ctxptr = ctx.Ptr() + ptrOffset // assign new ctxptr - - store(ctxptr, c.Idx, ptr) - store(ctxptr, c.End.Next.Idx, oldOffset) - store(ctxptr, c.End.Next.ElemIdx, uintptr(unsafe.Pointer(code.Next))) - storeIndent(ctxptr, c, uintptr(oldBaseIndent)) - code = c - recursiveLevel++ - case encoder.OpRecursiveEnd: - recursiveLevel-- - - // restore ctxptr - restoreIndent(ctx, code, ctxptr) - offset := load(ctxptr, code.Idx) - ctx.SeenPtr = ctx.SeenPtr[:len(ctx.SeenPtr)-1] - - codePtr := load(ctxptr, code.ElemIdx) - code = (*encoder.Opcode)(ptrToUnsafePtr(codePtr)) - ctxptr = ctx.Ptr() + offset - ptrOffset = offset - case encoder.OpStructPtrHead: - p := load(ctxptr, code.Idx) - if p == 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) - fallthrough - case encoder.OpStructHead: - p := load(ctxptr, code.Idx) - if p == 0 && ((code.Flags&encoder.IndirectFlags) != 0 || code.Next.Op == encoder.OpStructEnd) { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) - } - if (code.Flags&encoder.AnonymousKeyFlags) == 0 && len(code.Key) > 0 { - b = appendStructKey(ctx, code, b) - } - p += uintptr(code.Offset) - code = code.Next - store(ctxptr, code.Idx, p) - case encoder.OpStructPtrHeadOmitEmpty: - p := load(ctxptr, code.Idx) - if p == 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) - fallthrough - case encoder.OpStructHeadOmitEmpty: - p := load(ctxptr, code.Idx) - if p == 0 && ((code.Flags&encoder.IndirectFlags) != 0 || code.Next.Op == encoder.OpStructEnd) { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) - } - p += uintptr(code.Offset) - if p == 0 || (ptrToPtr(p) == 0 && (code.Flags&encoder.IsNextOpPtrTypeFlags) != 0) { - code = code.NextField - } else { - b = appendStructKey(ctx, code, b) - code = code.Next - store(ctxptr, code.Idx, p) - } - case encoder.OpStructPtrHeadInt: - if (code.Flags & encoder.IndirectFlags) != 0 { - p := load(ctxptr, code.Idx) - if p == 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) - } - fallthrough - case encoder.OpStructHeadInt: - p := load(ctxptr, code.Idx) - if p == 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) - } - b = appendStructKey(ctx, code, b) - b = appendInt(b, ptrToUint64(p+uintptr(code.Offset)), code) - b = appendComma(b) - code = code.Next - case encoder.OpStructPtrHeadOmitEmptyInt: - if (code.Flags & encoder.IndirectFlags) != 0 { - p := load(ctxptr, code.Idx) - if p == 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) - } - fallthrough - case encoder.OpStructHeadOmitEmptyInt: - p := load(ctxptr, code.Idx) - if p == 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) - } - u64 := ptrToUint64(p + uintptr(code.Offset)) - v := u64 & ((1 << code.NumBitSize) - 1) - if v == 0 { - code = code.NextField - } else { - b = appendStructKey(ctx, code, b) - b = appendInt(b, u64, code) - b = appendComma(b) - code = code.Next - } - case encoder.OpStructPtrHeadIntString: - if (code.Flags & encoder.IndirectFlags) != 0 { - p := load(ctxptr, code.Idx) - if p == 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) - } - fallthrough - case encoder.OpStructHeadIntString: - p := load(ctxptr, code.Idx) - if p == 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) - } - b = appendStructKey(ctx, code, b) - b = append(b, '"') - b = appendInt(b, ptrToUint64(p+uintptr(code.Offset)), code) - b = append(b, '"') - b = appendComma(b) - code = code.Next - case encoder.OpStructPtrHeadOmitEmptyIntString: - if (code.Flags & encoder.IndirectFlags) != 0 { - p := load(ctxptr, code.Idx) - if p == 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) - } - fallthrough - case encoder.OpStructHeadOmitEmptyIntString: - p := load(ctxptr, code.Idx) - if p == 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) - } - u64 := ptrToUint64(p + uintptr(code.Offset)) - v := u64 & ((1 << code.NumBitSize) - 1) - if v == 0 { - code = code.NextField - } else { - b = appendStructKey(ctx, code, b) - b = append(b, '"') - b = appendInt(b, u64, code) - b = append(b, '"') - b = appendComma(b) - code = code.Next - } - case encoder.OpStructPtrHeadIntPtr: - p := load(ctxptr, code.Idx) - if p == 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) - fallthrough - case encoder.OpStructHeadIntPtr: - p := load(ctxptr, code.Idx) - if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) - } - b = appendStructKey(ctx, code, b) - if (code.Flags & encoder.IndirectFlags) != 0 { - p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) - } - if p == 0 { - b = appendNull(b) - } else { - b = appendInt(b, ptrToUint64(p), code) - } - b = appendComma(b) - code = code.Next - case encoder.OpStructPtrHeadOmitEmptyIntPtr: - p := load(ctxptr, code.Idx) - if p == 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) - fallthrough - case encoder.OpStructHeadOmitEmptyIntPtr: - p := load(ctxptr, code.Idx) - if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) - } - if (code.Flags & encoder.IndirectFlags) != 0 { - p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) - } - if p != 0 { - b = appendStructKey(ctx, code, b) - b = appendInt(b, ptrToUint64(p), code) - b = appendComma(b) - } - code = code.Next - case encoder.OpStructPtrHeadIntPtrString: - p := load(ctxptr, code.Idx) - if p == 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) - fallthrough - case encoder.OpStructHeadIntPtrString: - p := load(ctxptr, code.Idx) - if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) - } - b = appendStructKey(ctx, code, b) - if (code.Flags & encoder.IndirectFlags) != 0 { - p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) - } - if p == 0 { - b = appendNull(b) - } else { - b = append(b, '"') - b = appendInt(b, ptrToUint64(p), code) - b = append(b, '"') - } - b = appendComma(b) - code = code.Next - case encoder.OpStructPtrHeadOmitEmptyIntPtrString: - p := load(ctxptr, code.Idx) - if p == 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) - fallthrough - case encoder.OpStructHeadOmitEmptyIntPtrString: - p := load(ctxptr, code.Idx) - if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) - } - if (code.Flags & encoder.IndirectFlags) != 0 { - p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) - } - if p != 0 { - b = appendStructKey(ctx, code, b) - b = append(b, '"') - b = appendInt(b, ptrToUint64(p), code) - b = append(b, '"') - b = appendComma(b) - } - code = code.Next - case encoder.OpStructPtrHeadUint: - if (code.Flags & encoder.IndirectFlags) != 0 { - p := load(ctxptr, code.Idx) - if p == 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) - } - fallthrough - case encoder.OpStructHeadUint: - p := load(ctxptr, code.Idx) - if p == 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) - } - b = appendStructKey(ctx, code, b) - b = appendUint(b, ptrToUint64(p+uintptr(code.Offset)), code) - b = appendComma(b) - code = code.Next - case encoder.OpStructPtrHeadOmitEmptyUint: - if (code.Flags & encoder.IndirectFlags) != 0 { - p := load(ctxptr, code.Idx) - if p == 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) - } - fallthrough - case encoder.OpStructHeadOmitEmptyUint: - p := load(ctxptr, code.Idx) - if p == 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) - } - u64 := ptrToUint64(p + uintptr(code.Offset)) - v := u64 & ((1 << code.NumBitSize) - 1) - if v == 0 { - code = code.NextField - } else { - b = appendStructKey(ctx, code, b) - b = appendUint(b, u64, code) - b = appendComma(b) - code = code.Next - } - case encoder.OpStructPtrHeadUintString: - if (code.Flags & encoder.IndirectFlags) != 0 { - p := load(ctxptr, code.Idx) - if p == 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) - } - fallthrough - case encoder.OpStructHeadUintString: - p := load(ctxptr, code.Idx) - if p == 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) - } - b = appendStructKey(ctx, code, b) - b = append(b, '"') - b = appendUint(b, ptrToUint64(p+uintptr(code.Offset)), code) - b = append(b, '"') - b = appendComma(b) - code = code.Next - case encoder.OpStructPtrHeadOmitEmptyUintString: - if (code.Flags & encoder.IndirectFlags) != 0 { - p := load(ctxptr, code.Idx) - if p == 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) - } - fallthrough - case encoder.OpStructHeadOmitEmptyUintString: - p := load(ctxptr, code.Idx) - if p == 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) - } - u64 := ptrToUint64(p + uintptr(code.Offset)) - v := u64 & ((1 << code.NumBitSize) - 1) - if v == 0 { - code = code.NextField - } else { - b = appendStructKey(ctx, code, b) - b = append(b, '"') - b = appendUint(b, u64, code) - b = append(b, '"') - b = appendComma(b) - code = code.Next - } - case encoder.OpStructPtrHeadUintPtr: - p := load(ctxptr, code.Idx) - if p == 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) - fallthrough - case encoder.OpStructHeadUintPtr: - p := load(ctxptr, code.Idx) - if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) - } - b = appendStructKey(ctx, code, b) - if (code.Flags & encoder.IndirectFlags) != 0 { - p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) - } - if p == 0 { - b = appendNull(b) - } else { - b = appendUint(b, ptrToUint64(p), code) - } - b = appendComma(b) - code = code.Next - case encoder.OpStructPtrHeadOmitEmptyUintPtr: - p := load(ctxptr, code.Idx) - if p == 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) - fallthrough - case encoder.OpStructHeadOmitEmptyUintPtr: - p := load(ctxptr, code.Idx) - if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) - } - if (code.Flags & encoder.IndirectFlags) != 0 { - p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) - } - if p != 0 { - b = appendStructKey(ctx, code, b) - b = appendUint(b, ptrToUint64(p), code) - b = appendComma(b) - } - code = code.Next - case encoder.OpStructPtrHeadUintPtrString: - p := load(ctxptr, code.Idx) - if p == 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) - fallthrough - case encoder.OpStructHeadUintPtrString: - p := load(ctxptr, code.Idx) - if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) - } - b = appendStructKey(ctx, code, b) - if (code.Flags & encoder.IndirectFlags) != 0 { - p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) - } - if p == 0 { - b = appendNull(b) - } else { - b = append(b, '"') - b = appendUint(b, ptrToUint64(p), code) - b = append(b, '"') - } - b = appendComma(b) - code = code.Next - case encoder.OpStructPtrHeadOmitEmptyUintPtrString: - p := load(ctxptr, code.Idx) - if p == 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) - fallthrough - case encoder.OpStructHeadOmitEmptyUintPtrString: - p := load(ctxptr, code.Idx) - if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) - } - if (code.Flags & encoder.IndirectFlags) != 0 { - p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) - } - if p != 0 { - b = appendStructKey(ctx, code, b) - b = append(b, '"') - b = appendUint(b, ptrToUint64(p), code) - b = append(b, '"') - b = appendComma(b) - } - code = code.Next - case encoder.OpStructPtrHeadFloat32: - if (code.Flags & encoder.IndirectFlags) != 0 { - p := load(ctxptr, code.Idx) - if p == 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) - } - fallthrough - case encoder.OpStructHeadFloat32: - p := load(ctxptr, code.Idx) - if p == 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) - } - b = appendStructKey(ctx, code, b) - b = appendFloat32(b, ptrToFloat32(p+uintptr(code.Offset))) - b = appendComma(b) - code = code.Next - case encoder.OpStructPtrHeadOmitEmptyFloat32: - if (code.Flags & encoder.IndirectFlags) != 0 { - p := load(ctxptr, code.Idx) - if p == 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) - } - fallthrough - case encoder.OpStructHeadOmitEmptyFloat32: - p := load(ctxptr, code.Idx) - if p == 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) - } - v := ptrToFloat32(p + uintptr(code.Offset)) - if v == 0 { - code = code.NextField - } else { - b = appendStructKey(ctx, code, b) - b = appendFloat32(b, v) - b = appendComma(b) - code = code.Next - } - case encoder.OpStructPtrHeadFloat32String: - if (code.Flags & encoder.IndirectFlags) != 0 { - p := load(ctxptr, code.Idx) - if p == 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) - } - fallthrough - case encoder.OpStructHeadFloat32String: - p := load(ctxptr, code.Idx) - if p == 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) - } - b = appendStructKey(ctx, code, b) - b = append(b, '"') - b = appendFloat32(b, ptrToFloat32(p+uintptr(code.Offset))) - b = append(b, '"') - b = appendComma(b) - code = code.Next - case encoder.OpStructPtrHeadOmitEmptyFloat32String: - if (code.Flags & encoder.IndirectFlags) != 0 { - p := load(ctxptr, code.Idx) - if p == 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) - } - fallthrough - case encoder.OpStructHeadOmitEmptyFloat32String: - p := load(ctxptr, code.Idx) - if p == 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) - } - v := ptrToFloat32(p + uintptr(code.Offset)) - if v == 0 { - code = code.NextField - } else { - b = appendStructKey(ctx, code, b) - b = append(b, '"') - b = appendFloat32(b, v) - b = append(b, '"') - b = appendComma(b) - code = code.Next - } - case encoder.OpStructPtrHeadFloat32Ptr: - p := load(ctxptr, code.Idx) - if p == 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) - fallthrough - case encoder.OpStructHeadFloat32Ptr: - p := load(ctxptr, code.Idx) - if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) - } - b = appendStructKey(ctx, code, b) - if (code.Flags & encoder.IndirectFlags) != 0 { - p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) - } - if p == 0 { - b = appendNull(b) - } else { - b = appendFloat32(b, ptrToFloat32(p)) - } - b = appendComma(b) - code = code.Next - case encoder.OpStructPtrHeadOmitEmptyFloat32Ptr: - p := load(ctxptr, code.Idx) - if p == 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) - fallthrough - case encoder.OpStructHeadOmitEmptyFloat32Ptr: - p := load(ctxptr, code.Idx) - if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) - } - if (code.Flags & encoder.IndirectFlags) != 0 { - p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) - } - if p != 0 { - b = appendStructKey(ctx, code, b) - b = appendFloat32(b, ptrToFloat32(p)) - b = appendComma(b) - } - code = code.Next - case encoder.OpStructPtrHeadFloat32PtrString: - p := load(ctxptr, code.Idx) - if p == 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) - fallthrough - case encoder.OpStructHeadFloat32PtrString: - p := load(ctxptr, code.Idx) - if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) - } - b = appendStructKey(ctx, code, b) - if (code.Flags & encoder.IndirectFlags) != 0 { - p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) - } - if p == 0 { - b = appendNull(b) - } else { - b = append(b, '"') - b = appendFloat32(b, ptrToFloat32(p)) - b = append(b, '"') - } - b = appendComma(b) - code = code.Next - case encoder.OpStructPtrHeadOmitEmptyFloat32PtrString: - p := load(ctxptr, code.Idx) - if p == 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) - fallthrough - case encoder.OpStructHeadOmitEmptyFloat32PtrString: - p := load(ctxptr, code.Idx) - if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) - } - if (code.Flags & encoder.IndirectFlags) != 0 { - p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) - } - if p != 0 { - b = appendStructKey(ctx, code, b) - b = append(b, '"') - b = appendFloat32(b, ptrToFloat32(p)) - b = append(b, '"') - b = appendComma(b) - } - code = code.Next - case encoder.OpStructPtrHeadFloat64: - if (code.Flags & encoder.IndirectFlags) != 0 { - p := load(ctxptr, code.Idx) - if p == 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) - } - fallthrough - case encoder.OpStructHeadFloat64: - p := load(ctxptr, code.Idx) - if p == 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - v := ptrToFloat64(p + uintptr(code.Offset)) - if math.IsInf(v, 0) || math.IsNaN(v) { - return nil, errUnsupportedFloat(v) - } - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) - } - b = appendStructKey(ctx, code, b) - b = appendFloat64(b, v) - b = appendComma(b) - code = code.Next - case encoder.OpStructPtrHeadOmitEmptyFloat64: - if (code.Flags & encoder.IndirectFlags) != 0 { - p := load(ctxptr, code.Idx) - if p == 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) - } - fallthrough - case encoder.OpStructHeadOmitEmptyFloat64: - p := load(ctxptr, code.Idx) - if p == 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) - } - v := ptrToFloat64(p + uintptr(code.Offset)) - if v == 0 { - code = code.NextField - } else { - if math.IsInf(v, 0) || math.IsNaN(v) { - return nil, errUnsupportedFloat(v) - } - b = appendStructKey(ctx, code, b) - b = appendFloat64(b, v) - b = appendComma(b) - code = code.Next - } - case encoder.OpStructPtrHeadFloat64String: - if (code.Flags & encoder.IndirectFlags) != 0 { - p := load(ctxptr, code.Idx) - if p == 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) - } - fallthrough - case encoder.OpStructHeadFloat64String: - p := load(ctxptr, code.Idx) - if p == 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) - } - v := ptrToFloat64(p + uintptr(code.Offset)) - if math.IsInf(v, 0) || math.IsNaN(v) { - return nil, errUnsupportedFloat(v) - } - b = appendStructKey(ctx, code, b) - b = append(b, '"') - b = appendFloat64(b, v) - b = append(b, '"') - b = appendComma(b) - code = code.Next - case encoder.OpStructPtrHeadOmitEmptyFloat64String: - if (code.Flags & encoder.IndirectFlags) != 0 { - p := load(ctxptr, code.Idx) - if p == 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) - } - fallthrough - case encoder.OpStructHeadOmitEmptyFloat64String: - p := load(ctxptr, code.Idx) - if p == 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) - } - v := ptrToFloat64(p + uintptr(code.Offset)) - if v == 0 { - code = code.NextField - } else { - if math.IsInf(v, 0) || math.IsNaN(v) { - return nil, errUnsupportedFloat(v) - } - b = appendStructKey(ctx, code, b) - b = append(b, '"') - b = appendFloat64(b, v) - b = append(b, '"') - b = appendComma(b) - code = code.Next - } - case encoder.OpStructPtrHeadFloat64Ptr: - p := load(ctxptr, code.Idx) - if p == 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) - fallthrough - case encoder.OpStructHeadFloat64Ptr: - p := load(ctxptr, code.Idx) - if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) - } - b = appendStructKey(ctx, code, b) - if (code.Flags & encoder.IndirectFlags) != 0 { - p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) - } - if p == 0 { - b = appendNull(b) - } else { - v := ptrToFloat64(p) - if math.IsInf(v, 0) || math.IsNaN(v) { - return nil, errUnsupportedFloat(v) - } - b = appendFloat64(b, v) - } - b = appendComma(b) - code = code.Next - case encoder.OpStructPtrHeadOmitEmptyFloat64Ptr: - p := load(ctxptr, code.Idx) - if p == 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) - fallthrough - case encoder.OpStructHeadOmitEmptyFloat64Ptr: - p := load(ctxptr, code.Idx) - if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) - } - if (code.Flags & encoder.IndirectFlags) != 0 { - p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) - } - if p != 0 { - b = appendStructKey(ctx, code, b) - v := ptrToFloat64(p) - if math.IsInf(v, 0) || math.IsNaN(v) { - return nil, errUnsupportedFloat(v) - } - b = appendFloat64(b, v) - b = appendComma(b) - } - code = code.Next - case encoder.OpStructPtrHeadFloat64PtrString: - p := load(ctxptr, code.Idx) - if p == 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) - fallthrough - case encoder.OpStructHeadFloat64PtrString: - p := load(ctxptr, code.Idx) - if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) - } - b = appendStructKey(ctx, code, b) - if (code.Flags & encoder.IndirectFlags) != 0 { - p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) - } - if p == 0 { - b = appendNull(b) - } else { - b = append(b, '"') - v := ptrToFloat64(p) - if math.IsInf(v, 0) || math.IsNaN(v) { - return nil, errUnsupportedFloat(v) - } - b = appendFloat64(b, v) - b = append(b, '"') - } - b = appendComma(b) - code = code.Next - case encoder.OpStructPtrHeadOmitEmptyFloat64PtrString: - p := load(ctxptr, code.Idx) - if p == 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) - fallthrough - case encoder.OpStructHeadOmitEmptyFloat64PtrString: - p := load(ctxptr, code.Idx) - if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) - } - if (code.Flags & encoder.IndirectFlags) != 0 { - p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) - } - if p != 0 { - b = appendStructKey(ctx, code, b) - b = append(b, '"') - v := ptrToFloat64(p) - if math.IsInf(v, 0) || math.IsNaN(v) { - return nil, errUnsupportedFloat(v) - } - b = appendFloat64(b, v) - b = append(b, '"') - b = appendComma(b) - } - code = code.Next - case encoder.OpStructPtrHeadString: - if (code.Flags & encoder.IndirectFlags) != 0 { - p := load(ctxptr, code.Idx) - if p == 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) - } - fallthrough - case encoder.OpStructHeadString: - p := load(ctxptr, code.Idx) - if p == 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) - } - b = appendStructKey(ctx, code, b) - b = appendString(b, ptrToString(p+uintptr(code.Offset))) - b = appendComma(b) - code = code.Next - case encoder.OpStructPtrHeadOmitEmptyString: - if (code.Flags & encoder.IndirectFlags) != 0 { - p := load(ctxptr, code.Idx) - if p == 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) - } - fallthrough - case encoder.OpStructHeadOmitEmptyString: - p := load(ctxptr, code.Idx) - if p == 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) - } - v := ptrToString(p + uintptr(code.Offset)) - if v == "" { - code = code.NextField - } else { - b = appendStructKey(ctx, code, b) - b = appendString(b, v) - b = appendComma(b) - code = code.Next - } - case encoder.OpStructPtrHeadStringString: - if (code.Flags & encoder.IndirectFlags) != 0 { - p := load(ctxptr, code.Idx) - if p == 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) - } - fallthrough - case encoder.OpStructHeadStringString: - p := load(ctxptr, code.Idx) - if p == 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) - } - b = appendStructKey(ctx, code, b) - b = appendString(b, string(appendString([]byte{}, ptrToString(p+uintptr(code.Offset))))) - b = appendComma(b) - code = code.Next - case encoder.OpStructPtrHeadOmitEmptyStringString: - if (code.Flags & encoder.IndirectFlags) != 0 { - p := load(ctxptr, code.Idx) - if p == 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) - } - fallthrough - case encoder.OpStructHeadOmitEmptyStringString: - p := load(ctxptr, code.Idx) - if p == 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) - } - v := ptrToString(p + uintptr(code.Offset)) - if v == "" { - code = code.NextField - } else { - b = appendStructKey(ctx, code, b) - b = appendString(b, string(appendString([]byte{}, v))) - b = appendComma(b) - code = code.Next - } - case encoder.OpStructPtrHeadStringPtr: - p := load(ctxptr, code.Idx) - if p == 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) - fallthrough - case encoder.OpStructHeadStringPtr: - p := load(ctxptr, code.Idx) - if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) - } - b = appendStructKey(ctx, code, b) - if (code.Flags & encoder.IndirectFlags) != 0 { - p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) - } - if p == 0 { - b = appendNull(b) - } else { - b = appendString(b, ptrToString(p)) - } - b = appendComma(b) - code = code.Next - case encoder.OpStructPtrHeadOmitEmptyStringPtr: - p := load(ctxptr, code.Idx) - if p == 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) - fallthrough - case encoder.OpStructHeadOmitEmptyStringPtr: - p := load(ctxptr, code.Idx) - if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) - } - if (code.Flags & encoder.IndirectFlags) != 0 { - p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) - } - if p != 0 { - b = appendStructKey(ctx, code, b) - b = appendString(b, ptrToString(p)) - b = appendComma(b) - } - code = code.Next - case encoder.OpStructPtrHeadStringPtrString: - p := load(ctxptr, code.Idx) - if p == 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) - fallthrough - case encoder.OpStructHeadStringPtrString: - p := load(ctxptr, code.Idx) - if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) - } - b = appendStructKey(ctx, code, b) - if (code.Flags & encoder.IndirectFlags) != 0 { - p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) - } - if p == 0 { - b = appendNull(b) - } else { - b = appendString(b, string(appendString([]byte{}, ptrToString(p)))) - } - b = appendComma(b) - code = code.Next - case encoder.OpStructPtrHeadOmitEmptyStringPtrString: - p := load(ctxptr, code.Idx) - if p == 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) - fallthrough - case encoder.OpStructHeadOmitEmptyStringPtrString: - p := load(ctxptr, code.Idx) - if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) - } - if (code.Flags & encoder.IndirectFlags) != 0 { - p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) - } - if p != 0 { - b = appendStructKey(ctx, code, b) - b = appendString(b, string(appendString([]byte{}, ptrToString(p)))) - b = appendComma(b) - } - code = code.Next - case encoder.OpStructPtrHeadBool: - if (code.Flags & encoder.IndirectFlags) != 0 { - p := load(ctxptr, code.Idx) - if p == 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) - } - fallthrough - case encoder.OpStructHeadBool: - p := load(ctxptr, code.Idx) - if p == 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) - } - b = appendStructKey(ctx, code, b) - b = appendBool(b, ptrToBool(p+uintptr(code.Offset))) - b = appendComma(b) - code = code.Next - case encoder.OpStructPtrHeadOmitEmptyBool: - if (code.Flags & encoder.IndirectFlags) != 0 { - p := load(ctxptr, code.Idx) - if p == 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) - } - fallthrough - case encoder.OpStructHeadOmitEmptyBool: - p := load(ctxptr, code.Idx) - if p == 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) - } - v := ptrToBool(p + uintptr(code.Offset)) - if v { - b = appendStructKey(ctx, code, b) - b = appendBool(b, v) - b = appendComma(b) - code = code.Next - } else { - code = code.NextField - } - case encoder.OpStructPtrHeadBoolString: - if (code.Flags & encoder.IndirectFlags) != 0 { - p := load(ctxptr, code.Idx) - if p == 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) - } - fallthrough - case encoder.OpStructHeadBoolString: - p := load(ctxptr, code.Idx) - if p == 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) - } - b = appendStructKey(ctx, code, b) - b = append(b, '"') - b = appendBool(b, ptrToBool(p+uintptr(code.Offset))) - b = append(b, '"') - b = appendComma(b) - code = code.Next - case encoder.OpStructPtrHeadOmitEmptyBoolString: - if (code.Flags & encoder.IndirectFlags) != 0 { - p := load(ctxptr, code.Idx) - if p == 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) - } - fallthrough - case encoder.OpStructHeadOmitEmptyBoolString: - p := load(ctxptr, code.Idx) - if p == 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) - } - v := ptrToBool(p + uintptr(code.Offset)) - if v { - b = appendStructKey(ctx, code, b) - b = append(b, '"') - b = appendBool(b, v) - b = append(b, '"') - b = appendComma(b) - code = code.Next - } else { - code = code.NextField - } - case encoder.OpStructPtrHeadBoolPtr: - p := load(ctxptr, code.Idx) - if p == 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) - fallthrough - case encoder.OpStructHeadBoolPtr: - p := load(ctxptr, code.Idx) - if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) - } - b = appendStructKey(ctx, code, b) - if (code.Flags & encoder.IndirectFlags) != 0 { - p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) - } - if p == 0 { - b = appendNull(b) - } else { - b = appendBool(b, ptrToBool(p)) - } - b = appendComma(b) - code = code.Next - case encoder.OpStructPtrHeadOmitEmptyBoolPtr: - p := load(ctxptr, code.Idx) - if p == 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) - fallthrough - case encoder.OpStructHeadOmitEmptyBoolPtr: - p := load(ctxptr, code.Idx) - if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) - } - if (code.Flags & encoder.IndirectFlags) != 0 { - p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) - } - if p != 0 { - b = appendStructKey(ctx, code, b) - b = appendBool(b, ptrToBool(p)) - b = appendComma(b) - } - code = code.Next - case encoder.OpStructPtrHeadBoolPtrString: - p := load(ctxptr, code.Idx) - if p == 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) - fallthrough - case encoder.OpStructHeadBoolPtrString: - p := load(ctxptr, code.Idx) - if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) - } - b = appendStructKey(ctx, code, b) - if (code.Flags & encoder.IndirectFlags) != 0 { - p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) - } - if p == 0 { - b = appendNull(b) - } else { - b = append(b, '"') - b = appendBool(b, ptrToBool(p)) - b = append(b, '"') - } - b = appendComma(b) - code = code.Next - case encoder.OpStructPtrHeadOmitEmptyBoolPtrString: - p := load(ctxptr, code.Idx) - if p == 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) - fallthrough - case encoder.OpStructHeadOmitEmptyBoolPtrString: - p := load(ctxptr, code.Idx) - if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) - } - if (code.Flags & encoder.IndirectFlags) != 0 { - p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) - } - if p != 0 { - b = appendStructKey(ctx, code, b) - b = append(b, '"') - b = appendBool(b, ptrToBool(p)) - b = append(b, '"') - b = appendComma(b) - } - code = code.Next - case encoder.OpStructPtrHeadBytes: - if (code.Flags & encoder.IndirectFlags) != 0 { - p := load(ctxptr, code.Idx) - if p == 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) - } - fallthrough - case encoder.OpStructHeadBytes: - p := load(ctxptr, code.Idx) - if p == 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) - } - b = appendStructKey(ctx, code, b) - b = appendByteSlice(b, ptrToBytes(p+uintptr(code.Offset))) - b = appendComma(b) - code = code.Next - case encoder.OpStructPtrHeadOmitEmptyBytes: - if (code.Flags & encoder.IndirectFlags) != 0 { - p := load(ctxptr, code.Idx) - if p == 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) - } - fallthrough - case encoder.OpStructHeadOmitEmptyBytes: - p := load(ctxptr, code.Idx) - if p == 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) - } - v := ptrToBytes(p + uintptr(code.Offset)) - if len(v) == 0 { - code = code.NextField - } else { - b = appendStructKey(ctx, code, b) - b = appendByteSlice(b, v) - b = appendComma(b) - code = code.Next - } - case encoder.OpStructPtrHeadBytesPtr: - p := load(ctxptr, code.Idx) - if p == 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) - fallthrough - case encoder.OpStructHeadBytesPtr: - p := load(ctxptr, code.Idx) - if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) - } - b = appendStructKey(ctx, code, b) - if (code.Flags & encoder.IndirectFlags) != 0 { - p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) - } - if p == 0 { - b = appendNull(b) - } else { - b = appendByteSlice(b, ptrToBytes(p)) - } - b = appendComma(b) - code = code.Next - case encoder.OpStructPtrHeadOmitEmptyBytesPtr: - p := load(ctxptr, code.Idx) - if p == 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) - fallthrough - case encoder.OpStructHeadOmitEmptyBytesPtr: - p := load(ctxptr, code.Idx) - if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) - } - if (code.Flags & encoder.IndirectFlags) != 0 { - p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) - } - if p != 0 { - b = appendStructKey(ctx, code, b) - b = appendByteSlice(b, ptrToBytes(p)) - b = appendComma(b) - } - code = code.Next - case encoder.OpStructPtrHeadNumber: - if (code.Flags & encoder.IndirectFlags) != 0 { - p := load(ctxptr, code.Idx) - if p == 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) - } - fallthrough - case encoder.OpStructHeadNumber: - p := load(ctxptr, code.Idx) - if p == 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) - } - b = appendStructKey(ctx, code, b) - bb, err := appendNumber(b, ptrToNumber(p+uintptr(code.Offset))) - if err != nil { - return nil, err - } - b = appendComma(bb) - code = code.Next - case encoder.OpStructPtrHeadOmitEmptyNumber: - if (code.Flags & encoder.IndirectFlags) != 0 { - p := load(ctxptr, code.Idx) - if p == 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) - } - fallthrough - case encoder.OpStructHeadOmitEmptyNumber: - p := load(ctxptr, code.Idx) - if p == 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) - } - v := ptrToNumber(p + uintptr(code.Offset)) - if v == "" { - code = code.NextField - } else { - b = appendStructKey(ctx, code, b) - bb, err := appendNumber(b, v) - if err != nil { - return nil, err - } - b = appendComma(bb) - code = code.Next - } - case encoder.OpStructPtrHeadNumberString: - if (code.Flags & encoder.IndirectFlags) != 0 { - p := load(ctxptr, code.Idx) - if p == 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) - } - fallthrough - case encoder.OpStructHeadNumberString: - p := load(ctxptr, code.Idx) - if p == 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) - } - b = appendStructKey(ctx, code, b) - b = append(b, '"') - bb, err := appendNumber(b, ptrToNumber(p+uintptr(code.Offset))) - if err != nil { - return nil, err - } - b = append(bb, '"') - b = appendComma(b) - code = code.Next - case encoder.OpStructPtrHeadOmitEmptyNumberString: - if (code.Flags & encoder.IndirectFlags) != 0 { - p := load(ctxptr, code.Idx) - if p == 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) - } - fallthrough - case encoder.OpStructHeadOmitEmptyNumberString: - p := load(ctxptr, code.Idx) - if p == 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) - } - v := ptrToNumber(p + uintptr(code.Offset)) - if v == "" { - code = code.NextField - } else { - b = appendStructKey(ctx, code, b) - b = append(b, '"') - bb, err := appendNumber(b, v) - if err != nil { - return nil, err - } - b = append(bb, '"') - b = appendComma(b) - code = code.Next - } - case encoder.OpStructPtrHeadNumberPtr: - p := load(ctxptr, code.Idx) - if p == 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) - fallthrough - case encoder.OpStructHeadNumberPtr: - p := load(ctxptr, code.Idx) - if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) - } - b = appendStructKey(ctx, code, b) - if (code.Flags & encoder.IndirectFlags) != 0 { - p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) - } - if p == 0 { - b = appendNull(b) - } else { - bb, err := appendNumber(b, ptrToNumber(p)) - if err != nil { - return nil, err - } - b = bb - } - b = appendComma(b) - code = code.Next - case encoder.OpStructPtrHeadOmitEmptyNumberPtr: - p := load(ctxptr, code.Idx) - if p == 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) - fallthrough - case encoder.OpStructHeadOmitEmptyNumberPtr: - p := load(ctxptr, code.Idx) - if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) - } - if (code.Flags & encoder.IndirectFlags) != 0 { - p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) - } - if p != 0 { - b = appendStructKey(ctx, code, b) - bb, err := appendNumber(b, ptrToNumber(p)) - if err != nil { - return nil, err - } - b = appendComma(bb) - } - code = code.Next - case encoder.OpStructPtrHeadNumberPtrString: - p := load(ctxptr, code.Idx) - if p == 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) - fallthrough - case encoder.OpStructHeadNumberPtrString: - p := load(ctxptr, code.Idx) - if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) - } - b = appendStructKey(ctx, code, b) - if (code.Flags & encoder.IndirectFlags) != 0 { - p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) - } - if p == 0 { - b = appendNull(b) - } else { - b = append(b, '"') - bb, err := appendNumber(b, ptrToNumber(p)) - if err != nil { - return nil, err - } - b = append(bb, '"') - } - b = appendComma(b) - code = code.Next - case encoder.OpStructPtrHeadOmitEmptyNumberPtrString: - p := load(ctxptr, code.Idx) - if p == 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) - fallthrough - case encoder.OpStructHeadOmitEmptyNumberPtrString: - p := load(ctxptr, code.Idx) - if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) - } - if (code.Flags & encoder.IndirectFlags) != 0 { - p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) - } - if p != 0 { - b = appendStructKey(ctx, code, b) - b = append(b, '"') - bb, err := appendNumber(b, ptrToNumber(p)) - if err != nil { - return nil, err - } - b = append(bb, '"') - b = appendComma(b) - } - code = code.Next - case encoder.OpStructPtrHeadArray, encoder.OpStructPtrHeadSlice: - if (code.Flags & encoder.IndirectFlags) != 0 { - p := load(ctxptr, code.Idx) - if p == 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) - } - fallthrough - case encoder.OpStructHeadArray, encoder.OpStructHeadSlice: - p := load(ctxptr, code.Idx) - if p == 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) - } - b = appendStructKey(ctx, code, b) - p += uintptr(code.Offset) - code = code.Next - store(ctxptr, code.Idx, p) - case encoder.OpStructPtrHeadOmitEmptyArray: - if (code.Flags & encoder.IndirectFlags) != 0 { - p := load(ctxptr, code.Idx) - if p == 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) - } - fallthrough - case encoder.OpStructHeadOmitEmptyArray: - p := load(ctxptr, code.Idx) - if p == 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) - } - p += uintptr(code.Offset) - b = appendStructKey(ctx, code, b) - code = code.Next - store(ctxptr, code.Idx, p) - case encoder.OpStructPtrHeadOmitEmptySlice: - if (code.Flags & encoder.IndirectFlags) != 0 { - p := load(ctxptr, code.Idx) - if p == 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) - } - fallthrough - case encoder.OpStructHeadOmitEmptySlice: - p := load(ctxptr, code.Idx) - if p == 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) - } - p += uintptr(code.Offset) - slice := ptrToSlice(p) - if slice.Len == 0 { - code = code.NextField - } else { - b = appendStructKey(ctx, code, b) - code = code.Next - store(ctxptr, code.Idx, p) - } - case encoder.OpStructPtrHeadArrayPtr, encoder.OpStructPtrHeadSlicePtr: - p := load(ctxptr, code.Idx) - if p == 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) - fallthrough - case encoder.OpStructHeadArrayPtr, encoder.OpStructHeadSlicePtr: - p := load(ctxptr, code.Idx) - if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) - } - b = appendStructKey(ctx, code, b) - if (code.Flags & encoder.IndirectFlags) != 0 { - p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) - } - if p == 0 { - b = appendNull(b) - b = appendComma(b) - code = code.NextField - } else { - code = code.Next - store(ctxptr, code.Idx, p) - } - case encoder.OpStructPtrHeadOmitEmptyArrayPtr, encoder.OpStructPtrHeadOmitEmptySlicePtr: - p := load(ctxptr, code.Idx) - if p == 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) - fallthrough - case encoder.OpStructHeadOmitEmptyArrayPtr, encoder.OpStructHeadOmitEmptySlicePtr: - p := load(ctxptr, code.Idx) - if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) - } - if (code.Flags & encoder.IndirectFlags) != 0 { - p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) - } - if p == 0 { - code = code.NextField - } else { - b = appendStructKey(ctx, code, b) - code = code.Next - store(ctxptr, code.Idx, p) - } - case encoder.OpStructPtrHeadMap: - p := load(ctxptr, code.Idx) - if p == 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) - fallthrough - case encoder.OpStructHeadMap: - p := load(ctxptr, code.Idx) - if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) - } - b = appendStructKey(ctx, code, b) - if p != 0 && (code.Flags&encoder.IndirectFlags) != 0 { - p = ptrToPtr(p + uintptr(code.Offset)) - } - code = code.Next - store(ctxptr, code.Idx, p) - case encoder.OpStructPtrHeadOmitEmptyMap: - p := load(ctxptr, code.Idx) - if p == 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) - fallthrough - case encoder.OpStructHeadOmitEmptyMap: - p := load(ctxptr, code.Idx) - if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) - } - if p != 0 && (code.Flags&encoder.IndirectFlags) != 0 { - p = ptrToPtr(p + uintptr(code.Offset)) - } - if maplen(ptrToUnsafePtr(p)) == 0 { - code = code.NextField - } else { - b = appendStructKey(ctx, code, b) - code = code.Next - store(ctxptr, code.Idx, p) - } - case encoder.OpStructPtrHeadMapPtr: - p := load(ctxptr, code.Idx) - if p == 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) - fallthrough - case encoder.OpStructHeadMapPtr: - p := load(ctxptr, code.Idx) - if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) - } - b = appendStructKey(ctx, code, b) - if p == 0 { - b = appendNull(b) - b = appendComma(b) - code = code.NextField - break - } - p = ptrToPtr(p + uintptr(code.Offset)) - if p == 0 { - b = appendNull(b) - b = appendComma(b) - code = code.NextField - } else { - if (code.Flags & encoder.IndirectFlags) != 0 { - p = ptrToNPtr(p, code.PtrNum) - } - code = code.Next - store(ctxptr, code.Idx, p) - } - case encoder.OpStructPtrHeadOmitEmptyMapPtr: - p := load(ctxptr, code.Idx) - if p == 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) - fallthrough - case encoder.OpStructHeadOmitEmptyMapPtr: - p := load(ctxptr, code.Idx) - if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) - } - if p == 0 { - code = code.NextField - break - } - p = ptrToPtr(p + uintptr(code.Offset)) - if p == 0 { - code = code.NextField - } else { - if (code.Flags & encoder.IndirectFlags) != 0 { - p = ptrToNPtr(p, code.PtrNum) - } - b = appendStructKey(ctx, code, b) - code = code.Next - store(ctxptr, code.Idx, p) - } - case encoder.OpStructPtrHeadMarshalJSON: - p := load(ctxptr, code.Idx) - if p == 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if (code.Flags & encoder.IndirectFlags) != 0 { - store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) - } - fallthrough - case encoder.OpStructHeadMarshalJSON: - p := load(ctxptr, code.Idx) - if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) - } - b = appendStructKey(ctx, code, b) - if (code.Flags & encoder.IsNilableTypeFlags) != 0 { - if (code.Flags&encoder.IndirectFlags) != 0 || code.Op == encoder.OpStructPtrHeadMarshalJSON { - p = ptrToPtr(p + uintptr(code.Offset)) - } - } - if p == 0 && (code.Flags&encoder.NilCheckFlags) != 0 { - b = appendNull(b) - } else { - bb, err := appendMarshalJSON(ctx, code, b, ptrToInterface(code, p)) - if err != nil { - return nil, err - } - b = bb - } - b = appendComma(b) - code = code.Next - case encoder.OpStructPtrHeadOmitEmptyMarshalJSON: - p := load(ctxptr, code.Idx) - if p == 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if (code.Flags & encoder.IndirectFlags) != 0 { - store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) - } - fallthrough - case encoder.OpStructHeadOmitEmptyMarshalJSON: - p := load(ctxptr, code.Idx) - if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) - } - if (code.Flags & encoder.IsNilableTypeFlags) != 0 { - if (code.Flags&encoder.IndirectFlags) != 0 || code.Op == encoder.OpStructPtrHeadOmitEmptyMarshalJSON { - p = ptrToPtr(p + uintptr(code.Offset)) - } - } - iface := ptrToInterface(code, p) - if (code.Flags&encoder.NilCheckFlags) != 0 && encoder.IsNilForMarshaler(iface) { - code = code.NextField - } else { - b = appendStructKey(ctx, code, b) - bb, err := appendMarshalJSON(ctx, code, b, iface) - if err != nil { - return nil, err - } - b = bb - b = appendComma(b) - code = code.Next - } - case encoder.OpStructPtrHeadMarshalJSONPtr: - p := load(ctxptr, code.Idx) - if p == 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) - fallthrough - case encoder.OpStructHeadMarshalJSONPtr: - p := load(ctxptr, code.Idx) - if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) - } - b = appendStructKey(ctx, code, b) - if (code.Flags & encoder.IndirectFlags) != 0 { - p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) - } - if p == 0 { - b = appendNull(b) - } else { - bb, err := appendMarshalJSON(ctx, code, b, ptrToInterface(code, p)) - if err != nil { - return nil, err - } - b = bb - } - b = appendComma(b) - code = code.Next - case encoder.OpStructPtrHeadOmitEmptyMarshalJSONPtr: - p := load(ctxptr, code.Idx) - if p == 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) - fallthrough - case encoder.OpStructHeadOmitEmptyMarshalJSONPtr: - p := load(ctxptr, code.Idx) - if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if (code.Flags & encoder.IndirectFlags) != 0 { - p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) - } - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) - } - if p == 0 { - code = code.NextField - } else { - b = appendStructKey(ctx, code, b) - bb, err := appendMarshalJSON(ctx, code, b, ptrToInterface(code, p)) - if err != nil { - return nil, err - } - b = bb - b = appendComma(b) - code = code.Next - } - case encoder.OpStructPtrHeadMarshalText: - p := load(ctxptr, code.Idx) - if p == 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if (code.Flags & encoder.IndirectFlags) != 0 { - store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) - } - fallthrough - case encoder.OpStructHeadMarshalText: - p := load(ctxptr, code.Idx) - if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) - } - b = appendStructKey(ctx, code, b) - if (code.Flags & encoder.IsNilableTypeFlags) != 0 { - if (code.Flags&encoder.IndirectFlags) != 0 || code.Op == encoder.OpStructPtrHeadMarshalText { - p = ptrToPtr(p + uintptr(code.Offset)) - } - } - if p == 0 && (code.Flags&encoder.NilCheckFlags) != 0 { - b = appendNull(b) - } else { - bb, err := appendMarshalText(code, b, ptrToInterface(code, p)) - if err != nil { - return nil, err - } - b = bb - } - b = appendComma(b) - code = code.Next - case encoder.OpStructPtrHeadOmitEmptyMarshalText: - p := load(ctxptr, code.Idx) - if p == 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if (code.Flags & encoder.IndirectFlags) != 0 { - store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) - } - fallthrough - case encoder.OpStructHeadOmitEmptyMarshalText: - p := load(ctxptr, code.Idx) - if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) - } - if (code.Flags & encoder.IsNilableTypeFlags) != 0 { - if (code.Flags&encoder.IndirectFlags) != 0 || code.Op == encoder.OpStructPtrHeadOmitEmptyMarshalText { - p = ptrToPtr(p + uintptr(code.Offset)) - } - } - if p == 0 && (code.Flags&encoder.NilCheckFlags) != 0 { - code = code.NextField - } else { - b = appendStructKey(ctx, code, b) - bb, err := appendMarshalText(code, b, ptrToInterface(code, p)) - if err != nil { - return nil, err - } - b = bb - b = appendComma(b) - code = code.Next - } - case encoder.OpStructPtrHeadMarshalTextPtr: - p := load(ctxptr, code.Idx) - if p == 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) - fallthrough - case encoder.OpStructHeadMarshalTextPtr: - p := load(ctxptr, code.Idx) - if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) - } - b = appendStructKey(ctx, code, b) - if (code.Flags & encoder.IndirectFlags) != 0 { - p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) - } - if p == 0 { - b = appendNull(b) - } else { - bb, err := appendMarshalText(code, b, ptrToInterface(code, p)) - if err != nil { - return nil, err - } - b = bb - } - b = appendComma(b) - code = code.Next - case encoder.OpStructPtrHeadOmitEmptyMarshalTextPtr: - p := load(ctxptr, code.Idx) - if p == 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) - fallthrough - case encoder.OpStructHeadOmitEmptyMarshalTextPtr: - p := load(ctxptr, code.Idx) - if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if (code.Flags & encoder.IndirectFlags) != 0 { - p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) - } - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) - } - if p == 0 { - code = code.NextField - } else { - b = appendStructKey(ctx, code, b) - bb, err := appendMarshalText(code, b, ptrToInterface(code, p)) - if err != nil { - return nil, err - } - b = bb - b = appendComma(b) - code = code.Next - } - case encoder.OpStructField: - if code.Flags&encoder.AnonymousKeyFlags == 0 { - b = appendStructKey(ctx, code, b) - } - p := load(ctxptr, code.Idx) + uintptr(code.Offset) - code = code.Next - store(ctxptr, code.Idx, p) - case encoder.OpStructFieldOmitEmpty: - p := load(ctxptr, code.Idx) - p += uintptr(code.Offset) - if ptrToPtr(p) == 0 && (code.Flags&encoder.IsNextOpPtrTypeFlags) != 0 { - code = code.NextField - } else { - b = appendStructKey(ctx, code, b) - code = code.Next - store(ctxptr, code.Idx, p) - } - case encoder.OpStructFieldInt: - p := load(ctxptr, code.Idx) - b = appendStructKey(ctx, code, b) - b = appendInt(b, ptrToUint64(p+uintptr(code.Offset)), code) - b = appendComma(b) - code = code.Next - case encoder.OpStructFieldOmitEmptyInt: - p := load(ctxptr, code.Idx) - u64 := ptrToUint64(p + uintptr(code.Offset)) - v := u64 & ((1 << code.NumBitSize) - 1) - if v != 0 { - b = appendStructKey(ctx, code, b) - b = appendInt(b, u64, code) - b = appendComma(b) - } - code = code.Next - case encoder.OpStructFieldIntString: - p := load(ctxptr, code.Idx) - b = appendStructKey(ctx, code, b) - b = append(b, '"') - b = appendInt(b, ptrToUint64(p+uintptr(code.Offset)), code) - b = append(b, '"') - b = appendComma(b) - code = code.Next - case encoder.OpStructFieldOmitEmptyIntString: - p := load(ctxptr, code.Idx) - u64 := ptrToUint64(p + uintptr(code.Offset)) - v := u64 & ((1 << code.NumBitSize) - 1) - if v != 0 { - b = appendStructKey(ctx, code, b) - b = append(b, '"') - b = appendInt(b, u64, code) - b = append(b, '"') - b = appendComma(b) - } - code = code.Next - case encoder.OpStructFieldIntPtr: - p := load(ctxptr, code.Idx) - p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) - b = appendStructKey(ctx, code, b) - if p == 0 { - b = appendNull(b) - } else { - b = appendInt(b, ptrToUint64(p), code) - } - b = appendComma(b) - code = code.Next - case encoder.OpStructFieldOmitEmptyIntPtr: - p := load(ctxptr, code.Idx) - p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) - if p != 0 { - b = appendStructKey(ctx, code, b) - b = appendInt(b, ptrToUint64(p), code) - b = appendComma(b) - } - code = code.Next - case encoder.OpStructFieldIntPtrString: - p := load(ctxptr, code.Idx) - p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) - b = appendStructKey(ctx, code, b) - if p == 0 { - b = appendNull(b) - } else { - b = append(b, '"') - b = appendInt(b, ptrToUint64(p), code) - b = append(b, '"') - } - b = appendComma(b) - code = code.Next - case encoder.OpStructFieldOmitEmptyIntPtrString: - p := load(ctxptr, code.Idx) - p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) - if p != 0 { - b = appendStructKey(ctx, code, b) - b = append(b, '"') - b = appendInt(b, ptrToUint64(p), code) - b = append(b, '"') - b = appendComma(b) - } - code = code.Next - case encoder.OpStructFieldUint: - p := load(ctxptr, code.Idx) - b = appendStructKey(ctx, code, b) - b = appendUint(b, ptrToUint64(p+uintptr(code.Offset)), code) - b = appendComma(b) - code = code.Next - case encoder.OpStructFieldOmitEmptyUint: - p := load(ctxptr, code.Idx) - u64 := ptrToUint64(p + uintptr(code.Offset)) - v := u64 & ((1 << code.NumBitSize) - 1) - if v != 0 { - b = appendStructKey(ctx, code, b) - b = appendUint(b, u64, code) - b = appendComma(b) - } - code = code.Next - case encoder.OpStructFieldUintString: - p := load(ctxptr, code.Idx) - b = appendStructKey(ctx, code, b) - b = append(b, '"') - b = appendUint(b, ptrToUint64(p+uintptr(code.Offset)), code) - b = append(b, '"') - b = appendComma(b) - code = code.Next - case encoder.OpStructFieldOmitEmptyUintString: - p := load(ctxptr, code.Idx) - u64 := ptrToUint64(p + uintptr(code.Offset)) - v := u64 & ((1 << code.NumBitSize) - 1) - if v != 0 { - b = appendStructKey(ctx, code, b) - b = append(b, '"') - b = appendUint(b, u64, code) - b = append(b, '"') - b = appendComma(b) - } - code = code.Next - case encoder.OpStructFieldUintPtr: - p := load(ctxptr, code.Idx) - p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) - b = appendStructKey(ctx, code, b) - if p == 0 { - b = appendNull(b) - } else { - b = appendUint(b, ptrToUint64(p), code) - } - b = appendComma(b) - code = code.Next - case encoder.OpStructFieldOmitEmptyUintPtr: - p := load(ctxptr, code.Idx) - p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) - if p != 0 { - b = appendStructKey(ctx, code, b) - b = appendUint(b, ptrToUint64(p), code) - b = appendComma(b) - } - code = code.Next - case encoder.OpStructFieldUintPtrString: - p := load(ctxptr, code.Idx) - p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) - b = appendStructKey(ctx, code, b) - if p == 0 { - b = appendNull(b) - } else { - b = append(b, '"') - b = appendUint(b, ptrToUint64(p), code) - b = append(b, '"') - } - b = appendComma(b) - code = code.Next - case encoder.OpStructFieldOmitEmptyUintPtrString: - p := load(ctxptr, code.Idx) - p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) - if p != 0 { - b = appendStructKey(ctx, code, b) - b = append(b, '"') - b = appendUint(b, ptrToUint64(p), code) - b = append(b, '"') - b = appendComma(b) - } - code = code.Next - case encoder.OpStructFieldFloat32: - p := load(ctxptr, code.Idx) - b = appendStructKey(ctx, code, b) - b = appendFloat32(b, ptrToFloat32(p+uintptr(code.Offset))) - b = appendComma(b) - code = code.Next - case encoder.OpStructFieldOmitEmptyFloat32: - p := load(ctxptr, code.Idx) - v := ptrToFloat32(p + uintptr(code.Offset)) - if v != 0 { - b = appendStructKey(ctx, code, b) - b = appendFloat32(b, v) - b = appendComma(b) - } - code = code.Next - case encoder.OpStructFieldFloat32String: - p := load(ctxptr, code.Idx) - b = appendStructKey(ctx, code, b) - b = append(b, '"') - b = appendFloat32(b, ptrToFloat32(p+uintptr(code.Offset))) - b = append(b, '"') - b = appendComma(b) - code = code.Next - case encoder.OpStructFieldOmitEmptyFloat32String: - p := load(ctxptr, code.Idx) - v := ptrToFloat32(p + uintptr(code.Offset)) - if v != 0 { - b = appendStructKey(ctx, code, b) - b = append(b, '"') - b = appendFloat32(b, v) - b = append(b, '"') - b = appendComma(b) - } - code = code.Next - case encoder.OpStructFieldFloat32Ptr: - p := load(ctxptr, code.Idx) - p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) - b = appendStructKey(ctx, code, b) - if p == 0 { - b = appendNull(b) - } else { - b = appendFloat32(b, ptrToFloat32(p)) - } - b = appendComma(b) - code = code.Next - case encoder.OpStructFieldOmitEmptyFloat32Ptr: - p := load(ctxptr, code.Idx) - p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) - if p != 0 { - b = appendStructKey(ctx, code, b) - b = appendFloat32(b, ptrToFloat32(p)) - b = appendComma(b) - } - code = code.Next - case encoder.OpStructFieldFloat32PtrString: - p := load(ctxptr, code.Idx) - p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) - b = appendStructKey(ctx, code, b) - if p == 0 { - b = appendNull(b) - } else { - b = append(b, '"') - b = appendFloat32(b, ptrToFloat32(p)) - b = append(b, '"') - } - b = appendComma(b) - code = code.Next - case encoder.OpStructFieldOmitEmptyFloat32PtrString: - p := load(ctxptr, code.Idx) - p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) - if p != 0 { - b = appendStructKey(ctx, code, b) - b = append(b, '"') - b = appendFloat32(b, ptrToFloat32(p)) - b = append(b, '"') - b = appendComma(b) - } - code = code.Next - case encoder.OpStructFieldFloat64: - p := load(ctxptr, code.Idx) - b = appendStructKey(ctx, code, b) - v := ptrToFloat64(p + uintptr(code.Offset)) - if math.IsInf(v, 0) || math.IsNaN(v) { - return nil, errUnsupportedFloat(v) - } - b = appendFloat64(b, v) - b = appendComma(b) - code = code.Next - case encoder.OpStructFieldOmitEmptyFloat64: - p := load(ctxptr, code.Idx) - v := ptrToFloat64(p + uintptr(code.Offset)) - if v != 0 { - if math.IsInf(v, 0) || math.IsNaN(v) { - return nil, errUnsupportedFloat(v) - } - b = appendStructKey(ctx, code, b) - b = appendFloat64(b, v) - b = appendComma(b) - } - code = code.Next - case encoder.OpStructFieldFloat64String: - p := load(ctxptr, code.Idx) - v := ptrToFloat64(p + uintptr(code.Offset)) - if math.IsInf(v, 0) || math.IsNaN(v) { - return nil, errUnsupportedFloat(v) - } - b = appendStructKey(ctx, code, b) - b = append(b, '"') - b = appendFloat64(b, v) - b = append(b, '"') - b = appendComma(b) - code = code.Next - case encoder.OpStructFieldOmitEmptyFloat64String: - p := load(ctxptr, code.Idx) - v := ptrToFloat64(p + uintptr(code.Offset)) - if v != 0 { - if math.IsInf(v, 0) || math.IsNaN(v) { - return nil, errUnsupportedFloat(v) - } - b = appendStructKey(ctx, code, b) - b = append(b, '"') - b = appendFloat64(b, v) - b = append(b, '"') - b = appendComma(b) - } - code = code.Next - case encoder.OpStructFieldFloat64Ptr: - p := load(ctxptr, code.Idx) - p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) - b = appendStructKey(ctx, code, b) - if p == 0 { - b = appendNull(b) - b = appendComma(b) - code = code.Next - break - } - v := ptrToFloat64(p) - if math.IsInf(v, 0) || math.IsNaN(v) { - return nil, errUnsupportedFloat(v) - } - b = appendFloat64(b, v) - b = appendComma(b) - code = code.Next - case encoder.OpStructFieldOmitEmptyFloat64Ptr: - p := load(ctxptr, code.Idx) - p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) - if p != 0 { - b = appendStructKey(ctx, code, b) - v := ptrToFloat64(p) - if math.IsInf(v, 0) || math.IsNaN(v) { - return nil, errUnsupportedFloat(v) - } - b = appendFloat64(b, v) - b = appendComma(b) - } - code = code.Next - case encoder.OpStructFieldFloat64PtrString: - p := load(ctxptr, code.Idx) - p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) - b = appendStructKey(ctx, code, b) - if p == 0 { - b = appendNull(b) - } else { - v := ptrToFloat64(p) - if math.IsInf(v, 0) || math.IsNaN(v) { - return nil, errUnsupportedFloat(v) - } - b = append(b, '"') - b = appendFloat64(b, v) - b = append(b, '"') - } - b = appendComma(b) - code = code.Next - case encoder.OpStructFieldOmitEmptyFloat64PtrString: - p := load(ctxptr, code.Idx) - p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) - if p != 0 { - b = appendStructKey(ctx, code, b) - b = append(b, '"') - v := ptrToFloat64(p) - if math.IsInf(v, 0) || math.IsNaN(v) { - return nil, errUnsupportedFloat(v) - } - b = appendFloat64(b, v) - b = append(b, '"') - b = appendComma(b) - } - code = code.Next - case encoder.OpStructFieldString: - p := load(ctxptr, code.Idx) - b = appendStructKey(ctx, code, b) - b = appendString(b, ptrToString(p+uintptr(code.Offset))) - b = appendComma(b) - code = code.Next - case encoder.OpStructFieldOmitEmptyString: - p := load(ctxptr, code.Idx) - v := ptrToString(p + uintptr(code.Offset)) - if v != "" { - b = appendStructKey(ctx, code, b) - b = appendString(b, v) - b = appendComma(b) - } - code = code.Next - case encoder.OpStructFieldStringString: - p := load(ctxptr, code.Idx) - s := ptrToString(p + uintptr(code.Offset)) - b = appendStructKey(ctx, code, b) - b = appendString(b, string(appendString([]byte{}, s))) - b = appendComma(b) - code = code.Next - case encoder.OpStructFieldOmitEmptyStringString: - p := load(ctxptr, code.Idx) - v := ptrToString(p + uintptr(code.Offset)) - if v != "" { - b = appendStructKey(ctx, code, b) - b = appendString(b, string(appendString([]byte{}, v))) - b = appendComma(b) - } - code = code.Next - case encoder.OpStructFieldStringPtr: - p := load(ctxptr, code.Idx) - p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) - b = appendStructKey(ctx, code, b) - if p == 0 { - b = appendNull(b) - } else { - b = appendString(b, ptrToString(p)) - } - b = appendComma(b) - code = code.Next - case encoder.OpStructFieldOmitEmptyStringPtr: - p := load(ctxptr, code.Idx) - p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) - if p != 0 { - b = appendStructKey(ctx, code, b) - b = appendString(b, ptrToString(p)) - b = appendComma(b) - } - code = code.Next - case encoder.OpStructFieldStringPtrString: - p := load(ctxptr, code.Idx) - p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) - b = appendStructKey(ctx, code, b) - if p == 0 { - b = appendNull(b) - } else { - b = appendString(b, string(appendString([]byte{}, ptrToString(p)))) - } - b = appendComma(b) - code = code.Next - case encoder.OpStructFieldOmitEmptyStringPtrString: - p := load(ctxptr, code.Idx) - p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) - if p != 0 { - b = appendStructKey(ctx, code, b) - b = appendString(b, string(appendString([]byte{}, ptrToString(p)))) - b = appendComma(b) - } - code = code.Next - case encoder.OpStructFieldBool: - p := load(ctxptr, code.Idx) - b = appendStructKey(ctx, code, b) - b = appendBool(b, ptrToBool(p+uintptr(code.Offset))) - b = appendComma(b) - code = code.Next - case encoder.OpStructFieldOmitEmptyBool: - p := load(ctxptr, code.Idx) - v := ptrToBool(p + uintptr(code.Offset)) - if v { - b = appendStructKey(ctx, code, b) - b = appendBool(b, v) - b = appendComma(b) - } - code = code.Next - case encoder.OpStructFieldBoolString: - p := load(ctxptr, code.Idx) - b = appendStructKey(ctx, code, b) - b = append(b, '"') - b = appendBool(b, ptrToBool(p+uintptr(code.Offset))) - b = append(b, '"') - b = appendComma(b) - code = code.Next - case encoder.OpStructFieldOmitEmptyBoolString: - p := load(ctxptr, code.Idx) - v := ptrToBool(p + uintptr(code.Offset)) - if v { - b = appendStructKey(ctx, code, b) - b = append(b, '"') - b = appendBool(b, v) - b = append(b, '"') - b = appendComma(b) - } - code = code.Next - case encoder.OpStructFieldBoolPtr: - p := load(ctxptr, code.Idx) - p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) - b = appendStructKey(ctx, code, b) - if p == 0 { - b = appendNull(b) - } else { - b = appendBool(b, ptrToBool(p)) - } - b = appendComma(b) - code = code.Next - case encoder.OpStructFieldOmitEmptyBoolPtr: - p := load(ctxptr, code.Idx) - p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) - if p != 0 { - b = appendStructKey(ctx, code, b) - b = appendBool(b, ptrToBool(p)) - b = appendComma(b) - } - code = code.Next - case encoder.OpStructFieldBoolPtrString: - p := load(ctxptr, code.Idx) - p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) - b = appendStructKey(ctx, code, b) - if p == 0 { - b = appendNull(b) - } else { - b = append(b, '"') - b = appendBool(b, ptrToBool(p)) - b = append(b, '"') - } - b = appendComma(b) - code = code.Next - case encoder.OpStructFieldOmitEmptyBoolPtrString: - p := load(ctxptr, code.Idx) - p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) - if p != 0 { - b = appendStructKey(ctx, code, b) - b = append(b, '"') - b = appendBool(b, ptrToBool(p)) - b = append(b, '"') - b = appendComma(b) - } - code = code.Next - case encoder.OpStructFieldBytes: - p := load(ctxptr, code.Idx) - b = appendStructKey(ctx, code, b) - b = appendByteSlice(b, ptrToBytes(p+uintptr(code.Offset))) - b = appendComma(b) - code = code.Next - case encoder.OpStructFieldOmitEmptyBytes: - p := load(ctxptr, code.Idx) - v := ptrToBytes(p + uintptr(code.Offset)) - if len(v) > 0 { - b = appendStructKey(ctx, code, b) - b = appendByteSlice(b, v) - b = appendComma(b) - } - code = code.Next - case encoder.OpStructFieldBytesPtr: - p := load(ctxptr, code.Idx) - p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) - b = appendStructKey(ctx, code, b) - if p == 0 { - b = appendNull(b) - } else { - b = appendByteSlice(b, ptrToBytes(p)) - } - b = appendComma(b) - code = code.Next - case encoder.OpStructFieldOmitEmptyBytesPtr: - p := load(ctxptr, code.Idx) - p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) - if p != 0 { - b = appendStructKey(ctx, code, b) - b = appendByteSlice(b, ptrToBytes(p)) - b = appendComma(b) - } - code = code.Next - case encoder.OpStructFieldNumber: - p := load(ctxptr, code.Idx) - b = appendStructKey(ctx, code, b) - bb, err := appendNumber(b, ptrToNumber(p+uintptr(code.Offset))) - if err != nil { - return nil, err - } - b = appendComma(bb) - code = code.Next - case encoder.OpStructFieldOmitEmptyNumber: - p := load(ctxptr, code.Idx) - v := ptrToNumber(p + uintptr(code.Offset)) - if v != "" { - b = appendStructKey(ctx, code, b) - bb, err := appendNumber(b, v) - if err != nil { - return nil, err - } - b = appendComma(bb) - } - code = code.Next - case encoder.OpStructFieldNumberString: - p := load(ctxptr, code.Idx) - b = appendStructKey(ctx, code, b) - b = append(b, '"') - bb, err := appendNumber(b, ptrToNumber(p+uintptr(code.Offset))) - if err != nil { - return nil, err - } - b = append(bb, '"') - b = appendComma(b) - code = code.Next - case encoder.OpStructFieldOmitEmptyNumberString: - p := load(ctxptr, code.Idx) - v := ptrToNumber(p + uintptr(code.Offset)) - if v != "" { - b = appendStructKey(ctx, code, b) - b = append(b, '"') - bb, err := appendNumber(b, v) - if err != nil { - return nil, err - } - b = append(bb, '"') - b = appendComma(b) - } - code = code.Next - case encoder.OpStructFieldNumberPtr: - p := load(ctxptr, code.Idx) - p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) - b = appendStructKey(ctx, code, b) - if p == 0 { - b = appendNull(b) - } else { - bb, err := appendNumber(b, ptrToNumber(p)) - if err != nil { - return nil, err - } - b = bb - } - b = appendComma(b) - code = code.Next - case encoder.OpStructFieldOmitEmptyNumberPtr: - p := load(ctxptr, code.Idx) - p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) - if p != 0 { - b = appendStructKey(ctx, code, b) - bb, err := appendNumber(b, ptrToNumber(p)) - if err != nil { - return nil, err - } - b = appendComma(bb) - } - code = code.Next - case encoder.OpStructFieldNumberPtrString: - p := load(ctxptr, code.Idx) - p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) - b = appendStructKey(ctx, code, b) - if p == 0 { - b = appendNull(b) - } else { - b = append(b, '"') - bb, err := appendNumber(b, ptrToNumber(p)) - if err != nil { - return nil, err - } - b = append(bb, '"') - } - b = appendComma(b) - code = code.Next - case encoder.OpStructFieldOmitEmptyNumberPtrString: - p := load(ctxptr, code.Idx) - p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) - if p != 0 { - b = appendStructKey(ctx, code, b) - b = append(b, '"') - bb, err := appendNumber(b, ptrToNumber(p)) - if err != nil { - return nil, err - } - b = append(bb, '"') - b = appendComma(b) - } - code = code.Next - case encoder.OpStructFieldMarshalJSON: - p := load(ctxptr, code.Idx) - b = appendStructKey(ctx, code, b) - p += uintptr(code.Offset) - if (code.Flags & encoder.IsNilableTypeFlags) != 0 { - p = ptrToPtr(p) - } - if p == 0 && (code.Flags&encoder.NilCheckFlags) != 0 { - b = appendNull(b) - } else { - bb, err := appendMarshalJSON(ctx, code, b, ptrToInterface(code, p)) - if err != nil { - return nil, err - } - b = bb - } - b = appendComma(b) - code = code.Next - case encoder.OpStructFieldOmitEmptyMarshalJSON: - p := load(ctxptr, code.Idx) - p += uintptr(code.Offset) - if (code.Flags & encoder.IsNilableTypeFlags) != 0 { - p = ptrToPtr(p) - } - if p == 0 && (code.Flags&encoder.NilCheckFlags) != 0 { - code = code.NextField - break - } - iface := ptrToInterface(code, p) - if (code.Flags&encoder.NilCheckFlags) != 0 && encoder.IsNilForMarshaler(iface) { - code = code.NextField - break - } - b = appendStructKey(ctx, code, b) - bb, err := appendMarshalJSON(ctx, code, b, iface) - if err != nil { - return nil, err - } - b = appendComma(bb) - code = code.Next - case encoder.OpStructFieldMarshalJSONPtr: - p := load(ctxptr, code.Idx) - b = appendStructKey(ctx, code, b) - p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) - if p == 0 { - b = appendNull(b) - } else { - bb, err := appendMarshalJSON(ctx, code, b, ptrToInterface(code, p)) - if err != nil { - return nil, err - } - b = bb - } - b = appendComma(b) - code = code.Next - case encoder.OpStructFieldOmitEmptyMarshalJSONPtr: - p := load(ctxptr, code.Idx) - p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) - if p != 0 { - b = appendStructKey(ctx, code, b) - bb, err := appendMarshalJSON(ctx, code, b, ptrToInterface(code, p)) - if err != nil { - return nil, err - } - b = appendComma(bb) - } - code = code.Next - case encoder.OpStructFieldMarshalText: - p := load(ctxptr, code.Idx) - b = appendStructKey(ctx, code, b) - p += uintptr(code.Offset) - if (code.Flags & encoder.IsNilableTypeFlags) != 0 { - p = ptrToPtr(p) - } - if p == 0 && (code.Flags&encoder.NilCheckFlags) != 0 { - b = appendNull(b) - } else { - bb, err := appendMarshalText(code, b, ptrToInterface(code, p)) - if err != nil { - return nil, err - } - b = bb - } - b = appendComma(b) - code = code.Next - case encoder.OpStructFieldOmitEmptyMarshalText: - p := load(ctxptr, code.Idx) - p += uintptr(code.Offset) - if (code.Flags & encoder.IsNilableTypeFlags) != 0 { - p = ptrToPtr(p) - } - if p == 0 && (code.Flags&encoder.NilCheckFlags) != 0 { - code = code.NextField - break - } - b = appendStructKey(ctx, code, b) - bb, err := appendMarshalText(code, b, ptrToInterface(code, p)) - if err != nil { - return nil, err - } - b = appendComma(bb) - code = code.Next - case encoder.OpStructFieldMarshalTextPtr: - p := load(ctxptr, code.Idx) - b = appendStructKey(ctx, code, b) - p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) - if p == 0 { - b = appendNull(b) - } else { - bb, err := appendMarshalText(code, b, ptrToInterface(code, p)) - if err != nil { - return nil, err - } - b = bb - } - b = appendComma(b) - code = code.Next - case encoder.OpStructFieldOmitEmptyMarshalTextPtr: - p := load(ctxptr, code.Idx) - p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) - if p != 0 { - b = appendStructKey(ctx, code, b) - bb, err := appendMarshalText(code, b, ptrToInterface(code, p)) - if err != nil { - return nil, err - } - b = appendComma(bb) - } - code = code.Next - case encoder.OpStructFieldArray: - b = appendStructKey(ctx, code, b) - p := load(ctxptr, code.Idx) - p += uintptr(code.Offset) - code = code.Next - store(ctxptr, code.Idx, p) - case encoder.OpStructFieldOmitEmptyArray: - b = appendStructKey(ctx, code, b) - p := load(ctxptr, code.Idx) - p += uintptr(code.Offset) - code = code.Next - store(ctxptr, code.Idx, p) - case encoder.OpStructFieldArrayPtr: - b = appendStructKey(ctx, code, b) - p := load(ctxptr, code.Idx) - p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) - code = code.Next - store(ctxptr, code.Idx, p) - case encoder.OpStructFieldOmitEmptyArrayPtr: - p := load(ctxptr, code.Idx) - p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) - if p != 0 { - b = appendStructKey(ctx, code, b) - code = code.Next - store(ctxptr, code.Idx, p) - } else { - code = code.NextField - } - case encoder.OpStructFieldSlice: - b = appendStructKey(ctx, code, b) - p := load(ctxptr, code.Idx) - p += uintptr(code.Offset) - code = code.Next - store(ctxptr, code.Idx, p) - case encoder.OpStructFieldOmitEmptySlice: - p := load(ctxptr, code.Idx) - p += uintptr(code.Offset) - slice := ptrToSlice(p) - if slice.Len == 0 { - code = code.NextField - } else { - b = appendStructKey(ctx, code, b) - code = code.Next - store(ctxptr, code.Idx, p) - } - case encoder.OpStructFieldSlicePtr: - b = appendStructKey(ctx, code, b) - p := load(ctxptr, code.Idx) - p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) - code = code.Next - store(ctxptr, code.Idx, p) - case encoder.OpStructFieldOmitEmptySlicePtr: - p := load(ctxptr, code.Idx) - p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) - if p != 0 { - b = appendStructKey(ctx, code, b) - code = code.Next - store(ctxptr, code.Idx, p) - } else { - code = code.NextField - } - case encoder.OpStructFieldMap: - b = appendStructKey(ctx, code, b) - p := load(ctxptr, code.Idx) - p = ptrToPtr(p + uintptr(code.Offset)) - code = code.Next - store(ctxptr, code.Idx, p) - case encoder.OpStructFieldOmitEmptyMap: - p := load(ctxptr, code.Idx) - p = ptrToPtr(p + uintptr(code.Offset)) - if p == 0 || maplen(ptrToUnsafePtr(p)) == 0 { - code = code.NextField - } else { - b = appendStructKey(ctx, code, b) - code = code.Next - store(ctxptr, code.Idx, p) - } - case encoder.OpStructFieldMapPtr: - b = appendStructKey(ctx, code, b) - p := load(ctxptr, code.Idx) - p = ptrToPtr(p + uintptr(code.Offset)) - if p != 0 { - p = ptrToNPtr(p, code.PtrNum) - } - code = code.Next - store(ctxptr, code.Idx, p) - case encoder.OpStructFieldOmitEmptyMapPtr: - p := load(ctxptr, code.Idx) - p = ptrToPtr(p + uintptr(code.Offset)) - if p != 0 { - p = ptrToNPtr(p, code.PtrNum) - } - if p != 0 { - b = appendStructKey(ctx, code, b) - code = code.Next - store(ctxptr, code.Idx, p) - } else { - code = code.NextField - } - case encoder.OpStructFieldStruct: - b = appendStructKey(ctx, code, b) - p := load(ctxptr, code.Idx) - p += uintptr(code.Offset) - code = code.Next - store(ctxptr, code.Idx, p) - case encoder.OpStructFieldOmitEmptyStruct: - p := load(ctxptr, code.Idx) - p += uintptr(code.Offset) - if ptrToPtr(p) == 0 && (code.Flags&encoder.IsNextOpPtrTypeFlags) != 0 { - code = code.NextField - } else { - b = appendStructKey(ctx, code, b) - code = code.Next - store(ctxptr, code.Idx, p) - } - case encoder.OpStructAnonymousEnd: - code = code.Next - case encoder.OpStructEnd: - b = appendStructEndSkipLast(ctx, code, b) - code = code.Next - case encoder.OpStructEndInt: - p := load(ctxptr, code.Idx) - b = appendStructKey(ctx, code, b) - b = appendInt(b, ptrToUint64(p+uintptr(code.Offset)), code) - b = appendStructEnd(ctx, code, b) - code = code.Next - case encoder.OpStructEndOmitEmptyInt: - p := load(ctxptr, code.Idx) - u64 := ptrToUint64(p + uintptr(code.Offset)) - v := u64 & ((1 << code.NumBitSize) - 1) - if v != 0 { - b = appendStructKey(ctx, code, b) - b = appendInt(b, u64, code) - b = appendStructEnd(ctx, code, b) - } else { - b = appendStructEndSkipLast(ctx, code, b) - } - code = code.Next - case encoder.OpStructEndIntString: - p := load(ctxptr, code.Idx) - b = appendStructKey(ctx, code, b) - b = append(b, '"') - b = appendInt(b, ptrToUint64(p+uintptr(code.Offset)), code) - b = append(b, '"') - b = appendStructEnd(ctx, code, b) - code = code.Next - case encoder.OpStructEndOmitEmptyIntString: - p := load(ctxptr, code.Idx) - u64 := ptrToUint64(p + uintptr(code.Offset)) - v := u64 & ((1 << code.NumBitSize) - 1) - if v != 0 { - b = appendStructKey(ctx, code, b) - b = append(b, '"') - b = appendInt(b, u64, code) - b = append(b, '"') - b = appendStructEnd(ctx, code, b) - } else { - b = appendStructEndSkipLast(ctx, code, b) - } - code = code.Next - case encoder.OpStructEndIntPtr: - b = appendStructKey(ctx, code, b) - p := load(ctxptr, code.Idx) - p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) - if p == 0 { - b = appendNull(b) - } else { - b = appendInt(b, ptrToUint64(p), code) - } - b = appendStructEnd(ctx, code, b) - code = code.Next - case encoder.OpStructEndOmitEmptyIntPtr: - p := load(ctxptr, code.Idx) - p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) - if p != 0 { - b = appendStructKey(ctx, code, b) - b = appendInt(b, ptrToUint64(p), code) - b = appendStructEnd(ctx, code, b) - } else { - b = appendStructEndSkipLast(ctx, code, b) - } - code = code.Next - case encoder.OpStructEndIntPtrString: - b = appendStructKey(ctx, code, b) - p := load(ctxptr, code.Idx) - p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) - if p == 0 { - b = appendNull(b) - } else { - b = append(b, '"') - b = appendInt(b, ptrToUint64(p), code) - b = append(b, '"') - } - b = appendStructEnd(ctx, code, b) - code = code.Next - case encoder.OpStructEndOmitEmptyIntPtrString: - p := load(ctxptr, code.Idx) - p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) - if p != 0 { - b = appendStructKey(ctx, code, b) - b = append(b, '"') - b = appendInt(b, ptrToUint64(p), code) - b = append(b, '"') - b = appendStructEnd(ctx, code, b) - } else { - b = appendStructEndSkipLast(ctx, code, b) - } - code = code.Next - case encoder.OpStructEndUint: - p := load(ctxptr, code.Idx) - b = appendStructKey(ctx, code, b) - b = appendUint(b, ptrToUint64(p+uintptr(code.Offset)), code) - b = appendStructEnd(ctx, code, b) - code = code.Next - case encoder.OpStructEndOmitEmptyUint: - p := load(ctxptr, code.Idx) - u64 := ptrToUint64(p + uintptr(code.Offset)) - v := u64 & ((1 << code.NumBitSize) - 1) - if v != 0 { - b = appendStructKey(ctx, code, b) - b = appendUint(b, u64, code) - b = appendStructEnd(ctx, code, b) - } else { - b = appendStructEndSkipLast(ctx, code, b) - } - code = code.Next - case encoder.OpStructEndUintString: - p := load(ctxptr, code.Idx) - b = appendStructKey(ctx, code, b) - b = append(b, '"') - b = appendUint(b, ptrToUint64(p+uintptr(code.Offset)), code) - b = append(b, '"') - b = appendStructEnd(ctx, code, b) - code = code.Next - case encoder.OpStructEndOmitEmptyUintString: - p := load(ctxptr, code.Idx) - u64 := ptrToUint64(p + uintptr(code.Offset)) - v := u64 & ((1 << code.NumBitSize) - 1) - if v != 0 { - b = appendStructKey(ctx, code, b) - b = append(b, '"') - b = appendUint(b, u64, code) - b = append(b, '"') - b = appendStructEnd(ctx, code, b) - } else { - b = appendStructEndSkipLast(ctx, code, b) - } - code = code.Next - case encoder.OpStructEndUintPtr: - b = appendStructKey(ctx, code, b) - p := load(ctxptr, code.Idx) - p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) - if p == 0 { - b = appendNull(b) - } else { - b = appendUint(b, ptrToUint64(p), code) - } - b = appendStructEnd(ctx, code, b) - code = code.Next - case encoder.OpStructEndOmitEmptyUintPtr: - p := load(ctxptr, code.Idx) - p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) - if p != 0 { - b = appendStructKey(ctx, code, b) - b = appendUint(b, ptrToUint64(p), code) - b = appendStructEnd(ctx, code, b) - } else { - b = appendStructEndSkipLast(ctx, code, b) - } - code = code.Next - case encoder.OpStructEndUintPtrString: - b = appendStructKey(ctx, code, b) - p := load(ctxptr, code.Idx) - p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) - if p == 0 { - b = appendNull(b) - } else { - b = append(b, '"') - b = appendUint(b, ptrToUint64(p), code) - b = append(b, '"') - } - b = appendStructEnd(ctx, code, b) - code = code.Next - case encoder.OpStructEndOmitEmptyUintPtrString: - p := load(ctxptr, code.Idx) - p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) - if p != 0 { - b = appendStructKey(ctx, code, b) - b = append(b, '"') - b = appendUint(b, ptrToUint64(p), code) - b = append(b, '"') - b = appendStructEnd(ctx, code, b) - } else { - b = appendStructEndSkipLast(ctx, code, b) - } - code = code.Next - case encoder.OpStructEndFloat32: - p := load(ctxptr, code.Idx) - b = appendStructKey(ctx, code, b) - b = appendFloat32(b, ptrToFloat32(p+uintptr(code.Offset))) - b = appendStructEnd(ctx, code, b) - code = code.Next - case encoder.OpStructEndOmitEmptyFloat32: - p := load(ctxptr, code.Idx) - v := ptrToFloat32(p + uintptr(code.Offset)) - if v != 0 { - b = appendStructKey(ctx, code, b) - b = appendFloat32(b, v) - b = appendStructEnd(ctx, code, b) - } else { - b = appendStructEndSkipLast(ctx, code, b) - } - code = code.Next - case encoder.OpStructEndFloat32String: - p := load(ctxptr, code.Idx) - b = appendStructKey(ctx, code, b) - b = append(b, '"') - b = appendFloat32(b, ptrToFloat32(p+uintptr(code.Offset))) - b = append(b, '"') - b = appendStructEnd(ctx, code, b) - code = code.Next - case encoder.OpStructEndOmitEmptyFloat32String: - p := load(ctxptr, code.Idx) - v := ptrToFloat32(p + uintptr(code.Offset)) - if v != 0 { - b = appendStructKey(ctx, code, b) - b = append(b, '"') - b = appendFloat32(b, v) - b = append(b, '"') - b = appendStructEnd(ctx, code, b) - } else { - b = appendStructEndSkipLast(ctx, code, b) - } - code = code.Next - case encoder.OpStructEndFloat32Ptr: - b = appendStructKey(ctx, code, b) - p := load(ctxptr, code.Idx) - p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) - if p == 0 { - b = appendNull(b) - } else { - b = appendFloat32(b, ptrToFloat32(p)) - } - b = appendStructEnd(ctx, code, b) - code = code.Next - case encoder.OpStructEndOmitEmptyFloat32Ptr: - p := load(ctxptr, code.Idx) - p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) - if p != 0 { - b = appendStructKey(ctx, code, b) - b = appendFloat32(b, ptrToFloat32(p)) - b = appendStructEnd(ctx, code, b) - } else { - b = appendStructEndSkipLast(ctx, code, b) - } - code = code.Next - case encoder.OpStructEndFloat32PtrString: - b = appendStructKey(ctx, code, b) - p := load(ctxptr, code.Idx) - p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) - if p == 0 { - b = appendNull(b) - } else { - b = append(b, '"') - b = appendFloat32(b, ptrToFloat32(p)) - b = append(b, '"') - } - b = appendStructEnd(ctx, code, b) - code = code.Next - case encoder.OpStructEndOmitEmptyFloat32PtrString: - p := load(ctxptr, code.Idx) - p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) - if p != 0 { - b = appendStructKey(ctx, code, b) - b = append(b, '"') - b = appendFloat32(b, ptrToFloat32(p)) - b = append(b, '"') - b = appendStructEnd(ctx, code, b) - } else { - b = appendStructEndSkipLast(ctx, code, b) - } - code = code.Next - case encoder.OpStructEndFloat64: - p := load(ctxptr, code.Idx) - v := ptrToFloat64(p + uintptr(code.Offset)) - if math.IsInf(v, 0) || math.IsNaN(v) { - return nil, errUnsupportedFloat(v) - } - b = appendStructKey(ctx, code, b) - b = appendFloat64(b, v) - b = appendStructEnd(ctx, code, b) - code = code.Next - case encoder.OpStructEndOmitEmptyFloat64: - p := load(ctxptr, code.Idx) - v := ptrToFloat64(p + uintptr(code.Offset)) - if v != 0 { - if math.IsInf(v, 0) || math.IsNaN(v) { - return nil, errUnsupportedFloat(v) - } - b = appendStructKey(ctx, code, b) - b = appendFloat64(b, v) - b = appendStructEnd(ctx, code, b) - } else { - b = appendStructEndSkipLast(ctx, code, b) - } - code = code.Next - case encoder.OpStructEndFloat64String: - p := load(ctxptr, code.Idx) - v := ptrToFloat64(p + uintptr(code.Offset)) - if math.IsInf(v, 0) || math.IsNaN(v) { - return nil, errUnsupportedFloat(v) - } - b = appendStructKey(ctx, code, b) - b = append(b, '"') - b = appendFloat64(b, v) - b = append(b, '"') - b = appendStructEnd(ctx, code, b) - code = code.Next - case encoder.OpStructEndOmitEmptyFloat64String: - p := load(ctxptr, code.Idx) - v := ptrToFloat64(p + uintptr(code.Offset)) - if v != 0 { - if math.IsInf(v, 0) || math.IsNaN(v) { - return nil, errUnsupportedFloat(v) - } - b = appendStructKey(ctx, code, b) - b = append(b, '"') - b = appendFloat64(b, v) - b = append(b, '"') - b = appendStructEnd(ctx, code, b) - } else { - b = appendStructEndSkipLast(ctx, code, b) - } - code = code.Next - case encoder.OpStructEndFloat64Ptr: - b = appendStructKey(ctx, code, b) - p := load(ctxptr, code.Idx) - p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) - if p == 0 { - b = appendNull(b) - b = appendStructEnd(ctx, code, b) - code = code.Next - break - } - v := ptrToFloat64(p) - if math.IsInf(v, 0) || math.IsNaN(v) { - return nil, errUnsupportedFloat(v) - } - b = appendFloat64(b, v) - b = appendStructEnd(ctx, code, b) - code = code.Next - case encoder.OpStructEndOmitEmptyFloat64Ptr: - p := load(ctxptr, code.Idx) - p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) - if p != 0 { - b = appendStructKey(ctx, code, b) - v := ptrToFloat64(p) - if math.IsInf(v, 0) || math.IsNaN(v) { - return nil, errUnsupportedFloat(v) - } - b = appendFloat64(b, v) - b = appendStructEnd(ctx, code, b) - } else { - b = appendStructEndSkipLast(ctx, code, b) - } - code = code.Next - case encoder.OpStructEndFloat64PtrString: - b = appendStructKey(ctx, code, b) - p := load(ctxptr, code.Idx) - p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) - if p == 0 { - b = appendNull(b) - } else { - b = append(b, '"') - v := ptrToFloat64(p) - if math.IsInf(v, 0) || math.IsNaN(v) { - return nil, errUnsupportedFloat(v) - } - b = appendFloat64(b, v) - b = append(b, '"') - } - b = appendStructEnd(ctx, code, b) - code = code.Next - case encoder.OpStructEndOmitEmptyFloat64PtrString: - p := load(ctxptr, code.Idx) - p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) - if p != 0 { - b = appendStructKey(ctx, code, b) - v := ptrToFloat64(p) - if math.IsInf(v, 0) || math.IsNaN(v) { - return nil, errUnsupportedFloat(v) - } - b = append(b, '"') - b = appendFloat64(b, v) - b = append(b, '"') - b = appendStructEnd(ctx, code, b) - } else { - b = appendStructEndSkipLast(ctx, code, b) - } - code = code.Next - case encoder.OpStructEndString: - p := load(ctxptr, code.Idx) - b = appendStructKey(ctx, code, b) - b = appendString(b, ptrToString(p+uintptr(code.Offset))) - b = appendStructEnd(ctx, code, b) - code = code.Next - case encoder.OpStructEndOmitEmptyString: - p := load(ctxptr, code.Idx) - v := ptrToString(p + uintptr(code.Offset)) - if v != "" { - b = appendStructKey(ctx, code, b) - b = appendString(b, v) - b = appendStructEnd(ctx, code, b) - } else { - b = appendStructEndSkipLast(ctx, code, b) - } - code = code.Next - case encoder.OpStructEndStringString: - p := load(ctxptr, code.Idx) - b = appendStructKey(ctx, code, b) - s := ptrToString(p + uintptr(code.Offset)) - b = appendString(b, string(appendString([]byte{}, s))) - b = appendStructEnd(ctx, code, b) - code = code.Next - case encoder.OpStructEndOmitEmptyStringString: - p := load(ctxptr, code.Idx) - v := ptrToString(p + uintptr(code.Offset)) - if v != "" { - b = appendStructKey(ctx, code, b) - b = appendString(b, string(appendString([]byte{}, v))) - b = appendStructEnd(ctx, code, b) - } else { - b = appendStructEndSkipLast(ctx, code, b) - } - code = code.Next - case encoder.OpStructEndStringPtr: - b = appendStructKey(ctx, code, b) - p := load(ctxptr, code.Idx) - p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) - if p == 0 { - b = appendNull(b) - } else { - b = appendString(b, ptrToString(p)) - } - b = appendStructEnd(ctx, code, b) - code = code.Next - case encoder.OpStructEndOmitEmptyStringPtr: - p := load(ctxptr, code.Idx) - p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) - if p != 0 { - b = appendStructKey(ctx, code, b) - b = appendString(b, ptrToString(p)) - b = appendStructEnd(ctx, code, b) - } else { - b = appendStructEndSkipLast(ctx, code, b) - } - code = code.Next - case encoder.OpStructEndStringPtrString: - b = appendStructKey(ctx, code, b) - p := load(ctxptr, code.Idx) - p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) - if p == 0 { - b = appendNull(b) - } else { - b = appendString(b, string(appendString([]byte{}, ptrToString(p)))) - } - b = appendStructEnd(ctx, code, b) - code = code.Next - case encoder.OpStructEndOmitEmptyStringPtrString: - p := load(ctxptr, code.Idx) - p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) - if p != 0 { - b = appendStructKey(ctx, code, b) - b = appendString(b, string(appendString([]byte{}, ptrToString(p)))) - b = appendStructEnd(ctx, code, b) - } else { - b = appendStructEndSkipLast(ctx, code, b) - } - code = code.Next - case encoder.OpStructEndBool: - p := load(ctxptr, code.Idx) - b = appendStructKey(ctx, code, b) - b = appendBool(b, ptrToBool(p+uintptr(code.Offset))) - b = appendStructEnd(ctx, code, b) - code = code.Next - case encoder.OpStructEndOmitEmptyBool: - p := load(ctxptr, code.Idx) - v := ptrToBool(p + uintptr(code.Offset)) - if v { - b = appendStructKey(ctx, code, b) - b = appendBool(b, v) - b = appendStructEnd(ctx, code, b) - } else { - b = appendStructEndSkipLast(ctx, code, b) - } - code = code.Next - case encoder.OpStructEndBoolString: - p := load(ctxptr, code.Idx) - b = appendStructKey(ctx, code, b) - b = append(b, '"') - b = appendBool(b, ptrToBool(p+uintptr(code.Offset))) - b = append(b, '"') - b = appendStructEnd(ctx, code, b) - code = code.Next - case encoder.OpStructEndOmitEmptyBoolString: - p := load(ctxptr, code.Idx) - v := ptrToBool(p + uintptr(code.Offset)) - if v { - b = appendStructKey(ctx, code, b) - b = append(b, '"') - b = appendBool(b, v) - b = append(b, '"') - b = appendStructEnd(ctx, code, b) - } else { - b = appendStructEndSkipLast(ctx, code, b) - } - code = code.Next - case encoder.OpStructEndBoolPtr: - b = appendStructKey(ctx, code, b) - p := load(ctxptr, code.Idx) - p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) - if p == 0 { - b = appendNull(b) - } else { - b = appendBool(b, ptrToBool(p)) - } - b = appendStructEnd(ctx, code, b) - code = code.Next - case encoder.OpStructEndOmitEmptyBoolPtr: - p := load(ctxptr, code.Idx) - p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) - if p != 0 { - b = appendStructKey(ctx, code, b) - b = appendBool(b, ptrToBool(p)) - b = appendStructEnd(ctx, code, b) - } else { - b = appendStructEndSkipLast(ctx, code, b) - } - code = code.Next - case encoder.OpStructEndBoolPtrString: - b = appendStructKey(ctx, code, b) - p := load(ctxptr, code.Idx) - p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) - if p == 0 { - b = appendNull(b) - } else { - b = append(b, '"') - b = appendBool(b, ptrToBool(p)) - b = append(b, '"') - } - b = appendStructEnd(ctx, code, b) - code = code.Next - case encoder.OpStructEndOmitEmptyBoolPtrString: - p := load(ctxptr, code.Idx) - p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) - if p != 0 { - b = appendStructKey(ctx, code, b) - b = append(b, '"') - b = appendBool(b, ptrToBool(p)) - b = append(b, '"') - b = appendStructEnd(ctx, code, b) - } else { - b = appendStructEndSkipLast(ctx, code, b) - } - code = code.Next - case encoder.OpStructEndBytes: - p := load(ctxptr, code.Idx) - b = appendStructKey(ctx, code, b) - b = appendByteSlice(b, ptrToBytes(p+uintptr(code.Offset))) - b = appendStructEnd(ctx, code, b) - code = code.Next - case encoder.OpStructEndOmitEmptyBytes: - p := load(ctxptr, code.Idx) - v := ptrToBytes(p + uintptr(code.Offset)) - if len(v) > 0 { - b = appendStructKey(ctx, code, b) - b = appendByteSlice(b, v) - b = appendStructEnd(ctx, code, b) - } else { - b = appendStructEndSkipLast(ctx, code, b) - } - code = code.Next - case encoder.OpStructEndBytesPtr: - b = appendStructKey(ctx, code, b) - p := load(ctxptr, code.Idx) - p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) - if p == 0 { - b = appendNull(b) - } else { - b = appendByteSlice(b, ptrToBytes(p)) - } - b = appendStructEnd(ctx, code, b) - code = code.Next - case encoder.OpStructEndOmitEmptyBytesPtr: - p := load(ctxptr, code.Idx) - p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) - if p != 0 { - b = appendStructKey(ctx, code, b) - b = appendByteSlice(b, ptrToBytes(p)) - b = appendStructEnd(ctx, code, b) - } else { - b = appendStructEndSkipLast(ctx, code, b) - } - code = code.Next - case encoder.OpStructEndNumber: - p := load(ctxptr, code.Idx) - b = appendStructKey(ctx, code, b) - bb, err := appendNumber(b, ptrToNumber(p+uintptr(code.Offset))) - if err != nil { - return nil, err - } - b = appendStructEnd(ctx, code, bb) - code = code.Next - case encoder.OpStructEndOmitEmptyNumber: - p := load(ctxptr, code.Idx) - v := ptrToNumber(p + uintptr(code.Offset)) - if v != "" { - b = appendStructKey(ctx, code, b) - bb, err := appendNumber(b, v) - if err != nil { - return nil, err - } - b = appendStructEnd(ctx, code, bb) - } else { - b = appendStructEndSkipLast(ctx, code, b) - } - code = code.Next - case encoder.OpStructEndNumberString: - p := load(ctxptr, code.Idx) - b = appendStructKey(ctx, code, b) - b = append(b, '"') - bb, err := appendNumber(b, ptrToNumber(p+uintptr(code.Offset))) - if err != nil { - return nil, err - } - b = append(bb, '"') - b = appendStructEnd(ctx, code, b) - code = code.Next - case encoder.OpStructEndOmitEmptyNumberString: - p := load(ctxptr, code.Idx) - v := ptrToNumber(p + uintptr(code.Offset)) - if v != "" { - b = appendStructKey(ctx, code, b) - b = append(b, '"') - bb, err := appendNumber(b, v) - if err != nil { - return nil, err - } - b = append(bb, '"') - b = appendStructEnd(ctx, code, b) - } else { - b = appendStructEndSkipLast(ctx, code, b) - } - code = code.Next - case encoder.OpStructEndNumberPtr: - b = appendStructKey(ctx, code, b) - p := load(ctxptr, code.Idx) - p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) - if p == 0 { - b = appendNull(b) - } else { - bb, err := appendNumber(b, ptrToNumber(p)) - if err != nil { - return nil, err - } - b = bb - } - b = appendStructEnd(ctx, code, b) - code = code.Next - case encoder.OpStructEndOmitEmptyNumberPtr: - p := load(ctxptr, code.Idx) - p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) - if p != 0 { - b = appendStructKey(ctx, code, b) - bb, err := appendNumber(b, ptrToNumber(p)) - if err != nil { - return nil, err - } - b = appendStructEnd(ctx, code, bb) - } else { - b = appendStructEndSkipLast(ctx, code, b) - } - code = code.Next - case encoder.OpStructEndNumberPtrString: - b = appendStructKey(ctx, code, b) - p := load(ctxptr, code.Idx) - p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) - if p == 0 { - b = appendNull(b) - } else { - b = append(b, '"') - bb, err := appendNumber(b, ptrToNumber(p)) - if err != nil { - return nil, err - } - b = append(bb, '"') - } - b = appendStructEnd(ctx, code, b) - code = code.Next - case encoder.OpStructEndOmitEmptyNumberPtrString: - p := load(ctxptr, code.Idx) - p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) - if p != 0 { - b = appendStructKey(ctx, code, b) - b = append(b, '"') - bb, err := appendNumber(b, ptrToNumber(p)) - if err != nil { - return nil, err - } - b = append(bb, '"') - b = appendStructEnd(ctx, code, b) - } else { - b = appendStructEndSkipLast(ctx, code, b) - } - code = code.Next - case encoder.OpEnd: - goto END - } - } -END: - return b, nil -} diff --git a/internal/encoder/vm_escaped_indent/debug_vm.go b/internal/encoder/vm_escaped_indent/debug_vm.go deleted file mode 100644 index dcbdb10..0000000 --- a/internal/encoder/vm_escaped_indent/debug_vm.go +++ /dev/null @@ -1,27 +0,0 @@ -package vm_escaped_indent - -import ( - "fmt" - - "github.com/goccy/go-json/internal/encoder" -) - -func DebugRun(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]byte, error) { - defer func() { - if err := recover(); err != nil { - fmt.Println("=============[DEBUG]===============") - fmt.Println("* [TYPE]") - fmt.Println(codeSet.Type) - fmt.Printf("\n") - fmt.Println("* [ALL OPCODE]") - fmt.Println(ctx.Code.Dump()) - fmt.Printf("\n") - fmt.Println("* [CONTEXT]") - fmt.Printf("%+v\n", ctx) - fmt.Println("===================================") - panic(err) - } - }() - - return Run(ctx, b, codeSet) -} diff --git a/internal/encoder/vm_escaped_indent/hack.go b/internal/encoder/vm_escaped_indent/hack.go deleted file mode 100644 index 49d3cec..0000000 --- a/internal/encoder/vm_escaped_indent/hack.go +++ /dev/null @@ -1,6 +0,0 @@ -package vm_escaped_indent - -// HACK: compile order -// `vm`, `vm_escaped`, `vm_indent`, `vm_escaped_indent` packages uses a lot of memory to compile, -// so forcibly make dependencies and avoid compiling in concurrent. -// dependency order: vm => vm_escaped => vm_indent => vm_escaped_indent diff --git a/internal/encoder/vm_escaped_indent/util.go b/internal/encoder/vm_escaped_indent/util.go deleted file mode 100644 index 48354f5..0000000 --- a/internal/encoder/vm_escaped_indent/util.go +++ /dev/null @@ -1,242 +0,0 @@ -package vm_escaped_indent - -import ( - "encoding/json" - "fmt" - "unsafe" - - "github.com/goccy/go-json/internal/encoder" - "github.com/goccy/go-json/internal/runtime" -) - -const uintptrSize = 4 << (^uintptr(0) >> 63) - -var ( - appendInt = encoder.AppendInt - appendUint = encoder.AppendUint - appendFloat32 = encoder.AppendFloat32 - appendFloat64 = encoder.AppendFloat64 - appendString = encoder.AppendString - appendByteSlice = encoder.AppendByteSlice - appendNumber = encoder.AppendNumber - appendStructEnd = encoder.AppendStructEndIndent - appendIndent = encoder.AppendIndent - errUnsupportedValue = encoder.ErrUnsupportedValue - errUnsupportedFloat = encoder.ErrUnsupportedFloat - mapiterinit = encoder.MapIterInit - mapiterkey = encoder.MapIterKey - mapitervalue = encoder.MapIterValue - mapiternext = encoder.MapIterNext - maplen = encoder.MapLen -) - -type emptyInterface struct { - typ *runtime.Type - ptr unsafe.Pointer -} - -func errUnimplementedOp(op encoder.OpType) error { - return fmt.Errorf("encoder (indent+escaped): opcode %s has not been implemented", op) -} - -func load(base uintptr, idx uint32) uintptr { - addr := base + uintptr(idx) - return **(**uintptr)(unsafe.Pointer(&addr)) -} - -func store(base uintptr, idx uint32, p uintptr) { - addr := base + uintptr(idx) - **(**uintptr)(unsafe.Pointer(&addr)) = p -} - -func loadNPtr(base uintptr, idx uint32, ptrNum uint8) uintptr { - addr := base + uintptr(idx) - p := **(**uintptr)(unsafe.Pointer(&addr)) - for i := uint8(0); i < ptrNum; i++ { - if p == 0 { - return 0 - } - p = ptrToPtr(p) - } - return p -} - -func ptrToUint64(p uintptr) uint64 { return **(**uint64)(unsafe.Pointer(&p)) } -func ptrToFloat32(p uintptr) float32 { return **(**float32)(unsafe.Pointer(&p)) } -func ptrToFloat64(p uintptr) float64 { return **(**float64)(unsafe.Pointer(&p)) } -func ptrToBool(p uintptr) bool { return **(**bool)(unsafe.Pointer(&p)) } -func ptrToBytes(p uintptr) []byte { return **(**[]byte)(unsafe.Pointer(&p)) } -func ptrToNumber(p uintptr) json.Number { return **(**json.Number)(unsafe.Pointer(&p)) } -func ptrToString(p uintptr) string { return **(**string)(unsafe.Pointer(&p)) } -func ptrToSlice(p uintptr) *runtime.SliceHeader { return *(**runtime.SliceHeader)(unsafe.Pointer(&p)) } -func ptrToPtr(p uintptr) uintptr { - return uintptr(**(**unsafe.Pointer)(unsafe.Pointer(&p))) -} -func ptrToNPtr(p uintptr, ptrNum uint8) uintptr { - for i := uint8(0); i < ptrNum; i++ { - if p == 0 { - return 0 - } - p = ptrToPtr(p) - } - return p -} - -func ptrToUnsafePtr(p uintptr) unsafe.Pointer { - return *(*unsafe.Pointer)(unsafe.Pointer(&p)) -} -func ptrToInterface(code *encoder.Opcode, p uintptr) interface{} { - return *(*interface{})(unsafe.Pointer(&emptyInterface{ - typ: code.Type, - ptr: *(*unsafe.Pointer)(unsafe.Pointer(&p)), - })) -} - -func appendBool(b []byte, v bool) []byte { - if v { - return append(b, "true"...) - } - return append(b, "false"...) -} - -func appendNull(b []byte) []byte { - return append(b, "null"...) -} - -func appendComma(b []byte) []byte { - return append(b, ',', '\n') -} - -func appendColon(b []byte) []byte { - return append(b, ':', ' ') -} - -func appendInterface(ctx *encoder.RuntimeContext, codeSet *encoder.OpcodeSet, code *encoder.Opcode, b []byte, iface *emptyInterface, ptrOffset uintptr) ([]byte, error) { - ctx.KeepRefs = append(ctx.KeepRefs, unsafe.Pointer(iface)) - ifaceCodeSet, err := encoder.CompileToGetCodeSet(uintptr(unsafe.Pointer(iface.typ))) - if err != nil { - return nil, err - } - - totalLength := uintptr(codeSet.CodeLength) - nextTotalLength := uintptr(ifaceCodeSet.CodeLength) - - curlen := uintptr(len(ctx.Ptrs)) - offsetNum := ptrOffset / uintptrSize - - newLen := offsetNum + totalLength + nextTotalLength - if curlen < newLen { - ctx.Ptrs = append(ctx.Ptrs, make([]uintptr, newLen-curlen)...) - } - oldPtrs := ctx.Ptrs - - newPtrs := ctx.Ptrs[(ptrOffset+totalLength*uintptrSize)/uintptrSize:] - newPtrs[0] = uintptr(iface.ptr) - - ctx.Ptrs = newPtrs - - oldBaseIndent := ctx.BaseIndent - ctx.BaseIndent = code.Indent - ctx.Code = ifaceCodeSet.EscapeKeyCode - bb, err := Run(ctx, b, ifaceCodeSet) - if err != nil { - return nil, err - } - ctx.BaseIndent = oldBaseIndent - - ctx.Ptrs = oldPtrs - - return bb, nil -} - -func appendMapKeyValue(ctx *encoder.RuntimeContext, code *encoder.Opcode, b, key, value []byte) []byte { - b = appendIndent(ctx, b, code.Indent+1) - b = append(b, key...) - b[len(b)-2] = ':' - b[len(b)-1] = ' ' - return append(b, value...) -} - -func appendMapEnd(ctx *encoder.RuntimeContext, code *encoder.Opcode, b []byte) []byte { - b = b[:len(b)-2] - b = append(b, '\n') - b = appendIndent(ctx, b, code.Indent) - return append(b, '}', ',', '\n') -} - -func appendArrayHead(ctx *encoder.RuntimeContext, code *encoder.Opcode, b []byte) []byte { - b = append(b, '[', '\n') - return appendIndent(ctx, b, code.Indent+1) -} - -func appendArrayEnd(ctx *encoder.RuntimeContext, code *encoder.Opcode, b []byte) []byte { - b = b[:len(b)-2] - b = append(b, '\n') - b = appendIndent(ctx, b, code.Indent) - return append(b, ']', ',', '\n') -} - -func appendEmptyArray(b []byte) []byte { - return append(b, '[', ']', ',', '\n') -} - -func appendEmptyObject(b []byte) []byte { - return append(b, '{', '}', ',', '\n') -} - -func appendObjectEnd(ctx *encoder.RuntimeContext, code *encoder.Opcode, b []byte) []byte { - last := len(b) - 1 - b[last] = '\n' - b = appendIndent(ctx, b, code.Indent-1) - return append(b, '}', ',', '\n') -} - -func appendMarshalJSON(ctx *encoder.RuntimeContext, code *encoder.Opcode, b []byte, v interface{}) ([]byte, error) { - return encoder.AppendMarshalJSONIndent(ctx, code, b, v, true) -} - -func appendMarshalText(code *encoder.Opcode, b []byte, v interface{}) ([]byte, error) { - return encoder.AppendMarshalTextIndent(code, b, v, true) -} - -func appendStructHead(b []byte) []byte { - return append(b, '{', '\n') -} - -func appendStructKey(ctx *encoder.RuntimeContext, code *encoder.Opcode, b []byte) []byte { - b = appendIndent(ctx, b, code.Indent) - b = append(b, code.Key...) - return append(b, ' ') -} - -func appendStructEndSkipLast(ctx *encoder.RuntimeContext, code *encoder.Opcode, b []byte) []byte { - last := len(b) - 1 - if b[last-1] == '{' { - b[last] = '}' - } else { - if b[last] == '\n' { - // to remove ',' and '\n' characters - b = b[:len(b)-2] - } - b = append(b, '\n') - b = appendIndent(ctx, b, code.Indent-1) - b = append(b, '}') - } - return appendComma(b) -} - -func restoreIndent(ctx *encoder.RuntimeContext, code *encoder.Opcode, ctxptr uintptr) { - ctx.BaseIndent = uint32(load(ctxptr, code.Length)) -} - -func storeIndent(ctxptr uintptr, code *encoder.Opcode, indent uintptr) { - store(ctxptr, code.End.Next.Length, indent) -} - -func appendArrayElemIndent(ctx *encoder.RuntimeContext, code *encoder.Opcode, b []byte) []byte { - return appendIndent(ctx, b, code.Indent+1) -} - -func appendMapKeyIndent(ctx *encoder.RuntimeContext, code *encoder.Opcode, b []byte) []byte { - return appendIndent(ctx, b, code.Indent) -} diff --git a/internal/encoder/vm_escaped_indent/vm.go b/internal/encoder/vm_escaped_indent/vm.go deleted file mode 100644 index fa9ff75..0000000 --- a/internal/encoder/vm_escaped_indent/vm.go +++ /dev/null @@ -1,4993 +0,0 @@ -// Code generated by internal/cmd/generator. DO NOT EDIT! -package vm_escaped_indent - -import ( - "math" - "sort" - "unsafe" - - "github.com/goccy/go-json/internal/encoder" -) - -func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]byte, error) { - recursiveLevel := 0 - ptrOffset := uintptr(0) - ctxptr := ctx.Ptr() - code := ctx.Code - - for { - switch code.Op { - default: - return nil, errUnimplementedOp(code.Op) - case encoder.OpPtr: - p := load(ctxptr, code.Idx) - code = code.Next - store(ctxptr, code.Idx, ptrToPtr(p)) - case encoder.OpIntPtr: - p := loadNPtr(ctxptr, code.Idx, code.PtrNum) - if p == 0 { - b = appendNull(b) - b = appendComma(b) - code = code.Next - break - } - store(ctxptr, code.Idx, p) - fallthrough - case encoder.OpInt: - b = appendInt(b, ptrToUint64(load(ctxptr, code.Idx)), code) - b = appendComma(b) - code = code.Next - case encoder.OpUintPtr: - p := loadNPtr(ctxptr, code.Idx, code.PtrNum) - if p == 0 { - b = appendNull(b) - b = appendComma(b) - code = code.Next - break - } - store(ctxptr, code.Idx, p) - fallthrough - case encoder.OpUint: - b = appendUint(b, ptrToUint64(load(ctxptr, code.Idx)), code) - b = appendComma(b) - code = code.Next - case encoder.OpIntString: - b = append(b, '"') - b = appendInt(b, ptrToUint64(load(ctxptr, code.Idx)), code) - b = append(b, '"') - b = appendComma(b) - code = code.Next - case encoder.OpUintString: - b = append(b, '"') - b = appendUint(b, ptrToUint64(load(ctxptr, code.Idx)), code) - b = append(b, '"') - b = appendComma(b) - code = code.Next - case encoder.OpFloat32Ptr: - p := loadNPtr(ctxptr, code.Idx, code.PtrNum) - if p == 0 { - b = appendNull(b) - b = appendComma(b) - code = code.Next - break - } - store(ctxptr, code.Idx, p) - fallthrough - case encoder.OpFloat32: - b = appendFloat32(b, ptrToFloat32(load(ctxptr, code.Idx))) - b = appendComma(b) - code = code.Next - case encoder.OpFloat64Ptr: - p := loadNPtr(ctxptr, code.Idx, code.PtrNum) - if p == 0 { - b = appendNull(b) - b = appendComma(b) - code = code.Next - break - } - store(ctxptr, code.Idx, p) - fallthrough - case encoder.OpFloat64: - v := ptrToFloat64(load(ctxptr, code.Idx)) - if math.IsInf(v, 0) || math.IsNaN(v) { - return nil, errUnsupportedFloat(v) - } - b = appendFloat64(b, v) - b = appendComma(b) - code = code.Next - case encoder.OpStringPtr: - p := loadNPtr(ctxptr, code.Idx, code.PtrNum) - if p == 0 { - b = appendNull(b) - b = appendComma(b) - code = code.Next - break - } - store(ctxptr, code.Idx, p) - fallthrough - case encoder.OpString: - b = appendString(b, ptrToString(load(ctxptr, code.Idx))) - b = appendComma(b) - code = code.Next - case encoder.OpBoolPtr: - p := loadNPtr(ctxptr, code.Idx, code.PtrNum) - if p == 0 { - b = appendNull(b) - b = appendComma(b) - code = code.Next - break - } - store(ctxptr, code.Idx, p) - fallthrough - case encoder.OpBool: - b = appendBool(b, ptrToBool(load(ctxptr, code.Idx))) - b = appendComma(b) - code = code.Next - case encoder.OpBytesPtr: - p := loadNPtr(ctxptr, code.Idx, code.PtrNum) - if p == 0 { - b = appendNull(b) - b = appendComma(b) - code = code.Next - break - } - store(ctxptr, code.Idx, p) - fallthrough - case encoder.OpBytes: - b = appendByteSlice(b, ptrToBytes(load(ctxptr, code.Idx))) - b = appendComma(b) - code = code.Next - case encoder.OpNumberPtr: - p := loadNPtr(ctxptr, code.Idx, code.PtrNum) - if p == 0 { - b = appendNull(b) - b = appendComma(b) - code = code.Next - break - } - store(ctxptr, code.Idx, p) - fallthrough - case encoder.OpNumber: - bb, err := appendNumber(b, ptrToNumber(load(ctxptr, code.Idx))) - if err != nil { - return nil, err - } - b = appendComma(bb) - code = code.Next - case encoder.OpInterfacePtr: - p := loadNPtr(ctxptr, code.Idx, code.PtrNum) - if p == 0 { - b = appendNull(b) - b = appendComma(b) - code = code.Next - break - } - store(ctxptr, code.Idx, p) - fallthrough - case encoder.OpInterface: - p := load(ctxptr, code.Idx) - if p == 0 { - b = appendNull(b) - b = appendComma(b) - code = code.Next - break - } - for _, seen := range ctx.SeenPtr { - if p == seen { - return nil, errUnsupportedValue(code, p) - } - } - ctx.SeenPtr = append(ctx.SeenPtr, p) - iface := (*emptyInterface)(ptrToUnsafePtr(p)) - if iface.ptr == nil { - b = appendNull(b) - b = appendComma(b) - code = code.Next - break - } - bb, err := appendInterface(ctx, codeSet, code, b, iface, ptrOffset) - if err != nil { - return nil, err - } - ctxptr = ctx.Ptr() - ctx.SeenPtr = ctx.SeenPtr[:len(ctx.SeenPtr)-1] - - b = bb - code = code.Next - case encoder.OpMarshalJSONPtr: - p := load(ctxptr, code.Idx) - if p == 0 { - b = appendNull(b) - b = appendComma(b) - code = code.Next - break - } - store(ctxptr, code.Idx, ptrToPtr(p)) - fallthrough - case encoder.OpMarshalJSON: - p := load(ctxptr, code.Idx) - if p == 0 { - b = appendNull(b) - b = appendComma(b) - code = code.Next - break - } - if (code.Flags&encoder.IsNilableTypeFlags) != 0 && (code.Flags&encoder.IndirectFlags) != 0 { - p = ptrToPtr(p) - } - bb, err := appendMarshalJSON(ctx, code, b, ptrToInterface(code, p)) - if err != nil { - return nil, err - } - b = appendComma(bb) - code = code.Next - case encoder.OpMarshalTextPtr: - p := load(ctxptr, code.Idx) - if p == 0 { - b = appendNull(b) - b = appendComma(b) - code = code.Next - break - } - store(ctxptr, code.Idx, ptrToPtr(p)) - fallthrough - case encoder.OpMarshalText: - p := load(ctxptr, code.Idx) - if p == 0 { - b = append(b, `""`...) - b = appendComma(b) - code = code.Next - break - } - if (code.Flags&encoder.IsNilableTypeFlags) != 0 && (code.Flags&encoder.IndirectFlags) != 0 { - p = ptrToPtr(p) - } - bb, err := appendMarshalText(code, b, ptrToInterface(code, p)) - if err != nil { - return nil, err - } - b = appendComma(bb) - code = code.Next - case encoder.OpSlicePtr: - p := loadNPtr(ctxptr, code.Idx, code.PtrNum) - if p == 0 { - b = appendNull(b) - b = appendComma(b) - code = code.End.Next - break - } - store(ctxptr, code.Idx, p) - fallthrough - case encoder.OpSlice: - p := load(ctxptr, code.Idx) - slice := ptrToSlice(p) - if p == 0 || slice.Data == nil { - b = appendNull(b) - b = appendComma(b) - code = code.End.Next - break - } - store(ctxptr, code.ElemIdx, 0) - store(ctxptr, code.Length, uintptr(slice.Len)) - store(ctxptr, code.Idx, uintptr(slice.Data)) - if slice.Len > 0 { - b = appendArrayHead(ctx, code, b) - code = code.Next - store(ctxptr, code.Idx, uintptr(slice.Data)) - } else { - b = appendEmptyArray(b) - code = code.End.Next - } - case encoder.OpSliceElem: - idx := load(ctxptr, code.ElemIdx) - length := load(ctxptr, code.Length) - idx++ - if idx < length { - b = appendArrayElemIndent(ctx, code, b) - store(ctxptr, code.ElemIdx, idx) - data := load(ctxptr, code.Idx) - size := uintptr(code.Size) - code = code.Next - store(ctxptr, code.Idx, data+idx*size) - } else { - b = appendArrayEnd(ctx, code, b) - code = code.End.Next - } - case encoder.OpArrayPtr: - p := loadNPtr(ctxptr, code.Idx, code.PtrNum) - if p == 0 { - b = appendNull(b) - b = appendComma(b) - code = code.End.Next - break - } - store(ctxptr, code.Idx, p) - fallthrough - case encoder.OpArray: - p := load(ctxptr, code.Idx) - if p == 0 { - b = appendNull(b) - b = appendComma(b) - code = code.End.Next - break - } - if code.Length > 0 { - b = appendArrayHead(ctx, code, b) - store(ctxptr, code.ElemIdx, 0) - code = code.Next - store(ctxptr, code.Idx, p) - } else { - b = appendEmptyArray(b) - code = code.End.Next - } - case encoder.OpArrayElem: - idx := load(ctxptr, code.ElemIdx) - idx++ - if idx < uintptr(code.Length) { - b = appendArrayElemIndent(ctx, code, b) - store(ctxptr, code.ElemIdx, idx) - p := load(ctxptr, code.Idx) - size := uintptr(code.Size) - code = code.Next - store(ctxptr, code.Idx, p+idx*size) - } else { - b = appendArrayEnd(ctx, code, b) - code = code.End.Next - } - case encoder.OpMapPtr: - p := loadNPtr(ctxptr, code.Idx, code.PtrNum) - if p == 0 { - b = appendNull(b) - b = appendComma(b) - code = code.End.Next - break - } - store(ctxptr, code.Idx, p) - fallthrough - case encoder.OpMap: - p := load(ctxptr, code.Idx) - if p == 0 { - b = appendNull(b) - b = appendComma(b) - code = code.End.Next - break - } - uptr := ptrToUnsafePtr(p) - mlen := maplen(uptr) - if mlen <= 0 { - b = appendEmptyObject(b) - code = code.End.Next - break - } - b = appendStructHead(b) - iter := mapiterinit(code.Type, uptr) - ctx.KeepRefs = append(ctx.KeepRefs, iter) - store(ctxptr, code.ElemIdx, 0) - store(ctxptr, code.Length, uintptr(mlen)) - store(ctxptr, code.MapIter, uintptr(iter)) - if ctx.Option.UnorderedMap { - b = appendMapKeyIndent(ctx, code.Next, b) - } else { - mapCtx := encoder.NewMapContext(mlen) - mapCtx.Pos = append(mapCtx.Pos, len(b)) - ctx.KeepRefs = append(ctx.KeepRefs, unsafe.Pointer(mapCtx)) - store(ctxptr, code.End.MapPos, uintptr(unsafe.Pointer(mapCtx))) - } - key := mapiterkey(iter) - store(ctxptr, code.Next.Idx, uintptr(key)) - code = code.Next - case encoder.OpMapKey: - idx := load(ctxptr, code.ElemIdx) - length := load(ctxptr, code.Length) - idx++ - if ctx.Option.UnorderedMap { - if idx < length { - b = appendMapKeyIndent(ctx, code, b) - store(ctxptr, code.ElemIdx, idx) - ptr := load(ctxptr, code.MapIter) - iter := ptrToUnsafePtr(ptr) - key := mapiterkey(iter) - store(ctxptr, code.Next.Idx, uintptr(key)) - code = code.Next - } else { - b = appendObjectEnd(ctx, code, b) - code = code.End.Next - } - } else { - ptr := load(ctxptr, code.End.MapPos) - mapCtx := (*encoder.MapContext)(ptrToUnsafePtr(ptr)) - mapCtx.Pos = append(mapCtx.Pos, len(b)) - if idx < length { - ptr := load(ctxptr, code.MapIter) - iter := ptrToUnsafePtr(ptr) - store(ctxptr, code.ElemIdx, idx) - key := mapiterkey(iter) - store(ctxptr, code.Next.Idx, uintptr(key)) - code = code.Next - } else { - code = code.End - } - } - case encoder.OpMapValue: - if ctx.Option.UnorderedMap { - b = appendColon(b) - } else { - ptr := load(ctxptr, code.End.MapPos) - mapCtx := (*encoder.MapContext)(ptrToUnsafePtr(ptr)) - mapCtx.Pos = append(mapCtx.Pos, len(b)) - } - ptr := load(ctxptr, code.MapIter) - iter := ptrToUnsafePtr(ptr) - value := mapitervalue(iter) - store(ctxptr, code.Next.Idx, uintptr(value)) - mapiternext(iter) - code = code.Next - case encoder.OpMapEnd: - // this operation only used by sorted map. - length := int(load(ctxptr, code.Length)) - ptr := load(ctxptr, code.MapPos) - mapCtx := (*encoder.MapContext)(ptrToUnsafePtr(ptr)) - pos := mapCtx.Pos - for i := 0; i < length; i++ { - startKey := pos[i*2] - startValue := pos[i*2+1] - var endValue int - if i+1 < length { - endValue = pos[i*2+2] - } else { - endValue = len(b) - } - mapCtx.Slice.Items = append(mapCtx.Slice.Items, encoder.MapItem{ - Key: b[startKey:startValue], - Value: b[startValue:endValue], - }) - } - sort.Sort(mapCtx.Slice) - buf := mapCtx.Buf - for _, item := range mapCtx.Slice.Items { - buf = appendMapKeyValue(ctx, code, buf, item.Key, item.Value) - } - buf = appendMapEnd(ctx, code, buf) - b = b[:pos[0]] - b = append(b, buf...) - mapCtx.Buf = buf - encoder.ReleaseMapContext(mapCtx) - code = code.Next - case encoder.OpRecursivePtr: - p := load(ctxptr, code.Idx) - if p == 0 { - code = code.Next - break - } - store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) - fallthrough - case encoder.OpRecursive: - ptr := load(ctxptr, code.Idx) - if ptr != 0 { - if recursiveLevel > encoder.StartDetectingCyclesAfter { - for _, seen := range ctx.SeenPtr { - if ptr == seen { - return nil, errUnsupportedValue(code, ptr) - } - } - } - } - ctx.SeenPtr = append(ctx.SeenPtr, ptr) - c := code.Jmp.Code - curlen := uintptr(len(ctx.Ptrs)) - offsetNum := ptrOffset / uintptrSize - oldOffset := ptrOffset - ptrOffset += code.Jmp.CurLen * uintptrSize - oldBaseIndent := ctx.BaseIndent - ctx.BaseIndent += code.Indent - 1 - - newLen := offsetNum + code.Jmp.CurLen + code.Jmp.NextLen - if curlen < newLen { - ctx.Ptrs = append(ctx.Ptrs, make([]uintptr, newLen-curlen)...) - } - ctxptr = ctx.Ptr() + ptrOffset // assign new ctxptr - - store(ctxptr, c.Idx, ptr) - store(ctxptr, c.End.Next.Idx, oldOffset) - store(ctxptr, c.End.Next.ElemIdx, uintptr(unsafe.Pointer(code.Next))) - storeIndent(ctxptr, c, uintptr(oldBaseIndent)) - code = c - recursiveLevel++ - case encoder.OpRecursiveEnd: - recursiveLevel-- - - // restore ctxptr - restoreIndent(ctx, code, ctxptr) - offset := load(ctxptr, code.Idx) - ctx.SeenPtr = ctx.SeenPtr[:len(ctx.SeenPtr)-1] - - codePtr := load(ctxptr, code.ElemIdx) - code = (*encoder.Opcode)(ptrToUnsafePtr(codePtr)) - ctxptr = ctx.Ptr() + offset - ptrOffset = offset - case encoder.OpStructPtrHead: - p := load(ctxptr, code.Idx) - if p == 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) - fallthrough - case encoder.OpStructHead: - p := load(ctxptr, code.Idx) - if p == 0 && ((code.Flags&encoder.IndirectFlags) != 0 || code.Next.Op == encoder.OpStructEnd) { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) - } - if (code.Flags&encoder.AnonymousKeyFlags) == 0 && len(code.Key) > 0 { - b = appendStructKey(ctx, code, b) - } - p += uintptr(code.Offset) - code = code.Next - store(ctxptr, code.Idx, p) - case encoder.OpStructPtrHeadOmitEmpty: - p := load(ctxptr, code.Idx) - if p == 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) - fallthrough - case encoder.OpStructHeadOmitEmpty: - p := load(ctxptr, code.Idx) - if p == 0 && ((code.Flags&encoder.IndirectFlags) != 0 || code.Next.Op == encoder.OpStructEnd) { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) - } - p += uintptr(code.Offset) - if p == 0 || (ptrToPtr(p) == 0 && (code.Flags&encoder.IsNextOpPtrTypeFlags) != 0) { - code = code.NextField - } else { - b = appendStructKey(ctx, code, b) - code = code.Next - store(ctxptr, code.Idx, p) - } - case encoder.OpStructPtrHeadInt: - if (code.Flags & encoder.IndirectFlags) != 0 { - p := load(ctxptr, code.Idx) - if p == 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) - } - fallthrough - case encoder.OpStructHeadInt: - p := load(ctxptr, code.Idx) - if p == 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) - } - b = appendStructKey(ctx, code, b) - b = appendInt(b, ptrToUint64(p+uintptr(code.Offset)), code) - b = appendComma(b) - code = code.Next - case encoder.OpStructPtrHeadOmitEmptyInt: - if (code.Flags & encoder.IndirectFlags) != 0 { - p := load(ctxptr, code.Idx) - if p == 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) - } - fallthrough - case encoder.OpStructHeadOmitEmptyInt: - p := load(ctxptr, code.Idx) - if p == 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) - } - u64 := ptrToUint64(p + uintptr(code.Offset)) - v := u64 & ((1 << code.NumBitSize) - 1) - if v == 0 { - code = code.NextField - } else { - b = appendStructKey(ctx, code, b) - b = appendInt(b, u64, code) - b = appendComma(b) - code = code.Next - } - case encoder.OpStructPtrHeadIntString: - if (code.Flags & encoder.IndirectFlags) != 0 { - p := load(ctxptr, code.Idx) - if p == 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) - } - fallthrough - case encoder.OpStructHeadIntString: - p := load(ctxptr, code.Idx) - if p == 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) - } - b = appendStructKey(ctx, code, b) - b = append(b, '"') - b = appendInt(b, ptrToUint64(p+uintptr(code.Offset)), code) - b = append(b, '"') - b = appendComma(b) - code = code.Next - case encoder.OpStructPtrHeadOmitEmptyIntString: - if (code.Flags & encoder.IndirectFlags) != 0 { - p := load(ctxptr, code.Idx) - if p == 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) - } - fallthrough - case encoder.OpStructHeadOmitEmptyIntString: - p := load(ctxptr, code.Idx) - if p == 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) - } - u64 := ptrToUint64(p + uintptr(code.Offset)) - v := u64 & ((1 << code.NumBitSize) - 1) - if v == 0 { - code = code.NextField - } else { - b = appendStructKey(ctx, code, b) - b = append(b, '"') - b = appendInt(b, u64, code) - b = append(b, '"') - b = appendComma(b) - code = code.Next - } - case encoder.OpStructPtrHeadIntPtr: - p := load(ctxptr, code.Idx) - if p == 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) - fallthrough - case encoder.OpStructHeadIntPtr: - p := load(ctxptr, code.Idx) - if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) - } - b = appendStructKey(ctx, code, b) - if (code.Flags & encoder.IndirectFlags) != 0 { - p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) - } - if p == 0 { - b = appendNull(b) - } else { - b = appendInt(b, ptrToUint64(p), code) - } - b = appendComma(b) - code = code.Next - case encoder.OpStructPtrHeadOmitEmptyIntPtr: - p := load(ctxptr, code.Idx) - if p == 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) - fallthrough - case encoder.OpStructHeadOmitEmptyIntPtr: - p := load(ctxptr, code.Idx) - if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) - } - if (code.Flags & encoder.IndirectFlags) != 0 { - p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) - } - if p != 0 { - b = appendStructKey(ctx, code, b) - b = appendInt(b, ptrToUint64(p), code) - b = appendComma(b) - } - code = code.Next - case encoder.OpStructPtrHeadIntPtrString: - p := load(ctxptr, code.Idx) - if p == 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) - fallthrough - case encoder.OpStructHeadIntPtrString: - p := load(ctxptr, code.Idx) - if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) - } - b = appendStructKey(ctx, code, b) - if (code.Flags & encoder.IndirectFlags) != 0 { - p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) - } - if p == 0 { - b = appendNull(b) - } else { - b = append(b, '"') - b = appendInt(b, ptrToUint64(p), code) - b = append(b, '"') - } - b = appendComma(b) - code = code.Next - case encoder.OpStructPtrHeadOmitEmptyIntPtrString: - p := load(ctxptr, code.Idx) - if p == 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) - fallthrough - case encoder.OpStructHeadOmitEmptyIntPtrString: - p := load(ctxptr, code.Idx) - if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) - } - if (code.Flags & encoder.IndirectFlags) != 0 { - p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) - } - if p != 0 { - b = appendStructKey(ctx, code, b) - b = append(b, '"') - b = appendInt(b, ptrToUint64(p), code) - b = append(b, '"') - b = appendComma(b) - } - code = code.Next - case encoder.OpStructPtrHeadUint: - if (code.Flags & encoder.IndirectFlags) != 0 { - p := load(ctxptr, code.Idx) - if p == 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) - } - fallthrough - case encoder.OpStructHeadUint: - p := load(ctxptr, code.Idx) - if p == 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) - } - b = appendStructKey(ctx, code, b) - b = appendUint(b, ptrToUint64(p+uintptr(code.Offset)), code) - b = appendComma(b) - code = code.Next - case encoder.OpStructPtrHeadOmitEmptyUint: - if (code.Flags & encoder.IndirectFlags) != 0 { - p := load(ctxptr, code.Idx) - if p == 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) - } - fallthrough - case encoder.OpStructHeadOmitEmptyUint: - p := load(ctxptr, code.Idx) - if p == 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) - } - u64 := ptrToUint64(p + uintptr(code.Offset)) - v := u64 & ((1 << code.NumBitSize) - 1) - if v == 0 { - code = code.NextField - } else { - b = appendStructKey(ctx, code, b) - b = appendUint(b, u64, code) - b = appendComma(b) - code = code.Next - } - case encoder.OpStructPtrHeadUintString: - if (code.Flags & encoder.IndirectFlags) != 0 { - p := load(ctxptr, code.Idx) - if p == 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) - } - fallthrough - case encoder.OpStructHeadUintString: - p := load(ctxptr, code.Idx) - if p == 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) - } - b = appendStructKey(ctx, code, b) - b = append(b, '"') - b = appendUint(b, ptrToUint64(p+uintptr(code.Offset)), code) - b = append(b, '"') - b = appendComma(b) - code = code.Next - case encoder.OpStructPtrHeadOmitEmptyUintString: - if (code.Flags & encoder.IndirectFlags) != 0 { - p := load(ctxptr, code.Idx) - if p == 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) - } - fallthrough - case encoder.OpStructHeadOmitEmptyUintString: - p := load(ctxptr, code.Idx) - if p == 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) - } - u64 := ptrToUint64(p + uintptr(code.Offset)) - v := u64 & ((1 << code.NumBitSize) - 1) - if v == 0 { - code = code.NextField - } else { - b = appendStructKey(ctx, code, b) - b = append(b, '"') - b = appendUint(b, u64, code) - b = append(b, '"') - b = appendComma(b) - code = code.Next - } - case encoder.OpStructPtrHeadUintPtr: - p := load(ctxptr, code.Idx) - if p == 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) - fallthrough - case encoder.OpStructHeadUintPtr: - p := load(ctxptr, code.Idx) - if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) - } - b = appendStructKey(ctx, code, b) - if (code.Flags & encoder.IndirectFlags) != 0 { - p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) - } - if p == 0 { - b = appendNull(b) - } else { - b = appendUint(b, ptrToUint64(p), code) - } - b = appendComma(b) - code = code.Next - case encoder.OpStructPtrHeadOmitEmptyUintPtr: - p := load(ctxptr, code.Idx) - if p == 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) - fallthrough - case encoder.OpStructHeadOmitEmptyUintPtr: - p := load(ctxptr, code.Idx) - if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) - } - if (code.Flags & encoder.IndirectFlags) != 0 { - p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) - } - if p != 0 { - b = appendStructKey(ctx, code, b) - b = appendUint(b, ptrToUint64(p), code) - b = appendComma(b) - } - code = code.Next - case encoder.OpStructPtrHeadUintPtrString: - p := load(ctxptr, code.Idx) - if p == 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) - fallthrough - case encoder.OpStructHeadUintPtrString: - p := load(ctxptr, code.Idx) - if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) - } - b = appendStructKey(ctx, code, b) - if (code.Flags & encoder.IndirectFlags) != 0 { - p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) - } - if p == 0 { - b = appendNull(b) - } else { - b = append(b, '"') - b = appendUint(b, ptrToUint64(p), code) - b = append(b, '"') - } - b = appendComma(b) - code = code.Next - case encoder.OpStructPtrHeadOmitEmptyUintPtrString: - p := load(ctxptr, code.Idx) - if p == 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) - fallthrough - case encoder.OpStructHeadOmitEmptyUintPtrString: - p := load(ctxptr, code.Idx) - if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) - } - if (code.Flags & encoder.IndirectFlags) != 0 { - p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) - } - if p != 0 { - b = appendStructKey(ctx, code, b) - b = append(b, '"') - b = appendUint(b, ptrToUint64(p), code) - b = append(b, '"') - b = appendComma(b) - } - code = code.Next - case encoder.OpStructPtrHeadFloat32: - if (code.Flags & encoder.IndirectFlags) != 0 { - p := load(ctxptr, code.Idx) - if p == 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) - } - fallthrough - case encoder.OpStructHeadFloat32: - p := load(ctxptr, code.Idx) - if p == 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) - } - b = appendStructKey(ctx, code, b) - b = appendFloat32(b, ptrToFloat32(p+uintptr(code.Offset))) - b = appendComma(b) - code = code.Next - case encoder.OpStructPtrHeadOmitEmptyFloat32: - if (code.Flags & encoder.IndirectFlags) != 0 { - p := load(ctxptr, code.Idx) - if p == 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) - } - fallthrough - case encoder.OpStructHeadOmitEmptyFloat32: - p := load(ctxptr, code.Idx) - if p == 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) - } - v := ptrToFloat32(p + uintptr(code.Offset)) - if v == 0 { - code = code.NextField - } else { - b = appendStructKey(ctx, code, b) - b = appendFloat32(b, v) - b = appendComma(b) - code = code.Next - } - case encoder.OpStructPtrHeadFloat32String: - if (code.Flags & encoder.IndirectFlags) != 0 { - p := load(ctxptr, code.Idx) - if p == 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) - } - fallthrough - case encoder.OpStructHeadFloat32String: - p := load(ctxptr, code.Idx) - if p == 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) - } - b = appendStructKey(ctx, code, b) - b = append(b, '"') - b = appendFloat32(b, ptrToFloat32(p+uintptr(code.Offset))) - b = append(b, '"') - b = appendComma(b) - code = code.Next - case encoder.OpStructPtrHeadOmitEmptyFloat32String: - if (code.Flags & encoder.IndirectFlags) != 0 { - p := load(ctxptr, code.Idx) - if p == 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) - } - fallthrough - case encoder.OpStructHeadOmitEmptyFloat32String: - p := load(ctxptr, code.Idx) - if p == 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) - } - v := ptrToFloat32(p + uintptr(code.Offset)) - if v == 0 { - code = code.NextField - } else { - b = appendStructKey(ctx, code, b) - b = append(b, '"') - b = appendFloat32(b, v) - b = append(b, '"') - b = appendComma(b) - code = code.Next - } - case encoder.OpStructPtrHeadFloat32Ptr: - p := load(ctxptr, code.Idx) - if p == 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) - fallthrough - case encoder.OpStructHeadFloat32Ptr: - p := load(ctxptr, code.Idx) - if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) - } - b = appendStructKey(ctx, code, b) - if (code.Flags & encoder.IndirectFlags) != 0 { - p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) - } - if p == 0 { - b = appendNull(b) - } else { - b = appendFloat32(b, ptrToFloat32(p)) - } - b = appendComma(b) - code = code.Next - case encoder.OpStructPtrHeadOmitEmptyFloat32Ptr: - p := load(ctxptr, code.Idx) - if p == 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) - fallthrough - case encoder.OpStructHeadOmitEmptyFloat32Ptr: - p := load(ctxptr, code.Idx) - if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) - } - if (code.Flags & encoder.IndirectFlags) != 0 { - p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) - } - if p != 0 { - b = appendStructKey(ctx, code, b) - b = appendFloat32(b, ptrToFloat32(p)) - b = appendComma(b) - } - code = code.Next - case encoder.OpStructPtrHeadFloat32PtrString: - p := load(ctxptr, code.Idx) - if p == 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) - fallthrough - case encoder.OpStructHeadFloat32PtrString: - p := load(ctxptr, code.Idx) - if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) - } - b = appendStructKey(ctx, code, b) - if (code.Flags & encoder.IndirectFlags) != 0 { - p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) - } - if p == 0 { - b = appendNull(b) - } else { - b = append(b, '"') - b = appendFloat32(b, ptrToFloat32(p)) - b = append(b, '"') - } - b = appendComma(b) - code = code.Next - case encoder.OpStructPtrHeadOmitEmptyFloat32PtrString: - p := load(ctxptr, code.Idx) - if p == 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) - fallthrough - case encoder.OpStructHeadOmitEmptyFloat32PtrString: - p := load(ctxptr, code.Idx) - if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) - } - if (code.Flags & encoder.IndirectFlags) != 0 { - p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) - } - if p != 0 { - b = appendStructKey(ctx, code, b) - b = append(b, '"') - b = appendFloat32(b, ptrToFloat32(p)) - b = append(b, '"') - b = appendComma(b) - } - code = code.Next - case encoder.OpStructPtrHeadFloat64: - if (code.Flags & encoder.IndirectFlags) != 0 { - p := load(ctxptr, code.Idx) - if p == 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) - } - fallthrough - case encoder.OpStructHeadFloat64: - p := load(ctxptr, code.Idx) - if p == 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - v := ptrToFloat64(p + uintptr(code.Offset)) - if math.IsInf(v, 0) || math.IsNaN(v) { - return nil, errUnsupportedFloat(v) - } - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) - } - b = appendStructKey(ctx, code, b) - b = appendFloat64(b, v) - b = appendComma(b) - code = code.Next - case encoder.OpStructPtrHeadOmitEmptyFloat64: - if (code.Flags & encoder.IndirectFlags) != 0 { - p := load(ctxptr, code.Idx) - if p == 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) - } - fallthrough - case encoder.OpStructHeadOmitEmptyFloat64: - p := load(ctxptr, code.Idx) - if p == 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) - } - v := ptrToFloat64(p + uintptr(code.Offset)) - if v == 0 { - code = code.NextField - } else { - if math.IsInf(v, 0) || math.IsNaN(v) { - return nil, errUnsupportedFloat(v) - } - b = appendStructKey(ctx, code, b) - b = appendFloat64(b, v) - b = appendComma(b) - code = code.Next - } - case encoder.OpStructPtrHeadFloat64String: - if (code.Flags & encoder.IndirectFlags) != 0 { - p := load(ctxptr, code.Idx) - if p == 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) - } - fallthrough - case encoder.OpStructHeadFloat64String: - p := load(ctxptr, code.Idx) - if p == 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) - } - v := ptrToFloat64(p + uintptr(code.Offset)) - if math.IsInf(v, 0) || math.IsNaN(v) { - return nil, errUnsupportedFloat(v) - } - b = appendStructKey(ctx, code, b) - b = append(b, '"') - b = appendFloat64(b, v) - b = append(b, '"') - b = appendComma(b) - code = code.Next - case encoder.OpStructPtrHeadOmitEmptyFloat64String: - if (code.Flags & encoder.IndirectFlags) != 0 { - p := load(ctxptr, code.Idx) - if p == 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) - } - fallthrough - case encoder.OpStructHeadOmitEmptyFloat64String: - p := load(ctxptr, code.Idx) - if p == 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) - } - v := ptrToFloat64(p + uintptr(code.Offset)) - if v == 0 { - code = code.NextField - } else { - if math.IsInf(v, 0) || math.IsNaN(v) { - return nil, errUnsupportedFloat(v) - } - b = appendStructKey(ctx, code, b) - b = append(b, '"') - b = appendFloat64(b, v) - b = append(b, '"') - b = appendComma(b) - code = code.Next - } - case encoder.OpStructPtrHeadFloat64Ptr: - p := load(ctxptr, code.Idx) - if p == 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) - fallthrough - case encoder.OpStructHeadFloat64Ptr: - p := load(ctxptr, code.Idx) - if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) - } - b = appendStructKey(ctx, code, b) - if (code.Flags & encoder.IndirectFlags) != 0 { - p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) - } - if p == 0 { - b = appendNull(b) - } else { - v := ptrToFloat64(p) - if math.IsInf(v, 0) || math.IsNaN(v) { - return nil, errUnsupportedFloat(v) - } - b = appendFloat64(b, v) - } - b = appendComma(b) - code = code.Next - case encoder.OpStructPtrHeadOmitEmptyFloat64Ptr: - p := load(ctxptr, code.Idx) - if p == 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) - fallthrough - case encoder.OpStructHeadOmitEmptyFloat64Ptr: - p := load(ctxptr, code.Idx) - if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) - } - if (code.Flags & encoder.IndirectFlags) != 0 { - p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) - } - if p != 0 { - b = appendStructKey(ctx, code, b) - v := ptrToFloat64(p) - if math.IsInf(v, 0) || math.IsNaN(v) { - return nil, errUnsupportedFloat(v) - } - b = appendFloat64(b, v) - b = appendComma(b) - } - code = code.Next - case encoder.OpStructPtrHeadFloat64PtrString: - p := load(ctxptr, code.Idx) - if p == 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) - fallthrough - case encoder.OpStructHeadFloat64PtrString: - p := load(ctxptr, code.Idx) - if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) - } - b = appendStructKey(ctx, code, b) - if (code.Flags & encoder.IndirectFlags) != 0 { - p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) - } - if p == 0 { - b = appendNull(b) - } else { - b = append(b, '"') - v := ptrToFloat64(p) - if math.IsInf(v, 0) || math.IsNaN(v) { - return nil, errUnsupportedFloat(v) - } - b = appendFloat64(b, v) - b = append(b, '"') - } - b = appendComma(b) - code = code.Next - case encoder.OpStructPtrHeadOmitEmptyFloat64PtrString: - p := load(ctxptr, code.Idx) - if p == 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) - fallthrough - case encoder.OpStructHeadOmitEmptyFloat64PtrString: - p := load(ctxptr, code.Idx) - if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) - } - if (code.Flags & encoder.IndirectFlags) != 0 { - p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) - } - if p != 0 { - b = appendStructKey(ctx, code, b) - b = append(b, '"') - v := ptrToFloat64(p) - if math.IsInf(v, 0) || math.IsNaN(v) { - return nil, errUnsupportedFloat(v) - } - b = appendFloat64(b, v) - b = append(b, '"') - b = appendComma(b) - } - code = code.Next - case encoder.OpStructPtrHeadString: - if (code.Flags & encoder.IndirectFlags) != 0 { - p := load(ctxptr, code.Idx) - if p == 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) - } - fallthrough - case encoder.OpStructHeadString: - p := load(ctxptr, code.Idx) - if p == 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) - } - b = appendStructKey(ctx, code, b) - b = appendString(b, ptrToString(p+uintptr(code.Offset))) - b = appendComma(b) - code = code.Next - case encoder.OpStructPtrHeadOmitEmptyString: - if (code.Flags & encoder.IndirectFlags) != 0 { - p := load(ctxptr, code.Idx) - if p == 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) - } - fallthrough - case encoder.OpStructHeadOmitEmptyString: - p := load(ctxptr, code.Idx) - if p == 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) - } - v := ptrToString(p + uintptr(code.Offset)) - if v == "" { - code = code.NextField - } else { - b = appendStructKey(ctx, code, b) - b = appendString(b, v) - b = appendComma(b) - code = code.Next - } - case encoder.OpStructPtrHeadStringString: - if (code.Flags & encoder.IndirectFlags) != 0 { - p := load(ctxptr, code.Idx) - if p == 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) - } - fallthrough - case encoder.OpStructHeadStringString: - p := load(ctxptr, code.Idx) - if p == 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) - } - b = appendStructKey(ctx, code, b) - b = appendString(b, string(appendString([]byte{}, ptrToString(p+uintptr(code.Offset))))) - b = appendComma(b) - code = code.Next - case encoder.OpStructPtrHeadOmitEmptyStringString: - if (code.Flags & encoder.IndirectFlags) != 0 { - p := load(ctxptr, code.Idx) - if p == 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) - } - fallthrough - case encoder.OpStructHeadOmitEmptyStringString: - p := load(ctxptr, code.Idx) - if p == 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) - } - v := ptrToString(p + uintptr(code.Offset)) - if v == "" { - code = code.NextField - } else { - b = appendStructKey(ctx, code, b) - b = appendString(b, string(appendString([]byte{}, v))) - b = appendComma(b) - code = code.Next - } - case encoder.OpStructPtrHeadStringPtr: - p := load(ctxptr, code.Idx) - if p == 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) - fallthrough - case encoder.OpStructHeadStringPtr: - p := load(ctxptr, code.Idx) - if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) - } - b = appendStructKey(ctx, code, b) - if (code.Flags & encoder.IndirectFlags) != 0 { - p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) - } - if p == 0 { - b = appendNull(b) - } else { - b = appendString(b, ptrToString(p)) - } - b = appendComma(b) - code = code.Next - case encoder.OpStructPtrHeadOmitEmptyStringPtr: - p := load(ctxptr, code.Idx) - if p == 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) - fallthrough - case encoder.OpStructHeadOmitEmptyStringPtr: - p := load(ctxptr, code.Idx) - if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) - } - if (code.Flags & encoder.IndirectFlags) != 0 { - p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) - } - if p != 0 { - b = appendStructKey(ctx, code, b) - b = appendString(b, ptrToString(p)) - b = appendComma(b) - } - code = code.Next - case encoder.OpStructPtrHeadStringPtrString: - p := load(ctxptr, code.Idx) - if p == 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) - fallthrough - case encoder.OpStructHeadStringPtrString: - p := load(ctxptr, code.Idx) - if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) - } - b = appendStructKey(ctx, code, b) - if (code.Flags & encoder.IndirectFlags) != 0 { - p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) - } - if p == 0 { - b = appendNull(b) - } else { - b = appendString(b, string(appendString([]byte{}, ptrToString(p)))) - } - b = appendComma(b) - code = code.Next - case encoder.OpStructPtrHeadOmitEmptyStringPtrString: - p := load(ctxptr, code.Idx) - if p == 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) - fallthrough - case encoder.OpStructHeadOmitEmptyStringPtrString: - p := load(ctxptr, code.Idx) - if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) - } - if (code.Flags & encoder.IndirectFlags) != 0 { - p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) - } - if p != 0 { - b = appendStructKey(ctx, code, b) - b = appendString(b, string(appendString([]byte{}, ptrToString(p)))) - b = appendComma(b) - } - code = code.Next - case encoder.OpStructPtrHeadBool: - if (code.Flags & encoder.IndirectFlags) != 0 { - p := load(ctxptr, code.Idx) - if p == 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) - } - fallthrough - case encoder.OpStructHeadBool: - p := load(ctxptr, code.Idx) - if p == 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) - } - b = appendStructKey(ctx, code, b) - b = appendBool(b, ptrToBool(p+uintptr(code.Offset))) - b = appendComma(b) - code = code.Next - case encoder.OpStructPtrHeadOmitEmptyBool: - if (code.Flags & encoder.IndirectFlags) != 0 { - p := load(ctxptr, code.Idx) - if p == 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) - } - fallthrough - case encoder.OpStructHeadOmitEmptyBool: - p := load(ctxptr, code.Idx) - if p == 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) - } - v := ptrToBool(p + uintptr(code.Offset)) - if v { - b = appendStructKey(ctx, code, b) - b = appendBool(b, v) - b = appendComma(b) - code = code.Next - } else { - code = code.NextField - } - case encoder.OpStructPtrHeadBoolString: - if (code.Flags & encoder.IndirectFlags) != 0 { - p := load(ctxptr, code.Idx) - if p == 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) - } - fallthrough - case encoder.OpStructHeadBoolString: - p := load(ctxptr, code.Idx) - if p == 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) - } - b = appendStructKey(ctx, code, b) - b = append(b, '"') - b = appendBool(b, ptrToBool(p+uintptr(code.Offset))) - b = append(b, '"') - b = appendComma(b) - code = code.Next - case encoder.OpStructPtrHeadOmitEmptyBoolString: - if (code.Flags & encoder.IndirectFlags) != 0 { - p := load(ctxptr, code.Idx) - if p == 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) - } - fallthrough - case encoder.OpStructHeadOmitEmptyBoolString: - p := load(ctxptr, code.Idx) - if p == 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) - } - v := ptrToBool(p + uintptr(code.Offset)) - if v { - b = appendStructKey(ctx, code, b) - b = append(b, '"') - b = appendBool(b, v) - b = append(b, '"') - b = appendComma(b) - code = code.Next - } else { - code = code.NextField - } - case encoder.OpStructPtrHeadBoolPtr: - p := load(ctxptr, code.Idx) - if p == 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) - fallthrough - case encoder.OpStructHeadBoolPtr: - p := load(ctxptr, code.Idx) - if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) - } - b = appendStructKey(ctx, code, b) - if (code.Flags & encoder.IndirectFlags) != 0 { - p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) - } - if p == 0 { - b = appendNull(b) - } else { - b = appendBool(b, ptrToBool(p)) - } - b = appendComma(b) - code = code.Next - case encoder.OpStructPtrHeadOmitEmptyBoolPtr: - p := load(ctxptr, code.Idx) - if p == 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) - fallthrough - case encoder.OpStructHeadOmitEmptyBoolPtr: - p := load(ctxptr, code.Idx) - if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) - } - if (code.Flags & encoder.IndirectFlags) != 0 { - p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) - } - if p != 0 { - b = appendStructKey(ctx, code, b) - b = appendBool(b, ptrToBool(p)) - b = appendComma(b) - } - code = code.Next - case encoder.OpStructPtrHeadBoolPtrString: - p := load(ctxptr, code.Idx) - if p == 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) - fallthrough - case encoder.OpStructHeadBoolPtrString: - p := load(ctxptr, code.Idx) - if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) - } - b = appendStructKey(ctx, code, b) - if (code.Flags & encoder.IndirectFlags) != 0 { - p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) - } - if p == 0 { - b = appendNull(b) - } else { - b = append(b, '"') - b = appendBool(b, ptrToBool(p)) - b = append(b, '"') - } - b = appendComma(b) - code = code.Next - case encoder.OpStructPtrHeadOmitEmptyBoolPtrString: - p := load(ctxptr, code.Idx) - if p == 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) - fallthrough - case encoder.OpStructHeadOmitEmptyBoolPtrString: - p := load(ctxptr, code.Idx) - if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) - } - if (code.Flags & encoder.IndirectFlags) != 0 { - p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) - } - if p != 0 { - b = appendStructKey(ctx, code, b) - b = append(b, '"') - b = appendBool(b, ptrToBool(p)) - b = append(b, '"') - b = appendComma(b) - } - code = code.Next - case encoder.OpStructPtrHeadBytes: - if (code.Flags & encoder.IndirectFlags) != 0 { - p := load(ctxptr, code.Idx) - if p == 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) - } - fallthrough - case encoder.OpStructHeadBytes: - p := load(ctxptr, code.Idx) - if p == 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) - } - b = appendStructKey(ctx, code, b) - b = appendByteSlice(b, ptrToBytes(p+uintptr(code.Offset))) - b = appendComma(b) - code = code.Next - case encoder.OpStructPtrHeadOmitEmptyBytes: - if (code.Flags & encoder.IndirectFlags) != 0 { - p := load(ctxptr, code.Idx) - if p == 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) - } - fallthrough - case encoder.OpStructHeadOmitEmptyBytes: - p := load(ctxptr, code.Idx) - if p == 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) - } - v := ptrToBytes(p + uintptr(code.Offset)) - if len(v) == 0 { - code = code.NextField - } else { - b = appendStructKey(ctx, code, b) - b = appendByteSlice(b, v) - b = appendComma(b) - code = code.Next - } - case encoder.OpStructPtrHeadBytesPtr: - p := load(ctxptr, code.Idx) - if p == 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) - fallthrough - case encoder.OpStructHeadBytesPtr: - p := load(ctxptr, code.Idx) - if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) - } - b = appendStructKey(ctx, code, b) - if (code.Flags & encoder.IndirectFlags) != 0 { - p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) - } - if p == 0 { - b = appendNull(b) - } else { - b = appendByteSlice(b, ptrToBytes(p)) - } - b = appendComma(b) - code = code.Next - case encoder.OpStructPtrHeadOmitEmptyBytesPtr: - p := load(ctxptr, code.Idx) - if p == 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) - fallthrough - case encoder.OpStructHeadOmitEmptyBytesPtr: - p := load(ctxptr, code.Idx) - if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) - } - if (code.Flags & encoder.IndirectFlags) != 0 { - p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) - } - if p != 0 { - b = appendStructKey(ctx, code, b) - b = appendByteSlice(b, ptrToBytes(p)) - b = appendComma(b) - } - code = code.Next - case encoder.OpStructPtrHeadNumber: - if (code.Flags & encoder.IndirectFlags) != 0 { - p := load(ctxptr, code.Idx) - if p == 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) - } - fallthrough - case encoder.OpStructHeadNumber: - p := load(ctxptr, code.Idx) - if p == 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) - } - b = appendStructKey(ctx, code, b) - bb, err := appendNumber(b, ptrToNumber(p+uintptr(code.Offset))) - if err != nil { - return nil, err - } - b = appendComma(bb) - code = code.Next - case encoder.OpStructPtrHeadOmitEmptyNumber: - if (code.Flags & encoder.IndirectFlags) != 0 { - p := load(ctxptr, code.Idx) - if p == 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) - } - fallthrough - case encoder.OpStructHeadOmitEmptyNumber: - p := load(ctxptr, code.Idx) - if p == 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) - } - v := ptrToNumber(p + uintptr(code.Offset)) - if v == "" { - code = code.NextField - } else { - b = appendStructKey(ctx, code, b) - bb, err := appendNumber(b, v) - if err != nil { - return nil, err - } - b = appendComma(bb) - code = code.Next - } - case encoder.OpStructPtrHeadNumberString: - if (code.Flags & encoder.IndirectFlags) != 0 { - p := load(ctxptr, code.Idx) - if p == 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) - } - fallthrough - case encoder.OpStructHeadNumberString: - p := load(ctxptr, code.Idx) - if p == 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) - } - b = appendStructKey(ctx, code, b) - b = append(b, '"') - bb, err := appendNumber(b, ptrToNumber(p+uintptr(code.Offset))) - if err != nil { - return nil, err - } - b = append(bb, '"') - b = appendComma(b) - code = code.Next - case encoder.OpStructPtrHeadOmitEmptyNumberString: - if (code.Flags & encoder.IndirectFlags) != 0 { - p := load(ctxptr, code.Idx) - if p == 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) - } - fallthrough - case encoder.OpStructHeadOmitEmptyNumberString: - p := load(ctxptr, code.Idx) - if p == 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) - } - v := ptrToNumber(p + uintptr(code.Offset)) - if v == "" { - code = code.NextField - } else { - b = appendStructKey(ctx, code, b) - b = append(b, '"') - bb, err := appendNumber(b, v) - if err != nil { - return nil, err - } - b = append(bb, '"') - b = appendComma(b) - code = code.Next - } - case encoder.OpStructPtrHeadNumberPtr: - p := load(ctxptr, code.Idx) - if p == 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) - fallthrough - case encoder.OpStructHeadNumberPtr: - p := load(ctxptr, code.Idx) - if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) - } - b = appendStructKey(ctx, code, b) - if (code.Flags & encoder.IndirectFlags) != 0 { - p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) - } - if p == 0 { - b = appendNull(b) - } else { - bb, err := appendNumber(b, ptrToNumber(p)) - if err != nil { - return nil, err - } - b = bb - } - b = appendComma(b) - code = code.Next - case encoder.OpStructPtrHeadOmitEmptyNumberPtr: - p := load(ctxptr, code.Idx) - if p == 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) - fallthrough - case encoder.OpStructHeadOmitEmptyNumberPtr: - p := load(ctxptr, code.Idx) - if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) - } - if (code.Flags & encoder.IndirectFlags) != 0 { - p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) - } - if p != 0 { - b = appendStructKey(ctx, code, b) - bb, err := appendNumber(b, ptrToNumber(p)) - if err != nil { - return nil, err - } - b = appendComma(bb) - } - code = code.Next - case encoder.OpStructPtrHeadNumberPtrString: - p := load(ctxptr, code.Idx) - if p == 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) - fallthrough - case encoder.OpStructHeadNumberPtrString: - p := load(ctxptr, code.Idx) - if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) - } - b = appendStructKey(ctx, code, b) - if (code.Flags & encoder.IndirectFlags) != 0 { - p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) - } - if p == 0 { - b = appendNull(b) - } else { - b = append(b, '"') - bb, err := appendNumber(b, ptrToNumber(p)) - if err != nil { - return nil, err - } - b = append(bb, '"') - } - b = appendComma(b) - code = code.Next - case encoder.OpStructPtrHeadOmitEmptyNumberPtrString: - p := load(ctxptr, code.Idx) - if p == 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) - fallthrough - case encoder.OpStructHeadOmitEmptyNumberPtrString: - p := load(ctxptr, code.Idx) - if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) - } - if (code.Flags & encoder.IndirectFlags) != 0 { - p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) - } - if p != 0 { - b = appendStructKey(ctx, code, b) - b = append(b, '"') - bb, err := appendNumber(b, ptrToNumber(p)) - if err != nil { - return nil, err - } - b = append(bb, '"') - b = appendComma(b) - } - code = code.Next - case encoder.OpStructPtrHeadArray, encoder.OpStructPtrHeadSlice: - if (code.Flags & encoder.IndirectFlags) != 0 { - p := load(ctxptr, code.Idx) - if p == 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) - } - fallthrough - case encoder.OpStructHeadArray, encoder.OpStructHeadSlice: - p := load(ctxptr, code.Idx) - if p == 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) - } - b = appendStructKey(ctx, code, b) - p += uintptr(code.Offset) - code = code.Next - store(ctxptr, code.Idx, p) - case encoder.OpStructPtrHeadOmitEmptyArray: - if (code.Flags & encoder.IndirectFlags) != 0 { - p := load(ctxptr, code.Idx) - if p == 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) - } - fallthrough - case encoder.OpStructHeadOmitEmptyArray: - p := load(ctxptr, code.Idx) - if p == 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) - } - p += uintptr(code.Offset) - b = appendStructKey(ctx, code, b) - code = code.Next - store(ctxptr, code.Idx, p) - case encoder.OpStructPtrHeadOmitEmptySlice: - if (code.Flags & encoder.IndirectFlags) != 0 { - p := load(ctxptr, code.Idx) - if p == 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) - } - fallthrough - case encoder.OpStructHeadOmitEmptySlice: - p := load(ctxptr, code.Idx) - if p == 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) - } - p += uintptr(code.Offset) - slice := ptrToSlice(p) - if slice.Len == 0 { - code = code.NextField - } else { - b = appendStructKey(ctx, code, b) - code = code.Next - store(ctxptr, code.Idx, p) - } - case encoder.OpStructPtrHeadArrayPtr, encoder.OpStructPtrHeadSlicePtr: - p := load(ctxptr, code.Idx) - if p == 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) - fallthrough - case encoder.OpStructHeadArrayPtr, encoder.OpStructHeadSlicePtr: - p := load(ctxptr, code.Idx) - if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) - } - b = appendStructKey(ctx, code, b) - if (code.Flags & encoder.IndirectFlags) != 0 { - p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) - } - if p == 0 { - b = appendNull(b) - b = appendComma(b) - code = code.NextField - } else { - code = code.Next - store(ctxptr, code.Idx, p) - } - case encoder.OpStructPtrHeadOmitEmptyArrayPtr, encoder.OpStructPtrHeadOmitEmptySlicePtr: - p := load(ctxptr, code.Idx) - if p == 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) - fallthrough - case encoder.OpStructHeadOmitEmptyArrayPtr, encoder.OpStructHeadOmitEmptySlicePtr: - p := load(ctxptr, code.Idx) - if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) - } - if (code.Flags & encoder.IndirectFlags) != 0 { - p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) - } - if p == 0 { - code = code.NextField - } else { - b = appendStructKey(ctx, code, b) - code = code.Next - store(ctxptr, code.Idx, p) - } - case encoder.OpStructPtrHeadMap: - p := load(ctxptr, code.Idx) - if p == 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) - fallthrough - case encoder.OpStructHeadMap: - p := load(ctxptr, code.Idx) - if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) - } - b = appendStructKey(ctx, code, b) - if p != 0 && (code.Flags&encoder.IndirectFlags) != 0 { - p = ptrToPtr(p + uintptr(code.Offset)) - } - code = code.Next - store(ctxptr, code.Idx, p) - case encoder.OpStructPtrHeadOmitEmptyMap: - p := load(ctxptr, code.Idx) - if p == 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) - fallthrough - case encoder.OpStructHeadOmitEmptyMap: - p := load(ctxptr, code.Idx) - if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) - } - if p != 0 && (code.Flags&encoder.IndirectFlags) != 0 { - p = ptrToPtr(p + uintptr(code.Offset)) - } - if maplen(ptrToUnsafePtr(p)) == 0 { - code = code.NextField - } else { - b = appendStructKey(ctx, code, b) - code = code.Next - store(ctxptr, code.Idx, p) - } - case encoder.OpStructPtrHeadMapPtr: - p := load(ctxptr, code.Idx) - if p == 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) - fallthrough - case encoder.OpStructHeadMapPtr: - p := load(ctxptr, code.Idx) - if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) - } - b = appendStructKey(ctx, code, b) - if p == 0 { - b = appendNull(b) - b = appendComma(b) - code = code.NextField - break - } - p = ptrToPtr(p + uintptr(code.Offset)) - if p == 0 { - b = appendNull(b) - b = appendComma(b) - code = code.NextField - } else { - if (code.Flags & encoder.IndirectFlags) != 0 { - p = ptrToNPtr(p, code.PtrNum) - } - code = code.Next - store(ctxptr, code.Idx, p) - } - case encoder.OpStructPtrHeadOmitEmptyMapPtr: - p := load(ctxptr, code.Idx) - if p == 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) - fallthrough - case encoder.OpStructHeadOmitEmptyMapPtr: - p := load(ctxptr, code.Idx) - if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) - } - if p == 0 { - code = code.NextField - break - } - p = ptrToPtr(p + uintptr(code.Offset)) - if p == 0 { - code = code.NextField - } else { - if (code.Flags & encoder.IndirectFlags) != 0 { - p = ptrToNPtr(p, code.PtrNum) - } - b = appendStructKey(ctx, code, b) - code = code.Next - store(ctxptr, code.Idx, p) - } - case encoder.OpStructPtrHeadMarshalJSON: - p := load(ctxptr, code.Idx) - if p == 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if (code.Flags & encoder.IndirectFlags) != 0 { - store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) - } - fallthrough - case encoder.OpStructHeadMarshalJSON: - p := load(ctxptr, code.Idx) - if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) - } - b = appendStructKey(ctx, code, b) - if (code.Flags & encoder.IsNilableTypeFlags) != 0 { - if (code.Flags&encoder.IndirectFlags) != 0 || code.Op == encoder.OpStructPtrHeadMarshalJSON { - p = ptrToPtr(p + uintptr(code.Offset)) - } - } - if p == 0 && (code.Flags&encoder.NilCheckFlags) != 0 { - b = appendNull(b) - } else { - bb, err := appendMarshalJSON(ctx, code, b, ptrToInterface(code, p)) - if err != nil { - return nil, err - } - b = bb - } - b = appendComma(b) - code = code.Next - case encoder.OpStructPtrHeadOmitEmptyMarshalJSON: - p := load(ctxptr, code.Idx) - if p == 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if (code.Flags & encoder.IndirectFlags) != 0 { - store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) - } - fallthrough - case encoder.OpStructHeadOmitEmptyMarshalJSON: - p := load(ctxptr, code.Idx) - if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) - } - if (code.Flags & encoder.IsNilableTypeFlags) != 0 { - if (code.Flags&encoder.IndirectFlags) != 0 || code.Op == encoder.OpStructPtrHeadOmitEmptyMarshalJSON { - p = ptrToPtr(p + uintptr(code.Offset)) - } - } - iface := ptrToInterface(code, p) - if (code.Flags&encoder.NilCheckFlags) != 0 && encoder.IsNilForMarshaler(iface) { - code = code.NextField - } else { - b = appendStructKey(ctx, code, b) - bb, err := appendMarshalJSON(ctx, code, b, iface) - if err != nil { - return nil, err - } - b = bb - b = appendComma(b) - code = code.Next - } - case encoder.OpStructPtrHeadMarshalJSONPtr: - p := load(ctxptr, code.Idx) - if p == 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) - fallthrough - case encoder.OpStructHeadMarshalJSONPtr: - p := load(ctxptr, code.Idx) - if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) - } - b = appendStructKey(ctx, code, b) - if (code.Flags & encoder.IndirectFlags) != 0 { - p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) - } - if p == 0 { - b = appendNull(b) - } else { - bb, err := appendMarshalJSON(ctx, code, b, ptrToInterface(code, p)) - if err != nil { - return nil, err - } - b = bb - } - b = appendComma(b) - code = code.Next - case encoder.OpStructPtrHeadOmitEmptyMarshalJSONPtr: - p := load(ctxptr, code.Idx) - if p == 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) - fallthrough - case encoder.OpStructHeadOmitEmptyMarshalJSONPtr: - p := load(ctxptr, code.Idx) - if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if (code.Flags & encoder.IndirectFlags) != 0 { - p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) - } - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) - } - if p == 0 { - code = code.NextField - } else { - b = appendStructKey(ctx, code, b) - bb, err := appendMarshalJSON(ctx, code, b, ptrToInterface(code, p)) - if err != nil { - return nil, err - } - b = bb - b = appendComma(b) - code = code.Next - } - case encoder.OpStructPtrHeadMarshalText: - p := load(ctxptr, code.Idx) - if p == 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if (code.Flags & encoder.IndirectFlags) != 0 { - store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) - } - fallthrough - case encoder.OpStructHeadMarshalText: - p := load(ctxptr, code.Idx) - if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) - } - b = appendStructKey(ctx, code, b) - if (code.Flags & encoder.IsNilableTypeFlags) != 0 { - if (code.Flags&encoder.IndirectFlags) != 0 || code.Op == encoder.OpStructPtrHeadMarshalText { - p = ptrToPtr(p + uintptr(code.Offset)) - } - } - if p == 0 && (code.Flags&encoder.NilCheckFlags) != 0 { - b = appendNull(b) - } else { - bb, err := appendMarshalText(code, b, ptrToInterface(code, p)) - if err != nil { - return nil, err - } - b = bb - } - b = appendComma(b) - code = code.Next - case encoder.OpStructPtrHeadOmitEmptyMarshalText: - p := load(ctxptr, code.Idx) - if p == 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if (code.Flags & encoder.IndirectFlags) != 0 { - store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) - } - fallthrough - case encoder.OpStructHeadOmitEmptyMarshalText: - p := load(ctxptr, code.Idx) - if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) - } - if (code.Flags & encoder.IsNilableTypeFlags) != 0 { - if (code.Flags&encoder.IndirectFlags) != 0 || code.Op == encoder.OpStructPtrHeadOmitEmptyMarshalText { - p = ptrToPtr(p + uintptr(code.Offset)) - } - } - if p == 0 && (code.Flags&encoder.NilCheckFlags) != 0 { - code = code.NextField - } else { - b = appendStructKey(ctx, code, b) - bb, err := appendMarshalText(code, b, ptrToInterface(code, p)) - if err != nil { - return nil, err - } - b = bb - b = appendComma(b) - code = code.Next - } - case encoder.OpStructPtrHeadMarshalTextPtr: - p := load(ctxptr, code.Idx) - if p == 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) - fallthrough - case encoder.OpStructHeadMarshalTextPtr: - p := load(ctxptr, code.Idx) - if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) - } - b = appendStructKey(ctx, code, b) - if (code.Flags & encoder.IndirectFlags) != 0 { - p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) - } - if p == 0 { - b = appendNull(b) - } else { - bb, err := appendMarshalText(code, b, ptrToInterface(code, p)) - if err != nil { - return nil, err - } - b = bb - } - b = appendComma(b) - code = code.Next - case encoder.OpStructPtrHeadOmitEmptyMarshalTextPtr: - p := load(ctxptr, code.Idx) - if p == 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) - fallthrough - case encoder.OpStructHeadOmitEmptyMarshalTextPtr: - p := load(ctxptr, code.Idx) - if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if (code.Flags & encoder.IndirectFlags) != 0 { - p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) - } - if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) - } - if p == 0 { - code = code.NextField - } else { - b = appendStructKey(ctx, code, b) - bb, err := appendMarshalText(code, b, ptrToInterface(code, p)) - if err != nil { - return nil, err - } - b = bb - b = appendComma(b) - code = code.Next - } - case encoder.OpStructField: - if code.Flags&encoder.AnonymousKeyFlags == 0 { - b = appendStructKey(ctx, code, b) - } - p := load(ctxptr, code.Idx) + uintptr(code.Offset) - code = code.Next - store(ctxptr, code.Idx, p) - case encoder.OpStructFieldOmitEmpty: - p := load(ctxptr, code.Idx) - p += uintptr(code.Offset) - if ptrToPtr(p) == 0 && (code.Flags&encoder.IsNextOpPtrTypeFlags) != 0 { - code = code.NextField - } else { - b = appendStructKey(ctx, code, b) - code = code.Next - store(ctxptr, code.Idx, p) - } - case encoder.OpStructFieldInt: - p := load(ctxptr, code.Idx) - b = appendStructKey(ctx, code, b) - b = appendInt(b, ptrToUint64(p+uintptr(code.Offset)), code) - b = appendComma(b) - code = code.Next - case encoder.OpStructFieldOmitEmptyInt: - p := load(ctxptr, code.Idx) - u64 := ptrToUint64(p + uintptr(code.Offset)) - v := u64 & ((1 << code.NumBitSize) - 1) - if v != 0 { - b = appendStructKey(ctx, code, b) - b = appendInt(b, u64, code) - b = appendComma(b) - } - code = code.Next - case encoder.OpStructFieldIntString: - p := load(ctxptr, code.Idx) - b = appendStructKey(ctx, code, b) - b = append(b, '"') - b = appendInt(b, ptrToUint64(p+uintptr(code.Offset)), code) - b = append(b, '"') - b = appendComma(b) - code = code.Next - case encoder.OpStructFieldOmitEmptyIntString: - p := load(ctxptr, code.Idx) - u64 := ptrToUint64(p + uintptr(code.Offset)) - v := u64 & ((1 << code.NumBitSize) - 1) - if v != 0 { - b = appendStructKey(ctx, code, b) - b = append(b, '"') - b = appendInt(b, u64, code) - b = append(b, '"') - b = appendComma(b) - } - code = code.Next - case encoder.OpStructFieldIntPtr: - p := load(ctxptr, code.Idx) - p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) - b = appendStructKey(ctx, code, b) - if p == 0 { - b = appendNull(b) - } else { - b = appendInt(b, ptrToUint64(p), code) - } - b = appendComma(b) - code = code.Next - case encoder.OpStructFieldOmitEmptyIntPtr: - p := load(ctxptr, code.Idx) - p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) - if p != 0 { - b = appendStructKey(ctx, code, b) - b = appendInt(b, ptrToUint64(p), code) - b = appendComma(b) - } - code = code.Next - case encoder.OpStructFieldIntPtrString: - p := load(ctxptr, code.Idx) - p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) - b = appendStructKey(ctx, code, b) - if p == 0 { - b = appendNull(b) - } else { - b = append(b, '"') - b = appendInt(b, ptrToUint64(p), code) - b = append(b, '"') - } - b = appendComma(b) - code = code.Next - case encoder.OpStructFieldOmitEmptyIntPtrString: - p := load(ctxptr, code.Idx) - p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) - if p != 0 { - b = appendStructKey(ctx, code, b) - b = append(b, '"') - b = appendInt(b, ptrToUint64(p), code) - b = append(b, '"') - b = appendComma(b) - } - code = code.Next - case encoder.OpStructFieldUint: - p := load(ctxptr, code.Idx) - b = appendStructKey(ctx, code, b) - b = appendUint(b, ptrToUint64(p+uintptr(code.Offset)), code) - b = appendComma(b) - code = code.Next - case encoder.OpStructFieldOmitEmptyUint: - p := load(ctxptr, code.Idx) - u64 := ptrToUint64(p + uintptr(code.Offset)) - v := u64 & ((1 << code.NumBitSize) - 1) - if v != 0 { - b = appendStructKey(ctx, code, b) - b = appendUint(b, u64, code) - b = appendComma(b) - } - code = code.Next - case encoder.OpStructFieldUintString: - p := load(ctxptr, code.Idx) - b = appendStructKey(ctx, code, b) - b = append(b, '"') - b = appendUint(b, ptrToUint64(p+uintptr(code.Offset)), code) - b = append(b, '"') - b = appendComma(b) - code = code.Next - case encoder.OpStructFieldOmitEmptyUintString: - p := load(ctxptr, code.Idx) - u64 := ptrToUint64(p + uintptr(code.Offset)) - v := u64 & ((1 << code.NumBitSize) - 1) - if v != 0 { - b = appendStructKey(ctx, code, b) - b = append(b, '"') - b = appendUint(b, u64, code) - b = append(b, '"') - b = appendComma(b) - } - code = code.Next - case encoder.OpStructFieldUintPtr: - p := load(ctxptr, code.Idx) - p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) - b = appendStructKey(ctx, code, b) - if p == 0 { - b = appendNull(b) - } else { - b = appendUint(b, ptrToUint64(p), code) - } - b = appendComma(b) - code = code.Next - case encoder.OpStructFieldOmitEmptyUintPtr: - p := load(ctxptr, code.Idx) - p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) - if p != 0 { - b = appendStructKey(ctx, code, b) - b = appendUint(b, ptrToUint64(p), code) - b = appendComma(b) - } - code = code.Next - case encoder.OpStructFieldUintPtrString: - p := load(ctxptr, code.Idx) - p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) - b = appendStructKey(ctx, code, b) - if p == 0 { - b = appendNull(b) - } else { - b = append(b, '"') - b = appendUint(b, ptrToUint64(p), code) - b = append(b, '"') - } - b = appendComma(b) - code = code.Next - case encoder.OpStructFieldOmitEmptyUintPtrString: - p := load(ctxptr, code.Idx) - p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) - if p != 0 { - b = appendStructKey(ctx, code, b) - b = append(b, '"') - b = appendUint(b, ptrToUint64(p), code) - b = append(b, '"') - b = appendComma(b) - } - code = code.Next - case encoder.OpStructFieldFloat32: - p := load(ctxptr, code.Idx) - b = appendStructKey(ctx, code, b) - b = appendFloat32(b, ptrToFloat32(p+uintptr(code.Offset))) - b = appendComma(b) - code = code.Next - case encoder.OpStructFieldOmitEmptyFloat32: - p := load(ctxptr, code.Idx) - v := ptrToFloat32(p + uintptr(code.Offset)) - if v != 0 { - b = appendStructKey(ctx, code, b) - b = appendFloat32(b, v) - b = appendComma(b) - } - code = code.Next - case encoder.OpStructFieldFloat32String: - p := load(ctxptr, code.Idx) - b = appendStructKey(ctx, code, b) - b = append(b, '"') - b = appendFloat32(b, ptrToFloat32(p+uintptr(code.Offset))) - b = append(b, '"') - b = appendComma(b) - code = code.Next - case encoder.OpStructFieldOmitEmptyFloat32String: - p := load(ctxptr, code.Idx) - v := ptrToFloat32(p + uintptr(code.Offset)) - if v != 0 { - b = appendStructKey(ctx, code, b) - b = append(b, '"') - b = appendFloat32(b, v) - b = append(b, '"') - b = appendComma(b) - } - code = code.Next - case encoder.OpStructFieldFloat32Ptr: - p := load(ctxptr, code.Idx) - p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) - b = appendStructKey(ctx, code, b) - if p == 0 { - b = appendNull(b) - } else { - b = appendFloat32(b, ptrToFloat32(p)) - } - b = appendComma(b) - code = code.Next - case encoder.OpStructFieldOmitEmptyFloat32Ptr: - p := load(ctxptr, code.Idx) - p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) - if p != 0 { - b = appendStructKey(ctx, code, b) - b = appendFloat32(b, ptrToFloat32(p)) - b = appendComma(b) - } - code = code.Next - case encoder.OpStructFieldFloat32PtrString: - p := load(ctxptr, code.Idx) - p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) - b = appendStructKey(ctx, code, b) - if p == 0 { - b = appendNull(b) - } else { - b = append(b, '"') - b = appendFloat32(b, ptrToFloat32(p)) - b = append(b, '"') - } - b = appendComma(b) - code = code.Next - case encoder.OpStructFieldOmitEmptyFloat32PtrString: - p := load(ctxptr, code.Idx) - p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) - if p != 0 { - b = appendStructKey(ctx, code, b) - b = append(b, '"') - b = appendFloat32(b, ptrToFloat32(p)) - b = append(b, '"') - b = appendComma(b) - } - code = code.Next - case encoder.OpStructFieldFloat64: - p := load(ctxptr, code.Idx) - b = appendStructKey(ctx, code, b) - v := ptrToFloat64(p + uintptr(code.Offset)) - if math.IsInf(v, 0) || math.IsNaN(v) { - return nil, errUnsupportedFloat(v) - } - b = appendFloat64(b, v) - b = appendComma(b) - code = code.Next - case encoder.OpStructFieldOmitEmptyFloat64: - p := load(ctxptr, code.Idx) - v := ptrToFloat64(p + uintptr(code.Offset)) - if v != 0 { - if math.IsInf(v, 0) || math.IsNaN(v) { - return nil, errUnsupportedFloat(v) - } - b = appendStructKey(ctx, code, b) - b = appendFloat64(b, v) - b = appendComma(b) - } - code = code.Next - case encoder.OpStructFieldFloat64String: - p := load(ctxptr, code.Idx) - v := ptrToFloat64(p + uintptr(code.Offset)) - if math.IsInf(v, 0) || math.IsNaN(v) { - return nil, errUnsupportedFloat(v) - } - b = appendStructKey(ctx, code, b) - b = append(b, '"') - b = appendFloat64(b, v) - b = append(b, '"') - b = appendComma(b) - code = code.Next - case encoder.OpStructFieldOmitEmptyFloat64String: - p := load(ctxptr, code.Idx) - v := ptrToFloat64(p + uintptr(code.Offset)) - if v != 0 { - if math.IsInf(v, 0) || math.IsNaN(v) { - return nil, errUnsupportedFloat(v) - } - b = appendStructKey(ctx, code, b) - b = append(b, '"') - b = appendFloat64(b, v) - b = append(b, '"') - b = appendComma(b) - } - code = code.Next - case encoder.OpStructFieldFloat64Ptr: - p := load(ctxptr, code.Idx) - p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) - b = appendStructKey(ctx, code, b) - if p == 0 { - b = appendNull(b) - b = appendComma(b) - code = code.Next - break - } - v := ptrToFloat64(p) - if math.IsInf(v, 0) || math.IsNaN(v) { - return nil, errUnsupportedFloat(v) - } - b = appendFloat64(b, v) - b = appendComma(b) - code = code.Next - case encoder.OpStructFieldOmitEmptyFloat64Ptr: - p := load(ctxptr, code.Idx) - p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) - if p != 0 { - b = appendStructKey(ctx, code, b) - v := ptrToFloat64(p) - if math.IsInf(v, 0) || math.IsNaN(v) { - return nil, errUnsupportedFloat(v) - } - b = appendFloat64(b, v) - b = appendComma(b) - } - code = code.Next - case encoder.OpStructFieldFloat64PtrString: - p := load(ctxptr, code.Idx) - p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) - b = appendStructKey(ctx, code, b) - if p == 0 { - b = appendNull(b) - } else { - v := ptrToFloat64(p) - if math.IsInf(v, 0) || math.IsNaN(v) { - return nil, errUnsupportedFloat(v) - } - b = append(b, '"') - b = appendFloat64(b, v) - b = append(b, '"') - } - b = appendComma(b) - code = code.Next - case encoder.OpStructFieldOmitEmptyFloat64PtrString: - p := load(ctxptr, code.Idx) - p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) - if p != 0 { - b = appendStructKey(ctx, code, b) - b = append(b, '"') - v := ptrToFloat64(p) - if math.IsInf(v, 0) || math.IsNaN(v) { - return nil, errUnsupportedFloat(v) - } - b = appendFloat64(b, v) - b = append(b, '"') - b = appendComma(b) - } - code = code.Next - case encoder.OpStructFieldString: - p := load(ctxptr, code.Idx) - b = appendStructKey(ctx, code, b) - b = appendString(b, ptrToString(p+uintptr(code.Offset))) - b = appendComma(b) - code = code.Next - case encoder.OpStructFieldOmitEmptyString: - p := load(ctxptr, code.Idx) - v := ptrToString(p + uintptr(code.Offset)) - if v != "" { - b = appendStructKey(ctx, code, b) - b = appendString(b, v) - b = appendComma(b) - } - code = code.Next - case encoder.OpStructFieldStringString: - p := load(ctxptr, code.Idx) - s := ptrToString(p + uintptr(code.Offset)) - b = appendStructKey(ctx, code, b) - b = appendString(b, string(appendString([]byte{}, s))) - b = appendComma(b) - code = code.Next - case encoder.OpStructFieldOmitEmptyStringString: - p := load(ctxptr, code.Idx) - v := ptrToString(p + uintptr(code.Offset)) - if v != "" { - b = appendStructKey(ctx, code, b) - b = appendString(b, string(appendString([]byte{}, v))) - b = appendComma(b) - } - code = code.Next - case encoder.OpStructFieldStringPtr: - p := load(ctxptr, code.Idx) - p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) - b = appendStructKey(ctx, code, b) - if p == 0 { - b = appendNull(b) - } else { - b = appendString(b, ptrToString(p)) - } - b = appendComma(b) - code = code.Next - case encoder.OpStructFieldOmitEmptyStringPtr: - p := load(ctxptr, code.Idx) - p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) - if p != 0 { - b = appendStructKey(ctx, code, b) - b = appendString(b, ptrToString(p)) - b = appendComma(b) - } - code = code.Next - case encoder.OpStructFieldStringPtrString: - p := load(ctxptr, code.Idx) - p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) - b = appendStructKey(ctx, code, b) - if p == 0 { - b = appendNull(b) - } else { - b = appendString(b, string(appendString([]byte{}, ptrToString(p)))) - } - b = appendComma(b) - code = code.Next - case encoder.OpStructFieldOmitEmptyStringPtrString: - p := load(ctxptr, code.Idx) - p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) - if p != 0 { - b = appendStructKey(ctx, code, b) - b = appendString(b, string(appendString([]byte{}, ptrToString(p)))) - b = appendComma(b) - } - code = code.Next - case encoder.OpStructFieldBool: - p := load(ctxptr, code.Idx) - b = appendStructKey(ctx, code, b) - b = appendBool(b, ptrToBool(p+uintptr(code.Offset))) - b = appendComma(b) - code = code.Next - case encoder.OpStructFieldOmitEmptyBool: - p := load(ctxptr, code.Idx) - v := ptrToBool(p + uintptr(code.Offset)) - if v { - b = appendStructKey(ctx, code, b) - b = appendBool(b, v) - b = appendComma(b) - } - code = code.Next - case encoder.OpStructFieldBoolString: - p := load(ctxptr, code.Idx) - b = appendStructKey(ctx, code, b) - b = append(b, '"') - b = appendBool(b, ptrToBool(p+uintptr(code.Offset))) - b = append(b, '"') - b = appendComma(b) - code = code.Next - case encoder.OpStructFieldOmitEmptyBoolString: - p := load(ctxptr, code.Idx) - v := ptrToBool(p + uintptr(code.Offset)) - if v { - b = appendStructKey(ctx, code, b) - b = append(b, '"') - b = appendBool(b, v) - b = append(b, '"') - b = appendComma(b) - } - code = code.Next - case encoder.OpStructFieldBoolPtr: - p := load(ctxptr, code.Idx) - p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) - b = appendStructKey(ctx, code, b) - if p == 0 { - b = appendNull(b) - } else { - b = appendBool(b, ptrToBool(p)) - } - b = appendComma(b) - code = code.Next - case encoder.OpStructFieldOmitEmptyBoolPtr: - p := load(ctxptr, code.Idx) - p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) - if p != 0 { - b = appendStructKey(ctx, code, b) - b = appendBool(b, ptrToBool(p)) - b = appendComma(b) - } - code = code.Next - case encoder.OpStructFieldBoolPtrString: - p := load(ctxptr, code.Idx) - p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) - b = appendStructKey(ctx, code, b) - if p == 0 { - b = appendNull(b) - } else { - b = append(b, '"') - b = appendBool(b, ptrToBool(p)) - b = append(b, '"') - } - b = appendComma(b) - code = code.Next - case encoder.OpStructFieldOmitEmptyBoolPtrString: - p := load(ctxptr, code.Idx) - p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) - if p != 0 { - b = appendStructKey(ctx, code, b) - b = append(b, '"') - b = appendBool(b, ptrToBool(p)) - b = append(b, '"') - b = appendComma(b) - } - code = code.Next - case encoder.OpStructFieldBytes: - p := load(ctxptr, code.Idx) - b = appendStructKey(ctx, code, b) - b = appendByteSlice(b, ptrToBytes(p+uintptr(code.Offset))) - b = appendComma(b) - code = code.Next - case encoder.OpStructFieldOmitEmptyBytes: - p := load(ctxptr, code.Idx) - v := ptrToBytes(p + uintptr(code.Offset)) - if len(v) > 0 { - b = appendStructKey(ctx, code, b) - b = appendByteSlice(b, v) - b = appendComma(b) - } - code = code.Next - case encoder.OpStructFieldBytesPtr: - p := load(ctxptr, code.Idx) - p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) - b = appendStructKey(ctx, code, b) - if p == 0 { - b = appendNull(b) - } else { - b = appendByteSlice(b, ptrToBytes(p)) - } - b = appendComma(b) - code = code.Next - case encoder.OpStructFieldOmitEmptyBytesPtr: - p := load(ctxptr, code.Idx) - p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) - if p != 0 { - b = appendStructKey(ctx, code, b) - b = appendByteSlice(b, ptrToBytes(p)) - b = appendComma(b) - } - code = code.Next - case encoder.OpStructFieldNumber: - p := load(ctxptr, code.Idx) - b = appendStructKey(ctx, code, b) - bb, err := appendNumber(b, ptrToNumber(p+uintptr(code.Offset))) - if err != nil { - return nil, err - } - b = appendComma(bb) - code = code.Next - case encoder.OpStructFieldOmitEmptyNumber: - p := load(ctxptr, code.Idx) - v := ptrToNumber(p + uintptr(code.Offset)) - if v != "" { - b = appendStructKey(ctx, code, b) - bb, err := appendNumber(b, v) - if err != nil { - return nil, err - } - b = appendComma(bb) - } - code = code.Next - case encoder.OpStructFieldNumberString: - p := load(ctxptr, code.Idx) - b = appendStructKey(ctx, code, b) - b = append(b, '"') - bb, err := appendNumber(b, ptrToNumber(p+uintptr(code.Offset))) - if err != nil { - return nil, err - } - b = append(bb, '"') - b = appendComma(b) - code = code.Next - case encoder.OpStructFieldOmitEmptyNumberString: - p := load(ctxptr, code.Idx) - v := ptrToNumber(p + uintptr(code.Offset)) - if v != "" { - b = appendStructKey(ctx, code, b) - b = append(b, '"') - bb, err := appendNumber(b, v) - if err != nil { - return nil, err - } - b = append(bb, '"') - b = appendComma(b) - } - code = code.Next - case encoder.OpStructFieldNumberPtr: - p := load(ctxptr, code.Idx) - p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) - b = appendStructKey(ctx, code, b) - if p == 0 { - b = appendNull(b) - } else { - bb, err := appendNumber(b, ptrToNumber(p)) - if err != nil { - return nil, err - } - b = bb - } - b = appendComma(b) - code = code.Next - case encoder.OpStructFieldOmitEmptyNumberPtr: - p := load(ctxptr, code.Idx) - p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) - if p != 0 { - b = appendStructKey(ctx, code, b) - bb, err := appendNumber(b, ptrToNumber(p)) - if err != nil { - return nil, err - } - b = appendComma(bb) - } - code = code.Next - case encoder.OpStructFieldNumberPtrString: - p := load(ctxptr, code.Idx) - p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) - b = appendStructKey(ctx, code, b) - if p == 0 { - b = appendNull(b) - } else { - b = append(b, '"') - bb, err := appendNumber(b, ptrToNumber(p)) - if err != nil { - return nil, err - } - b = append(bb, '"') - } - b = appendComma(b) - code = code.Next - case encoder.OpStructFieldOmitEmptyNumberPtrString: - p := load(ctxptr, code.Idx) - p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) - if p != 0 { - b = appendStructKey(ctx, code, b) - b = append(b, '"') - bb, err := appendNumber(b, ptrToNumber(p)) - if err != nil { - return nil, err - } - b = append(bb, '"') - b = appendComma(b) - } - code = code.Next - case encoder.OpStructFieldMarshalJSON: - p := load(ctxptr, code.Idx) - b = appendStructKey(ctx, code, b) - p += uintptr(code.Offset) - if (code.Flags & encoder.IsNilableTypeFlags) != 0 { - p = ptrToPtr(p) - } - if p == 0 && (code.Flags&encoder.NilCheckFlags) != 0 { - b = appendNull(b) - } else { - bb, err := appendMarshalJSON(ctx, code, b, ptrToInterface(code, p)) - if err != nil { - return nil, err - } - b = bb - } - b = appendComma(b) - code = code.Next - case encoder.OpStructFieldOmitEmptyMarshalJSON: - p := load(ctxptr, code.Idx) - p += uintptr(code.Offset) - if (code.Flags & encoder.IsNilableTypeFlags) != 0 { - p = ptrToPtr(p) - } - if p == 0 && (code.Flags&encoder.NilCheckFlags) != 0 { - code = code.NextField - break - } - iface := ptrToInterface(code, p) - if (code.Flags&encoder.NilCheckFlags) != 0 && encoder.IsNilForMarshaler(iface) { - code = code.NextField - break - } - b = appendStructKey(ctx, code, b) - bb, err := appendMarshalJSON(ctx, code, b, iface) - if err != nil { - return nil, err - } - b = appendComma(bb) - code = code.Next - case encoder.OpStructFieldMarshalJSONPtr: - p := load(ctxptr, code.Idx) - b = appendStructKey(ctx, code, b) - p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) - if p == 0 { - b = appendNull(b) - } else { - bb, err := appendMarshalJSON(ctx, code, b, ptrToInterface(code, p)) - if err != nil { - return nil, err - } - b = bb - } - b = appendComma(b) - code = code.Next - case encoder.OpStructFieldOmitEmptyMarshalJSONPtr: - p := load(ctxptr, code.Idx) - p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) - if p != 0 { - b = appendStructKey(ctx, code, b) - bb, err := appendMarshalJSON(ctx, code, b, ptrToInterface(code, p)) - if err != nil { - return nil, err - } - b = appendComma(bb) - } - code = code.Next - case encoder.OpStructFieldMarshalText: - p := load(ctxptr, code.Idx) - b = appendStructKey(ctx, code, b) - p += uintptr(code.Offset) - if (code.Flags & encoder.IsNilableTypeFlags) != 0 { - p = ptrToPtr(p) - } - if p == 0 && (code.Flags&encoder.NilCheckFlags) != 0 { - b = appendNull(b) - } else { - bb, err := appendMarshalText(code, b, ptrToInterface(code, p)) - if err != nil { - return nil, err - } - b = bb - } - b = appendComma(b) - code = code.Next - case encoder.OpStructFieldOmitEmptyMarshalText: - p := load(ctxptr, code.Idx) - p += uintptr(code.Offset) - if (code.Flags & encoder.IsNilableTypeFlags) != 0 { - p = ptrToPtr(p) - } - if p == 0 && (code.Flags&encoder.NilCheckFlags) != 0 { - code = code.NextField - break - } - b = appendStructKey(ctx, code, b) - bb, err := appendMarshalText(code, b, ptrToInterface(code, p)) - if err != nil { - return nil, err - } - b = appendComma(bb) - code = code.Next - case encoder.OpStructFieldMarshalTextPtr: - p := load(ctxptr, code.Idx) - b = appendStructKey(ctx, code, b) - p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) - if p == 0 { - b = appendNull(b) - } else { - bb, err := appendMarshalText(code, b, ptrToInterface(code, p)) - if err != nil { - return nil, err - } - b = bb - } - b = appendComma(b) - code = code.Next - case encoder.OpStructFieldOmitEmptyMarshalTextPtr: - p := load(ctxptr, code.Idx) - p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) - if p != 0 { - b = appendStructKey(ctx, code, b) - bb, err := appendMarshalText(code, b, ptrToInterface(code, p)) - if err != nil { - return nil, err - } - b = appendComma(bb) - } - code = code.Next - case encoder.OpStructFieldArray: - b = appendStructKey(ctx, code, b) - p := load(ctxptr, code.Idx) - p += uintptr(code.Offset) - code = code.Next - store(ctxptr, code.Idx, p) - case encoder.OpStructFieldOmitEmptyArray: - b = appendStructKey(ctx, code, b) - p := load(ctxptr, code.Idx) - p += uintptr(code.Offset) - code = code.Next - store(ctxptr, code.Idx, p) - case encoder.OpStructFieldArrayPtr: - b = appendStructKey(ctx, code, b) - p := load(ctxptr, code.Idx) - p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) - code = code.Next - store(ctxptr, code.Idx, p) - case encoder.OpStructFieldOmitEmptyArrayPtr: - p := load(ctxptr, code.Idx) - p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) - if p != 0 { - b = appendStructKey(ctx, code, b) - code = code.Next - store(ctxptr, code.Idx, p) - } else { - code = code.NextField - } - case encoder.OpStructFieldSlice: - b = appendStructKey(ctx, code, b) - p := load(ctxptr, code.Idx) - p += uintptr(code.Offset) - code = code.Next - store(ctxptr, code.Idx, p) - case encoder.OpStructFieldOmitEmptySlice: - p := load(ctxptr, code.Idx) - p += uintptr(code.Offset) - slice := ptrToSlice(p) - if slice.Len == 0 { - code = code.NextField - } else { - b = appendStructKey(ctx, code, b) - code = code.Next - store(ctxptr, code.Idx, p) - } - case encoder.OpStructFieldSlicePtr: - b = appendStructKey(ctx, code, b) - p := load(ctxptr, code.Idx) - p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) - code = code.Next - store(ctxptr, code.Idx, p) - case encoder.OpStructFieldOmitEmptySlicePtr: - p := load(ctxptr, code.Idx) - p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) - if p != 0 { - b = appendStructKey(ctx, code, b) - code = code.Next - store(ctxptr, code.Idx, p) - } else { - code = code.NextField - } - case encoder.OpStructFieldMap: - b = appendStructKey(ctx, code, b) - p := load(ctxptr, code.Idx) - p = ptrToPtr(p + uintptr(code.Offset)) - code = code.Next - store(ctxptr, code.Idx, p) - case encoder.OpStructFieldOmitEmptyMap: - p := load(ctxptr, code.Idx) - p = ptrToPtr(p + uintptr(code.Offset)) - if p == 0 || maplen(ptrToUnsafePtr(p)) == 0 { - code = code.NextField - } else { - b = appendStructKey(ctx, code, b) - code = code.Next - store(ctxptr, code.Idx, p) - } - case encoder.OpStructFieldMapPtr: - b = appendStructKey(ctx, code, b) - p := load(ctxptr, code.Idx) - p = ptrToPtr(p + uintptr(code.Offset)) - if p != 0 { - p = ptrToNPtr(p, code.PtrNum) - } - code = code.Next - store(ctxptr, code.Idx, p) - case encoder.OpStructFieldOmitEmptyMapPtr: - p := load(ctxptr, code.Idx) - p = ptrToPtr(p + uintptr(code.Offset)) - if p != 0 { - p = ptrToNPtr(p, code.PtrNum) - } - if p != 0 { - b = appendStructKey(ctx, code, b) - code = code.Next - store(ctxptr, code.Idx, p) - } else { - code = code.NextField - } - case encoder.OpStructFieldStruct: - b = appendStructKey(ctx, code, b) - p := load(ctxptr, code.Idx) - p += uintptr(code.Offset) - code = code.Next - store(ctxptr, code.Idx, p) - case encoder.OpStructFieldOmitEmptyStruct: - p := load(ctxptr, code.Idx) - p += uintptr(code.Offset) - if ptrToPtr(p) == 0 && (code.Flags&encoder.IsNextOpPtrTypeFlags) != 0 { - code = code.NextField - } else { - b = appendStructKey(ctx, code, b) - code = code.Next - store(ctxptr, code.Idx, p) - } - case encoder.OpStructAnonymousEnd: - code = code.Next - case encoder.OpStructEnd: - b = appendStructEndSkipLast(ctx, code, b) - code = code.Next - case encoder.OpStructEndInt: - p := load(ctxptr, code.Idx) - b = appendStructKey(ctx, code, b) - b = appendInt(b, ptrToUint64(p+uintptr(code.Offset)), code) - b = appendStructEnd(ctx, code, b) - code = code.Next - case encoder.OpStructEndOmitEmptyInt: - p := load(ctxptr, code.Idx) - u64 := ptrToUint64(p + uintptr(code.Offset)) - v := u64 & ((1 << code.NumBitSize) - 1) - if v != 0 { - b = appendStructKey(ctx, code, b) - b = appendInt(b, u64, code) - b = appendStructEnd(ctx, code, b) - } else { - b = appendStructEndSkipLast(ctx, code, b) - } - code = code.Next - case encoder.OpStructEndIntString: - p := load(ctxptr, code.Idx) - b = appendStructKey(ctx, code, b) - b = append(b, '"') - b = appendInt(b, ptrToUint64(p+uintptr(code.Offset)), code) - b = append(b, '"') - b = appendStructEnd(ctx, code, b) - code = code.Next - case encoder.OpStructEndOmitEmptyIntString: - p := load(ctxptr, code.Idx) - u64 := ptrToUint64(p + uintptr(code.Offset)) - v := u64 & ((1 << code.NumBitSize) - 1) - if v != 0 { - b = appendStructKey(ctx, code, b) - b = append(b, '"') - b = appendInt(b, u64, code) - b = append(b, '"') - b = appendStructEnd(ctx, code, b) - } else { - b = appendStructEndSkipLast(ctx, code, b) - } - code = code.Next - case encoder.OpStructEndIntPtr: - b = appendStructKey(ctx, code, b) - p := load(ctxptr, code.Idx) - p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) - if p == 0 { - b = appendNull(b) - } else { - b = appendInt(b, ptrToUint64(p), code) - } - b = appendStructEnd(ctx, code, b) - code = code.Next - case encoder.OpStructEndOmitEmptyIntPtr: - p := load(ctxptr, code.Idx) - p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) - if p != 0 { - b = appendStructKey(ctx, code, b) - b = appendInt(b, ptrToUint64(p), code) - b = appendStructEnd(ctx, code, b) - } else { - b = appendStructEndSkipLast(ctx, code, b) - } - code = code.Next - case encoder.OpStructEndIntPtrString: - b = appendStructKey(ctx, code, b) - p := load(ctxptr, code.Idx) - p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) - if p == 0 { - b = appendNull(b) - } else { - b = append(b, '"') - b = appendInt(b, ptrToUint64(p), code) - b = append(b, '"') - } - b = appendStructEnd(ctx, code, b) - code = code.Next - case encoder.OpStructEndOmitEmptyIntPtrString: - p := load(ctxptr, code.Idx) - p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) - if p != 0 { - b = appendStructKey(ctx, code, b) - b = append(b, '"') - b = appendInt(b, ptrToUint64(p), code) - b = append(b, '"') - b = appendStructEnd(ctx, code, b) - } else { - b = appendStructEndSkipLast(ctx, code, b) - } - code = code.Next - case encoder.OpStructEndUint: - p := load(ctxptr, code.Idx) - b = appendStructKey(ctx, code, b) - b = appendUint(b, ptrToUint64(p+uintptr(code.Offset)), code) - b = appendStructEnd(ctx, code, b) - code = code.Next - case encoder.OpStructEndOmitEmptyUint: - p := load(ctxptr, code.Idx) - u64 := ptrToUint64(p + uintptr(code.Offset)) - v := u64 & ((1 << code.NumBitSize) - 1) - if v != 0 { - b = appendStructKey(ctx, code, b) - b = appendUint(b, u64, code) - b = appendStructEnd(ctx, code, b) - } else { - b = appendStructEndSkipLast(ctx, code, b) - } - code = code.Next - case encoder.OpStructEndUintString: - p := load(ctxptr, code.Idx) - b = appendStructKey(ctx, code, b) - b = append(b, '"') - b = appendUint(b, ptrToUint64(p+uintptr(code.Offset)), code) - b = append(b, '"') - b = appendStructEnd(ctx, code, b) - code = code.Next - case encoder.OpStructEndOmitEmptyUintString: - p := load(ctxptr, code.Idx) - u64 := ptrToUint64(p + uintptr(code.Offset)) - v := u64 & ((1 << code.NumBitSize) - 1) - if v != 0 { - b = appendStructKey(ctx, code, b) - b = append(b, '"') - b = appendUint(b, u64, code) - b = append(b, '"') - b = appendStructEnd(ctx, code, b) - } else { - b = appendStructEndSkipLast(ctx, code, b) - } - code = code.Next - case encoder.OpStructEndUintPtr: - b = appendStructKey(ctx, code, b) - p := load(ctxptr, code.Idx) - p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) - if p == 0 { - b = appendNull(b) - } else { - b = appendUint(b, ptrToUint64(p), code) - } - b = appendStructEnd(ctx, code, b) - code = code.Next - case encoder.OpStructEndOmitEmptyUintPtr: - p := load(ctxptr, code.Idx) - p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) - if p != 0 { - b = appendStructKey(ctx, code, b) - b = appendUint(b, ptrToUint64(p), code) - b = appendStructEnd(ctx, code, b) - } else { - b = appendStructEndSkipLast(ctx, code, b) - } - code = code.Next - case encoder.OpStructEndUintPtrString: - b = appendStructKey(ctx, code, b) - p := load(ctxptr, code.Idx) - p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) - if p == 0 { - b = appendNull(b) - } else { - b = append(b, '"') - b = appendUint(b, ptrToUint64(p), code) - b = append(b, '"') - } - b = appendStructEnd(ctx, code, b) - code = code.Next - case encoder.OpStructEndOmitEmptyUintPtrString: - p := load(ctxptr, code.Idx) - p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) - if p != 0 { - b = appendStructKey(ctx, code, b) - b = append(b, '"') - b = appendUint(b, ptrToUint64(p), code) - b = append(b, '"') - b = appendStructEnd(ctx, code, b) - } else { - b = appendStructEndSkipLast(ctx, code, b) - } - code = code.Next - case encoder.OpStructEndFloat32: - p := load(ctxptr, code.Idx) - b = appendStructKey(ctx, code, b) - b = appendFloat32(b, ptrToFloat32(p+uintptr(code.Offset))) - b = appendStructEnd(ctx, code, b) - code = code.Next - case encoder.OpStructEndOmitEmptyFloat32: - p := load(ctxptr, code.Idx) - v := ptrToFloat32(p + uintptr(code.Offset)) - if v != 0 { - b = appendStructKey(ctx, code, b) - b = appendFloat32(b, v) - b = appendStructEnd(ctx, code, b) - } else { - b = appendStructEndSkipLast(ctx, code, b) - } - code = code.Next - case encoder.OpStructEndFloat32String: - p := load(ctxptr, code.Idx) - b = appendStructKey(ctx, code, b) - b = append(b, '"') - b = appendFloat32(b, ptrToFloat32(p+uintptr(code.Offset))) - b = append(b, '"') - b = appendStructEnd(ctx, code, b) - code = code.Next - case encoder.OpStructEndOmitEmptyFloat32String: - p := load(ctxptr, code.Idx) - v := ptrToFloat32(p + uintptr(code.Offset)) - if v != 0 { - b = appendStructKey(ctx, code, b) - b = append(b, '"') - b = appendFloat32(b, v) - b = append(b, '"') - b = appendStructEnd(ctx, code, b) - } else { - b = appendStructEndSkipLast(ctx, code, b) - } - code = code.Next - case encoder.OpStructEndFloat32Ptr: - b = appendStructKey(ctx, code, b) - p := load(ctxptr, code.Idx) - p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) - if p == 0 { - b = appendNull(b) - } else { - b = appendFloat32(b, ptrToFloat32(p)) - } - b = appendStructEnd(ctx, code, b) - code = code.Next - case encoder.OpStructEndOmitEmptyFloat32Ptr: - p := load(ctxptr, code.Idx) - p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) - if p != 0 { - b = appendStructKey(ctx, code, b) - b = appendFloat32(b, ptrToFloat32(p)) - b = appendStructEnd(ctx, code, b) - } else { - b = appendStructEndSkipLast(ctx, code, b) - } - code = code.Next - case encoder.OpStructEndFloat32PtrString: - b = appendStructKey(ctx, code, b) - p := load(ctxptr, code.Idx) - p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) - if p == 0 { - b = appendNull(b) - } else { - b = append(b, '"') - b = appendFloat32(b, ptrToFloat32(p)) - b = append(b, '"') - } - b = appendStructEnd(ctx, code, b) - code = code.Next - case encoder.OpStructEndOmitEmptyFloat32PtrString: - p := load(ctxptr, code.Idx) - p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) - if p != 0 { - b = appendStructKey(ctx, code, b) - b = append(b, '"') - b = appendFloat32(b, ptrToFloat32(p)) - b = append(b, '"') - b = appendStructEnd(ctx, code, b) - } else { - b = appendStructEndSkipLast(ctx, code, b) - } - code = code.Next - case encoder.OpStructEndFloat64: - p := load(ctxptr, code.Idx) - v := ptrToFloat64(p + uintptr(code.Offset)) - if math.IsInf(v, 0) || math.IsNaN(v) { - return nil, errUnsupportedFloat(v) - } - b = appendStructKey(ctx, code, b) - b = appendFloat64(b, v) - b = appendStructEnd(ctx, code, b) - code = code.Next - case encoder.OpStructEndOmitEmptyFloat64: - p := load(ctxptr, code.Idx) - v := ptrToFloat64(p + uintptr(code.Offset)) - if v != 0 { - if math.IsInf(v, 0) || math.IsNaN(v) { - return nil, errUnsupportedFloat(v) - } - b = appendStructKey(ctx, code, b) - b = appendFloat64(b, v) - b = appendStructEnd(ctx, code, b) - } else { - b = appendStructEndSkipLast(ctx, code, b) - } - code = code.Next - case encoder.OpStructEndFloat64String: - p := load(ctxptr, code.Idx) - v := ptrToFloat64(p + uintptr(code.Offset)) - if math.IsInf(v, 0) || math.IsNaN(v) { - return nil, errUnsupportedFloat(v) - } - b = appendStructKey(ctx, code, b) - b = append(b, '"') - b = appendFloat64(b, v) - b = append(b, '"') - b = appendStructEnd(ctx, code, b) - code = code.Next - case encoder.OpStructEndOmitEmptyFloat64String: - p := load(ctxptr, code.Idx) - v := ptrToFloat64(p + uintptr(code.Offset)) - if v != 0 { - if math.IsInf(v, 0) || math.IsNaN(v) { - return nil, errUnsupportedFloat(v) - } - b = appendStructKey(ctx, code, b) - b = append(b, '"') - b = appendFloat64(b, v) - b = append(b, '"') - b = appendStructEnd(ctx, code, b) - } else { - b = appendStructEndSkipLast(ctx, code, b) - } - code = code.Next - case encoder.OpStructEndFloat64Ptr: - b = appendStructKey(ctx, code, b) - p := load(ctxptr, code.Idx) - p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) - if p == 0 { - b = appendNull(b) - b = appendStructEnd(ctx, code, b) - code = code.Next - break - } - v := ptrToFloat64(p) - if math.IsInf(v, 0) || math.IsNaN(v) { - return nil, errUnsupportedFloat(v) - } - b = appendFloat64(b, v) - b = appendStructEnd(ctx, code, b) - code = code.Next - case encoder.OpStructEndOmitEmptyFloat64Ptr: - p := load(ctxptr, code.Idx) - p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) - if p != 0 { - b = appendStructKey(ctx, code, b) - v := ptrToFloat64(p) - if math.IsInf(v, 0) || math.IsNaN(v) { - return nil, errUnsupportedFloat(v) - } - b = appendFloat64(b, v) - b = appendStructEnd(ctx, code, b) - } else { - b = appendStructEndSkipLast(ctx, code, b) - } - code = code.Next - case encoder.OpStructEndFloat64PtrString: - b = appendStructKey(ctx, code, b) - p := load(ctxptr, code.Idx) - p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) - if p == 0 { - b = appendNull(b) - } else { - b = append(b, '"') - v := ptrToFloat64(p) - if math.IsInf(v, 0) || math.IsNaN(v) { - return nil, errUnsupportedFloat(v) - } - b = appendFloat64(b, v) - b = append(b, '"') - } - b = appendStructEnd(ctx, code, b) - code = code.Next - case encoder.OpStructEndOmitEmptyFloat64PtrString: - p := load(ctxptr, code.Idx) - p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) - if p != 0 { - b = appendStructKey(ctx, code, b) - v := ptrToFloat64(p) - if math.IsInf(v, 0) || math.IsNaN(v) { - return nil, errUnsupportedFloat(v) - } - b = append(b, '"') - b = appendFloat64(b, v) - b = append(b, '"') - b = appendStructEnd(ctx, code, b) - } else { - b = appendStructEndSkipLast(ctx, code, b) - } - code = code.Next - case encoder.OpStructEndString: - p := load(ctxptr, code.Idx) - b = appendStructKey(ctx, code, b) - b = appendString(b, ptrToString(p+uintptr(code.Offset))) - b = appendStructEnd(ctx, code, b) - code = code.Next - case encoder.OpStructEndOmitEmptyString: - p := load(ctxptr, code.Idx) - v := ptrToString(p + uintptr(code.Offset)) - if v != "" { - b = appendStructKey(ctx, code, b) - b = appendString(b, v) - b = appendStructEnd(ctx, code, b) - } else { - b = appendStructEndSkipLast(ctx, code, b) - } - code = code.Next - case encoder.OpStructEndStringString: - p := load(ctxptr, code.Idx) - b = appendStructKey(ctx, code, b) - s := ptrToString(p + uintptr(code.Offset)) - b = appendString(b, string(appendString([]byte{}, s))) - b = appendStructEnd(ctx, code, b) - code = code.Next - case encoder.OpStructEndOmitEmptyStringString: - p := load(ctxptr, code.Idx) - v := ptrToString(p + uintptr(code.Offset)) - if v != "" { - b = appendStructKey(ctx, code, b) - b = appendString(b, string(appendString([]byte{}, v))) - b = appendStructEnd(ctx, code, b) - } else { - b = appendStructEndSkipLast(ctx, code, b) - } - code = code.Next - case encoder.OpStructEndStringPtr: - b = appendStructKey(ctx, code, b) - p := load(ctxptr, code.Idx) - p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) - if p == 0 { - b = appendNull(b) - } else { - b = appendString(b, ptrToString(p)) - } - b = appendStructEnd(ctx, code, b) - code = code.Next - case encoder.OpStructEndOmitEmptyStringPtr: - p := load(ctxptr, code.Idx) - p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) - if p != 0 { - b = appendStructKey(ctx, code, b) - b = appendString(b, ptrToString(p)) - b = appendStructEnd(ctx, code, b) - } else { - b = appendStructEndSkipLast(ctx, code, b) - } - code = code.Next - case encoder.OpStructEndStringPtrString: - b = appendStructKey(ctx, code, b) - p := load(ctxptr, code.Idx) - p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) - if p == 0 { - b = appendNull(b) - } else { - b = appendString(b, string(appendString([]byte{}, ptrToString(p)))) - } - b = appendStructEnd(ctx, code, b) - code = code.Next - case encoder.OpStructEndOmitEmptyStringPtrString: - p := load(ctxptr, code.Idx) - p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) - if p != 0 { - b = appendStructKey(ctx, code, b) - b = appendString(b, string(appendString([]byte{}, ptrToString(p)))) - b = appendStructEnd(ctx, code, b) - } else { - b = appendStructEndSkipLast(ctx, code, b) - } - code = code.Next - case encoder.OpStructEndBool: - p := load(ctxptr, code.Idx) - b = appendStructKey(ctx, code, b) - b = appendBool(b, ptrToBool(p+uintptr(code.Offset))) - b = appendStructEnd(ctx, code, b) - code = code.Next - case encoder.OpStructEndOmitEmptyBool: - p := load(ctxptr, code.Idx) - v := ptrToBool(p + uintptr(code.Offset)) - if v { - b = appendStructKey(ctx, code, b) - b = appendBool(b, v) - b = appendStructEnd(ctx, code, b) - } else { - b = appendStructEndSkipLast(ctx, code, b) - } - code = code.Next - case encoder.OpStructEndBoolString: - p := load(ctxptr, code.Idx) - b = appendStructKey(ctx, code, b) - b = append(b, '"') - b = appendBool(b, ptrToBool(p+uintptr(code.Offset))) - b = append(b, '"') - b = appendStructEnd(ctx, code, b) - code = code.Next - case encoder.OpStructEndOmitEmptyBoolString: - p := load(ctxptr, code.Idx) - v := ptrToBool(p + uintptr(code.Offset)) - if v { - b = appendStructKey(ctx, code, b) - b = append(b, '"') - b = appendBool(b, v) - b = append(b, '"') - b = appendStructEnd(ctx, code, b) - } else { - b = appendStructEndSkipLast(ctx, code, b) - } - code = code.Next - case encoder.OpStructEndBoolPtr: - b = appendStructKey(ctx, code, b) - p := load(ctxptr, code.Idx) - p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) - if p == 0 { - b = appendNull(b) - } else { - b = appendBool(b, ptrToBool(p)) - } - b = appendStructEnd(ctx, code, b) - code = code.Next - case encoder.OpStructEndOmitEmptyBoolPtr: - p := load(ctxptr, code.Idx) - p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) - if p != 0 { - b = appendStructKey(ctx, code, b) - b = appendBool(b, ptrToBool(p)) - b = appendStructEnd(ctx, code, b) - } else { - b = appendStructEndSkipLast(ctx, code, b) - } - code = code.Next - case encoder.OpStructEndBoolPtrString: - b = appendStructKey(ctx, code, b) - p := load(ctxptr, code.Idx) - p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) - if p == 0 { - b = appendNull(b) - } else { - b = append(b, '"') - b = appendBool(b, ptrToBool(p)) - b = append(b, '"') - } - b = appendStructEnd(ctx, code, b) - code = code.Next - case encoder.OpStructEndOmitEmptyBoolPtrString: - p := load(ctxptr, code.Idx) - p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) - if p != 0 { - b = appendStructKey(ctx, code, b) - b = append(b, '"') - b = appendBool(b, ptrToBool(p)) - b = append(b, '"') - b = appendStructEnd(ctx, code, b) - } else { - b = appendStructEndSkipLast(ctx, code, b) - } - code = code.Next - case encoder.OpStructEndBytes: - p := load(ctxptr, code.Idx) - b = appendStructKey(ctx, code, b) - b = appendByteSlice(b, ptrToBytes(p+uintptr(code.Offset))) - b = appendStructEnd(ctx, code, b) - code = code.Next - case encoder.OpStructEndOmitEmptyBytes: - p := load(ctxptr, code.Idx) - v := ptrToBytes(p + uintptr(code.Offset)) - if len(v) > 0 { - b = appendStructKey(ctx, code, b) - b = appendByteSlice(b, v) - b = appendStructEnd(ctx, code, b) - } else { - b = appendStructEndSkipLast(ctx, code, b) - } - code = code.Next - case encoder.OpStructEndBytesPtr: - b = appendStructKey(ctx, code, b) - p := load(ctxptr, code.Idx) - p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) - if p == 0 { - b = appendNull(b) - } else { - b = appendByteSlice(b, ptrToBytes(p)) - } - b = appendStructEnd(ctx, code, b) - code = code.Next - case encoder.OpStructEndOmitEmptyBytesPtr: - p := load(ctxptr, code.Idx) - p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) - if p != 0 { - b = appendStructKey(ctx, code, b) - b = appendByteSlice(b, ptrToBytes(p)) - b = appendStructEnd(ctx, code, b) - } else { - b = appendStructEndSkipLast(ctx, code, b) - } - code = code.Next - case encoder.OpStructEndNumber: - p := load(ctxptr, code.Idx) - b = appendStructKey(ctx, code, b) - bb, err := appendNumber(b, ptrToNumber(p+uintptr(code.Offset))) - if err != nil { - return nil, err - } - b = appendStructEnd(ctx, code, bb) - code = code.Next - case encoder.OpStructEndOmitEmptyNumber: - p := load(ctxptr, code.Idx) - v := ptrToNumber(p + uintptr(code.Offset)) - if v != "" { - b = appendStructKey(ctx, code, b) - bb, err := appendNumber(b, v) - if err != nil { - return nil, err - } - b = appendStructEnd(ctx, code, bb) - } else { - b = appendStructEndSkipLast(ctx, code, b) - } - code = code.Next - case encoder.OpStructEndNumberString: - p := load(ctxptr, code.Idx) - b = appendStructKey(ctx, code, b) - b = append(b, '"') - bb, err := appendNumber(b, ptrToNumber(p+uintptr(code.Offset))) - if err != nil { - return nil, err - } - b = append(bb, '"') - b = appendStructEnd(ctx, code, b) - code = code.Next - case encoder.OpStructEndOmitEmptyNumberString: - p := load(ctxptr, code.Idx) - v := ptrToNumber(p + uintptr(code.Offset)) - if v != "" { - b = appendStructKey(ctx, code, b) - b = append(b, '"') - bb, err := appendNumber(b, v) - if err != nil { - return nil, err - } - b = append(bb, '"') - b = appendStructEnd(ctx, code, b) - } else { - b = appendStructEndSkipLast(ctx, code, b) - } - code = code.Next - case encoder.OpStructEndNumberPtr: - b = appendStructKey(ctx, code, b) - p := load(ctxptr, code.Idx) - p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) - if p == 0 { - b = appendNull(b) - } else { - bb, err := appendNumber(b, ptrToNumber(p)) - if err != nil { - return nil, err - } - b = bb - } - b = appendStructEnd(ctx, code, b) - code = code.Next - case encoder.OpStructEndOmitEmptyNumberPtr: - p := load(ctxptr, code.Idx) - p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) - if p != 0 { - b = appendStructKey(ctx, code, b) - bb, err := appendNumber(b, ptrToNumber(p)) - if err != nil { - return nil, err - } - b = appendStructEnd(ctx, code, bb) - } else { - b = appendStructEndSkipLast(ctx, code, b) - } - code = code.Next - case encoder.OpStructEndNumberPtrString: - b = appendStructKey(ctx, code, b) - p := load(ctxptr, code.Idx) - p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) - if p == 0 { - b = appendNull(b) - } else { - b = append(b, '"') - bb, err := appendNumber(b, ptrToNumber(p)) - if err != nil { - return nil, err - } - b = append(bb, '"') - } - b = appendStructEnd(ctx, code, b) - code = code.Next - case encoder.OpStructEndOmitEmptyNumberPtrString: - p := load(ctxptr, code.Idx) - p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) - if p != 0 { - b = appendStructKey(ctx, code, b) - b = append(b, '"') - bb, err := appendNumber(b, ptrToNumber(p)) - if err != nil { - return nil, err - } - b = append(bb, '"') - b = appendStructEnd(ctx, code, b) - } else { - b = appendStructEndSkipLast(ctx, code, b) - } - code = code.Next - case encoder.OpEnd: - goto END - } - } -END: - return b, nil -} diff --git a/internal/encoder/vm_indent/debug_vm.go b/internal/encoder/vm_indent/debug_vm.go index 348d6ff..b3822f5 100644 --- a/internal/encoder/vm_indent/debug_vm.go +++ b/internal/encoder/vm_indent/debug_vm.go @@ -7,6 +7,13 @@ import ( ) func DebugRun(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]byte, error) { + var code *encoder.Opcode + if ctx.Option.HTMLEscape { + code = codeSet.EscapeKeyCode + } else { + code = codeSet.NoescapeKeyCode + } + defer func() { if err := recover(); err != nil { fmt.Println("=============[DEBUG]===============") @@ -14,7 +21,7 @@ func DebugRun(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) fmt.Println(codeSet.Type) fmt.Printf("\n") fmt.Println("* [ALL OPCODE]") - fmt.Println(ctx.Code.Dump()) + fmt.Println(code.Dump()) fmt.Printf("\n") fmt.Println("* [CONTEXT]") fmt.Printf("%+v\n", ctx) diff --git a/internal/encoder/vm_indent/hack.go b/internal/encoder/vm_indent/hack.go index 789ade8..bddd9e3 100644 --- a/internal/encoder/vm_indent/hack.go +++ b/internal/encoder/vm_indent/hack.go @@ -1,9 +1,6 @@ package vm_indent -import ( - // HACK: compile order - // `vm`, `vm_escaped`, `vm_indent`, `vm_escaped_indent` packages uses a lot of memory to compile, - // so forcibly make dependencies and avoid compiling in concurrent. - // dependency order: vm => vm_escaped => vm_indent => vm_escaped_indent - _ "github.com/goccy/go-json/internal/encoder/vm_escaped_indent" -) +// HACK: compile order +// `vm`, `vm_indent` packages uses a lot of memory to compile, +// so forcibly make dependencies and avoid compiling in concurrent. +// dependency order: vm => vm_indent diff --git a/internal/encoder/vm_indent/util.go b/internal/encoder/vm_indent/util.go index 799f99c..2e057aa 100644 --- a/internal/encoder/vm_indent/util.go +++ b/internal/encoder/vm_indent/util.go @@ -92,22 +92,22 @@ func ptrToInterface(code *encoder.Opcode, p uintptr) interface{} { })) } -func appendBool(b []byte, v bool) []byte { +func appendBool(_ *encoder.RuntimeContext, b []byte, v bool) []byte { if v { return append(b, "true"...) } return append(b, "false"...) } -func appendNull(b []byte) []byte { +func appendNull(_ *encoder.RuntimeContext, b []byte) []byte { return append(b, "null"...) } -func appendComma(b []byte) []byte { +func appendComma(_ *encoder.RuntimeContext, b []byte) []byte { return append(b, ',', '\n') } -func appendColon(b []byte) []byte { +func appendColon(_ *encoder.RuntimeContext, b []byte) []byte { return append(b, ':', ' ') } @@ -137,7 +137,6 @@ func appendInterface(ctx *encoder.RuntimeContext, codeSet *encoder.OpcodeSet, co oldBaseIndent := ctx.BaseIndent ctx.BaseIndent = code.Indent - ctx.Code = ifaceCodeSet.NoescapeKeyCode bb, err := Run(ctx, b, ifaceCodeSet) if err != nil { return nil, err @@ -176,11 +175,11 @@ func appendArrayEnd(ctx *encoder.RuntimeContext, code *encoder.Opcode, b []byte) return append(b, ']', ',', '\n') } -func appendEmptyArray(b []byte) []byte { +func appendEmptyArray(_ *encoder.RuntimeContext, b []byte) []byte { return append(b, '[', ']', ',', '\n') } -func appendEmptyObject(b []byte) []byte { +func appendEmptyObject(_ *encoder.RuntimeContext, b []byte) []byte { return append(b, '{', '}', ',', '\n') } @@ -192,14 +191,14 @@ func appendObjectEnd(ctx *encoder.RuntimeContext, code *encoder.Opcode, b []byte } func appendMarshalJSON(ctx *encoder.RuntimeContext, code *encoder.Opcode, b []byte, v interface{}) ([]byte, error) { - return encoder.AppendMarshalJSONIndent(ctx, code, b, v, false) + return encoder.AppendMarshalJSONIndent(ctx, code, b, v) } -func appendMarshalText(code *encoder.Opcode, b []byte, v interface{}) ([]byte, error) { - return encoder.AppendMarshalTextIndent(code, b, v, false) +func appendMarshalText(ctx *encoder.RuntimeContext, code *encoder.Opcode, b []byte, v interface{}) ([]byte, error) { + return encoder.AppendMarshalTextIndent(ctx, code, b, v) } -func appendStructHead(b []byte) []byte { +func appendStructHead(_ *encoder.RuntimeContext, b []byte) []byte { return append(b, '{', '\n') } @@ -222,7 +221,7 @@ func appendStructEndSkipLast(ctx *encoder.RuntimeContext, code *encoder.Opcode, b = appendIndent(ctx, b, code.Indent-1) b = append(b, '}') } - return appendComma(b) + return appendComma(ctx, b) } func restoreIndent(ctx *encoder.RuntimeContext, code *encoder.Opcode, ctxptr uintptr) { diff --git a/internal/encoder/vm_indent/vm.go b/internal/encoder/vm_indent/vm.go index 9223c45..b9cd1d2 100644 --- a/internal/encoder/vm_indent/vm.go +++ b/internal/encoder/vm_indent/vm.go @@ -13,7 +13,12 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b recursiveLevel := 0 ptrOffset := uintptr(0) ctxptr := ctx.Ptr() - code := ctx.Code + var code *encoder.Opcode + if ctx.Option.HTMLEscape { + code = codeSet.EscapeKeyCode + } else { + code = codeSet.NoescapeKeyCode + } for { switch code.Op { @@ -26,8 +31,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b case encoder.OpIntPtr: p := loadNPtr(ctxptr, code.Idx, code.PtrNum) if p == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) code = code.Next break } @@ -35,13 +40,13 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b fallthrough case encoder.OpInt: b = appendInt(b, ptrToUint64(load(ctxptr, code.Idx)), code) - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpUintPtr: p := loadNPtr(ctxptr, code.Idx, code.PtrNum) if p == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) code = code.Next break } @@ -49,39 +54,39 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b fallthrough case encoder.OpUint: b = appendUint(b, ptrToUint64(load(ctxptr, code.Idx)), code) - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpIntString: b = append(b, '"') b = appendInt(b, ptrToUint64(load(ctxptr, code.Idx)), code) b = append(b, '"') - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpUintString: b = append(b, '"') b = appendUint(b, ptrToUint64(load(ctxptr, code.Idx)), code) b = append(b, '"') - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpFloat32Ptr: p := loadNPtr(ctxptr, code.Idx, code.PtrNum) if p == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) code = code.Next break } store(ctxptr, code.Idx, p) fallthrough case encoder.OpFloat32: - b = appendFloat32(b, ptrToFloat32(load(ctxptr, code.Idx))) - b = appendComma(b) + b = appendFloat32(ctx, b, ptrToFloat32(load(ctxptr, code.Idx))) + b = appendComma(ctx, b) code = code.Next case encoder.OpFloat64Ptr: p := loadNPtr(ctxptr, code.Idx, code.PtrNum) if p == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) code = code.Next break } @@ -92,73 +97,73 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b if math.IsInf(v, 0) || math.IsNaN(v) { return nil, errUnsupportedFloat(v) } - b = appendFloat64(b, v) - b = appendComma(b) + b = appendFloat64(ctx, b, v) + b = appendComma(ctx, b) code = code.Next case encoder.OpStringPtr: p := loadNPtr(ctxptr, code.Idx, code.PtrNum) if p == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) code = code.Next break } store(ctxptr, code.Idx, p) fallthrough case encoder.OpString: - b = appendString(b, ptrToString(load(ctxptr, code.Idx))) - b = appendComma(b) + b = appendString(ctx, b, ptrToString(load(ctxptr, code.Idx))) + b = appendComma(ctx, b) code = code.Next case encoder.OpBoolPtr: p := loadNPtr(ctxptr, code.Idx, code.PtrNum) if p == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) code = code.Next break } store(ctxptr, code.Idx, p) fallthrough case encoder.OpBool: - b = appendBool(b, ptrToBool(load(ctxptr, code.Idx))) - b = appendComma(b) + b = appendBool(ctx, b, ptrToBool(load(ctxptr, code.Idx))) + b = appendComma(ctx, b) code = code.Next case encoder.OpBytesPtr: p := loadNPtr(ctxptr, code.Idx, code.PtrNum) if p == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) code = code.Next break } store(ctxptr, code.Idx, p) fallthrough case encoder.OpBytes: - b = appendByteSlice(b, ptrToBytes(load(ctxptr, code.Idx))) - b = appendComma(b) + b = appendByteSlice(ctx, b, ptrToBytes(load(ctxptr, code.Idx))) + b = appendComma(ctx, b) code = code.Next case encoder.OpNumberPtr: p := loadNPtr(ctxptr, code.Idx, code.PtrNum) if p == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) code = code.Next break } store(ctxptr, code.Idx, p) fallthrough case encoder.OpNumber: - bb, err := appendNumber(b, ptrToNumber(load(ctxptr, code.Idx))) + bb, err := appendNumber(ctx, b, ptrToNumber(load(ctxptr, code.Idx))) if err != nil { return nil, err } - b = appendComma(bb) + b = appendComma(ctx, bb) code = code.Next case encoder.OpInterfacePtr: p := loadNPtr(ctxptr, code.Idx, code.PtrNum) if p == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) code = code.Next break } @@ -167,8 +172,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b case encoder.OpInterface: p := load(ctxptr, code.Idx) if p == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) code = code.Next break } @@ -180,8 +185,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b ctx.SeenPtr = append(ctx.SeenPtr, p) iface := (*emptyInterface)(ptrToUnsafePtr(p)) if iface.ptr == nil { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) code = code.Next break } @@ -197,8 +202,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b case encoder.OpMarshalJSONPtr: p := load(ctxptr, code.Idx) if p == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) code = code.Next break } @@ -207,8 +212,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b case encoder.OpMarshalJSON: p := load(ctxptr, code.Idx) if p == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) code = code.Next break } @@ -219,13 +224,13 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b if err != nil { return nil, err } - b = appendComma(bb) + b = appendComma(ctx, bb) code = code.Next case encoder.OpMarshalTextPtr: p := load(ctxptr, code.Idx) if p == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) code = code.Next break } @@ -235,24 +240,24 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 { b = append(b, `""`...) - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next break } if (code.Flags&encoder.IsNilableTypeFlags) != 0 && (code.Flags&encoder.IndirectFlags) != 0 { p = ptrToPtr(p) } - bb, err := appendMarshalText(code, b, ptrToInterface(code, p)) + bb, err := appendMarshalText(ctx, code, b, ptrToInterface(code, p)) if err != nil { return nil, err } - b = appendComma(bb) + b = appendComma(ctx, bb) code = code.Next case encoder.OpSlicePtr: p := loadNPtr(ctxptr, code.Idx, code.PtrNum) if p == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) code = code.End.Next break } @@ -262,8 +267,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) slice := ptrToSlice(p) if p == 0 || slice.Data == nil { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) code = code.End.Next break } @@ -275,7 +280,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b code = code.Next store(ctxptr, code.Idx, uintptr(slice.Data)) } else { - b = appendEmptyArray(b) + b = appendEmptyArray(ctx, b) code = code.End.Next } case encoder.OpSliceElem: @@ -296,8 +301,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b case encoder.OpArrayPtr: p := loadNPtr(ctxptr, code.Idx, code.PtrNum) if p == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) code = code.End.Next break } @@ -306,8 +311,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b case encoder.OpArray: p := load(ctxptr, code.Idx) if p == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) code = code.End.Next break } @@ -317,7 +322,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b code = code.Next store(ctxptr, code.Idx, p) } else { - b = appendEmptyArray(b) + b = appendEmptyArray(ctx, b) code = code.End.Next } case encoder.OpArrayElem: @@ -337,8 +342,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b case encoder.OpMapPtr: p := loadNPtr(ctxptr, code.Idx, code.PtrNum) if p == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) code = code.End.Next break } @@ -347,19 +352,19 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b case encoder.OpMap: p := load(ctxptr, code.Idx) if p == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) code = code.End.Next break } uptr := ptrToUnsafePtr(p) mlen := maplen(uptr) if mlen <= 0 { - b = appendEmptyObject(b) + b = appendEmptyObject(ctx, b) code = code.End.Next break } - b = appendStructHead(b) + b = appendStructHead(ctx, b) iter := mapiterinit(code.Type, uptr) ctx.KeepRefs = append(ctx.KeepRefs, iter) store(ctxptr, code.ElemIdx, 0) @@ -410,7 +415,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b } case encoder.OpMapValue: if ctx.Option.UnorderedMap { - b = appendColon(b) + b = appendColon(ctx, b) } else { ptr := load(ctxptr, code.End.MapPos) mapCtx := (*encoder.MapContext)(ptrToUnsafePtr(ptr)) @@ -509,8 +514,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -521,14 +526,14 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 && ((code.Flags&encoder.IndirectFlags) != 0 || code.Next.Op == encoder.OpStructEnd) { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) + b = appendStructHead(ctx, b) } if (code.Flags&encoder.AnonymousKeyFlags) == 0 && len(code.Key) > 0 { b = appendStructKey(ctx, code, b) @@ -540,8 +545,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -552,14 +557,14 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 && ((code.Flags&encoder.IndirectFlags) != 0 || code.Next.Op == encoder.OpStructEnd) { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) + b = appendStructHead(ctx, b) } p += uintptr(code.Offset) if p == 0 || (ptrToPtr(p) == 0 && (code.Flags&encoder.IsNextOpPtrTypeFlags) != 0) { @@ -574,8 +579,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -587,26 +592,26 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) + b = appendStructHead(ctx, b) } b = appendStructKey(ctx, code, b) b = appendInt(b, ptrToUint64(p+uintptr(code.Offset)), code) - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructPtrHeadOmitEmptyInt: if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -618,14 +623,14 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) + b = appendStructHead(ctx, b) } u64 := ptrToUint64(p + uintptr(code.Offset)) v := u64 & ((1 << code.NumBitSize) - 1) @@ -634,7 +639,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b } else { b = appendStructKey(ctx, code, b) b = appendInt(b, u64, code) - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next } case encoder.OpStructPtrHeadIntString: @@ -642,8 +647,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -655,28 +660,28 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) + b = appendStructHead(ctx, b) } b = appendStructKey(ctx, code, b) b = append(b, '"') b = appendInt(b, ptrToUint64(p+uintptr(code.Offset)), code) b = append(b, '"') - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructPtrHeadOmitEmptyIntString: if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -688,14 +693,14 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) + b = appendStructHead(ctx, b) } u64 := ptrToUint64(p + uintptr(code.Offset)) v := u64 & ((1 << code.NumBitSize) - 1) @@ -706,15 +711,15 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b b = append(b, '"') b = appendInt(b, u64, code) b = append(b, '"') - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next } case encoder.OpStructPtrHeadIntPtr: p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -725,32 +730,32 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) + b = appendStructHead(ctx, b) } b = appendStructKey(ctx, code, b) if (code.Flags & encoder.IndirectFlags) != 0 { p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p == 0 { - b = appendNull(b) + b = appendNull(ctx, b) } else { b = appendInt(b, ptrToUint64(p), code) } - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructPtrHeadOmitEmptyIntPtr: p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -761,14 +766,14 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) + b = appendStructHead(ctx, b) } if (code.Flags & encoder.IndirectFlags) != 0 { p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) @@ -776,15 +781,15 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b if p != 0 { b = appendStructKey(ctx, code, b) b = appendInt(b, ptrToUint64(p), code) - b = appendComma(b) + b = appendComma(ctx, b) } code = code.Next case encoder.OpStructPtrHeadIntPtrString: p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -795,34 +800,34 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) + b = appendStructHead(ctx, b) } b = appendStructKey(ctx, code, b) if (code.Flags & encoder.IndirectFlags) != 0 { p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p == 0 { - b = appendNull(b) + b = appendNull(ctx, b) } else { b = append(b, '"') b = appendInt(b, ptrToUint64(p), code) b = append(b, '"') } - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructPtrHeadOmitEmptyIntPtrString: p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -833,14 +838,14 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) + b = appendStructHead(ctx, b) } if (code.Flags & encoder.IndirectFlags) != 0 { p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) @@ -850,7 +855,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b b = append(b, '"') b = appendInt(b, ptrToUint64(p), code) b = append(b, '"') - b = appendComma(b) + b = appendComma(ctx, b) } code = code.Next case encoder.OpStructPtrHeadUint: @@ -858,8 +863,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -871,26 +876,26 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) + b = appendStructHead(ctx, b) } b = appendStructKey(ctx, code, b) b = appendUint(b, ptrToUint64(p+uintptr(code.Offset)), code) - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructPtrHeadOmitEmptyUint: if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -902,14 +907,14 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) + b = appendStructHead(ctx, b) } u64 := ptrToUint64(p + uintptr(code.Offset)) v := u64 & ((1 << code.NumBitSize) - 1) @@ -918,7 +923,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b } else { b = appendStructKey(ctx, code, b) b = appendUint(b, u64, code) - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next } case encoder.OpStructPtrHeadUintString: @@ -926,8 +931,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -939,28 +944,28 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) + b = appendStructHead(ctx, b) } b = appendStructKey(ctx, code, b) b = append(b, '"') b = appendUint(b, ptrToUint64(p+uintptr(code.Offset)), code) b = append(b, '"') - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructPtrHeadOmitEmptyUintString: if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -972,14 +977,14 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) + b = appendStructHead(ctx, b) } u64 := ptrToUint64(p + uintptr(code.Offset)) v := u64 & ((1 << code.NumBitSize) - 1) @@ -990,15 +995,15 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b b = append(b, '"') b = appendUint(b, u64, code) b = append(b, '"') - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next } case encoder.OpStructPtrHeadUintPtr: p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -1009,32 +1014,32 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) + b = appendStructHead(ctx, b) } b = appendStructKey(ctx, code, b) if (code.Flags & encoder.IndirectFlags) != 0 { p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p == 0 { - b = appendNull(b) + b = appendNull(ctx, b) } else { b = appendUint(b, ptrToUint64(p), code) } - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructPtrHeadOmitEmptyUintPtr: p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -1045,14 +1050,14 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) + b = appendStructHead(ctx, b) } if (code.Flags & encoder.IndirectFlags) != 0 { p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) @@ -1060,15 +1065,15 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b if p != 0 { b = appendStructKey(ctx, code, b) b = appendUint(b, ptrToUint64(p), code) - b = appendComma(b) + b = appendComma(ctx, b) } code = code.Next case encoder.OpStructPtrHeadUintPtrString: p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -1079,34 +1084,34 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) + b = appendStructHead(ctx, b) } b = appendStructKey(ctx, code, b) if (code.Flags & encoder.IndirectFlags) != 0 { p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p == 0 { - b = appendNull(b) + b = appendNull(ctx, b) } else { b = append(b, '"') b = appendUint(b, ptrToUint64(p), code) b = append(b, '"') } - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructPtrHeadOmitEmptyUintPtrString: p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -1117,14 +1122,14 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) + b = appendStructHead(ctx, b) } if (code.Flags & encoder.IndirectFlags) != 0 { p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) @@ -1134,7 +1139,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b b = append(b, '"') b = appendUint(b, ptrToUint64(p), code) b = append(b, '"') - b = appendComma(b) + b = appendComma(ctx, b) } code = code.Next case encoder.OpStructPtrHeadFloat32: @@ -1142,8 +1147,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -1155,26 +1160,26 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) + b = appendStructHead(ctx, b) } b = appendStructKey(ctx, code, b) - b = appendFloat32(b, ptrToFloat32(p+uintptr(code.Offset))) - b = appendComma(b) + b = appendFloat32(ctx, b, ptrToFloat32(p+uintptr(code.Offset))) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructPtrHeadOmitEmptyFloat32: if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -1186,22 +1191,22 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) + b = appendStructHead(ctx, b) } v := ptrToFloat32(p + uintptr(code.Offset)) if v == 0 { code = code.NextField } else { b = appendStructKey(ctx, code, b) - b = appendFloat32(b, v) - b = appendComma(b) + b = appendFloat32(ctx, b, v) + b = appendComma(ctx, b) code = code.Next } case encoder.OpStructPtrHeadFloat32String: @@ -1209,8 +1214,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -1222,28 +1227,28 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) + b = appendStructHead(ctx, b) } b = appendStructKey(ctx, code, b) b = append(b, '"') - b = appendFloat32(b, ptrToFloat32(p+uintptr(code.Offset))) + b = appendFloat32(ctx, b, ptrToFloat32(p+uintptr(code.Offset))) b = append(b, '"') - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructPtrHeadOmitEmptyFloat32String: if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -1255,14 +1260,14 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) + b = appendStructHead(ctx, b) } v := ptrToFloat32(p + uintptr(code.Offset)) if v == 0 { @@ -1270,17 +1275,17 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b } else { b = appendStructKey(ctx, code, b) b = append(b, '"') - b = appendFloat32(b, v) + b = appendFloat32(ctx, b, v) b = append(b, '"') - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next } case encoder.OpStructPtrHeadFloat32Ptr: p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -1291,32 +1296,32 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) + b = appendStructHead(ctx, b) } b = appendStructKey(ctx, code, b) if (code.Flags & encoder.IndirectFlags) != 0 { p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p == 0 { - b = appendNull(b) + b = appendNull(ctx, b) } else { - b = appendFloat32(b, ptrToFloat32(p)) + b = appendFloat32(ctx, b, ptrToFloat32(p)) } - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructPtrHeadOmitEmptyFloat32Ptr: p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -1327,30 +1332,30 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) + b = appendStructHead(ctx, b) } if (code.Flags & encoder.IndirectFlags) != 0 { p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p != 0 { b = appendStructKey(ctx, code, b) - b = appendFloat32(b, ptrToFloat32(p)) - b = appendComma(b) + b = appendFloat32(ctx, b, ptrToFloat32(p)) + b = appendComma(ctx, b) } code = code.Next case encoder.OpStructPtrHeadFloat32PtrString: p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -1361,34 +1366,34 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) + b = appendStructHead(ctx, b) } b = appendStructKey(ctx, code, b) if (code.Flags & encoder.IndirectFlags) != 0 { p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p == 0 { - b = appendNull(b) + b = appendNull(ctx, b) } else { b = append(b, '"') - b = appendFloat32(b, ptrToFloat32(p)) + b = appendFloat32(ctx, b, ptrToFloat32(p)) b = append(b, '"') } - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructPtrHeadOmitEmptyFloat32PtrString: p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -1399,14 +1404,14 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) + b = appendStructHead(ctx, b) } if (code.Flags & encoder.IndirectFlags) != 0 { p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) @@ -1414,9 +1419,9 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b if p != 0 { b = appendStructKey(ctx, code, b) b = append(b, '"') - b = appendFloat32(b, ptrToFloat32(p)) + b = appendFloat32(ctx, b, ptrToFloat32(p)) b = append(b, '"') - b = appendComma(b) + b = appendComma(ctx, b) } code = code.Next case encoder.OpStructPtrHeadFloat64: @@ -1424,8 +1429,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -1437,8 +1442,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -1448,19 +1453,19 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b return nil, errUnsupportedFloat(v) } if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) + b = appendStructHead(ctx, b) } b = appendStructKey(ctx, code, b) - b = appendFloat64(b, v) - b = appendComma(b) + b = appendFloat64(ctx, b, v) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructPtrHeadOmitEmptyFloat64: if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -1472,14 +1477,14 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) + b = appendStructHead(ctx, b) } v := ptrToFloat64(p + uintptr(code.Offset)) if v == 0 { @@ -1489,8 +1494,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b return nil, errUnsupportedFloat(v) } b = appendStructKey(ctx, code, b) - b = appendFloat64(b, v) - b = appendComma(b) + b = appendFloat64(ctx, b, v) + b = appendComma(ctx, b) code = code.Next } case encoder.OpStructPtrHeadFloat64String: @@ -1498,8 +1503,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -1511,14 +1516,14 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) + b = appendStructHead(ctx, b) } v := ptrToFloat64(p + uintptr(code.Offset)) if math.IsInf(v, 0) || math.IsNaN(v) { @@ -1526,17 +1531,17 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b } b = appendStructKey(ctx, code, b) b = append(b, '"') - b = appendFloat64(b, v) + b = appendFloat64(ctx, b, v) b = append(b, '"') - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructPtrHeadOmitEmptyFloat64String: if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -1548,14 +1553,14 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) + b = appendStructHead(ctx, b) } v := ptrToFloat64(p + uintptr(code.Offset)) if v == 0 { @@ -1566,17 +1571,17 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b } b = appendStructKey(ctx, code, b) b = append(b, '"') - b = appendFloat64(b, v) + b = appendFloat64(ctx, b, v) b = append(b, '"') - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next } case encoder.OpStructPtrHeadFloat64Ptr: p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -1587,36 +1592,36 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) + b = appendStructHead(ctx, b) } b = appendStructKey(ctx, code, b) if (code.Flags & encoder.IndirectFlags) != 0 { p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p == 0 { - b = appendNull(b) + b = appendNull(ctx, b) } else { v := ptrToFloat64(p) if math.IsInf(v, 0) || math.IsNaN(v) { return nil, errUnsupportedFloat(v) } - b = appendFloat64(b, v) + b = appendFloat64(ctx, b, v) } - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructPtrHeadOmitEmptyFloat64Ptr: p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -1627,14 +1632,14 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) + b = appendStructHead(ctx, b) } if (code.Flags & encoder.IndirectFlags) != 0 { p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) @@ -1645,16 +1650,16 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b if math.IsInf(v, 0) || math.IsNaN(v) { return nil, errUnsupportedFloat(v) } - b = appendFloat64(b, v) - b = appendComma(b) + b = appendFloat64(ctx, b, v) + b = appendComma(ctx, b) } code = code.Next case encoder.OpStructPtrHeadFloat64PtrString: p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -1665,38 +1670,38 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) + b = appendStructHead(ctx, b) } b = appendStructKey(ctx, code, b) if (code.Flags & encoder.IndirectFlags) != 0 { p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p == 0 { - b = appendNull(b) + b = appendNull(ctx, b) } else { b = append(b, '"') v := ptrToFloat64(p) if math.IsInf(v, 0) || math.IsNaN(v) { return nil, errUnsupportedFloat(v) } - b = appendFloat64(b, v) + b = appendFloat64(ctx, b, v) b = append(b, '"') } - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructPtrHeadOmitEmptyFloat64PtrString: p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -1707,14 +1712,14 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) + b = appendStructHead(ctx, b) } if (code.Flags & encoder.IndirectFlags) != 0 { p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) @@ -1726,9 +1731,9 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b if math.IsInf(v, 0) || math.IsNaN(v) { return nil, errUnsupportedFloat(v) } - b = appendFloat64(b, v) + b = appendFloat64(ctx, b, v) b = append(b, '"') - b = appendComma(b) + b = appendComma(ctx, b) } code = code.Next case encoder.OpStructPtrHeadString: @@ -1736,8 +1741,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -1749,26 +1754,26 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) + b = appendStructHead(ctx, b) } b = appendStructKey(ctx, code, b) - b = appendString(b, ptrToString(p+uintptr(code.Offset))) - b = appendComma(b) + b = appendString(ctx, b, ptrToString(p+uintptr(code.Offset))) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructPtrHeadOmitEmptyString: if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -1780,22 +1785,22 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) + b = appendStructHead(ctx, b) } v := ptrToString(p + uintptr(code.Offset)) if v == "" { code = code.NextField } else { b = appendStructKey(ctx, code, b) - b = appendString(b, v) - b = appendComma(b) + b = appendString(ctx, b, v) + b = appendComma(ctx, b) code = code.Next } case encoder.OpStructPtrHeadStringString: @@ -1803,8 +1808,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -1816,26 +1821,26 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) + b = appendStructHead(ctx, b) } b = appendStructKey(ctx, code, b) - b = appendString(b, string(appendString([]byte{}, ptrToString(p+uintptr(code.Offset))))) - b = appendComma(b) + b = appendString(ctx, b, string(appendString(ctx, []byte{}, ptrToString(p+uintptr(code.Offset))))) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructPtrHeadOmitEmptyStringString: if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -1847,30 +1852,30 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) + b = appendStructHead(ctx, b) } v := ptrToString(p + uintptr(code.Offset)) if v == "" { code = code.NextField } else { b = appendStructKey(ctx, code, b) - b = appendString(b, string(appendString([]byte{}, v))) - b = appendComma(b) + b = appendString(ctx, b, string(appendString(ctx, []byte{}, v))) + b = appendComma(ctx, b) code = code.Next } case encoder.OpStructPtrHeadStringPtr: p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -1881,32 +1886,32 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) + b = appendStructHead(ctx, b) } b = appendStructKey(ctx, code, b) if (code.Flags & encoder.IndirectFlags) != 0 { p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p == 0 { - b = appendNull(b) + b = appendNull(ctx, b) } else { - b = appendString(b, ptrToString(p)) + b = appendString(ctx, b, ptrToString(p)) } - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructPtrHeadOmitEmptyStringPtr: p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -1917,30 +1922,30 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) + b = appendStructHead(ctx, b) } if (code.Flags & encoder.IndirectFlags) != 0 { p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p != 0 { b = appendStructKey(ctx, code, b) - b = appendString(b, ptrToString(p)) - b = appendComma(b) + b = appendString(ctx, b, ptrToString(p)) + b = appendComma(ctx, b) } code = code.Next case encoder.OpStructPtrHeadStringPtrString: p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -1951,32 +1956,32 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) + b = appendStructHead(ctx, b) } b = appendStructKey(ctx, code, b) if (code.Flags & encoder.IndirectFlags) != 0 { p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p == 0 { - b = appendNull(b) + b = appendNull(ctx, b) } else { - b = appendString(b, string(appendString([]byte{}, ptrToString(p)))) + b = appendString(ctx, b, string(appendString(ctx, []byte{}, ptrToString(p)))) } - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructPtrHeadOmitEmptyStringPtrString: p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -1987,22 +1992,22 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) + b = appendStructHead(ctx, b) } if (code.Flags & encoder.IndirectFlags) != 0 { p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p != 0 { b = appendStructKey(ctx, code, b) - b = appendString(b, string(appendString([]byte{}, ptrToString(p)))) - b = appendComma(b) + b = appendString(ctx, b, string(appendString(ctx, []byte{}, ptrToString(p)))) + b = appendComma(ctx, b) } code = code.Next case encoder.OpStructPtrHeadBool: @@ -2010,8 +2015,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -2023,26 +2028,26 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) + b = appendStructHead(ctx, b) } b = appendStructKey(ctx, code, b) - b = appendBool(b, ptrToBool(p+uintptr(code.Offset))) - b = appendComma(b) + b = appendBool(ctx, b, ptrToBool(p+uintptr(code.Offset))) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructPtrHeadOmitEmptyBool: if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -2054,20 +2059,20 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) + b = appendStructHead(ctx, b) } v := ptrToBool(p + uintptr(code.Offset)) if v { b = appendStructKey(ctx, code, b) - b = appendBool(b, v) - b = appendComma(b) + b = appendBool(ctx, b, v) + b = appendComma(ctx, b) code = code.Next } else { code = code.NextField @@ -2077,8 +2082,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -2090,28 +2095,28 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) + b = appendStructHead(ctx, b) } b = appendStructKey(ctx, code, b) b = append(b, '"') - b = appendBool(b, ptrToBool(p+uintptr(code.Offset))) + b = appendBool(ctx, b, ptrToBool(p+uintptr(code.Offset))) b = append(b, '"') - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructPtrHeadOmitEmptyBoolString: if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -2123,22 +2128,22 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) + b = appendStructHead(ctx, b) } v := ptrToBool(p + uintptr(code.Offset)) if v { b = appendStructKey(ctx, code, b) b = append(b, '"') - b = appendBool(b, v) + b = appendBool(ctx, b, v) b = append(b, '"') - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next } else { code = code.NextField @@ -2147,8 +2152,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -2159,32 +2164,32 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) + b = appendStructHead(ctx, b) } b = appendStructKey(ctx, code, b) if (code.Flags & encoder.IndirectFlags) != 0 { p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p == 0 { - b = appendNull(b) + b = appendNull(ctx, b) } else { - b = appendBool(b, ptrToBool(p)) + b = appendBool(ctx, b, ptrToBool(p)) } - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructPtrHeadOmitEmptyBoolPtr: p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -2195,30 +2200,30 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) + b = appendStructHead(ctx, b) } if (code.Flags & encoder.IndirectFlags) != 0 { p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p != 0 { b = appendStructKey(ctx, code, b) - b = appendBool(b, ptrToBool(p)) - b = appendComma(b) + b = appendBool(ctx, b, ptrToBool(p)) + b = appendComma(ctx, b) } code = code.Next case encoder.OpStructPtrHeadBoolPtrString: p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -2229,34 +2234,34 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) + b = appendStructHead(ctx, b) } b = appendStructKey(ctx, code, b) if (code.Flags & encoder.IndirectFlags) != 0 { p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p == 0 { - b = appendNull(b) + b = appendNull(ctx, b) } else { b = append(b, '"') - b = appendBool(b, ptrToBool(p)) + b = appendBool(ctx, b, ptrToBool(p)) b = append(b, '"') } - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructPtrHeadOmitEmptyBoolPtrString: p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -2267,14 +2272,14 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) + b = appendStructHead(ctx, b) } if (code.Flags & encoder.IndirectFlags) != 0 { p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) @@ -2282,9 +2287,9 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b if p != 0 { b = appendStructKey(ctx, code, b) b = append(b, '"') - b = appendBool(b, ptrToBool(p)) + b = appendBool(ctx, b, ptrToBool(p)) b = append(b, '"') - b = appendComma(b) + b = appendComma(ctx, b) } code = code.Next case encoder.OpStructPtrHeadBytes: @@ -2292,8 +2297,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -2305,26 +2310,26 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) + b = appendStructHead(ctx, b) } b = appendStructKey(ctx, code, b) - b = appendByteSlice(b, ptrToBytes(p+uintptr(code.Offset))) - b = appendComma(b) + b = appendByteSlice(ctx, b, ptrToBytes(p+uintptr(code.Offset))) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructPtrHeadOmitEmptyBytes: if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -2336,30 +2341,30 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) + b = appendStructHead(ctx, b) } v := ptrToBytes(p + uintptr(code.Offset)) if len(v) == 0 { code = code.NextField } else { b = appendStructKey(ctx, code, b) - b = appendByteSlice(b, v) - b = appendComma(b) + b = appendByteSlice(ctx, b, v) + b = appendComma(ctx, b) code = code.Next } case encoder.OpStructPtrHeadBytesPtr: p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -2370,32 +2375,32 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) + b = appendStructHead(ctx, b) } b = appendStructKey(ctx, code, b) if (code.Flags & encoder.IndirectFlags) != 0 { p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p == 0 { - b = appendNull(b) + b = appendNull(ctx, b) } else { - b = appendByteSlice(b, ptrToBytes(p)) + b = appendByteSlice(ctx, b, ptrToBytes(p)) } - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructPtrHeadOmitEmptyBytesPtr: p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -2406,22 +2411,22 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) + b = appendStructHead(ctx, b) } if (code.Flags & encoder.IndirectFlags) != 0 { p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p != 0 { b = appendStructKey(ctx, code, b) - b = appendByteSlice(b, ptrToBytes(p)) - b = appendComma(b) + b = appendByteSlice(ctx, b, ptrToBytes(p)) + b = appendComma(ctx, b) } code = code.Next case encoder.OpStructPtrHeadNumber: @@ -2429,8 +2434,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -2442,29 +2447,29 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) + b = appendStructHead(ctx, b) } b = appendStructKey(ctx, code, b) - bb, err := appendNumber(b, ptrToNumber(p+uintptr(code.Offset))) + bb, err := appendNumber(ctx, b, ptrToNumber(p+uintptr(code.Offset))) if err != nil { return nil, err } - b = appendComma(bb) + b = appendComma(ctx, bb) code = code.Next case encoder.OpStructPtrHeadOmitEmptyNumber: if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -2476,25 +2481,25 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) + b = appendStructHead(ctx, b) } v := ptrToNumber(p + uintptr(code.Offset)) if v == "" { code = code.NextField } else { b = appendStructKey(ctx, code, b) - bb, err := appendNumber(b, v) + bb, err := appendNumber(ctx, b, v) if err != nil { return nil, err } - b = appendComma(bb) + b = appendComma(ctx, bb) code = code.Next } case encoder.OpStructPtrHeadNumberString: @@ -2502,8 +2507,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -2515,31 +2520,31 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) + b = appendStructHead(ctx, b) } b = appendStructKey(ctx, code, b) b = append(b, '"') - bb, err := appendNumber(b, ptrToNumber(p+uintptr(code.Offset))) + bb, err := appendNumber(ctx, b, ptrToNumber(p+uintptr(code.Offset))) if err != nil { return nil, err } b = append(bb, '"') - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructPtrHeadOmitEmptyNumberString: if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -2551,14 +2556,14 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) + b = appendStructHead(ctx, b) } v := ptrToNumber(p + uintptr(code.Offset)) if v == "" { @@ -2566,20 +2571,20 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b } else { b = appendStructKey(ctx, code, b) b = append(b, '"') - bb, err := appendNumber(b, v) + bb, err := appendNumber(ctx, b, v) if err != nil { return nil, err } b = append(bb, '"') - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next } case encoder.OpStructPtrHeadNumberPtr: p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -2590,36 +2595,36 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) + b = appendStructHead(ctx, b) } b = appendStructKey(ctx, code, b) if (code.Flags & encoder.IndirectFlags) != 0 { p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p == 0 { - b = appendNull(b) + b = appendNull(ctx, b) } else { - bb, err := appendNumber(b, ptrToNumber(p)) + bb, err := appendNumber(ctx, b, ptrToNumber(p)) if err != nil { return nil, err } b = bb } - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructPtrHeadOmitEmptyNumberPtr: p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -2630,33 +2635,33 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) + b = appendStructHead(ctx, b) } if (code.Flags & encoder.IndirectFlags) != 0 { p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p != 0 { b = appendStructKey(ctx, code, b) - bb, err := appendNumber(b, ptrToNumber(p)) + bb, err := appendNumber(ctx, b, ptrToNumber(p)) if err != nil { return nil, err } - b = appendComma(bb) + b = appendComma(ctx, bb) } code = code.Next case encoder.OpStructPtrHeadNumberPtrString: p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -2667,37 +2672,37 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) + b = appendStructHead(ctx, b) } b = appendStructKey(ctx, code, b) if (code.Flags & encoder.IndirectFlags) != 0 { p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p == 0 { - b = appendNull(b) + b = appendNull(ctx, b) } else { b = append(b, '"') - bb, err := appendNumber(b, ptrToNumber(p)) + bb, err := appendNumber(ctx, b, ptrToNumber(p)) if err != nil { return nil, err } b = append(bb, '"') } - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructPtrHeadOmitEmptyNumberPtrString: p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -2708,14 +2713,14 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) + b = appendStructHead(ctx, b) } if (code.Flags & encoder.IndirectFlags) != 0 { p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) @@ -2723,12 +2728,12 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b if p != 0 { b = appendStructKey(ctx, code, b) b = append(b, '"') - bb, err := appendNumber(b, ptrToNumber(p)) + bb, err := appendNumber(ctx, b, ptrToNumber(p)) if err != nil { return nil, err } b = append(bb, '"') - b = appendComma(b) + b = appendComma(ctx, b) } code = code.Next case encoder.OpStructPtrHeadArray, encoder.OpStructPtrHeadSlice: @@ -2736,8 +2741,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -2749,14 +2754,14 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) + b = appendStructHead(ctx, b) } b = appendStructKey(ctx, code, b) p += uintptr(code.Offset) @@ -2767,8 +2772,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -2780,14 +2785,14 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) + b = appendStructHead(ctx, b) } p += uintptr(code.Offset) b = appendStructKey(ctx, code, b) @@ -2798,8 +2803,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -2811,14 +2816,14 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) + b = appendStructHead(ctx, b) } p += uintptr(code.Offset) slice := ptrToSlice(p) @@ -2833,8 +2838,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -2845,22 +2850,22 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) + b = appendStructHead(ctx, b) } b = appendStructKey(ctx, code, b) if (code.Flags & encoder.IndirectFlags) != 0 { p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) code = code.NextField } else { code = code.Next @@ -2870,8 +2875,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -2882,14 +2887,14 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) + b = appendStructHead(ctx, b) } if (code.Flags & encoder.IndirectFlags) != 0 { p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) @@ -2905,8 +2910,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -2917,14 +2922,14 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) + b = appendStructHead(ctx, b) } b = appendStructKey(ctx, code, b) if p != 0 && (code.Flags&encoder.IndirectFlags) != 0 { @@ -2936,8 +2941,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -2948,14 +2953,14 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) + b = appendStructHead(ctx, b) } if p != 0 && (code.Flags&encoder.IndirectFlags) != 0 { p = ptrToPtr(p + uintptr(code.Offset)) @@ -2971,8 +2976,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -2983,26 +2988,26 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) + b = appendStructHead(ctx, b) } b = appendStructKey(ctx, code, b) if p == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) code = code.NextField break } p = ptrToPtr(p + uintptr(code.Offset)) if p == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) code = code.NextField } else { if (code.Flags & encoder.IndirectFlags) != 0 { @@ -3015,8 +3020,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -3027,14 +3032,14 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) + b = appendStructHead(ctx, b) } if p == 0 { code = code.NextField @@ -3055,8 +3060,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -3069,14 +3074,14 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) + b = appendStructHead(ctx, b) } b = appendStructKey(ctx, code, b) if (code.Flags & encoder.IsNilableTypeFlags) != 0 { @@ -3085,7 +3090,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b } } if p == 0 && (code.Flags&encoder.NilCheckFlags) != 0 { - b = appendNull(b) + b = appendNull(ctx, b) } else { bb, err := appendMarshalJSON(ctx, code, b, ptrToInterface(code, p)) if err != nil { @@ -3093,14 +3098,14 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b } b = bb } - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructPtrHeadOmitEmptyMarshalJSON: p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -3113,14 +3118,14 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) + b = appendStructHead(ctx, b) } if (code.Flags & encoder.IsNilableTypeFlags) != 0 { if (code.Flags&encoder.IndirectFlags) != 0 || code.Op == encoder.OpStructPtrHeadOmitEmptyMarshalJSON { @@ -3137,15 +3142,15 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b return nil, err } b = bb - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next } case encoder.OpStructPtrHeadMarshalJSONPtr: p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -3156,21 +3161,21 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) + b = appendStructHead(ctx, b) } b = appendStructKey(ctx, code, b) if (code.Flags & encoder.IndirectFlags) != 0 { p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p == 0 { - b = appendNull(b) + b = appendNull(ctx, b) } else { bb, err := appendMarshalJSON(ctx, code, b, ptrToInterface(code, p)) if err != nil { @@ -3178,14 +3183,14 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b } b = bb } - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructPtrHeadOmitEmptyMarshalJSONPtr: p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -3196,8 +3201,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -3206,7 +3211,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) + b = appendStructHead(ctx, b) } if p == 0 { code = code.NextField @@ -3217,15 +3222,15 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b return nil, err } b = bb - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next } case encoder.OpStructPtrHeadMarshalText: p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -3238,14 +3243,14 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) + b = appendStructHead(ctx, b) } b = appendStructKey(ctx, code, b) if (code.Flags & encoder.IsNilableTypeFlags) != 0 { @@ -3254,22 +3259,22 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b } } if p == 0 && (code.Flags&encoder.NilCheckFlags) != 0 { - b = appendNull(b) + b = appendNull(ctx, b) } else { - bb, err := appendMarshalText(code, b, ptrToInterface(code, p)) + bb, err := appendMarshalText(ctx, code, b, ptrToInterface(code, p)) if err != nil { return nil, err } b = bb } - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructPtrHeadOmitEmptyMarshalText: p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -3282,14 +3287,14 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) + b = appendStructHead(ctx, b) } if (code.Flags & encoder.IsNilableTypeFlags) != 0 { if (code.Flags&encoder.IndirectFlags) != 0 || code.Op == encoder.OpStructPtrHeadOmitEmptyMarshalText { @@ -3300,20 +3305,20 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b code = code.NextField } else { b = appendStructKey(ctx, code, b) - bb, err := appendMarshalText(code, b, ptrToInterface(code, p)) + bb, err := appendMarshalText(ctx, code, b, ptrToInterface(code, p)) if err != nil { return nil, err } b = bb - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next } case encoder.OpStructPtrHeadMarshalTextPtr: p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -3324,36 +3329,36 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) + b = appendStructHead(ctx, b) } b = appendStructKey(ctx, code, b) if (code.Flags & encoder.IndirectFlags) != 0 { p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p == 0 { - b = appendNull(b) + b = appendNull(ctx, b) } else { - bb, err := appendMarshalText(code, b, ptrToInterface(code, p)) + bb, err := appendMarshalText(ctx, code, b, ptrToInterface(code, p)) if err != nil { return nil, err } b = bb } - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructPtrHeadOmitEmptyMarshalTextPtr: p := load(ctxptr, code.Idx) if p == 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -3364,8 +3369,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -3374,18 +3379,18 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if code.Flags&encoder.AnonymousHeadFlags == 0 { - b = appendStructHead(b) + b = appendStructHead(ctx, b) } if p == 0 { code = code.NextField } else { b = appendStructKey(ctx, code, b) - bb, err := appendMarshalText(code, b, ptrToInterface(code, p)) + bb, err := appendMarshalText(ctx, code, b, ptrToInterface(code, p)) if err != nil { return nil, err } b = bb - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next } case encoder.OpStructField: @@ -3409,7 +3414,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) b = appendInt(b, ptrToUint64(p+uintptr(code.Offset)), code) - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructFieldOmitEmptyInt: p := load(ctxptr, code.Idx) @@ -3418,7 +3423,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b if v != 0 { b = appendStructKey(ctx, code, b) b = appendInt(b, u64, code) - b = appendComma(b) + b = appendComma(ctx, b) } code = code.Next case encoder.OpStructFieldIntString: @@ -3427,7 +3432,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b b = append(b, '"') b = appendInt(b, ptrToUint64(p+uintptr(code.Offset)), code) b = append(b, '"') - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructFieldOmitEmptyIntString: p := load(ctxptr, code.Idx) @@ -3438,7 +3443,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b b = append(b, '"') b = appendInt(b, u64, code) b = append(b, '"') - b = appendComma(b) + b = appendComma(ctx, b) } code = code.Next case encoder.OpStructFieldIntPtr: @@ -3446,11 +3451,11 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) b = appendStructKey(ctx, code, b) if p == 0 { - b = appendNull(b) + b = appendNull(ctx, b) } else { b = appendInt(b, ptrToUint64(p), code) } - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructFieldOmitEmptyIntPtr: p := load(ctxptr, code.Idx) @@ -3458,7 +3463,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b if p != 0 { b = appendStructKey(ctx, code, b) b = appendInt(b, ptrToUint64(p), code) - b = appendComma(b) + b = appendComma(ctx, b) } code = code.Next case encoder.OpStructFieldIntPtrString: @@ -3466,13 +3471,13 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) b = appendStructKey(ctx, code, b) if p == 0 { - b = appendNull(b) + b = appendNull(ctx, b) } else { b = append(b, '"') b = appendInt(b, ptrToUint64(p), code) b = append(b, '"') } - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructFieldOmitEmptyIntPtrString: p := load(ctxptr, code.Idx) @@ -3482,14 +3487,14 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b b = append(b, '"') b = appendInt(b, ptrToUint64(p), code) b = append(b, '"') - b = appendComma(b) + b = appendComma(ctx, b) } code = code.Next case encoder.OpStructFieldUint: p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) b = appendUint(b, ptrToUint64(p+uintptr(code.Offset)), code) - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructFieldOmitEmptyUint: p := load(ctxptr, code.Idx) @@ -3498,7 +3503,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b if v != 0 { b = appendStructKey(ctx, code, b) b = appendUint(b, u64, code) - b = appendComma(b) + b = appendComma(ctx, b) } code = code.Next case encoder.OpStructFieldUintString: @@ -3507,7 +3512,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b b = append(b, '"') b = appendUint(b, ptrToUint64(p+uintptr(code.Offset)), code) b = append(b, '"') - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructFieldOmitEmptyUintString: p := load(ctxptr, code.Idx) @@ -3518,7 +3523,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b b = append(b, '"') b = appendUint(b, u64, code) b = append(b, '"') - b = appendComma(b) + b = appendComma(ctx, b) } code = code.Next case encoder.OpStructFieldUintPtr: @@ -3526,11 +3531,11 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) b = appendStructKey(ctx, code, b) if p == 0 { - b = appendNull(b) + b = appendNull(ctx, b) } else { b = appendUint(b, ptrToUint64(p), code) } - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructFieldOmitEmptyUintPtr: p := load(ctxptr, code.Idx) @@ -3538,7 +3543,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b if p != 0 { b = appendStructKey(ctx, code, b) b = appendUint(b, ptrToUint64(p), code) - b = appendComma(b) + b = appendComma(ctx, b) } code = code.Next case encoder.OpStructFieldUintPtrString: @@ -3546,13 +3551,13 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) b = appendStructKey(ctx, code, b) if p == 0 { - b = appendNull(b) + b = appendNull(ctx, b) } else { b = append(b, '"') b = appendUint(b, ptrToUint64(p), code) b = append(b, '"') } - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructFieldOmitEmptyUintPtrString: p := load(ctxptr, code.Idx) @@ -3562,31 +3567,31 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b b = append(b, '"') b = appendUint(b, ptrToUint64(p), code) b = append(b, '"') - b = appendComma(b) + b = appendComma(ctx, b) } code = code.Next case encoder.OpStructFieldFloat32: p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) - b = appendFloat32(b, ptrToFloat32(p+uintptr(code.Offset))) - b = appendComma(b) + b = appendFloat32(ctx, b, ptrToFloat32(p+uintptr(code.Offset))) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructFieldOmitEmptyFloat32: p := load(ctxptr, code.Idx) v := ptrToFloat32(p + uintptr(code.Offset)) if v != 0 { b = appendStructKey(ctx, code, b) - b = appendFloat32(b, v) - b = appendComma(b) + b = appendFloat32(ctx, b, v) + b = appendComma(ctx, b) } code = code.Next case encoder.OpStructFieldFloat32String: p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) b = append(b, '"') - b = appendFloat32(b, ptrToFloat32(p+uintptr(code.Offset))) + b = appendFloat32(ctx, b, ptrToFloat32(p+uintptr(code.Offset))) b = append(b, '"') - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructFieldOmitEmptyFloat32String: p := load(ctxptr, code.Idx) @@ -3594,9 +3599,9 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b if v != 0 { b = appendStructKey(ctx, code, b) b = append(b, '"') - b = appendFloat32(b, v) + b = appendFloat32(ctx, b, v) b = append(b, '"') - b = appendComma(b) + b = appendComma(ctx, b) } code = code.Next case encoder.OpStructFieldFloat32Ptr: @@ -3604,19 +3609,19 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) b = appendStructKey(ctx, code, b) if p == 0 { - b = appendNull(b) + b = appendNull(ctx, b) } else { - b = appendFloat32(b, ptrToFloat32(p)) + b = appendFloat32(ctx, b, ptrToFloat32(p)) } - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructFieldOmitEmptyFloat32Ptr: p := load(ctxptr, code.Idx) p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p != 0 { b = appendStructKey(ctx, code, b) - b = appendFloat32(b, ptrToFloat32(p)) - b = appendComma(b) + b = appendFloat32(ctx, b, ptrToFloat32(p)) + b = appendComma(ctx, b) } code = code.Next case encoder.OpStructFieldFloat32PtrString: @@ -3624,13 +3629,13 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) b = appendStructKey(ctx, code, b) if p == 0 { - b = appendNull(b) + b = appendNull(ctx, b) } else { b = append(b, '"') - b = appendFloat32(b, ptrToFloat32(p)) + b = appendFloat32(ctx, b, ptrToFloat32(p)) b = append(b, '"') } - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructFieldOmitEmptyFloat32PtrString: p := load(ctxptr, code.Idx) @@ -3638,9 +3643,9 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b if p != 0 { b = appendStructKey(ctx, code, b) b = append(b, '"') - b = appendFloat32(b, ptrToFloat32(p)) + b = appendFloat32(ctx, b, ptrToFloat32(p)) b = append(b, '"') - b = appendComma(b) + b = appendComma(ctx, b) } code = code.Next case encoder.OpStructFieldFloat64: @@ -3650,8 +3655,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b if math.IsInf(v, 0) || math.IsNaN(v) { return nil, errUnsupportedFloat(v) } - b = appendFloat64(b, v) - b = appendComma(b) + b = appendFloat64(ctx, b, v) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructFieldOmitEmptyFloat64: p := load(ctxptr, code.Idx) @@ -3661,8 +3666,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b return nil, errUnsupportedFloat(v) } b = appendStructKey(ctx, code, b) - b = appendFloat64(b, v) - b = appendComma(b) + b = appendFloat64(ctx, b, v) + b = appendComma(ctx, b) } code = code.Next case encoder.OpStructFieldFloat64String: @@ -3673,9 +3678,9 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b } b = appendStructKey(ctx, code, b) b = append(b, '"') - b = appendFloat64(b, v) + b = appendFloat64(ctx, b, v) b = append(b, '"') - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructFieldOmitEmptyFloat64String: p := load(ctxptr, code.Idx) @@ -3686,9 +3691,9 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b } b = appendStructKey(ctx, code, b) b = append(b, '"') - b = appendFloat64(b, v) + b = appendFloat64(ctx, b, v) b = append(b, '"') - b = appendComma(b) + b = appendComma(ctx, b) } code = code.Next case encoder.OpStructFieldFloat64Ptr: @@ -3696,8 +3701,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) b = appendStructKey(ctx, code, b) if p == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) code = code.Next break } @@ -3705,8 +3710,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b if math.IsInf(v, 0) || math.IsNaN(v) { return nil, errUnsupportedFloat(v) } - b = appendFloat64(b, v) - b = appendComma(b) + b = appendFloat64(ctx, b, v) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructFieldOmitEmptyFloat64Ptr: p := load(ctxptr, code.Idx) @@ -3717,8 +3722,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b if math.IsInf(v, 0) || math.IsNaN(v) { return nil, errUnsupportedFloat(v) } - b = appendFloat64(b, v) - b = appendComma(b) + b = appendFloat64(ctx, b, v) + b = appendComma(ctx, b) } code = code.Next case encoder.OpStructFieldFloat64PtrString: @@ -3726,17 +3731,17 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) b = appendStructKey(ctx, code, b) if p == 0 { - b = appendNull(b) + b = appendNull(ctx, b) } else { v := ptrToFloat64(p) if math.IsInf(v, 0) || math.IsNaN(v) { return nil, errUnsupportedFloat(v) } b = append(b, '"') - b = appendFloat64(b, v) + b = appendFloat64(ctx, b, v) b = append(b, '"') } - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructFieldOmitEmptyFloat64PtrString: p := load(ctxptr, code.Idx) @@ -3748,40 +3753,40 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b if math.IsInf(v, 0) || math.IsNaN(v) { return nil, errUnsupportedFloat(v) } - b = appendFloat64(b, v) + b = appendFloat64(ctx, b, v) b = append(b, '"') - b = appendComma(b) + b = appendComma(ctx, b) } code = code.Next case encoder.OpStructFieldString: p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) - b = appendString(b, ptrToString(p+uintptr(code.Offset))) - b = appendComma(b) + b = appendString(ctx, b, ptrToString(p+uintptr(code.Offset))) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructFieldOmitEmptyString: p := load(ctxptr, code.Idx) v := ptrToString(p + uintptr(code.Offset)) if v != "" { b = appendStructKey(ctx, code, b) - b = appendString(b, v) - b = appendComma(b) + b = appendString(ctx, b, v) + b = appendComma(ctx, b) } code = code.Next case encoder.OpStructFieldStringString: p := load(ctxptr, code.Idx) s := ptrToString(p + uintptr(code.Offset)) b = appendStructKey(ctx, code, b) - b = appendString(b, string(appendString([]byte{}, s))) - b = appendComma(b) + b = appendString(ctx, b, string(appendString(ctx, []byte{}, s))) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructFieldOmitEmptyStringString: p := load(ctxptr, code.Idx) v := ptrToString(p + uintptr(code.Offset)) if v != "" { b = appendStructKey(ctx, code, b) - b = appendString(b, string(appendString([]byte{}, v))) - b = appendComma(b) + b = appendString(ctx, b, string(appendString(ctx, []byte{}, v))) + b = appendComma(ctx, b) } code = code.Next case encoder.OpStructFieldStringPtr: @@ -3789,19 +3794,19 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) b = appendStructKey(ctx, code, b) if p == 0 { - b = appendNull(b) + b = appendNull(ctx, b) } else { - b = appendString(b, ptrToString(p)) + b = appendString(ctx, b, ptrToString(p)) } - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructFieldOmitEmptyStringPtr: p := load(ctxptr, code.Idx) p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p != 0 { b = appendStructKey(ctx, code, b) - b = appendString(b, ptrToString(p)) - b = appendComma(b) + b = appendString(ctx, b, ptrToString(p)) + b = appendComma(ctx, b) } code = code.Next case encoder.OpStructFieldStringPtrString: @@ -3809,43 +3814,43 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) b = appendStructKey(ctx, code, b) if p == 0 { - b = appendNull(b) + b = appendNull(ctx, b) } else { - b = appendString(b, string(appendString([]byte{}, ptrToString(p)))) + b = appendString(ctx, b, string(appendString(ctx, []byte{}, ptrToString(p)))) } - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructFieldOmitEmptyStringPtrString: p := load(ctxptr, code.Idx) p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p != 0 { b = appendStructKey(ctx, code, b) - b = appendString(b, string(appendString([]byte{}, ptrToString(p)))) - b = appendComma(b) + b = appendString(ctx, b, string(appendString(ctx, []byte{}, ptrToString(p)))) + b = appendComma(ctx, b) } code = code.Next case encoder.OpStructFieldBool: p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) - b = appendBool(b, ptrToBool(p+uintptr(code.Offset))) - b = appendComma(b) + b = appendBool(ctx, b, ptrToBool(p+uintptr(code.Offset))) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructFieldOmitEmptyBool: p := load(ctxptr, code.Idx) v := ptrToBool(p + uintptr(code.Offset)) if v { b = appendStructKey(ctx, code, b) - b = appendBool(b, v) - b = appendComma(b) + b = appendBool(ctx, b, v) + b = appendComma(ctx, b) } code = code.Next case encoder.OpStructFieldBoolString: p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) b = append(b, '"') - b = appendBool(b, ptrToBool(p+uintptr(code.Offset))) + b = appendBool(ctx, b, ptrToBool(p+uintptr(code.Offset))) b = append(b, '"') - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructFieldOmitEmptyBoolString: p := load(ctxptr, code.Idx) @@ -3853,9 +3858,9 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b if v { b = appendStructKey(ctx, code, b) b = append(b, '"') - b = appendBool(b, v) + b = appendBool(ctx, b, v) b = append(b, '"') - b = appendComma(b) + b = appendComma(ctx, b) } code = code.Next case encoder.OpStructFieldBoolPtr: @@ -3863,19 +3868,19 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) b = appendStructKey(ctx, code, b) if p == 0 { - b = appendNull(b) + b = appendNull(ctx, b) } else { - b = appendBool(b, ptrToBool(p)) + b = appendBool(ctx, b, ptrToBool(p)) } - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructFieldOmitEmptyBoolPtr: p := load(ctxptr, code.Idx) p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p != 0 { b = appendStructKey(ctx, code, b) - b = appendBool(b, ptrToBool(p)) - b = appendComma(b) + b = appendBool(ctx, b, ptrToBool(p)) + b = appendComma(ctx, b) } code = code.Next case encoder.OpStructFieldBoolPtrString: @@ -3883,13 +3888,13 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) b = appendStructKey(ctx, code, b) if p == 0 { - b = appendNull(b) + b = appendNull(ctx, b) } else { b = append(b, '"') - b = appendBool(b, ptrToBool(p)) + b = appendBool(ctx, b, ptrToBool(p)) b = append(b, '"') } - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructFieldOmitEmptyBoolPtrString: p := load(ctxptr, code.Idx) @@ -3897,24 +3902,24 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b if p != 0 { b = appendStructKey(ctx, code, b) b = append(b, '"') - b = appendBool(b, ptrToBool(p)) + b = appendBool(ctx, b, ptrToBool(p)) b = append(b, '"') - b = appendComma(b) + b = appendComma(ctx, b) } code = code.Next case encoder.OpStructFieldBytes: p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) - b = appendByteSlice(b, ptrToBytes(p+uintptr(code.Offset))) - b = appendComma(b) + b = appendByteSlice(ctx, b, ptrToBytes(p+uintptr(code.Offset))) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructFieldOmitEmptyBytes: p := load(ctxptr, code.Idx) v := ptrToBytes(p + uintptr(code.Offset)) if len(v) > 0 { b = appendStructKey(ctx, code, b) - b = appendByteSlice(b, v) - b = appendComma(b) + b = appendByteSlice(ctx, b, v) + b = appendComma(ctx, b) } code = code.Next case encoder.OpStructFieldBytesPtr: @@ -3922,52 +3927,52 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) b = appendStructKey(ctx, code, b) if p == 0 { - b = appendNull(b) + b = appendNull(ctx, b) } else { - b = appendByteSlice(b, ptrToBytes(p)) + b = appendByteSlice(ctx, b, ptrToBytes(p)) } - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructFieldOmitEmptyBytesPtr: p := load(ctxptr, code.Idx) p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p != 0 { b = appendStructKey(ctx, code, b) - b = appendByteSlice(b, ptrToBytes(p)) - b = appendComma(b) + b = appendByteSlice(ctx, b, ptrToBytes(p)) + b = appendComma(ctx, b) } code = code.Next case encoder.OpStructFieldNumber: p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) - bb, err := appendNumber(b, ptrToNumber(p+uintptr(code.Offset))) + bb, err := appendNumber(ctx, b, ptrToNumber(p+uintptr(code.Offset))) if err != nil { return nil, err } - b = appendComma(bb) + b = appendComma(ctx, bb) code = code.Next case encoder.OpStructFieldOmitEmptyNumber: p := load(ctxptr, code.Idx) v := ptrToNumber(p + uintptr(code.Offset)) if v != "" { b = appendStructKey(ctx, code, b) - bb, err := appendNumber(b, v) + bb, err := appendNumber(ctx, b, v) if err != nil { return nil, err } - b = appendComma(bb) + b = appendComma(ctx, bb) } code = code.Next case encoder.OpStructFieldNumberString: p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) b = append(b, '"') - bb, err := appendNumber(b, ptrToNumber(p+uintptr(code.Offset))) + bb, err := appendNumber(ctx, b, ptrToNumber(p+uintptr(code.Offset))) if err != nil { return nil, err } b = append(bb, '"') - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructFieldOmitEmptyNumberString: p := load(ctxptr, code.Idx) @@ -3975,12 +3980,12 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b if v != "" { b = appendStructKey(ctx, code, b) b = append(b, '"') - bb, err := appendNumber(b, v) + bb, err := appendNumber(ctx, b, v) if err != nil { return nil, err } b = append(bb, '"') - b = appendComma(b) + b = appendComma(ctx, b) } code = code.Next case encoder.OpStructFieldNumberPtr: @@ -3988,26 +3993,26 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) b = appendStructKey(ctx, code, b) if p == 0 { - b = appendNull(b) + b = appendNull(ctx, b) } else { - bb, err := appendNumber(b, ptrToNumber(p)) + bb, err := appendNumber(ctx, b, ptrToNumber(p)) if err != nil { return nil, err } b = bb } - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructFieldOmitEmptyNumberPtr: p := load(ctxptr, code.Idx) p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p != 0 { b = appendStructKey(ctx, code, b) - bb, err := appendNumber(b, ptrToNumber(p)) + bb, err := appendNumber(ctx, b, ptrToNumber(p)) if err != nil { return nil, err } - b = appendComma(bb) + b = appendComma(ctx, bb) } code = code.Next case encoder.OpStructFieldNumberPtrString: @@ -4015,16 +4020,16 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) b = appendStructKey(ctx, code, b) if p == 0 { - b = appendNull(b) + b = appendNull(ctx, b) } else { b = append(b, '"') - bb, err := appendNumber(b, ptrToNumber(p)) + bb, err := appendNumber(ctx, b, ptrToNumber(p)) if err != nil { return nil, err } b = append(bb, '"') } - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructFieldOmitEmptyNumberPtrString: p := load(ctxptr, code.Idx) @@ -4032,12 +4037,12 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b if p != 0 { b = appendStructKey(ctx, code, b) b = append(b, '"') - bb, err := appendNumber(b, ptrToNumber(p)) + bb, err := appendNumber(ctx, b, ptrToNumber(p)) if err != nil { return nil, err } b = append(bb, '"') - b = appendComma(b) + b = appendComma(ctx, b) } code = code.Next case encoder.OpStructFieldMarshalJSON: @@ -4048,7 +4053,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p = ptrToPtr(p) } if p == 0 && (code.Flags&encoder.NilCheckFlags) != 0 { - b = appendNull(b) + b = appendNull(ctx, b) } else { bb, err := appendMarshalJSON(ctx, code, b, ptrToInterface(code, p)) if err != nil { @@ -4056,7 +4061,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b } b = bb } - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructFieldOmitEmptyMarshalJSON: p := load(ctxptr, code.Idx) @@ -4078,14 +4083,14 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b if err != nil { return nil, err } - b = appendComma(bb) + b = appendComma(ctx, bb) code = code.Next case encoder.OpStructFieldMarshalJSONPtr: p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p == 0 { - b = appendNull(b) + b = appendNull(ctx, b) } else { bb, err := appendMarshalJSON(ctx, code, b, ptrToInterface(code, p)) if err != nil { @@ -4093,7 +4098,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b } b = bb } - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructFieldOmitEmptyMarshalJSONPtr: p := load(ctxptr, code.Idx) @@ -4104,7 +4109,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b if err != nil { return nil, err } - b = appendComma(bb) + b = appendComma(ctx, bb) } code = code.Next case encoder.OpStructFieldMarshalText: @@ -4115,15 +4120,15 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p = ptrToPtr(p) } if p == 0 && (code.Flags&encoder.NilCheckFlags) != 0 { - b = appendNull(b) + b = appendNull(ctx, b) } else { - bb, err := appendMarshalText(code, b, ptrToInterface(code, p)) + bb, err := appendMarshalText(ctx, code, b, ptrToInterface(code, p)) if err != nil { return nil, err } b = bb } - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructFieldOmitEmptyMarshalText: p := load(ctxptr, code.Idx) @@ -4136,37 +4141,37 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b break } b = appendStructKey(ctx, code, b) - bb, err := appendMarshalText(code, b, ptrToInterface(code, p)) + bb, err := appendMarshalText(ctx, code, b, ptrToInterface(code, p)) if err != nil { return nil, err } - b = appendComma(bb) + b = appendComma(ctx, bb) code = code.Next case encoder.OpStructFieldMarshalTextPtr: p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p == 0 { - b = appendNull(b) + b = appendNull(ctx, b) } else { - bb, err := appendMarshalText(code, b, ptrToInterface(code, p)) + bb, err := appendMarshalText(ctx, code, b, ptrToInterface(code, p)) if err != nil { return nil, err } b = bb } - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructFieldOmitEmptyMarshalTextPtr: p := load(ctxptr, code.Idx) p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p != 0 { b = appendStructKey(ctx, code, b) - bb, err := appendMarshalText(code, b, ptrToInterface(code, p)) + bb, err := appendMarshalText(ctx, code, b, ptrToInterface(code, p)) if err != nil { return nil, err } - b = appendComma(bb) + b = appendComma(ctx, bb) } code = code.Next case encoder.OpStructFieldArray: @@ -4334,7 +4339,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p == 0 { - b = appendNull(b) + b = appendNull(ctx, b) } else { b = appendInt(b, ptrToUint64(p), code) } @@ -4356,7 +4361,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p == 0 { - b = appendNull(b) + b = appendNull(ctx, b) } else { b = append(b, '"') b = appendInt(b, ptrToUint64(p), code) @@ -4422,7 +4427,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p == 0 { - b = appendNull(b) + b = appendNull(ctx, b) } else { b = appendUint(b, ptrToUint64(p), code) } @@ -4444,7 +4449,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p == 0 { - b = appendNull(b) + b = appendNull(ctx, b) } else { b = append(b, '"') b = appendUint(b, ptrToUint64(p), code) @@ -4468,7 +4473,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b case encoder.OpStructEndFloat32: p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) - b = appendFloat32(b, ptrToFloat32(p+uintptr(code.Offset))) + b = appendFloat32(ctx, b, ptrToFloat32(p+uintptr(code.Offset))) b = appendStructEnd(ctx, code, b) code = code.Next case encoder.OpStructEndOmitEmptyFloat32: @@ -4476,7 +4481,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b v := ptrToFloat32(p + uintptr(code.Offset)) if v != 0 { b = appendStructKey(ctx, code, b) - b = appendFloat32(b, v) + b = appendFloat32(ctx, b, v) b = appendStructEnd(ctx, code, b) } else { b = appendStructEndSkipLast(ctx, code, b) @@ -4486,7 +4491,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) b = append(b, '"') - b = appendFloat32(b, ptrToFloat32(p+uintptr(code.Offset))) + b = appendFloat32(ctx, b, ptrToFloat32(p+uintptr(code.Offset))) b = append(b, '"') b = appendStructEnd(ctx, code, b) code = code.Next @@ -4496,7 +4501,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b if v != 0 { b = appendStructKey(ctx, code, b) b = append(b, '"') - b = appendFloat32(b, v) + b = appendFloat32(ctx, b, v) b = append(b, '"') b = appendStructEnd(ctx, code, b) } else { @@ -4508,9 +4513,9 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p == 0 { - b = appendNull(b) + b = appendNull(ctx, b) } else { - b = appendFloat32(b, ptrToFloat32(p)) + b = appendFloat32(ctx, b, ptrToFloat32(p)) } b = appendStructEnd(ctx, code, b) code = code.Next @@ -4519,7 +4524,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p != 0 { b = appendStructKey(ctx, code, b) - b = appendFloat32(b, ptrToFloat32(p)) + b = appendFloat32(ctx, b, ptrToFloat32(p)) b = appendStructEnd(ctx, code, b) } else { b = appendStructEndSkipLast(ctx, code, b) @@ -4530,10 +4535,10 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p == 0 { - b = appendNull(b) + b = appendNull(ctx, b) } else { b = append(b, '"') - b = appendFloat32(b, ptrToFloat32(p)) + b = appendFloat32(ctx, b, ptrToFloat32(p)) b = append(b, '"') } b = appendStructEnd(ctx, code, b) @@ -4544,7 +4549,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b if p != 0 { b = appendStructKey(ctx, code, b) b = append(b, '"') - b = appendFloat32(b, ptrToFloat32(p)) + b = appendFloat32(ctx, b, ptrToFloat32(p)) b = append(b, '"') b = appendStructEnd(ctx, code, b) } else { @@ -4558,7 +4563,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b return nil, errUnsupportedFloat(v) } b = appendStructKey(ctx, code, b) - b = appendFloat64(b, v) + b = appendFloat64(ctx, b, v) b = appendStructEnd(ctx, code, b) code = code.Next case encoder.OpStructEndOmitEmptyFloat64: @@ -4569,7 +4574,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b return nil, errUnsupportedFloat(v) } b = appendStructKey(ctx, code, b) - b = appendFloat64(b, v) + b = appendFloat64(ctx, b, v) b = appendStructEnd(ctx, code, b) } else { b = appendStructEndSkipLast(ctx, code, b) @@ -4583,7 +4588,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b } b = appendStructKey(ctx, code, b) b = append(b, '"') - b = appendFloat64(b, v) + b = appendFloat64(ctx, b, v) b = append(b, '"') b = appendStructEnd(ctx, code, b) code = code.Next @@ -4596,7 +4601,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b } b = appendStructKey(ctx, code, b) b = append(b, '"') - b = appendFloat64(b, v) + b = appendFloat64(ctx, b, v) b = append(b, '"') b = appendStructEnd(ctx, code, b) } else { @@ -4608,7 +4613,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p == 0 { - b = appendNull(b) + b = appendNull(ctx, b) b = appendStructEnd(ctx, code, b) code = code.Next break @@ -4617,7 +4622,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b if math.IsInf(v, 0) || math.IsNaN(v) { return nil, errUnsupportedFloat(v) } - b = appendFloat64(b, v) + b = appendFloat64(ctx, b, v) b = appendStructEnd(ctx, code, b) code = code.Next case encoder.OpStructEndOmitEmptyFloat64Ptr: @@ -4629,7 +4634,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b if math.IsInf(v, 0) || math.IsNaN(v) { return nil, errUnsupportedFloat(v) } - b = appendFloat64(b, v) + b = appendFloat64(ctx, b, v) b = appendStructEnd(ctx, code, b) } else { b = appendStructEndSkipLast(ctx, code, b) @@ -4640,14 +4645,14 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p == 0 { - b = appendNull(b) + b = appendNull(ctx, b) } else { b = append(b, '"') v := ptrToFloat64(p) if math.IsInf(v, 0) || math.IsNaN(v) { return nil, errUnsupportedFloat(v) } - b = appendFloat64(b, v) + b = appendFloat64(ctx, b, v) b = append(b, '"') } b = appendStructEnd(ctx, code, b) @@ -4662,7 +4667,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b return nil, errUnsupportedFloat(v) } b = append(b, '"') - b = appendFloat64(b, v) + b = appendFloat64(ctx, b, v) b = append(b, '"') b = appendStructEnd(ctx, code, b) } else { @@ -4672,7 +4677,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b case encoder.OpStructEndString: p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) - b = appendString(b, ptrToString(p+uintptr(code.Offset))) + b = appendString(ctx, b, ptrToString(p+uintptr(code.Offset))) b = appendStructEnd(ctx, code, b) code = code.Next case encoder.OpStructEndOmitEmptyString: @@ -4680,7 +4685,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b v := ptrToString(p + uintptr(code.Offset)) if v != "" { b = appendStructKey(ctx, code, b) - b = appendString(b, v) + b = appendString(ctx, b, v) b = appendStructEnd(ctx, code, b) } else { b = appendStructEndSkipLast(ctx, code, b) @@ -4690,7 +4695,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) s := ptrToString(p + uintptr(code.Offset)) - b = appendString(b, string(appendString([]byte{}, s))) + b = appendString(ctx, b, string(appendString(ctx, []byte{}, s))) b = appendStructEnd(ctx, code, b) code = code.Next case encoder.OpStructEndOmitEmptyStringString: @@ -4698,7 +4703,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b v := ptrToString(p + uintptr(code.Offset)) if v != "" { b = appendStructKey(ctx, code, b) - b = appendString(b, string(appendString([]byte{}, v))) + b = appendString(ctx, b, string(appendString(ctx, []byte{}, v))) b = appendStructEnd(ctx, code, b) } else { b = appendStructEndSkipLast(ctx, code, b) @@ -4709,9 +4714,9 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p == 0 { - b = appendNull(b) + b = appendNull(ctx, b) } else { - b = appendString(b, ptrToString(p)) + b = appendString(ctx, b, ptrToString(p)) } b = appendStructEnd(ctx, code, b) code = code.Next @@ -4720,7 +4725,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p != 0 { b = appendStructKey(ctx, code, b) - b = appendString(b, ptrToString(p)) + b = appendString(ctx, b, ptrToString(p)) b = appendStructEnd(ctx, code, b) } else { b = appendStructEndSkipLast(ctx, code, b) @@ -4731,9 +4736,9 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p == 0 { - b = appendNull(b) + b = appendNull(ctx, b) } else { - b = appendString(b, string(appendString([]byte{}, ptrToString(p)))) + b = appendString(ctx, b, string(appendString(ctx, []byte{}, ptrToString(p)))) } b = appendStructEnd(ctx, code, b) code = code.Next @@ -4742,7 +4747,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p != 0 { b = appendStructKey(ctx, code, b) - b = appendString(b, string(appendString([]byte{}, ptrToString(p)))) + b = appendString(ctx, b, string(appendString(ctx, []byte{}, ptrToString(p)))) b = appendStructEnd(ctx, code, b) } else { b = appendStructEndSkipLast(ctx, code, b) @@ -4751,7 +4756,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b case encoder.OpStructEndBool: p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) - b = appendBool(b, ptrToBool(p+uintptr(code.Offset))) + b = appendBool(ctx, b, ptrToBool(p+uintptr(code.Offset))) b = appendStructEnd(ctx, code, b) code = code.Next case encoder.OpStructEndOmitEmptyBool: @@ -4759,7 +4764,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b v := ptrToBool(p + uintptr(code.Offset)) if v { b = appendStructKey(ctx, code, b) - b = appendBool(b, v) + b = appendBool(ctx, b, v) b = appendStructEnd(ctx, code, b) } else { b = appendStructEndSkipLast(ctx, code, b) @@ -4769,7 +4774,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) b = append(b, '"') - b = appendBool(b, ptrToBool(p+uintptr(code.Offset))) + b = appendBool(ctx, b, ptrToBool(p+uintptr(code.Offset))) b = append(b, '"') b = appendStructEnd(ctx, code, b) code = code.Next @@ -4779,7 +4784,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b if v { b = appendStructKey(ctx, code, b) b = append(b, '"') - b = appendBool(b, v) + b = appendBool(ctx, b, v) b = append(b, '"') b = appendStructEnd(ctx, code, b) } else { @@ -4791,9 +4796,9 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p == 0 { - b = appendNull(b) + b = appendNull(ctx, b) } else { - b = appendBool(b, ptrToBool(p)) + b = appendBool(ctx, b, ptrToBool(p)) } b = appendStructEnd(ctx, code, b) code = code.Next @@ -4802,7 +4807,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p != 0 { b = appendStructKey(ctx, code, b) - b = appendBool(b, ptrToBool(p)) + b = appendBool(ctx, b, ptrToBool(p)) b = appendStructEnd(ctx, code, b) } else { b = appendStructEndSkipLast(ctx, code, b) @@ -4813,10 +4818,10 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p == 0 { - b = appendNull(b) + b = appendNull(ctx, b) } else { b = append(b, '"') - b = appendBool(b, ptrToBool(p)) + b = appendBool(ctx, b, ptrToBool(p)) b = append(b, '"') } b = appendStructEnd(ctx, code, b) @@ -4827,7 +4832,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b if p != 0 { b = appendStructKey(ctx, code, b) b = append(b, '"') - b = appendBool(b, ptrToBool(p)) + b = appendBool(ctx, b, ptrToBool(p)) b = append(b, '"') b = appendStructEnd(ctx, code, b) } else { @@ -4837,7 +4842,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b case encoder.OpStructEndBytes: p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) - b = appendByteSlice(b, ptrToBytes(p+uintptr(code.Offset))) + b = appendByteSlice(ctx, b, ptrToBytes(p+uintptr(code.Offset))) b = appendStructEnd(ctx, code, b) code = code.Next case encoder.OpStructEndOmitEmptyBytes: @@ -4845,7 +4850,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b v := ptrToBytes(p + uintptr(code.Offset)) if len(v) > 0 { b = appendStructKey(ctx, code, b) - b = appendByteSlice(b, v) + b = appendByteSlice(ctx, b, v) b = appendStructEnd(ctx, code, b) } else { b = appendStructEndSkipLast(ctx, code, b) @@ -4856,9 +4861,9 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p == 0 { - b = appendNull(b) + b = appendNull(ctx, b) } else { - b = appendByteSlice(b, ptrToBytes(p)) + b = appendByteSlice(ctx, b, ptrToBytes(p)) } b = appendStructEnd(ctx, code, b) code = code.Next @@ -4867,7 +4872,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p != 0 { b = appendStructKey(ctx, code, b) - b = appendByteSlice(b, ptrToBytes(p)) + b = appendByteSlice(ctx, b, ptrToBytes(p)) b = appendStructEnd(ctx, code, b) } else { b = appendStructEndSkipLast(ctx, code, b) @@ -4876,7 +4881,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b case encoder.OpStructEndNumber: p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) - bb, err := appendNumber(b, ptrToNumber(p+uintptr(code.Offset))) + bb, err := appendNumber(ctx, b, ptrToNumber(p+uintptr(code.Offset))) if err != nil { return nil, err } @@ -4887,7 +4892,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b v := ptrToNumber(p + uintptr(code.Offset)) if v != "" { b = appendStructKey(ctx, code, b) - bb, err := appendNumber(b, v) + bb, err := appendNumber(ctx, b, v) if err != nil { return nil, err } @@ -4900,7 +4905,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) b = append(b, '"') - bb, err := appendNumber(b, ptrToNumber(p+uintptr(code.Offset))) + bb, err := appendNumber(ctx, b, ptrToNumber(p+uintptr(code.Offset))) if err != nil { return nil, err } @@ -4913,7 +4918,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b if v != "" { b = appendStructKey(ctx, code, b) b = append(b, '"') - bb, err := appendNumber(b, v) + bb, err := appendNumber(ctx, b, v) if err != nil { return nil, err } @@ -4928,9 +4933,9 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p == 0 { - b = appendNull(b) + b = appendNull(ctx, b) } else { - bb, err := appendNumber(b, ptrToNumber(p)) + bb, err := appendNumber(ctx, b, ptrToNumber(p)) if err != nil { return nil, err } @@ -4943,7 +4948,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p != 0 { b = appendStructKey(ctx, code, b) - bb, err := appendNumber(b, ptrToNumber(p)) + bb, err := appendNumber(ctx, b, ptrToNumber(p)) if err != nil { return nil, err } @@ -4957,10 +4962,10 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b p := load(ctxptr, code.Idx) p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p == 0 { - b = appendNull(b) + b = appendNull(ctx, b) } else { b = append(b, '"') - bb, err := appendNumber(b, ptrToNumber(p)) + bb, err := appendNumber(ctx, b, ptrToNumber(p)) if err != nil { return nil, err } @@ -4974,7 +4979,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b if p != 0 { b = appendStructKey(ctx, code, b) b = append(b, '"') - bb, err := appendNumber(b, ptrToNumber(p)) + bb, err := appendNumber(ctx, b, ptrToNumber(p)) if err != nil { return nil, err }