2021-05-19 06:34:40 +03:00
|
|
|
// Code generated by internal/cmd/generator. DO NOT EDIT!
|
|
|
|
package vm
|
|
|
|
|
|
|
|
import (
|
|
|
|
"math"
|
2022-07-03 00:05:26 +03:00
|
|
|
"reflect"
|
2021-05-19 06:34:40 +03:00
|
|
|
"sort"
|
|
|
|
"unsafe"
|
|
|
|
|
|
|
|
"github.com/goccy/go-json/internal/encoder"
|
2021-08-30 07:03:14 +03:00
|
|
|
"github.com/goccy/go-json/internal/runtime"
|
2021-05-19 06:34:40 +03:00
|
|
|
)
|
|
|
|
|
2021-05-31 16:25:33 +03:00
|
|
|
func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]byte, error) {
|
2021-05-19 06:34:40 +03:00
|
|
|
recursiveLevel := 0
|
|
|
|
ptrOffset := uintptr(0)
|
|
|
|
ctxptr := ctx.Ptr()
|
2021-05-31 19:25:05 +03:00
|
|
|
var code *encoder.Opcode
|
2021-06-01 07:40:15 +03:00
|
|
|
if (ctx.Option.Flag & encoder.HTMLEscapeOption) != 0 {
|
2021-05-31 19:25:05 +03:00
|
|
|
code = codeSet.EscapeKeyCode
|
|
|
|
} else {
|
|
|
|
code = codeSet.NoescapeKeyCode
|
|
|
|
}
|
2021-05-19 06:34:40 +03:00
|
|
|
|
|
|
|
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 {
|
2021-11-28 15:46:32 +03:00
|
|
|
b = appendNullComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
code = code.Next
|
|
|
|
break
|
|
|
|
}
|
|
|
|
store(ctxptr, code.Idx, p)
|
|
|
|
fallthrough
|
|
|
|
case encoder.OpInt:
|
2021-10-14 09:00:28 +03:00
|
|
|
b = appendInt(ctx, b, load(ctxptr, code.Idx), code)
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
code = code.Next
|
|
|
|
case encoder.OpUintPtr:
|
|
|
|
p := loadNPtr(ctxptr, code.Idx, code.PtrNum)
|
|
|
|
if p == 0 {
|
2021-11-28 15:46:32 +03:00
|
|
|
b = appendNullComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
code = code.Next
|
|
|
|
break
|
|
|
|
}
|
|
|
|
store(ctxptr, code.Idx, p)
|
|
|
|
fallthrough
|
|
|
|
case encoder.OpUint:
|
2021-10-14 09:00:28 +03:00
|
|
|
b = appendUint(ctx, b, load(ctxptr, code.Idx), code)
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
code = code.Next
|
|
|
|
case encoder.OpIntString:
|
|
|
|
b = append(b, '"')
|
2021-10-14 09:00:28 +03:00
|
|
|
b = appendInt(ctx, b, load(ctxptr, code.Idx), code)
|
2021-05-19 06:34:40 +03:00
|
|
|
b = append(b, '"')
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
code = code.Next
|
|
|
|
case encoder.OpUintString:
|
|
|
|
b = append(b, '"')
|
2021-10-14 09:00:28 +03:00
|
|
|
b = appendUint(ctx, b, load(ctxptr, code.Idx), code)
|
2021-05-19 06:34:40 +03:00
|
|
|
b = append(b, '"')
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
code = code.Next
|
|
|
|
case encoder.OpFloat32Ptr:
|
|
|
|
p := loadNPtr(ctxptr, code.Idx, code.PtrNum)
|
|
|
|
if p == 0 {
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendNull(ctx, b)
|
|
|
|
b = appendComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
code = code.Next
|
|
|
|
break
|
|
|
|
}
|
|
|
|
store(ctxptr, code.Idx, p)
|
|
|
|
fallthrough
|
|
|
|
case encoder.OpFloat32:
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendFloat32(ctx, b, ptrToFloat32(load(ctxptr, code.Idx)))
|
|
|
|
b = appendComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
code = code.Next
|
|
|
|
case encoder.OpFloat64Ptr:
|
|
|
|
p := loadNPtr(ctxptr, code.Idx, code.PtrNum)
|
|
|
|
if p == 0 {
|
2021-11-28 15:46:32 +03:00
|
|
|
b = appendNullComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
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)
|
|
|
|
}
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendFloat64(ctx, b, v)
|
|
|
|
b = appendComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
code = code.Next
|
|
|
|
case encoder.OpStringPtr:
|
|
|
|
p := loadNPtr(ctxptr, code.Idx, code.PtrNum)
|
|
|
|
if p == 0 {
|
2021-11-28 15:46:32 +03:00
|
|
|
b = appendNullComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
code = code.Next
|
|
|
|
break
|
|
|
|
}
|
|
|
|
store(ctxptr, code.Idx, p)
|
|
|
|
fallthrough
|
|
|
|
case encoder.OpString:
|
2021-05-31 19:25:05 +03:00
|
|
|
b = appendString(ctx, b, ptrToString(load(ctxptr, code.Idx)))
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
code = code.Next
|
|
|
|
case encoder.OpBoolPtr:
|
|
|
|
p := loadNPtr(ctxptr, code.Idx, code.PtrNum)
|
|
|
|
if p == 0 {
|
2021-11-28 15:46:32 +03:00
|
|
|
b = appendNullComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
code = code.Next
|
|
|
|
break
|
|
|
|
}
|
|
|
|
store(ctxptr, code.Idx, p)
|
|
|
|
fallthrough
|
|
|
|
case encoder.OpBool:
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendBool(ctx, b, ptrToBool(load(ctxptr, code.Idx)))
|
|
|
|
b = appendComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
code = code.Next
|
|
|
|
case encoder.OpBytesPtr:
|
|
|
|
p := loadNPtr(ctxptr, code.Idx, code.PtrNum)
|
|
|
|
if p == 0 {
|
2021-11-28 15:46:32 +03:00
|
|
|
b = appendNullComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
code = code.Next
|
|
|
|
break
|
|
|
|
}
|
|
|
|
store(ctxptr, code.Idx, p)
|
|
|
|
fallthrough
|
|
|
|
case encoder.OpBytes:
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendByteSlice(ctx, b, ptrToBytes(load(ctxptr, code.Idx)))
|
|
|
|
b = appendComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
code = code.Next
|
|
|
|
case encoder.OpNumberPtr:
|
|
|
|
p := loadNPtr(ctxptr, code.Idx, code.PtrNum)
|
|
|
|
if p == 0 {
|
2021-11-28 15:46:32 +03:00
|
|
|
b = appendNullComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
code = code.Next
|
|
|
|
break
|
|
|
|
}
|
|
|
|
store(ctxptr, code.Idx, p)
|
|
|
|
fallthrough
|
|
|
|
case encoder.OpNumber:
|
2021-05-31 19:36:30 +03:00
|
|
|
bb, err := appendNumber(ctx, b, ptrToNumber(load(ctxptr, code.Idx)))
|
2021-05-19 06:34:40 +03:00
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendComma(ctx, bb)
|
2021-05-19 06:34:40 +03:00
|
|
|
code = code.Next
|
|
|
|
case encoder.OpInterfacePtr:
|
|
|
|
p := loadNPtr(ctxptr, code.Idx, code.PtrNum)
|
|
|
|
if p == 0 {
|
2021-11-28 15:46:32 +03:00
|
|
|
b = appendNullComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
code = code.Next
|
|
|
|
break
|
|
|
|
}
|
|
|
|
store(ctxptr, code.Idx, p)
|
|
|
|
fallthrough
|
|
|
|
case encoder.OpInterface:
|
|
|
|
p := load(ctxptr, code.Idx)
|
|
|
|
if p == 0 {
|
2021-11-28 15:46:32 +03:00
|
|
|
b = appendNullComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
code = code.Next
|
|
|
|
break
|
|
|
|
}
|
2021-06-26 09:49:13 +03:00
|
|
|
if recursiveLevel > encoder.StartDetectingCyclesAfter {
|
|
|
|
for _, seen := range ctx.SeenPtr {
|
|
|
|
if p == seen {
|
|
|
|
return nil, errUnsupportedValue(code, p)
|
|
|
|
}
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
ctx.SeenPtr = append(ctx.SeenPtr, p)
|
2021-08-30 07:03:14 +03:00
|
|
|
var (
|
|
|
|
typ *runtime.Type
|
|
|
|
ifacePtr unsafe.Pointer
|
|
|
|
)
|
2021-08-30 07:11:44 +03:00
|
|
|
up := ptrToUnsafePtr(p)
|
2021-08-30 07:03:14 +03:00
|
|
|
if code.Flags&encoder.NonEmptyInterfaceFlags != 0 {
|
2021-08-30 07:11:44 +03:00
|
|
|
iface := (*nonEmptyInterface)(up)
|
2021-08-30 07:03:14 +03:00
|
|
|
ifacePtr = iface.ptr
|
2021-09-27 04:55:37 +03:00
|
|
|
if iface.itab != nil {
|
2021-10-14 09:00:28 +03:00
|
|
|
typ = iface.itab.typ
|
2021-09-27 04:55:37 +03:00
|
|
|
}
|
2021-08-30 07:03:14 +03:00
|
|
|
} else {
|
2021-08-30 07:11:44 +03:00
|
|
|
iface := (*emptyInterface)(up)
|
2021-08-30 07:03:14 +03:00
|
|
|
ifacePtr = iface.ptr
|
|
|
|
typ = iface.typ
|
|
|
|
}
|
2022-07-03 00:05:26 +03:00
|
|
|
isDirectedNil := typ != nil && typ.Kind() == reflect.Struct && !runtime.IfaceIndir(typ)
|
|
|
|
if ifacePtr == nil && !isDirectedNil {
|
2021-11-28 15:46:32 +03:00
|
|
|
b = appendNullComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
code = code.Next
|
|
|
|
break
|
|
|
|
}
|
2021-08-30 07:11:44 +03:00
|
|
|
ctx.KeepRefs = append(ctx.KeepRefs, up)
|
2022-01-03 06:33:51 +03:00
|
|
|
ifaceCodeSet, err := encoder.CompileToGetCodeSet(ctx, uintptr(unsafe.Pointer(typ)))
|
2021-05-19 06:34:40 +03:00
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
2021-06-25 14:17:12 +03:00
|
|
|
|
|
|
|
totalLength := uintptr(code.Length) + 3
|
|
|
|
nextTotalLength := uintptr(ifaceCodeSet.CodeLength) + 3
|
|
|
|
|
|
|
|
var c *encoder.Opcode
|
|
|
|
if (ctx.Option.Flag & encoder.HTMLEscapeOption) != 0 {
|
|
|
|
c = ifaceCodeSet.InterfaceEscapeKeyCode
|
|
|
|
} else {
|
|
|
|
c = ifaceCodeSet.InterfaceNoescapeKeyCode
|
|
|
|
}
|
|
|
|
curlen := uintptr(len(ctx.Ptrs))
|
|
|
|
offsetNum := ptrOffset / uintptrSize
|
|
|
|
oldOffset := ptrOffset
|
|
|
|
ptrOffset += totalLength * uintptrSize
|
|
|
|
oldBaseIndent := ctx.BaseIndent
|
2022-01-04 16:30:16 +03:00
|
|
|
ctx.BaseIndent += code.Indent
|
2021-06-25 14:17:12 +03:00
|
|
|
|
|
|
|
newLen := offsetNum + totalLength + nextTotalLength
|
|
|
|
if curlen < newLen {
|
|
|
|
ctx.Ptrs = append(ctx.Ptrs, make([]uintptr, newLen-curlen)...)
|
|
|
|
}
|
|
|
|
ctxptr = ctx.Ptr() + ptrOffset // assign new ctxptr
|
|
|
|
|
|
|
|
end := ifaceCodeSet.EndCode
|
2021-08-30 07:03:14 +03:00
|
|
|
store(ctxptr, c.Idx, uintptr(ifacePtr))
|
2021-06-25 14:17:12 +03:00
|
|
|
store(ctxptr, end.Idx, oldOffset)
|
|
|
|
store(ctxptr, end.ElemIdx, uintptr(unsafe.Pointer(code.Next)))
|
2021-06-25 16:27:00 +03:00
|
|
|
storeIndent(ctxptr, end, uintptr(oldBaseIndent))
|
2021-06-25 14:17:12 +03:00
|
|
|
code = c
|
2021-06-26 09:49:13 +03:00
|
|
|
recursiveLevel++
|
2021-06-25 14:17:12 +03:00
|
|
|
case encoder.OpInterfaceEnd:
|
2021-06-26 09:49:13 +03:00
|
|
|
recursiveLevel--
|
|
|
|
|
2021-06-25 14:17:12 +03:00
|
|
|
// restore ctxptr
|
2021-06-26 09:49:13 +03:00
|
|
|
offset := load(ctxptr, code.Idx)
|
2021-06-25 14:17:12 +03:00
|
|
|
restoreIndent(ctx, code, ctxptr)
|
2021-05-19 06:34:40 +03:00
|
|
|
ctx.SeenPtr = ctx.SeenPtr[:len(ctx.SeenPtr)-1]
|
|
|
|
|
2021-06-25 14:17:12 +03:00
|
|
|
codePtr := load(ctxptr, code.ElemIdx)
|
|
|
|
code = (*encoder.Opcode)(ptrToUnsafePtr(codePtr))
|
|
|
|
ctxptr = ctx.Ptr() + offset
|
|
|
|
ptrOffset = offset
|
2021-05-19 06:34:40 +03:00
|
|
|
case encoder.OpMarshalJSONPtr:
|
|
|
|
p := load(ctxptr, code.Idx)
|
|
|
|
if p == 0 {
|
2021-11-28 15:46:32 +03:00
|
|
|
b = appendNullComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
code = code.Next
|
|
|
|
break
|
|
|
|
}
|
|
|
|
store(ctxptr, code.Idx, ptrToPtr(p))
|
|
|
|
fallthrough
|
|
|
|
case encoder.OpMarshalJSON:
|
|
|
|
p := load(ctxptr, code.Idx)
|
|
|
|
if p == 0 {
|
2021-11-28 15:46:32 +03:00
|
|
|
b = appendNullComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
code = code.Next
|
|
|
|
break
|
|
|
|
}
|
2021-05-29 08:47:18 +03:00
|
|
|
if (code.Flags&encoder.IsNilableTypeFlags) != 0 && (code.Flags&encoder.IndirectFlags) != 0 {
|
2021-05-19 06:34:40 +03:00
|
|
|
p = ptrToPtr(p)
|
|
|
|
}
|
|
|
|
bb, err := appendMarshalJSON(ctx, code, b, ptrToInterface(code, p))
|
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendComma(ctx, bb)
|
2021-05-19 06:34:40 +03:00
|
|
|
code = code.Next
|
|
|
|
case encoder.OpMarshalTextPtr:
|
|
|
|
p := load(ctxptr, code.Idx)
|
|
|
|
if p == 0 {
|
2021-11-28 15:46:32 +03:00
|
|
|
b = appendNullComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
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, `""`...)
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
code = code.Next
|
|
|
|
break
|
|
|
|
}
|
2021-05-29 08:47:18 +03:00
|
|
|
if (code.Flags&encoder.IsNilableTypeFlags) != 0 && (code.Flags&encoder.IndirectFlags) != 0 {
|
2021-05-19 06:34:40 +03:00
|
|
|
p = ptrToPtr(p)
|
|
|
|
}
|
2021-05-31 19:25:05 +03:00
|
|
|
bb, err := appendMarshalText(ctx, code, b, ptrToInterface(code, p))
|
2021-05-19 06:34:40 +03:00
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendComma(ctx, bb)
|
2021-05-19 06:34:40 +03:00
|
|
|
code = code.Next
|
|
|
|
case encoder.OpSlicePtr:
|
|
|
|
p := loadNPtr(ctxptr, code.Idx, code.PtrNum)
|
|
|
|
if p == 0 {
|
2021-11-28 15:46:32 +03:00
|
|
|
b = appendNullComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
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 {
|
2021-11-28 15:46:32 +03:00
|
|
|
b = appendNullComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
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 {
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendEmptyArray(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
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)
|
2021-05-29 08:47:18 +03:00
|
|
|
data := load(ctxptr, code.Idx)
|
|
|
|
size := uintptr(code.Size)
|
2021-05-19 06:34:40 +03:00
|
|
|
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 {
|
2021-11-28 15:46:32 +03:00
|
|
|
b = appendNullComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
code = code.End.Next
|
|
|
|
break
|
|
|
|
}
|
|
|
|
store(ctxptr, code.Idx, p)
|
|
|
|
fallthrough
|
|
|
|
case encoder.OpArray:
|
|
|
|
p := load(ctxptr, code.Idx)
|
|
|
|
if p == 0 {
|
2021-11-28 15:46:32 +03:00
|
|
|
b = appendNullComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
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 {
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendEmptyArray(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
code = code.End.Next
|
|
|
|
}
|
|
|
|
case encoder.OpArrayElem:
|
|
|
|
idx := load(ctxptr, code.ElemIdx)
|
|
|
|
idx++
|
2021-05-29 08:47:18 +03:00
|
|
|
if idx < uintptr(code.Length) {
|
2021-05-19 06:34:40 +03:00
|
|
|
b = appendArrayElemIndent(ctx, code, b)
|
|
|
|
store(ctxptr, code.ElemIdx, idx)
|
2021-05-29 08:47:18 +03:00
|
|
|
p := load(ctxptr, code.Idx)
|
|
|
|
size := uintptr(code.Size)
|
2021-05-19 06:34:40 +03:00
|
|
|
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 {
|
2021-11-28 15:46:32 +03:00
|
|
|
b = appendNullComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
code = code.End.Next
|
|
|
|
break
|
|
|
|
}
|
|
|
|
store(ctxptr, code.Idx, p)
|
|
|
|
fallthrough
|
|
|
|
case encoder.OpMap:
|
|
|
|
p := load(ctxptr, code.Idx)
|
|
|
|
if p == 0 {
|
2021-11-28 15:46:32 +03:00
|
|
|
b = appendNullComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
code = code.End.Next
|
|
|
|
break
|
|
|
|
}
|
|
|
|
uptr := ptrToUnsafePtr(p)
|
|
|
|
mlen := maplen(uptr)
|
|
|
|
if mlen <= 0 {
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendEmptyObject(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
code = code.End.Next
|
|
|
|
break
|
|
|
|
}
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendStructHead(ctx, b)
|
2022-01-03 16:42:04 +03:00
|
|
|
unorderedMap := (ctx.Option.Flag & encoder.UnorderedMapOption) != 0
|
|
|
|
mapCtx := encoder.NewMapContext(mlen, unorderedMap)
|
2021-12-27 05:14:42 +03:00
|
|
|
mapiterinit(code.Type, uptr, &mapCtx.Iter)
|
2021-12-27 11:50:55 +03:00
|
|
|
store(ctxptr, code.Idx, uintptr(unsafe.Pointer(mapCtx)))
|
2021-12-27 05:14:42 +03:00
|
|
|
ctx.KeepRefs = append(ctx.KeepRefs, unsafe.Pointer(mapCtx))
|
2022-01-03 16:42:04 +03:00
|
|
|
if unorderedMap {
|
2021-05-31 16:25:33 +03:00
|
|
|
b = appendMapKeyIndent(ctx, code.Next, b)
|
|
|
|
} else {
|
2021-12-27 05:14:42 +03:00
|
|
|
mapCtx.Start = len(b)
|
|
|
|
mapCtx.First = len(b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
2021-12-27 05:14:42 +03:00
|
|
|
key := mapiterkey(&mapCtx.Iter)
|
2021-05-19 06:34:40 +03:00
|
|
|
store(ctxptr, code.Next.Idx, uintptr(key))
|
|
|
|
code = code.Next
|
|
|
|
case encoder.OpMapKey:
|
2021-12-27 11:50:55 +03:00
|
|
|
mapCtx := (*encoder.MapContext)(ptrToUnsafePtr(load(ctxptr, code.Idx)))
|
2021-12-27 05:14:42 +03:00
|
|
|
idx := mapCtx.Idx
|
2021-05-19 06:34:40 +03:00
|
|
|
idx++
|
2021-06-01 07:40:15 +03:00
|
|
|
if (ctx.Option.Flag & encoder.UnorderedMapOption) != 0 {
|
2021-12-27 05:14:42 +03:00
|
|
|
if idx < mapCtx.Len {
|
2021-05-19 06:34:40 +03:00
|
|
|
b = appendMapKeyIndent(ctx, code, b)
|
2021-12-27 05:14:42 +03:00
|
|
|
mapCtx.Idx = int(idx)
|
|
|
|
key := mapiterkey(&mapCtx.Iter)
|
2021-05-19 06:34:40 +03:00
|
|
|
store(ctxptr, code.Next.Idx, uintptr(key))
|
|
|
|
code = code.Next
|
|
|
|
} else {
|
|
|
|
b = appendObjectEnd(ctx, code, b)
|
2021-12-27 05:14:42 +03:00
|
|
|
encoder.ReleaseMapContext(mapCtx)
|
2021-05-19 06:34:40 +03:00
|
|
|
code = code.End.Next
|
|
|
|
}
|
|
|
|
} else {
|
2021-12-27 05:14:42 +03:00
|
|
|
mapCtx.Slice.Items[mapCtx.Idx].Value = b[mapCtx.Start:len(b)]
|
|
|
|
if idx < mapCtx.Len {
|
|
|
|
mapCtx.Idx = int(idx)
|
|
|
|
mapCtx.Start = len(b)
|
|
|
|
key := mapiterkey(&mapCtx.Iter)
|
2021-05-19 06:34:40 +03:00
|
|
|
store(ctxptr, code.Next.Idx, uintptr(key))
|
|
|
|
code = code.Next
|
|
|
|
} else {
|
|
|
|
code = code.End
|
|
|
|
}
|
|
|
|
}
|
|
|
|
case encoder.OpMapValue:
|
2021-12-27 11:50:55 +03:00
|
|
|
mapCtx := (*encoder.MapContext)(ptrToUnsafePtr(load(ctxptr, code.Idx)))
|
2021-06-01 07:40:15 +03:00
|
|
|
if (ctx.Option.Flag & encoder.UnorderedMapOption) != 0 {
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendColon(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
} else {
|
2021-12-27 05:14:42 +03:00
|
|
|
mapCtx.Slice.Items[mapCtx.Idx].Key = b[mapCtx.Start:len(b)]
|
|
|
|
mapCtx.Start = len(b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
2021-12-27 05:14:42 +03:00
|
|
|
value := mapitervalue(&mapCtx.Iter)
|
2021-05-19 06:34:40 +03:00
|
|
|
store(ctxptr, code.Next.Idx, uintptr(value))
|
2021-12-27 05:14:42 +03:00
|
|
|
mapiternext(&mapCtx.Iter)
|
2021-05-19 06:34:40 +03:00
|
|
|
code = code.Next
|
|
|
|
case encoder.OpMapEnd:
|
|
|
|
// this operation only used by sorted map.
|
2021-12-27 11:50:55 +03:00
|
|
|
mapCtx := (*encoder.MapContext)(ptrToUnsafePtr(load(ctxptr, code.Idx)))
|
2021-05-19 06:34:40 +03:00
|
|
|
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)
|
2021-12-27 05:14:42 +03:00
|
|
|
b = b[:mapCtx.First]
|
2021-05-19 06:34:40 +03:00
|
|
|
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
|
2021-06-12 16:38:52 +03:00
|
|
|
indentDiffFromTop := c.Indent - 1
|
|
|
|
ctx.BaseIndent += code.Indent - indentDiffFromTop
|
2021-05-19 06:34:40 +03:00
|
|
|
|
|
|
|
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)))
|
2021-06-25 16:27:00 +03:00
|
|
|
storeIndent(ctxptr, c.End.Next, uintptr(oldBaseIndent))
|
2021-05-19 06:34:40 +03:00
|
|
|
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 {
|
2021-05-29 08:47:18 +03:00
|
|
|
if code.Flags&encoder.AnonymousHeadFlags == 0 {
|
2021-11-28 15:46:32 +03:00
|
|
|
b = appendNullComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
code = code.End.Next
|
|
|
|
break
|
|
|
|
}
|
|
|
|
store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
|
|
|
|
fallthrough
|
|
|
|
case encoder.OpStructHead:
|
|
|
|
p := load(ctxptr, code.Idx)
|
2021-05-29 08:47:18 +03:00
|
|
|
if p == 0 && ((code.Flags&encoder.IndirectFlags) != 0 || code.Next.Op == encoder.OpStructEnd) {
|
|
|
|
if code.Flags&encoder.AnonymousHeadFlags == 0 {
|
2021-11-28 15:46:32 +03:00
|
|
|
b = appendNullComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
code = code.End.Next
|
|
|
|
break
|
|
|
|
}
|
2021-05-29 08:47:18 +03:00
|
|
|
if code.Flags&encoder.AnonymousHeadFlags == 0 {
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendStructHead(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
2021-07-20 16:14:26 +03:00
|
|
|
if len(code.Key) > 0 {
|
|
|
|
if (code.Flags&encoder.IsTaggedKeyFlags) != 0 || code.Flags&encoder.AnonymousKeyFlags == 0 {
|
|
|
|
b = appendStructKey(ctx, code, b)
|
|
|
|
}
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
2021-05-29 08:47:18 +03:00
|
|
|
p += uintptr(code.Offset)
|
2021-05-19 06:34:40 +03:00
|
|
|
code = code.Next
|
|
|
|
store(ctxptr, code.Idx, p)
|
|
|
|
case encoder.OpStructPtrHeadOmitEmpty:
|
|
|
|
p := load(ctxptr, code.Idx)
|
|
|
|
if p == 0 {
|
2021-05-29 08:47:18 +03:00
|
|
|
if code.Flags&encoder.AnonymousHeadFlags == 0 {
|
2021-11-28 15:46:32 +03:00
|
|
|
b = appendNullComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
code = code.End.Next
|
|
|
|
break
|
|
|
|
}
|
|
|
|
store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
|
|
|
|
fallthrough
|
|
|
|
case encoder.OpStructHeadOmitEmpty:
|
|
|
|
p := load(ctxptr, code.Idx)
|
2021-05-29 08:47:18 +03:00
|
|
|
if p == 0 && ((code.Flags&encoder.IndirectFlags) != 0 || code.Next.Op == encoder.OpStructEnd) {
|
|
|
|
if code.Flags&encoder.AnonymousHeadFlags == 0 {
|
2021-11-28 15:46:32 +03:00
|
|
|
b = appendNullComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
code = code.End.Next
|
|
|
|
break
|
|
|
|
}
|
2021-05-29 08:47:18 +03:00
|
|
|
if code.Flags&encoder.AnonymousHeadFlags == 0 {
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendStructHead(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
2021-05-29 08:47:18 +03:00
|
|
|
p += uintptr(code.Offset)
|
|
|
|
if p == 0 || (ptrToPtr(p) == 0 && (code.Flags&encoder.IsNextOpPtrTypeFlags) != 0) {
|
2021-05-19 06:34:40 +03:00
|
|
|
code = code.NextField
|
|
|
|
} else {
|
|
|
|
b = appendStructKey(ctx, code, b)
|
|
|
|
code = code.Next
|
|
|
|
store(ctxptr, code.Idx, p)
|
|
|
|
}
|
|
|
|
case encoder.OpStructPtrHeadInt:
|
2021-05-29 08:47:18 +03:00
|
|
|
if (code.Flags & encoder.IndirectFlags) != 0 {
|
2021-05-19 06:34:40 +03:00
|
|
|
p := load(ctxptr, code.Idx)
|
|
|
|
if p == 0 {
|
2021-05-29 08:47:18 +03:00
|
|
|
if code.Flags&encoder.AnonymousHeadFlags == 0 {
|
2021-11-28 15:46:32 +03:00
|
|
|
b = appendNullComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
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 {
|
2021-05-29 08:47:18 +03:00
|
|
|
if code.Flags&encoder.AnonymousHeadFlags == 0 {
|
2021-11-28 15:46:32 +03:00
|
|
|
b = appendNullComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
code = code.End.Next
|
|
|
|
break
|
|
|
|
}
|
2021-05-29 08:47:18 +03:00
|
|
|
if code.Flags&encoder.AnonymousHeadFlags == 0 {
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendStructHead(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
b = appendStructKey(ctx, code, b)
|
2021-10-14 09:00:28 +03:00
|
|
|
b = appendInt(ctx, b, p+uintptr(code.Offset), code)
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
code = code.Next
|
|
|
|
case encoder.OpStructPtrHeadOmitEmptyInt:
|
2021-05-29 08:47:18 +03:00
|
|
|
if (code.Flags & encoder.IndirectFlags) != 0 {
|
2021-05-19 06:34:40 +03:00
|
|
|
p := load(ctxptr, code.Idx)
|
|
|
|
if p == 0 {
|
2021-05-29 08:47:18 +03:00
|
|
|
if code.Flags&encoder.AnonymousHeadFlags == 0 {
|
2021-11-28 15:46:32 +03:00
|
|
|
b = appendNullComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
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 {
|
2021-05-29 08:47:18 +03:00
|
|
|
if code.Flags&encoder.AnonymousHeadFlags == 0 {
|
2021-11-28 15:46:32 +03:00
|
|
|
b = appendNullComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
code = code.End.Next
|
|
|
|
break
|
|
|
|
}
|
2021-05-29 08:47:18 +03:00
|
|
|
if code.Flags&encoder.AnonymousHeadFlags == 0 {
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendStructHead(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
2021-10-14 09:00:28 +03:00
|
|
|
u64 := ptrToUint64(p+uintptr(code.Offset), code.NumBitSize)
|
2021-05-29 08:47:18 +03:00
|
|
|
v := u64 & ((1 << code.NumBitSize) - 1)
|
2021-05-19 06:34:40 +03:00
|
|
|
if v == 0 {
|
|
|
|
code = code.NextField
|
|
|
|
} else {
|
|
|
|
b = appendStructKey(ctx, code, b)
|
2021-10-14 09:00:28 +03:00
|
|
|
b = appendInt(ctx, b, p+uintptr(code.Offset), code)
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
code = code.Next
|
|
|
|
}
|
|
|
|
case encoder.OpStructPtrHeadIntString:
|
2021-05-29 08:47:18 +03:00
|
|
|
if (code.Flags & encoder.IndirectFlags) != 0 {
|
2021-05-19 06:34:40 +03:00
|
|
|
p := load(ctxptr, code.Idx)
|
|
|
|
if p == 0 {
|
2021-05-29 08:47:18 +03:00
|
|
|
if code.Flags&encoder.AnonymousHeadFlags == 0 {
|
2021-11-28 15:46:32 +03:00
|
|
|
b = appendNullComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
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 {
|
2021-05-29 08:47:18 +03:00
|
|
|
if code.Flags&encoder.AnonymousHeadFlags == 0 {
|
2021-11-28 15:46:32 +03:00
|
|
|
b = appendNullComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
code = code.End.Next
|
|
|
|
break
|
|
|
|
}
|
2021-05-29 08:47:18 +03:00
|
|
|
if code.Flags&encoder.AnonymousHeadFlags == 0 {
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendStructHead(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
b = appendStructKey(ctx, code, b)
|
|
|
|
b = append(b, '"')
|
2021-10-14 09:00:28 +03:00
|
|
|
b = appendInt(ctx, b, p+uintptr(code.Offset), code)
|
2021-05-19 06:34:40 +03:00
|
|
|
b = append(b, '"')
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
code = code.Next
|
|
|
|
case encoder.OpStructPtrHeadOmitEmptyIntString:
|
2021-05-29 08:47:18 +03:00
|
|
|
if (code.Flags & encoder.IndirectFlags) != 0 {
|
2021-05-19 06:34:40 +03:00
|
|
|
p := load(ctxptr, code.Idx)
|
|
|
|
if p == 0 {
|
2021-05-29 08:47:18 +03:00
|
|
|
if code.Flags&encoder.AnonymousHeadFlags == 0 {
|
2021-11-28 15:46:32 +03:00
|
|
|
b = appendNullComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
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 {
|
2021-05-29 08:47:18 +03:00
|
|
|
if code.Flags&encoder.AnonymousHeadFlags == 0 {
|
2021-11-28 15:46:32 +03:00
|
|
|
b = appendNullComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
code = code.End.Next
|
|
|
|
break
|
|
|
|
}
|
2021-05-29 08:47:18 +03:00
|
|
|
if code.Flags&encoder.AnonymousHeadFlags == 0 {
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendStructHead(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
2022-01-11 09:11:17 +03:00
|
|
|
p += uintptr(code.Offset)
|
|
|
|
u64 := ptrToUint64(p, code.NumBitSize)
|
2021-05-29 08:47:18 +03:00
|
|
|
v := u64 & ((1 << code.NumBitSize) - 1)
|
2021-05-19 06:34:40 +03:00
|
|
|
if v == 0 {
|
|
|
|
code = code.NextField
|
|
|
|
} else {
|
|
|
|
b = appendStructKey(ctx, code, b)
|
|
|
|
b = append(b, '"')
|
2022-01-11 09:11:17 +03:00
|
|
|
b = appendInt(ctx, b, p, code)
|
2021-05-19 06:34:40 +03:00
|
|
|
b = append(b, '"')
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
code = code.Next
|
|
|
|
}
|
|
|
|
case encoder.OpStructPtrHeadIntPtr:
|
|
|
|
p := load(ctxptr, code.Idx)
|
|
|
|
if p == 0 {
|
2021-05-29 08:47:18 +03:00
|
|
|
if code.Flags&encoder.AnonymousHeadFlags == 0 {
|
2021-11-28 15:46:32 +03:00
|
|
|
b = appendNullComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
code = code.End.Next
|
|
|
|
break
|
|
|
|
}
|
|
|
|
store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
|
|
|
|
fallthrough
|
|
|
|
case encoder.OpStructHeadIntPtr:
|
|
|
|
p := load(ctxptr, code.Idx)
|
2021-05-29 08:47:18 +03:00
|
|
|
if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 {
|
|
|
|
if code.Flags&encoder.AnonymousHeadFlags == 0 {
|
2021-11-28 15:46:32 +03:00
|
|
|
b = appendNullComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
code = code.End.Next
|
|
|
|
break
|
|
|
|
}
|
2021-05-29 08:47:18 +03:00
|
|
|
if code.Flags&encoder.AnonymousHeadFlags == 0 {
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendStructHead(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
b = appendStructKey(ctx, code, b)
|
2021-05-29 08:47:18 +03:00
|
|
|
if (code.Flags & encoder.IndirectFlags) != 0 {
|
|
|
|
p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
if p == 0 {
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendNull(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
} else {
|
2021-10-14 09:00:28 +03:00
|
|
|
b = appendInt(ctx, b, p, code)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
code = code.Next
|
|
|
|
case encoder.OpStructPtrHeadOmitEmptyIntPtr:
|
|
|
|
p := load(ctxptr, code.Idx)
|
|
|
|
if p == 0 {
|
2021-05-29 08:47:18 +03:00
|
|
|
if code.Flags&encoder.AnonymousHeadFlags == 0 {
|
2021-11-28 15:46:32 +03:00
|
|
|
b = appendNullComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
code = code.End.Next
|
|
|
|
break
|
|
|
|
}
|
|
|
|
store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
|
|
|
|
fallthrough
|
|
|
|
case encoder.OpStructHeadOmitEmptyIntPtr:
|
|
|
|
p := load(ctxptr, code.Idx)
|
2021-05-29 08:47:18 +03:00
|
|
|
if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 {
|
|
|
|
if code.Flags&encoder.AnonymousHeadFlags == 0 {
|
2021-11-28 15:46:32 +03:00
|
|
|
b = appendNullComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
code = code.End.Next
|
|
|
|
break
|
|
|
|
}
|
2021-05-29 08:47:18 +03:00
|
|
|
if code.Flags&encoder.AnonymousHeadFlags == 0 {
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendStructHead(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
2021-05-29 08:47:18 +03:00
|
|
|
if (code.Flags & encoder.IndirectFlags) != 0 {
|
|
|
|
p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
if p != 0 {
|
|
|
|
b = appendStructKey(ctx, code, b)
|
2021-10-14 09:00:28 +03:00
|
|
|
b = appendInt(ctx, b, p, code)
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
code = code.Next
|
|
|
|
case encoder.OpStructPtrHeadIntPtrString:
|
|
|
|
p := load(ctxptr, code.Idx)
|
|
|
|
if p == 0 {
|
2021-05-29 08:47:18 +03:00
|
|
|
if code.Flags&encoder.AnonymousHeadFlags == 0 {
|
2021-11-28 15:46:32 +03:00
|
|
|
b = appendNullComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
code = code.End.Next
|
|
|
|
break
|
|
|
|
}
|
|
|
|
store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
|
|
|
|
fallthrough
|
|
|
|
case encoder.OpStructHeadIntPtrString:
|
|
|
|
p := load(ctxptr, code.Idx)
|
2021-05-29 08:47:18 +03:00
|
|
|
if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 {
|
|
|
|
if code.Flags&encoder.AnonymousHeadFlags == 0 {
|
2021-11-28 15:46:32 +03:00
|
|
|
b = appendNullComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
code = code.End.Next
|
|
|
|
break
|
|
|
|
}
|
2021-05-29 08:47:18 +03:00
|
|
|
if code.Flags&encoder.AnonymousHeadFlags == 0 {
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendStructHead(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
b = appendStructKey(ctx, code, b)
|
2021-05-29 08:47:18 +03:00
|
|
|
if (code.Flags & encoder.IndirectFlags) != 0 {
|
|
|
|
p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
if p == 0 {
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendNull(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
} else {
|
|
|
|
b = append(b, '"')
|
2021-10-14 09:00:28 +03:00
|
|
|
b = appendInt(ctx, b, p, code)
|
2021-05-19 06:34:40 +03:00
|
|
|
b = append(b, '"')
|
|
|
|
}
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
code = code.Next
|
|
|
|
case encoder.OpStructPtrHeadOmitEmptyIntPtrString:
|
|
|
|
p := load(ctxptr, code.Idx)
|
|
|
|
if p == 0 {
|
2021-05-29 08:47:18 +03:00
|
|
|
if code.Flags&encoder.AnonymousHeadFlags == 0 {
|
2021-11-28 15:46:32 +03:00
|
|
|
b = appendNullComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
code = code.End.Next
|
|
|
|
break
|
|
|
|
}
|
|
|
|
store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
|
|
|
|
fallthrough
|
|
|
|
case encoder.OpStructHeadOmitEmptyIntPtrString:
|
|
|
|
p := load(ctxptr, code.Idx)
|
2021-05-29 08:47:18 +03:00
|
|
|
if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 {
|
|
|
|
if code.Flags&encoder.AnonymousHeadFlags == 0 {
|
2021-11-28 15:46:32 +03:00
|
|
|
b = appendNullComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
code = code.End.Next
|
|
|
|
break
|
|
|
|
}
|
2021-05-29 08:47:18 +03:00
|
|
|
if code.Flags&encoder.AnonymousHeadFlags == 0 {
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendStructHead(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
2021-05-29 08:47:18 +03:00
|
|
|
if (code.Flags & encoder.IndirectFlags) != 0 {
|
|
|
|
p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
if p != 0 {
|
|
|
|
b = appendStructKey(ctx, code, b)
|
|
|
|
b = append(b, '"')
|
2021-10-14 09:00:28 +03:00
|
|
|
b = appendInt(ctx, b, p, code)
|
2021-05-19 06:34:40 +03:00
|
|
|
b = append(b, '"')
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
code = code.Next
|
|
|
|
case encoder.OpStructPtrHeadUint:
|
2021-05-29 08:47:18 +03:00
|
|
|
if (code.Flags & encoder.IndirectFlags) != 0 {
|
2021-05-19 06:34:40 +03:00
|
|
|
p := load(ctxptr, code.Idx)
|
|
|
|
if p == 0 {
|
2021-05-29 08:47:18 +03:00
|
|
|
if code.Flags&encoder.AnonymousHeadFlags == 0 {
|
2021-11-28 15:46:32 +03:00
|
|
|
b = appendNullComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
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 {
|
2021-05-29 08:47:18 +03:00
|
|
|
if code.Flags&encoder.AnonymousHeadFlags == 0 {
|
2021-11-28 15:46:32 +03:00
|
|
|
b = appendNullComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
code = code.End.Next
|
|
|
|
break
|
|
|
|
}
|
2021-05-29 08:47:18 +03:00
|
|
|
if code.Flags&encoder.AnonymousHeadFlags == 0 {
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendStructHead(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
b = appendStructKey(ctx, code, b)
|
2021-10-14 09:00:28 +03:00
|
|
|
b = appendUint(ctx, b, p+uintptr(code.Offset), code)
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
code = code.Next
|
|
|
|
case encoder.OpStructPtrHeadOmitEmptyUint:
|
2021-05-29 08:47:18 +03:00
|
|
|
if (code.Flags & encoder.IndirectFlags) != 0 {
|
2021-05-19 06:34:40 +03:00
|
|
|
p := load(ctxptr, code.Idx)
|
|
|
|
if p == 0 {
|
2021-05-29 08:47:18 +03:00
|
|
|
if code.Flags&encoder.AnonymousHeadFlags == 0 {
|
2021-11-28 15:46:32 +03:00
|
|
|
b = appendNullComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
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 {
|
2021-05-29 08:47:18 +03:00
|
|
|
if code.Flags&encoder.AnonymousHeadFlags == 0 {
|
2021-11-28 15:46:32 +03:00
|
|
|
b = appendNullComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
code = code.End.Next
|
|
|
|
break
|
|
|
|
}
|
2021-05-29 08:47:18 +03:00
|
|
|
if code.Flags&encoder.AnonymousHeadFlags == 0 {
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendStructHead(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
2021-10-14 09:00:28 +03:00
|
|
|
u64 := ptrToUint64(p+uintptr(code.Offset), code.NumBitSize)
|
2021-05-29 08:47:18 +03:00
|
|
|
v := u64 & ((1 << code.NumBitSize) - 1)
|
2021-05-19 06:34:40 +03:00
|
|
|
if v == 0 {
|
|
|
|
code = code.NextField
|
|
|
|
} else {
|
|
|
|
b = appendStructKey(ctx, code, b)
|
2021-10-14 09:00:28 +03:00
|
|
|
b = appendUint(ctx, b, p+uintptr(code.Offset), code)
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
code = code.Next
|
|
|
|
}
|
|
|
|
case encoder.OpStructPtrHeadUintString:
|
2021-05-29 08:47:18 +03:00
|
|
|
if (code.Flags & encoder.IndirectFlags) != 0 {
|
2021-05-19 06:34:40 +03:00
|
|
|
p := load(ctxptr, code.Idx)
|
|
|
|
if p == 0 {
|
2021-05-29 08:47:18 +03:00
|
|
|
if code.Flags&encoder.AnonymousHeadFlags == 0 {
|
2021-11-28 15:46:32 +03:00
|
|
|
b = appendNullComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
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 {
|
2021-05-29 08:47:18 +03:00
|
|
|
if code.Flags&encoder.AnonymousHeadFlags == 0 {
|
2021-11-28 15:46:32 +03:00
|
|
|
b = appendNullComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
code = code.End.Next
|
|
|
|
break
|
|
|
|
}
|
2021-05-29 08:47:18 +03:00
|
|
|
if code.Flags&encoder.AnonymousHeadFlags == 0 {
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendStructHead(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
b = appendStructKey(ctx, code, b)
|
|
|
|
b = append(b, '"')
|
2021-10-14 09:00:28 +03:00
|
|
|
b = appendUint(ctx, b, p+uintptr(code.Offset), code)
|
2021-05-19 06:34:40 +03:00
|
|
|
b = append(b, '"')
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
code = code.Next
|
|
|
|
case encoder.OpStructPtrHeadOmitEmptyUintString:
|
2021-05-29 08:47:18 +03:00
|
|
|
if (code.Flags & encoder.IndirectFlags) != 0 {
|
2021-05-19 06:34:40 +03:00
|
|
|
p := load(ctxptr, code.Idx)
|
|
|
|
if p == 0 {
|
2021-05-29 08:47:18 +03:00
|
|
|
if code.Flags&encoder.AnonymousHeadFlags == 0 {
|
2021-11-28 15:46:32 +03:00
|
|
|
b = appendNullComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
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 {
|
2021-05-29 08:47:18 +03:00
|
|
|
if code.Flags&encoder.AnonymousHeadFlags == 0 {
|
2021-11-28 15:46:32 +03:00
|
|
|
b = appendNullComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
code = code.End.Next
|
|
|
|
break
|
|
|
|
}
|
2021-05-29 08:47:18 +03:00
|
|
|
if code.Flags&encoder.AnonymousHeadFlags == 0 {
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendStructHead(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
2021-10-14 09:00:28 +03:00
|
|
|
u64 := ptrToUint64(p+uintptr(code.Offset), code.NumBitSize)
|
2021-05-29 08:47:18 +03:00
|
|
|
v := u64 & ((1 << code.NumBitSize) - 1)
|
2021-05-19 06:34:40 +03:00
|
|
|
if v == 0 {
|
|
|
|
code = code.NextField
|
|
|
|
} else {
|
|
|
|
b = appendStructKey(ctx, code, b)
|
|
|
|
b = append(b, '"')
|
2021-10-14 09:00:28 +03:00
|
|
|
b = appendUint(ctx, b, p+uintptr(code.Offset), code)
|
2021-05-19 06:34:40 +03:00
|
|
|
b = append(b, '"')
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
code = code.Next
|
|
|
|
}
|
|
|
|
case encoder.OpStructPtrHeadUintPtr:
|
|
|
|
p := load(ctxptr, code.Idx)
|
|
|
|
if p == 0 {
|
2021-05-29 08:47:18 +03:00
|
|
|
if code.Flags&encoder.AnonymousHeadFlags == 0 {
|
2021-11-28 15:46:32 +03:00
|
|
|
b = appendNullComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
code = code.End.Next
|
|
|
|
break
|
|
|
|
}
|
|
|
|
store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
|
|
|
|
fallthrough
|
|
|
|
case encoder.OpStructHeadUintPtr:
|
|
|
|
p := load(ctxptr, code.Idx)
|
2021-05-29 08:47:18 +03:00
|
|
|
if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 {
|
|
|
|
if code.Flags&encoder.AnonymousHeadFlags == 0 {
|
2021-11-28 15:46:32 +03:00
|
|
|
b = appendNullComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
code = code.End.Next
|
|
|
|
break
|
|
|
|
}
|
2021-05-29 08:47:18 +03:00
|
|
|
if code.Flags&encoder.AnonymousHeadFlags == 0 {
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendStructHead(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
b = appendStructKey(ctx, code, b)
|
2021-05-29 08:47:18 +03:00
|
|
|
if (code.Flags & encoder.IndirectFlags) != 0 {
|
|
|
|
p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
if p == 0 {
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendNull(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
} else {
|
2021-10-14 09:00:28 +03:00
|
|
|
b = appendUint(ctx, b, p, code)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
code = code.Next
|
|
|
|
case encoder.OpStructPtrHeadOmitEmptyUintPtr:
|
|
|
|
p := load(ctxptr, code.Idx)
|
|
|
|
if p == 0 {
|
2021-05-29 08:47:18 +03:00
|
|
|
if code.Flags&encoder.AnonymousHeadFlags == 0 {
|
2021-11-28 15:46:32 +03:00
|
|
|
b = appendNullComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
code = code.End.Next
|
|
|
|
break
|
|
|
|
}
|
|
|
|
store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
|
|
|
|
fallthrough
|
|
|
|
case encoder.OpStructHeadOmitEmptyUintPtr:
|
|
|
|
p := load(ctxptr, code.Idx)
|
2021-05-29 08:47:18 +03:00
|
|
|
if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 {
|
|
|
|
if code.Flags&encoder.AnonymousHeadFlags == 0 {
|
2021-11-28 15:46:32 +03:00
|
|
|
b = appendNullComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
code = code.End.Next
|
|
|
|
break
|
|
|
|
}
|
2021-05-29 08:47:18 +03:00
|
|
|
if code.Flags&encoder.AnonymousHeadFlags == 0 {
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendStructHead(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
2021-05-29 08:47:18 +03:00
|
|
|
if (code.Flags & encoder.IndirectFlags) != 0 {
|
|
|
|
p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
if p != 0 {
|
|
|
|
b = appendStructKey(ctx, code, b)
|
2021-10-14 09:00:28 +03:00
|
|
|
b = appendUint(ctx, b, p, code)
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
code = code.Next
|
|
|
|
case encoder.OpStructPtrHeadUintPtrString:
|
|
|
|
p := load(ctxptr, code.Idx)
|
|
|
|
if p == 0 {
|
2021-05-29 08:47:18 +03:00
|
|
|
if code.Flags&encoder.AnonymousHeadFlags == 0 {
|
2021-11-28 15:46:32 +03:00
|
|
|
b = appendNullComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
code = code.End.Next
|
|
|
|
break
|
|
|
|
}
|
|
|
|
store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
|
|
|
|
fallthrough
|
|
|
|
case encoder.OpStructHeadUintPtrString:
|
|
|
|
p := load(ctxptr, code.Idx)
|
2021-05-29 08:47:18 +03:00
|
|
|
if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 {
|
|
|
|
if code.Flags&encoder.AnonymousHeadFlags == 0 {
|
2021-11-28 15:46:32 +03:00
|
|
|
b = appendNullComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
code = code.End.Next
|
|
|
|
break
|
|
|
|
}
|
2021-05-29 08:47:18 +03:00
|
|
|
if code.Flags&encoder.AnonymousHeadFlags == 0 {
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendStructHead(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
b = appendStructKey(ctx, code, b)
|
2021-05-29 08:47:18 +03:00
|
|
|
if (code.Flags & encoder.IndirectFlags) != 0 {
|
|
|
|
p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
if p == 0 {
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendNull(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
} else {
|
|
|
|
b = append(b, '"')
|
2021-10-14 09:00:28 +03:00
|
|
|
b = appendUint(ctx, b, p, code)
|
2021-05-19 06:34:40 +03:00
|
|
|
b = append(b, '"')
|
|
|
|
}
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
code = code.Next
|
|
|
|
case encoder.OpStructPtrHeadOmitEmptyUintPtrString:
|
|
|
|
p := load(ctxptr, code.Idx)
|
|
|
|
if p == 0 {
|
2021-05-29 08:47:18 +03:00
|
|
|
if code.Flags&encoder.AnonymousHeadFlags == 0 {
|
2021-11-28 15:46:32 +03:00
|
|
|
b = appendNullComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
code = code.End.Next
|
|
|
|
break
|
|
|
|
}
|
|
|
|
store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
|
|
|
|
fallthrough
|
|
|
|
case encoder.OpStructHeadOmitEmptyUintPtrString:
|
|
|
|
p := load(ctxptr, code.Idx)
|
2021-05-29 08:47:18 +03:00
|
|
|
if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 {
|
|
|
|
if code.Flags&encoder.AnonymousHeadFlags == 0 {
|
2021-11-28 15:46:32 +03:00
|
|
|
b = appendNullComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
code = code.End.Next
|
|
|
|
break
|
|
|
|
}
|
2021-05-29 08:47:18 +03:00
|
|
|
if code.Flags&encoder.AnonymousHeadFlags == 0 {
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendStructHead(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
2021-05-29 08:47:18 +03:00
|
|
|
if (code.Flags & encoder.IndirectFlags) != 0 {
|
|
|
|
p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
if p != 0 {
|
|
|
|
b = appendStructKey(ctx, code, b)
|
|
|
|
b = append(b, '"')
|
2021-10-14 09:00:28 +03:00
|
|
|
b = appendUint(ctx, b, p, code)
|
2021-05-19 06:34:40 +03:00
|
|
|
b = append(b, '"')
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
code = code.Next
|
|
|
|
case encoder.OpStructPtrHeadFloat32:
|
2021-05-29 08:47:18 +03:00
|
|
|
if (code.Flags & encoder.IndirectFlags) != 0 {
|
2021-05-19 06:34:40 +03:00
|
|
|
p := load(ctxptr, code.Idx)
|
|
|
|
if p == 0 {
|
2021-05-29 08:47:18 +03:00
|
|
|
if code.Flags&encoder.AnonymousHeadFlags == 0 {
|
2021-11-28 15:46:32 +03:00
|
|
|
b = appendNullComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
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 {
|
2021-05-29 08:47:18 +03:00
|
|
|
if code.Flags&encoder.AnonymousHeadFlags == 0 {
|
2021-11-28 15:46:32 +03:00
|
|
|
b = appendNullComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
code = code.End.Next
|
|
|
|
break
|
|
|
|
}
|
2021-05-29 08:47:18 +03:00
|
|
|
if code.Flags&encoder.AnonymousHeadFlags == 0 {
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendStructHead(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
b = appendStructKey(ctx, code, b)
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendFloat32(ctx, b, ptrToFloat32(p+uintptr(code.Offset)))
|
|
|
|
b = appendComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
code = code.Next
|
|
|
|
case encoder.OpStructPtrHeadOmitEmptyFloat32:
|
2021-05-29 08:47:18 +03:00
|
|
|
if (code.Flags & encoder.IndirectFlags) != 0 {
|
2021-05-19 06:34:40 +03:00
|
|
|
p := load(ctxptr, code.Idx)
|
|
|
|
if p == 0 {
|
2021-05-29 08:47:18 +03:00
|
|
|
if code.Flags&encoder.AnonymousHeadFlags == 0 {
|
2021-11-28 15:46:32 +03:00
|
|
|
b = appendNullComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
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 {
|
2021-05-29 08:47:18 +03:00
|
|
|
if code.Flags&encoder.AnonymousHeadFlags == 0 {
|
2021-11-28 15:46:32 +03:00
|
|
|
b = appendNullComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
code = code.End.Next
|
|
|
|
break
|
|
|
|
}
|
2021-05-29 08:47:18 +03:00
|
|
|
if code.Flags&encoder.AnonymousHeadFlags == 0 {
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendStructHead(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
2021-05-29 08:47:18 +03:00
|
|
|
v := ptrToFloat32(p + uintptr(code.Offset))
|
2021-05-19 06:34:40 +03:00
|
|
|
if v == 0 {
|
|
|
|
code = code.NextField
|
|
|
|
} else {
|
|
|
|
b = appendStructKey(ctx, code, b)
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendFloat32(ctx, b, v)
|
|
|
|
b = appendComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
code = code.Next
|
|
|
|
}
|
|
|
|
case encoder.OpStructPtrHeadFloat32String:
|
2021-05-29 08:47:18 +03:00
|
|
|
if (code.Flags & encoder.IndirectFlags) != 0 {
|
2021-05-19 06:34:40 +03:00
|
|
|
p := load(ctxptr, code.Idx)
|
|
|
|
if p == 0 {
|
2021-05-29 08:47:18 +03:00
|
|
|
if code.Flags&encoder.AnonymousHeadFlags == 0 {
|
2021-11-28 15:46:32 +03:00
|
|
|
b = appendNullComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
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 {
|
2021-05-29 08:47:18 +03:00
|
|
|
if code.Flags&encoder.AnonymousHeadFlags == 0 {
|
2021-11-28 15:46:32 +03:00
|
|
|
b = appendNullComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
code = code.End.Next
|
|
|
|
break
|
|
|
|
}
|
2021-05-29 08:47:18 +03:00
|
|
|
if code.Flags&encoder.AnonymousHeadFlags == 0 {
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendStructHead(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
b = appendStructKey(ctx, code, b)
|
|
|
|
b = append(b, '"')
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendFloat32(ctx, b, ptrToFloat32(p+uintptr(code.Offset)))
|
2021-05-19 06:34:40 +03:00
|
|
|
b = append(b, '"')
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
code = code.Next
|
|
|
|
case encoder.OpStructPtrHeadOmitEmptyFloat32String:
|
2021-05-29 08:47:18 +03:00
|
|
|
if (code.Flags & encoder.IndirectFlags) != 0 {
|
2021-05-19 06:34:40 +03:00
|
|
|
p := load(ctxptr, code.Idx)
|
|
|
|
if p == 0 {
|
2021-05-29 08:47:18 +03:00
|
|
|
if code.Flags&encoder.AnonymousHeadFlags == 0 {
|
2021-11-28 15:46:32 +03:00
|
|
|
b = appendNullComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
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 {
|
2021-05-29 08:47:18 +03:00
|
|
|
if code.Flags&encoder.AnonymousHeadFlags == 0 {
|
2021-11-28 15:46:32 +03:00
|
|
|
b = appendNullComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
code = code.End.Next
|
|
|
|
break
|
|
|
|
}
|
2021-05-29 08:47:18 +03:00
|
|
|
if code.Flags&encoder.AnonymousHeadFlags == 0 {
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendStructHead(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
2021-05-29 08:47:18 +03:00
|
|
|
v := ptrToFloat32(p + uintptr(code.Offset))
|
2021-05-19 06:34:40 +03:00
|
|
|
if v == 0 {
|
|
|
|
code = code.NextField
|
|
|
|
} else {
|
|
|
|
b = appendStructKey(ctx, code, b)
|
|
|
|
b = append(b, '"')
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendFloat32(ctx, b, v)
|
2021-05-19 06:34:40 +03:00
|
|
|
b = append(b, '"')
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
code = code.Next
|
|
|
|
}
|
|
|
|
case encoder.OpStructPtrHeadFloat32Ptr:
|
|
|
|
p := load(ctxptr, code.Idx)
|
|
|
|
if p == 0 {
|
2021-05-29 08:47:18 +03:00
|
|
|
if code.Flags&encoder.AnonymousHeadFlags == 0 {
|
2021-11-28 15:46:32 +03:00
|
|
|
b = appendNullComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
code = code.End.Next
|
|
|
|
break
|
|
|
|
}
|
|
|
|
store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
|
|
|
|
fallthrough
|
|
|
|
case encoder.OpStructHeadFloat32Ptr:
|
|
|
|
p := load(ctxptr, code.Idx)
|
2021-05-29 08:47:18 +03:00
|
|
|
if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 {
|
|
|
|
if code.Flags&encoder.AnonymousHeadFlags == 0 {
|
2021-11-28 15:46:32 +03:00
|
|
|
b = appendNullComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
code = code.End.Next
|
|
|
|
break
|
|
|
|
}
|
2021-05-29 08:47:18 +03:00
|
|
|
if code.Flags&encoder.AnonymousHeadFlags == 0 {
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendStructHead(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
b = appendStructKey(ctx, code, b)
|
2021-05-29 08:47:18 +03:00
|
|
|
if (code.Flags & encoder.IndirectFlags) != 0 {
|
|
|
|
p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
if p == 0 {
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendNull(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
} else {
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendFloat32(ctx, b, ptrToFloat32(p))
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
code = code.Next
|
|
|
|
case encoder.OpStructPtrHeadOmitEmptyFloat32Ptr:
|
|
|
|
p := load(ctxptr, code.Idx)
|
|
|
|
if p == 0 {
|
2021-05-29 08:47:18 +03:00
|
|
|
if code.Flags&encoder.AnonymousHeadFlags == 0 {
|
2021-11-28 15:46:32 +03:00
|
|
|
b = appendNullComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
code = code.End.Next
|
|
|
|
break
|
|
|
|
}
|
|
|
|
store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
|
|
|
|
fallthrough
|
|
|
|
case encoder.OpStructHeadOmitEmptyFloat32Ptr:
|
|
|
|
p := load(ctxptr, code.Idx)
|
2021-05-29 08:47:18 +03:00
|
|
|
if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 {
|
|
|
|
if code.Flags&encoder.AnonymousHeadFlags == 0 {
|
2021-11-28 15:46:32 +03:00
|
|
|
b = appendNullComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
code = code.End.Next
|
|
|
|
break
|
|
|
|
}
|
2021-05-29 08:47:18 +03:00
|
|
|
if code.Flags&encoder.AnonymousHeadFlags == 0 {
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendStructHead(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
2021-05-29 08:47:18 +03:00
|
|
|
if (code.Flags & encoder.IndirectFlags) != 0 {
|
|
|
|
p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
if p != 0 {
|
|
|
|
b = appendStructKey(ctx, code, b)
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendFloat32(ctx, b, ptrToFloat32(p))
|
|
|
|
b = appendComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
code = code.Next
|
|
|
|
case encoder.OpStructPtrHeadFloat32PtrString:
|
|
|
|
p := load(ctxptr, code.Idx)
|
|
|
|
if p == 0 {
|
2021-05-29 08:47:18 +03:00
|
|
|
if code.Flags&encoder.AnonymousHeadFlags == 0 {
|
2021-11-28 15:46:32 +03:00
|
|
|
b = appendNullComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
code = code.End.Next
|
|
|
|
break
|
|
|
|
}
|
|
|
|
store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
|
|
|
|
fallthrough
|
|
|
|
case encoder.OpStructHeadFloat32PtrString:
|
|
|
|
p := load(ctxptr, code.Idx)
|
2021-05-29 08:47:18 +03:00
|
|
|
if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 {
|
|
|
|
if code.Flags&encoder.AnonymousHeadFlags == 0 {
|
2021-11-28 15:46:32 +03:00
|
|
|
b = appendNullComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
code = code.End.Next
|
|
|
|
break
|
|
|
|
}
|
2021-05-29 08:47:18 +03:00
|
|
|
if code.Flags&encoder.AnonymousHeadFlags == 0 {
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendStructHead(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
b = appendStructKey(ctx, code, b)
|
2021-05-29 08:47:18 +03:00
|
|
|
if (code.Flags & encoder.IndirectFlags) != 0 {
|
|
|
|
p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
if p == 0 {
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendNull(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
} else {
|
|
|
|
b = append(b, '"')
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendFloat32(ctx, b, ptrToFloat32(p))
|
2021-05-19 06:34:40 +03:00
|
|
|
b = append(b, '"')
|
|
|
|
}
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
code = code.Next
|
|
|
|
case encoder.OpStructPtrHeadOmitEmptyFloat32PtrString:
|
|
|
|
p := load(ctxptr, code.Idx)
|
|
|
|
if p == 0 {
|
2021-05-29 08:47:18 +03:00
|
|
|
if code.Flags&encoder.AnonymousHeadFlags == 0 {
|
2021-11-28 15:46:32 +03:00
|
|
|
b = appendNullComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
code = code.End.Next
|
|
|
|
break
|
|
|
|
}
|
|
|
|
store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
|
|
|
|
fallthrough
|
|
|
|
case encoder.OpStructHeadOmitEmptyFloat32PtrString:
|
|
|
|
p := load(ctxptr, code.Idx)
|
2021-05-29 08:47:18 +03:00
|
|
|
if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 {
|
|
|
|
if code.Flags&encoder.AnonymousHeadFlags == 0 {
|
2021-11-28 15:46:32 +03:00
|
|
|
b = appendNullComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
code = code.End.Next
|
|
|
|
break
|
|
|
|
}
|
2021-05-29 08:47:18 +03:00
|
|
|
if code.Flags&encoder.AnonymousHeadFlags == 0 {
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendStructHead(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
2021-05-29 08:47:18 +03:00
|
|
|
if (code.Flags & encoder.IndirectFlags) != 0 {
|
|
|
|
p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
if p != 0 {
|
|
|
|
b = appendStructKey(ctx, code, b)
|
|
|
|
b = append(b, '"')
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendFloat32(ctx, b, ptrToFloat32(p))
|
2021-05-19 06:34:40 +03:00
|
|
|
b = append(b, '"')
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
code = code.Next
|
|
|
|
case encoder.OpStructPtrHeadFloat64:
|
2021-05-29 08:47:18 +03:00
|
|
|
if (code.Flags & encoder.IndirectFlags) != 0 {
|
2021-05-19 06:34:40 +03:00
|
|
|
p := load(ctxptr, code.Idx)
|
|
|
|
if p == 0 {
|
2021-05-29 08:47:18 +03:00
|
|
|
if code.Flags&encoder.AnonymousHeadFlags == 0 {
|
2021-11-28 15:46:32 +03:00
|
|
|
b = appendNullComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
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 {
|
2021-05-29 08:47:18 +03:00
|
|
|
if code.Flags&encoder.AnonymousHeadFlags == 0 {
|
2021-11-28 15:46:32 +03:00
|
|
|
b = appendNullComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
code = code.End.Next
|
|
|
|
break
|
|
|
|
}
|
2021-05-29 08:47:18 +03:00
|
|
|
v := ptrToFloat64(p + uintptr(code.Offset))
|
2021-05-19 06:34:40 +03:00
|
|
|
if math.IsInf(v, 0) || math.IsNaN(v) {
|
|
|
|
return nil, errUnsupportedFloat(v)
|
|
|
|
}
|
2021-05-29 08:47:18 +03:00
|
|
|
if code.Flags&encoder.AnonymousHeadFlags == 0 {
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendStructHead(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
b = appendStructKey(ctx, code, b)
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendFloat64(ctx, b, v)
|
|
|
|
b = appendComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
code = code.Next
|
|
|
|
case encoder.OpStructPtrHeadOmitEmptyFloat64:
|
2021-05-29 08:47:18 +03:00
|
|
|
if (code.Flags & encoder.IndirectFlags) != 0 {
|
2021-05-19 06:34:40 +03:00
|
|
|
p := load(ctxptr, code.Idx)
|
|
|
|
if p == 0 {
|
2021-05-29 08:47:18 +03:00
|
|
|
if code.Flags&encoder.AnonymousHeadFlags == 0 {
|
2021-11-28 15:46:32 +03:00
|
|
|
b = appendNullComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
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 {
|
2021-05-29 08:47:18 +03:00
|
|
|
if code.Flags&encoder.AnonymousHeadFlags == 0 {
|
2021-11-28 15:46:32 +03:00
|
|
|
b = appendNullComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
code = code.End.Next
|
|
|
|
break
|
|
|
|
}
|
2021-05-29 08:47:18 +03:00
|
|
|
if code.Flags&encoder.AnonymousHeadFlags == 0 {
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendStructHead(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
2021-05-29 08:47:18 +03:00
|
|
|
v := ptrToFloat64(p + uintptr(code.Offset))
|
2021-05-19 06:34:40 +03:00
|
|
|
if v == 0 {
|
|
|
|
code = code.NextField
|
|
|
|
} else {
|
|
|
|
if math.IsInf(v, 0) || math.IsNaN(v) {
|
|
|
|
return nil, errUnsupportedFloat(v)
|
|
|
|
}
|
|
|
|
b = appendStructKey(ctx, code, b)
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendFloat64(ctx, b, v)
|
|
|
|
b = appendComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
code = code.Next
|
|
|
|
}
|
|
|
|
case encoder.OpStructPtrHeadFloat64String:
|
2021-05-29 08:47:18 +03:00
|
|
|
if (code.Flags & encoder.IndirectFlags) != 0 {
|
2021-05-19 06:34:40 +03:00
|
|
|
p := load(ctxptr, code.Idx)
|
|
|
|
if p == 0 {
|
2021-05-29 08:47:18 +03:00
|
|
|
if code.Flags&encoder.AnonymousHeadFlags == 0 {
|
2021-11-28 15:46:32 +03:00
|
|
|
b = appendNullComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
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 {
|
2021-05-29 08:47:18 +03:00
|
|
|
if code.Flags&encoder.AnonymousHeadFlags == 0 {
|
2021-11-28 15:46:32 +03:00
|
|
|
b = appendNullComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
code = code.End.Next
|
|
|
|
break
|
|
|
|
}
|
2021-05-29 08:47:18 +03:00
|
|
|
if code.Flags&encoder.AnonymousHeadFlags == 0 {
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendStructHead(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
2021-05-29 08:47:18 +03:00
|
|
|
v := ptrToFloat64(p + uintptr(code.Offset))
|
2021-05-19 06:34:40 +03:00
|
|
|
if math.IsInf(v, 0) || math.IsNaN(v) {
|
|
|
|
return nil, errUnsupportedFloat(v)
|
|
|
|
}
|
|
|
|
b = appendStructKey(ctx, code, b)
|
|
|
|
b = append(b, '"')
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendFloat64(ctx, b, v)
|
2021-05-19 06:34:40 +03:00
|
|
|
b = append(b, '"')
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
code = code.Next
|
|
|
|
case encoder.OpStructPtrHeadOmitEmptyFloat64String:
|
2021-05-29 08:47:18 +03:00
|
|
|
if (code.Flags & encoder.IndirectFlags) != 0 {
|
2021-05-19 06:34:40 +03:00
|
|
|
p := load(ctxptr, code.Idx)
|
|
|
|
if p == 0 {
|
2021-05-29 08:47:18 +03:00
|
|
|
if code.Flags&encoder.AnonymousHeadFlags == 0 {
|
2021-11-28 15:46:32 +03:00
|
|
|
b = appendNullComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
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 {
|
2021-05-29 08:47:18 +03:00
|
|
|
if code.Flags&encoder.AnonymousHeadFlags == 0 {
|
2021-11-28 15:46:32 +03:00
|
|
|
b = appendNullComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
code = code.End.Next
|
|
|
|
break
|
|
|
|
}
|
2021-05-29 08:47:18 +03:00
|
|
|
if code.Flags&encoder.AnonymousHeadFlags == 0 {
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendStructHead(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
2021-05-29 08:47:18 +03:00
|
|
|
v := ptrToFloat64(p + uintptr(code.Offset))
|
2021-05-19 06:34:40 +03:00
|
|
|
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, '"')
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendFloat64(ctx, b, v)
|
2021-05-19 06:34:40 +03:00
|
|
|
b = append(b, '"')
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
code = code.Next
|
|
|
|
}
|
|
|
|
case encoder.OpStructPtrHeadFloat64Ptr:
|
|
|
|
p := load(ctxptr, code.Idx)
|
|
|
|
if p == 0 {
|
2021-05-29 08:47:18 +03:00
|
|
|
if code.Flags&encoder.AnonymousHeadFlags == 0 {
|
2021-11-28 15:46:32 +03:00
|
|
|
b = appendNullComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
code = code.End.Next
|
|
|
|
break
|
|
|
|
}
|
|
|
|
store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
|
|
|
|
fallthrough
|
|
|
|
case encoder.OpStructHeadFloat64Ptr:
|
|
|
|
p := load(ctxptr, code.Idx)
|
2021-05-29 08:47:18 +03:00
|
|
|
if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 {
|
|
|
|
if code.Flags&encoder.AnonymousHeadFlags == 0 {
|
2021-11-28 15:46:32 +03:00
|
|
|
b = appendNullComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
code = code.End.Next
|
|
|
|
break
|
|
|
|
}
|
2021-05-29 08:47:18 +03:00
|
|
|
if code.Flags&encoder.AnonymousHeadFlags == 0 {
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendStructHead(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
b = appendStructKey(ctx, code, b)
|
2021-05-29 08:47:18 +03:00
|
|
|
if (code.Flags & encoder.IndirectFlags) != 0 {
|
|
|
|
p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
if p == 0 {
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendNull(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
} else {
|
|
|
|
v := ptrToFloat64(p)
|
|
|
|
if math.IsInf(v, 0) || math.IsNaN(v) {
|
|
|
|
return nil, errUnsupportedFloat(v)
|
|
|
|
}
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendFloat64(ctx, b, v)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
code = code.Next
|
|
|
|
case encoder.OpStructPtrHeadOmitEmptyFloat64Ptr:
|
|
|
|
p := load(ctxptr, code.Idx)
|
|
|
|
if p == 0 {
|
2021-05-29 08:47:18 +03:00
|
|
|
if code.Flags&encoder.AnonymousHeadFlags == 0 {
|
2021-11-28 15:46:32 +03:00
|
|
|
b = appendNullComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
code = code.End.Next
|
|
|
|
break
|
|
|
|
}
|
|
|
|
store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
|
|
|
|
fallthrough
|
|
|
|
case encoder.OpStructHeadOmitEmptyFloat64Ptr:
|
|
|
|
p := load(ctxptr, code.Idx)
|
2021-05-29 08:47:18 +03:00
|
|
|
if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 {
|
|
|
|
if code.Flags&encoder.AnonymousHeadFlags == 0 {
|
2021-11-28 15:46:32 +03:00
|
|
|
b = appendNullComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
code = code.End.Next
|
|
|
|
break
|
|
|
|
}
|
2021-05-29 08:47:18 +03:00
|
|
|
if code.Flags&encoder.AnonymousHeadFlags == 0 {
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendStructHead(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
2021-05-29 08:47:18 +03:00
|
|
|
if (code.Flags & encoder.IndirectFlags) != 0 {
|
|
|
|
p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
if p != 0 {
|
|
|
|
b = appendStructKey(ctx, code, b)
|
|
|
|
v := ptrToFloat64(p)
|
|
|
|
if math.IsInf(v, 0) || math.IsNaN(v) {
|
|
|
|
return nil, errUnsupportedFloat(v)
|
|
|
|
}
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendFloat64(ctx, b, v)
|
|
|
|
b = appendComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
code = code.Next
|
|
|
|
case encoder.OpStructPtrHeadFloat64PtrString:
|
|
|
|
p := load(ctxptr, code.Idx)
|
|
|
|
if p == 0 {
|
2021-05-29 08:47:18 +03:00
|
|
|
if code.Flags&encoder.AnonymousHeadFlags == 0 {
|
2021-11-28 15:46:32 +03:00
|
|
|
b = appendNullComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
code = code.End.Next
|
|
|
|
break
|
|
|
|
}
|
|
|
|
store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
|
|
|
|
fallthrough
|
|
|
|
case encoder.OpStructHeadFloat64PtrString:
|
|
|
|
p := load(ctxptr, code.Idx)
|
2021-05-29 08:47:18 +03:00
|
|
|
if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 {
|
|
|
|
if code.Flags&encoder.AnonymousHeadFlags == 0 {
|
2021-11-28 15:46:32 +03:00
|
|
|
b = appendNullComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
code = code.End.Next
|
|
|
|
break
|
|
|
|
}
|
2021-05-29 08:47:18 +03:00
|
|
|
if code.Flags&encoder.AnonymousHeadFlags == 0 {
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendStructHead(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
b = appendStructKey(ctx, code, b)
|
2021-05-29 08:47:18 +03:00
|
|
|
if (code.Flags & encoder.IndirectFlags) != 0 {
|
|
|
|
p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
if p == 0 {
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendNull(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
} else {
|
|
|
|
b = append(b, '"')
|
|
|
|
v := ptrToFloat64(p)
|
|
|
|
if math.IsInf(v, 0) || math.IsNaN(v) {
|
|
|
|
return nil, errUnsupportedFloat(v)
|
|
|
|
}
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendFloat64(ctx, b, v)
|
2021-05-19 06:34:40 +03:00
|
|
|
b = append(b, '"')
|
|
|
|
}
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
code = code.Next
|
|
|
|
case encoder.OpStructPtrHeadOmitEmptyFloat64PtrString:
|
|
|
|
p := load(ctxptr, code.Idx)
|
|
|
|
if p == 0 {
|
2021-05-29 08:47:18 +03:00
|
|
|
if code.Flags&encoder.AnonymousHeadFlags == 0 {
|
2021-11-28 15:46:32 +03:00
|
|
|
b = appendNullComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
code = code.End.Next
|
|
|
|
break
|
|
|
|
}
|
|
|
|
store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
|
|
|
|
fallthrough
|
|
|
|
case encoder.OpStructHeadOmitEmptyFloat64PtrString:
|
|
|
|
p := load(ctxptr, code.Idx)
|
2021-05-29 08:47:18 +03:00
|
|
|
if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 {
|
|
|
|
if code.Flags&encoder.AnonymousHeadFlags == 0 {
|
2021-11-28 15:46:32 +03:00
|
|
|
b = appendNullComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
code = code.End.Next
|
|
|
|
break
|
|
|
|
}
|
2021-05-29 08:47:18 +03:00
|
|
|
if code.Flags&encoder.AnonymousHeadFlags == 0 {
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendStructHead(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
2021-05-29 08:47:18 +03:00
|
|
|
if (code.Flags & encoder.IndirectFlags) != 0 {
|
|
|
|
p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
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)
|
|
|
|
}
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendFloat64(ctx, b, v)
|
2021-05-19 06:34:40 +03:00
|
|
|
b = append(b, '"')
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
code = code.Next
|
|
|
|
case encoder.OpStructPtrHeadString:
|
2021-05-29 08:47:18 +03:00
|
|
|
if (code.Flags & encoder.IndirectFlags) != 0 {
|
2021-05-19 06:34:40 +03:00
|
|
|
p := load(ctxptr, code.Idx)
|
|
|
|
if p == 0 {
|
2021-05-29 08:47:18 +03:00
|
|
|
if code.Flags&encoder.AnonymousHeadFlags == 0 {
|
2021-11-28 15:46:32 +03:00
|
|
|
b = appendNullComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
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 {
|
2021-05-29 08:47:18 +03:00
|
|
|
if code.Flags&encoder.AnonymousHeadFlags == 0 {
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendNull(ctx, b)
|
|
|
|
b = appendComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
code = code.End.Next
|
|
|
|
break
|
|
|
|
}
|
2021-05-29 08:47:18 +03:00
|
|
|
if code.Flags&encoder.AnonymousHeadFlags == 0 {
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendStructHead(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
b = appendStructKey(ctx, code, b)
|
2021-05-31 19:25:05 +03:00
|
|
|
b = appendString(ctx, b, ptrToString(p+uintptr(code.Offset)))
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
code = code.Next
|
|
|
|
case encoder.OpStructPtrHeadOmitEmptyString:
|
2021-05-29 08:47:18 +03:00
|
|
|
if (code.Flags & encoder.IndirectFlags) != 0 {
|
2021-05-19 06:34:40 +03:00
|
|
|
p := load(ctxptr, code.Idx)
|
|
|
|
if p == 0 {
|
2021-05-29 08:47:18 +03:00
|
|
|
if code.Flags&encoder.AnonymousHeadFlags == 0 {
|
2021-11-28 15:46:32 +03:00
|
|
|
b = appendNullComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
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 {
|
2021-05-29 08:47:18 +03:00
|
|
|
if code.Flags&encoder.AnonymousHeadFlags == 0 {
|
2021-11-28 15:46:32 +03:00
|
|
|
b = appendNullComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
code = code.End.Next
|
|
|
|
break
|
|
|
|
}
|
2021-05-29 08:47:18 +03:00
|
|
|
if code.Flags&encoder.AnonymousHeadFlags == 0 {
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendStructHead(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
2021-05-29 08:47:18 +03:00
|
|
|
v := ptrToString(p + uintptr(code.Offset))
|
2021-05-19 06:34:40 +03:00
|
|
|
if v == "" {
|
|
|
|
code = code.NextField
|
|
|
|
} else {
|
|
|
|
b = appendStructKey(ctx, code, b)
|
2021-05-31 19:25:05 +03:00
|
|
|
b = appendString(ctx, b, v)
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
code = code.Next
|
|
|
|
}
|
|
|
|
case encoder.OpStructPtrHeadStringString:
|
2021-05-29 08:47:18 +03:00
|
|
|
if (code.Flags & encoder.IndirectFlags) != 0 {
|
2021-05-19 06:34:40 +03:00
|
|
|
p := load(ctxptr, code.Idx)
|
|
|
|
if p == 0 {
|
2021-05-29 08:47:18 +03:00
|
|
|
if code.Flags&encoder.AnonymousHeadFlags == 0 {
|
2021-11-28 15:46:32 +03:00
|
|
|
b = appendNullComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
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 {
|
2021-05-29 08:47:18 +03:00
|
|
|
if code.Flags&encoder.AnonymousHeadFlags == 0 {
|
2021-11-28 15:46:32 +03:00
|
|
|
b = appendNullComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
code = code.End.Next
|
|
|
|
break
|
|
|
|
}
|
2021-05-29 08:47:18 +03:00
|
|
|
if code.Flags&encoder.AnonymousHeadFlags == 0 {
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendStructHead(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
b = appendStructKey(ctx, code, b)
|
2021-05-31 19:25:05 +03:00
|
|
|
b = appendString(ctx, b, string(appendString(ctx, []byte{}, ptrToString(p+uintptr(code.Offset)))))
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
code = code.Next
|
|
|
|
case encoder.OpStructPtrHeadOmitEmptyStringString:
|
2021-05-29 08:47:18 +03:00
|
|
|
if (code.Flags & encoder.IndirectFlags) != 0 {
|
2021-05-19 06:34:40 +03:00
|
|
|
p := load(ctxptr, code.Idx)
|
|
|
|
if p == 0 {
|
2021-05-29 08:47:18 +03:00
|
|
|
if code.Flags&encoder.AnonymousHeadFlags == 0 {
|
2021-11-28 15:46:32 +03:00
|
|
|
b = appendNullComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
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 {
|
2021-05-29 08:47:18 +03:00
|
|
|
if code.Flags&encoder.AnonymousHeadFlags == 0 {
|
2021-11-28 15:46:32 +03:00
|
|
|
b = appendNullComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
code = code.End.Next
|
|
|
|
break
|
|
|
|
}
|
2021-05-29 08:47:18 +03:00
|
|
|
if code.Flags&encoder.AnonymousHeadFlags == 0 {
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendStructHead(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
2021-05-29 08:47:18 +03:00
|
|
|
v := ptrToString(p + uintptr(code.Offset))
|
2021-05-19 06:34:40 +03:00
|
|
|
if v == "" {
|
|
|
|
code = code.NextField
|
|
|
|
} else {
|
|
|
|
b = appendStructKey(ctx, code, b)
|
2021-05-31 19:25:05 +03:00
|
|
|
b = appendString(ctx, b, string(appendString(ctx, []byte{}, v)))
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
code = code.Next
|
|
|
|
}
|
|
|
|
case encoder.OpStructPtrHeadStringPtr:
|
|
|
|
p := load(ctxptr, code.Idx)
|
|
|
|
if p == 0 {
|
2021-05-29 08:47:18 +03:00
|
|
|
if code.Flags&encoder.AnonymousHeadFlags == 0 {
|
2021-11-28 15:46:32 +03:00
|
|
|
b = appendNullComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
code = code.End.Next
|
|
|
|
break
|
|
|
|
}
|
|
|
|
store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
|
|
|
|
fallthrough
|
|
|
|
case encoder.OpStructHeadStringPtr:
|
|
|
|
p := load(ctxptr, code.Idx)
|
2021-05-29 08:47:18 +03:00
|
|
|
if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 {
|
|
|
|
if code.Flags&encoder.AnonymousHeadFlags == 0 {
|
2021-11-28 15:46:32 +03:00
|
|
|
b = appendNullComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
code = code.End.Next
|
|
|
|
break
|
|
|
|
}
|
2021-05-29 08:47:18 +03:00
|
|
|
if code.Flags&encoder.AnonymousHeadFlags == 0 {
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendStructHead(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
b = appendStructKey(ctx, code, b)
|
2021-05-29 08:47:18 +03:00
|
|
|
if (code.Flags & encoder.IndirectFlags) != 0 {
|
|
|
|
p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
if p == 0 {
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendNull(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
} else {
|
2021-05-31 19:25:05 +03:00
|
|
|
b = appendString(ctx, b, ptrToString(p))
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
code = code.Next
|
|
|
|
case encoder.OpStructPtrHeadOmitEmptyStringPtr:
|
|
|
|
p := load(ctxptr, code.Idx)
|
|
|
|
if p == 0 {
|
2021-05-29 08:47:18 +03:00
|
|
|
if code.Flags&encoder.AnonymousHeadFlags == 0 {
|
2021-11-28 15:46:32 +03:00
|
|
|
b = appendNullComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
code = code.End.Next
|
|
|
|
break
|
|
|
|
}
|
|
|
|
store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
|
|
|
|
fallthrough
|
|
|
|
case encoder.OpStructHeadOmitEmptyStringPtr:
|
|
|
|
p := load(ctxptr, code.Idx)
|
2021-05-29 08:47:18 +03:00
|
|
|
if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 {
|
|
|
|
if code.Flags&encoder.AnonymousHeadFlags == 0 {
|
2021-11-28 15:46:32 +03:00
|
|
|
b = appendNullComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
code = code.End.Next
|
|
|
|
break
|
|
|
|
}
|
2021-05-29 08:47:18 +03:00
|
|
|
if code.Flags&encoder.AnonymousHeadFlags == 0 {
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendStructHead(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
2021-05-29 08:47:18 +03:00
|
|
|
if (code.Flags & encoder.IndirectFlags) != 0 {
|
|
|
|
p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
if p != 0 {
|
|
|
|
b = appendStructKey(ctx, code, b)
|
2021-05-31 19:25:05 +03:00
|
|
|
b = appendString(ctx, b, ptrToString(p))
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
code = code.Next
|
|
|
|
case encoder.OpStructPtrHeadStringPtrString:
|
|
|
|
p := load(ctxptr, code.Idx)
|
|
|
|
if p == 0 {
|
2021-05-29 08:47:18 +03:00
|
|
|
if code.Flags&encoder.AnonymousHeadFlags == 0 {
|
2021-11-28 15:46:32 +03:00
|
|
|
b = appendNullComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
code = code.End.Next
|
|
|
|
break
|
|
|
|
}
|
|
|
|
store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
|
|
|
|
fallthrough
|
|
|
|
case encoder.OpStructHeadStringPtrString:
|
|
|
|
p := load(ctxptr, code.Idx)
|
2021-05-29 08:47:18 +03:00
|
|
|
if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 {
|
|
|
|
if code.Flags&encoder.AnonymousHeadFlags == 0 {
|
2021-11-28 15:46:32 +03:00
|
|
|
b = appendNullComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
code = code.End.Next
|
|
|
|
break
|
|
|
|
}
|
2021-05-29 08:47:18 +03:00
|
|
|
if code.Flags&encoder.AnonymousHeadFlags == 0 {
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendStructHead(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
b = appendStructKey(ctx, code, b)
|
2021-05-29 08:47:18 +03:00
|
|
|
if (code.Flags & encoder.IndirectFlags) != 0 {
|
|
|
|
p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
if p == 0 {
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendNull(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
} else {
|
2021-05-31 19:25:05 +03:00
|
|
|
b = appendString(ctx, b, string(appendString(ctx, []byte{}, ptrToString(p))))
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
code = code.Next
|
|
|
|
case encoder.OpStructPtrHeadOmitEmptyStringPtrString:
|
|
|
|
p := load(ctxptr, code.Idx)
|
|
|
|
if p == 0 {
|
2021-05-29 08:47:18 +03:00
|
|
|
if code.Flags&encoder.AnonymousHeadFlags == 0 {
|
2021-11-28 15:46:32 +03:00
|
|
|
b = appendNullComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
code = code.End.Next
|
|
|
|
break
|
|
|
|
}
|
|
|
|
store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
|
|
|
|
fallthrough
|
|
|
|
case encoder.OpStructHeadOmitEmptyStringPtrString:
|
|
|
|
p := load(ctxptr, code.Idx)
|
2021-05-29 08:47:18 +03:00
|
|
|
if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 {
|
|
|
|
if code.Flags&encoder.AnonymousHeadFlags == 0 {
|
2021-11-28 15:46:32 +03:00
|
|
|
b = appendNullComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
code = code.End.Next
|
|
|
|
break
|
|
|
|
}
|
2021-05-29 08:47:18 +03:00
|
|
|
if code.Flags&encoder.AnonymousHeadFlags == 0 {
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendStructHead(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
2021-05-29 08:47:18 +03:00
|
|
|
if (code.Flags & encoder.IndirectFlags) != 0 {
|
|
|
|
p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
if p != 0 {
|
|
|
|
b = appendStructKey(ctx, code, b)
|
2021-05-31 19:25:05 +03:00
|
|
|
b = appendString(ctx, b, string(appendString(ctx, []byte{}, ptrToString(p))))
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
code = code.Next
|
|
|
|
case encoder.OpStructPtrHeadBool:
|
2021-05-29 08:47:18 +03:00
|
|
|
if (code.Flags & encoder.IndirectFlags) != 0 {
|
2021-05-19 06:34:40 +03:00
|
|
|
p := load(ctxptr, code.Idx)
|
|
|
|
if p == 0 {
|
2021-05-29 08:47:18 +03:00
|
|
|
if code.Flags&encoder.AnonymousHeadFlags == 0 {
|
2021-11-28 15:46:32 +03:00
|
|
|
b = appendNullComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
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 {
|
2021-05-29 08:47:18 +03:00
|
|
|
if code.Flags&encoder.AnonymousHeadFlags == 0 {
|
2021-11-28 15:46:32 +03:00
|
|
|
b = appendNullComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
code = code.End.Next
|
|
|
|
break
|
|
|
|
}
|
2021-05-29 08:47:18 +03:00
|
|
|
if code.Flags&encoder.AnonymousHeadFlags == 0 {
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendStructHead(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
b = appendStructKey(ctx, code, b)
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendBool(ctx, b, ptrToBool(p+uintptr(code.Offset)))
|
|
|
|
b = appendComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
code = code.Next
|
|
|
|
case encoder.OpStructPtrHeadOmitEmptyBool:
|
2021-05-29 08:47:18 +03:00
|
|
|
if (code.Flags & encoder.IndirectFlags) != 0 {
|
2021-05-19 06:34:40 +03:00
|
|
|
p := load(ctxptr, code.Idx)
|
|
|
|
if p == 0 {
|
2021-05-29 08:47:18 +03:00
|
|
|
if code.Flags&encoder.AnonymousHeadFlags == 0 {
|
2021-11-28 15:46:32 +03:00
|
|
|
b = appendNullComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
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 {
|
2021-05-29 08:47:18 +03:00
|
|
|
if code.Flags&encoder.AnonymousHeadFlags == 0 {
|
2021-11-28 15:46:32 +03:00
|
|
|
b = appendNullComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
code = code.End.Next
|
|
|
|
break
|
|
|
|
}
|
2021-05-29 08:47:18 +03:00
|
|
|
if code.Flags&encoder.AnonymousHeadFlags == 0 {
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendStructHead(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
2021-05-29 08:47:18 +03:00
|
|
|
v := ptrToBool(p + uintptr(code.Offset))
|
2021-05-19 06:34:40 +03:00
|
|
|
if v {
|
|
|
|
b = appendStructKey(ctx, code, b)
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendBool(ctx, b, v)
|
|
|
|
b = appendComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
code = code.Next
|
|
|
|
} else {
|
|
|
|
code = code.NextField
|
|
|
|
}
|
|
|
|
case encoder.OpStructPtrHeadBoolString:
|
2021-05-29 08:47:18 +03:00
|
|
|
if (code.Flags & encoder.IndirectFlags) != 0 {
|
2021-05-19 06:34:40 +03:00
|
|
|
p := load(ctxptr, code.Idx)
|
|
|
|
if p == 0 {
|
2021-05-29 08:47:18 +03:00
|
|
|
if code.Flags&encoder.AnonymousHeadFlags == 0 {
|
2021-11-28 15:46:32 +03:00
|
|
|
b = appendNullComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
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 {
|
2021-05-29 08:47:18 +03:00
|
|
|
if code.Flags&encoder.AnonymousHeadFlags == 0 {
|
2021-11-28 15:46:32 +03:00
|
|
|
b = appendNullComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
code = code.End.Next
|
|
|
|
break
|
|
|
|
}
|
2021-05-29 08:47:18 +03:00
|
|
|
if code.Flags&encoder.AnonymousHeadFlags == 0 {
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendStructHead(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
b = appendStructKey(ctx, code, b)
|
|
|
|
b = append(b, '"')
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendBool(ctx, b, ptrToBool(p+uintptr(code.Offset)))
|
2021-05-19 06:34:40 +03:00
|
|
|
b = append(b, '"')
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
code = code.Next
|
|
|
|
case encoder.OpStructPtrHeadOmitEmptyBoolString:
|
2021-05-29 08:47:18 +03:00
|
|
|
if (code.Flags & encoder.IndirectFlags) != 0 {
|
2021-05-19 06:34:40 +03:00
|
|
|
p := load(ctxptr, code.Idx)
|
|
|
|
if p == 0 {
|
2021-05-29 08:47:18 +03:00
|
|
|
if code.Flags&encoder.AnonymousHeadFlags == 0 {
|
2021-11-28 15:46:32 +03:00
|
|
|
b = appendNullComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
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 {
|
2021-05-29 08:47:18 +03:00
|
|
|
if code.Flags&encoder.AnonymousHeadFlags == 0 {
|
2021-11-28 15:46:32 +03:00
|
|
|
b = appendNullComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
code = code.End.Next
|
|
|
|
break
|
|
|
|
}
|
2021-05-29 08:47:18 +03:00
|
|
|
if code.Flags&encoder.AnonymousHeadFlags == 0 {
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendStructHead(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
2021-05-29 08:47:18 +03:00
|
|
|
v := ptrToBool(p + uintptr(code.Offset))
|
2021-05-19 06:34:40 +03:00
|
|
|
if v {
|
|
|
|
b = appendStructKey(ctx, code, b)
|
|
|
|
b = append(b, '"')
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendBool(ctx, b, v)
|
2021-05-19 06:34:40 +03:00
|
|
|
b = append(b, '"')
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
code = code.Next
|
|
|
|
} else {
|
|
|
|
code = code.NextField
|
|
|
|
}
|
|
|
|
case encoder.OpStructPtrHeadBoolPtr:
|
|
|
|
p := load(ctxptr, code.Idx)
|
|
|
|
if p == 0 {
|
2021-05-29 08:47:18 +03:00
|
|
|
if code.Flags&encoder.AnonymousHeadFlags == 0 {
|
2021-11-28 15:46:32 +03:00
|
|
|
b = appendNullComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
code = code.End.Next
|
|
|
|
break
|
|
|
|
}
|
|
|
|
store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
|
|
|
|
fallthrough
|
|
|
|
case encoder.OpStructHeadBoolPtr:
|
|
|
|
p := load(ctxptr, code.Idx)
|
2021-05-29 08:47:18 +03:00
|
|
|
if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 {
|
|
|
|
if code.Flags&encoder.AnonymousHeadFlags == 0 {
|
2021-11-28 15:46:32 +03:00
|
|
|
b = appendNullComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
code = code.End.Next
|
|
|
|
break
|
|
|
|
}
|
2021-05-29 08:47:18 +03:00
|
|
|
if code.Flags&encoder.AnonymousHeadFlags == 0 {
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendStructHead(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
b = appendStructKey(ctx, code, b)
|
2021-05-29 08:47:18 +03:00
|
|
|
if (code.Flags & encoder.IndirectFlags) != 0 {
|
|
|
|
p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
if p == 0 {
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendNull(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
} else {
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendBool(ctx, b, ptrToBool(p))
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
code = code.Next
|
|
|
|
case encoder.OpStructPtrHeadOmitEmptyBoolPtr:
|
|
|
|
p := load(ctxptr, code.Idx)
|
|
|
|
if p == 0 {
|
2021-05-29 08:47:18 +03:00
|
|
|
if code.Flags&encoder.AnonymousHeadFlags == 0 {
|
2021-11-28 15:46:32 +03:00
|
|
|
b = appendNullComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
code = code.End.Next
|
|
|
|
break
|
|
|
|
}
|
|
|
|
store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
|
|
|
|
fallthrough
|
|
|
|
case encoder.OpStructHeadOmitEmptyBoolPtr:
|
|
|
|
p := load(ctxptr, code.Idx)
|
2021-05-29 08:47:18 +03:00
|
|
|
if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 {
|
|
|
|
if code.Flags&encoder.AnonymousHeadFlags == 0 {
|
2021-11-28 15:46:32 +03:00
|
|
|
b = appendNullComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
code = code.End.Next
|
|
|
|
break
|
|
|
|
}
|
2021-05-29 08:47:18 +03:00
|
|
|
if code.Flags&encoder.AnonymousHeadFlags == 0 {
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendStructHead(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
2021-05-29 08:47:18 +03:00
|
|
|
if (code.Flags & encoder.IndirectFlags) != 0 {
|
|
|
|
p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
if p != 0 {
|
|
|
|
b = appendStructKey(ctx, code, b)
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendBool(ctx, b, ptrToBool(p))
|
|
|
|
b = appendComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
code = code.Next
|
|
|
|
case encoder.OpStructPtrHeadBoolPtrString:
|
|
|
|
p := load(ctxptr, code.Idx)
|
|
|
|
if p == 0 {
|
2021-05-29 08:47:18 +03:00
|
|
|
if code.Flags&encoder.AnonymousHeadFlags == 0 {
|
2021-11-28 15:46:32 +03:00
|
|
|
b = appendNullComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
code = code.End.Next
|
|
|
|
break
|
|
|
|
}
|
|
|
|
store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
|
|
|
|
fallthrough
|
|
|
|
case encoder.OpStructHeadBoolPtrString:
|
|
|
|
p := load(ctxptr, code.Idx)
|
2021-05-29 08:47:18 +03:00
|
|
|
if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 {
|
|
|
|
if code.Flags&encoder.AnonymousHeadFlags == 0 {
|
2021-11-28 15:46:32 +03:00
|
|
|
b = appendNullComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
code = code.End.Next
|
|
|
|
break
|
|
|
|
}
|
2021-05-29 08:47:18 +03:00
|
|
|
if code.Flags&encoder.AnonymousHeadFlags == 0 {
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendStructHead(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
b = appendStructKey(ctx, code, b)
|
2021-05-29 08:47:18 +03:00
|
|
|
if (code.Flags & encoder.IndirectFlags) != 0 {
|
|
|
|
p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
if p == 0 {
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendNull(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
} else {
|
|
|
|
b = append(b, '"')
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendBool(ctx, b, ptrToBool(p))
|
2021-05-19 06:34:40 +03:00
|
|
|
b = append(b, '"')
|
|
|
|
}
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
code = code.Next
|
|
|
|
case encoder.OpStructPtrHeadOmitEmptyBoolPtrString:
|
|
|
|
p := load(ctxptr, code.Idx)
|
|
|
|
if p == 0 {
|
2021-05-29 08:47:18 +03:00
|
|
|
if code.Flags&encoder.AnonymousHeadFlags == 0 {
|
2021-11-28 15:46:32 +03:00
|
|
|
b = appendNullComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
code = code.End.Next
|
|
|
|
break
|
|
|
|
}
|
|
|
|
store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
|
|
|
|
fallthrough
|
|
|
|
case encoder.OpStructHeadOmitEmptyBoolPtrString:
|
|
|
|
p := load(ctxptr, code.Idx)
|
2021-05-29 08:47:18 +03:00
|
|
|
if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 {
|
|
|
|
if code.Flags&encoder.AnonymousHeadFlags == 0 {
|
2021-11-28 15:46:32 +03:00
|
|
|
b = appendNullComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
code = code.End.Next
|
|
|
|
break
|
|
|
|
}
|
2021-05-29 08:47:18 +03:00
|
|
|
if code.Flags&encoder.AnonymousHeadFlags == 0 {
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendStructHead(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
2021-05-29 08:47:18 +03:00
|
|
|
if (code.Flags & encoder.IndirectFlags) != 0 {
|
|
|
|
p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
if p != 0 {
|
|
|
|
b = appendStructKey(ctx, code, b)
|
|
|
|
b = append(b, '"')
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendBool(ctx, b, ptrToBool(p))
|
2021-05-19 06:34:40 +03:00
|
|
|
b = append(b, '"')
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
code = code.Next
|
|
|
|
case encoder.OpStructPtrHeadBytes:
|
2021-05-29 08:47:18 +03:00
|
|
|
if (code.Flags & encoder.IndirectFlags) != 0 {
|
2021-05-19 06:34:40 +03:00
|
|
|
p := load(ctxptr, code.Idx)
|
|
|
|
if p == 0 {
|
2021-05-29 08:47:18 +03:00
|
|
|
if code.Flags&encoder.AnonymousHeadFlags == 0 {
|
2021-11-28 15:46:32 +03:00
|
|
|
b = appendNullComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
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 {
|
2021-05-29 08:47:18 +03:00
|
|
|
if code.Flags&encoder.AnonymousHeadFlags == 0 {
|
2021-11-28 15:46:32 +03:00
|
|
|
b = appendNullComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
code = code.End.Next
|
|
|
|
break
|
|
|
|
}
|
2021-05-29 08:47:18 +03:00
|
|
|
if code.Flags&encoder.AnonymousHeadFlags == 0 {
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendStructHead(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
b = appendStructKey(ctx, code, b)
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendByteSlice(ctx, b, ptrToBytes(p+uintptr(code.Offset)))
|
|
|
|
b = appendComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
code = code.Next
|
|
|
|
case encoder.OpStructPtrHeadOmitEmptyBytes:
|
2021-05-29 08:47:18 +03:00
|
|
|
if (code.Flags & encoder.IndirectFlags) != 0 {
|
2021-05-19 06:34:40 +03:00
|
|
|
p := load(ctxptr, code.Idx)
|
|
|
|
if p == 0 {
|
2021-05-29 08:47:18 +03:00
|
|
|
if code.Flags&encoder.AnonymousHeadFlags == 0 {
|
2021-11-28 15:46:32 +03:00
|
|
|
b = appendNullComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
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 {
|
2021-05-29 08:47:18 +03:00
|
|
|
if code.Flags&encoder.AnonymousHeadFlags == 0 {
|
2021-11-28 15:46:32 +03:00
|
|
|
b = appendNullComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
code = code.End.Next
|
|
|
|
break
|
|
|
|
}
|
2021-05-29 08:47:18 +03:00
|
|
|
if code.Flags&encoder.AnonymousHeadFlags == 0 {
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendStructHead(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
2021-05-29 08:47:18 +03:00
|
|
|
v := ptrToBytes(p + uintptr(code.Offset))
|
2021-05-19 06:34:40 +03:00
|
|
|
if len(v) == 0 {
|
|
|
|
code = code.NextField
|
|
|
|
} else {
|
|
|
|
b = appendStructKey(ctx, code, b)
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendByteSlice(ctx, b, v)
|
|
|
|
b = appendComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
code = code.Next
|
|
|
|
}
|
|
|
|
case encoder.OpStructPtrHeadBytesPtr:
|
|
|
|
p := load(ctxptr, code.Idx)
|
|
|
|
if p == 0 {
|
2021-05-29 08:47:18 +03:00
|
|
|
if code.Flags&encoder.AnonymousHeadFlags == 0 {
|
2021-11-28 15:46:32 +03:00
|
|
|
b = appendNullComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
code = code.End.Next
|
|
|
|
break
|
|
|
|
}
|
|
|
|
store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
|
|
|
|
fallthrough
|
|
|
|
case encoder.OpStructHeadBytesPtr:
|
|
|
|
p := load(ctxptr, code.Idx)
|
2021-05-29 08:47:18 +03:00
|
|
|
if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 {
|
|
|
|
if code.Flags&encoder.AnonymousHeadFlags == 0 {
|
2021-11-28 15:46:32 +03:00
|
|
|
b = appendNullComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
code = code.End.Next
|
|
|
|
break
|
|
|
|
}
|
2021-05-29 08:47:18 +03:00
|
|
|
if code.Flags&encoder.AnonymousHeadFlags == 0 {
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendStructHead(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
b = appendStructKey(ctx, code, b)
|
2021-05-29 08:47:18 +03:00
|
|
|
if (code.Flags & encoder.IndirectFlags) != 0 {
|
|
|
|
p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
if p == 0 {
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendNull(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
} else {
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendByteSlice(ctx, b, ptrToBytes(p))
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
code = code.Next
|
|
|
|
case encoder.OpStructPtrHeadOmitEmptyBytesPtr:
|
|
|
|
p := load(ctxptr, code.Idx)
|
|
|
|
if p == 0 {
|
2021-05-29 08:47:18 +03:00
|
|
|
if code.Flags&encoder.AnonymousHeadFlags == 0 {
|
2021-11-28 15:46:32 +03:00
|
|
|
b = appendNullComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
code = code.End.Next
|
|
|
|
break
|
|
|
|
}
|
|
|
|
store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
|
|
|
|
fallthrough
|
|
|
|
case encoder.OpStructHeadOmitEmptyBytesPtr:
|
|
|
|
p := load(ctxptr, code.Idx)
|
2021-05-29 08:47:18 +03:00
|
|
|
if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 {
|
|
|
|
if code.Flags&encoder.AnonymousHeadFlags == 0 {
|
2021-11-28 15:46:32 +03:00
|
|
|
b = appendNullComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
code = code.End.Next
|
|
|
|
break
|
|
|
|
}
|
2021-05-29 08:47:18 +03:00
|
|
|
if code.Flags&encoder.AnonymousHeadFlags == 0 {
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendStructHead(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
2021-05-29 08:47:18 +03:00
|
|
|
if (code.Flags & encoder.IndirectFlags) != 0 {
|
|
|
|
p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
if p != 0 {
|
|
|
|
b = appendStructKey(ctx, code, b)
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendByteSlice(ctx, b, ptrToBytes(p))
|
|
|
|
b = appendComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
code = code.Next
|
|
|
|
case encoder.OpStructPtrHeadNumber:
|
2021-05-29 08:47:18 +03:00
|
|
|
if (code.Flags & encoder.IndirectFlags) != 0 {
|
2021-05-19 06:34:40 +03:00
|
|
|
p := load(ctxptr, code.Idx)
|
|
|
|
if p == 0 {
|
2021-05-29 08:47:18 +03:00
|
|
|
if code.Flags&encoder.AnonymousHeadFlags == 0 {
|
2021-11-28 15:46:32 +03:00
|
|
|
b = appendNullComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
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 {
|
2021-05-29 08:47:18 +03:00
|
|
|
if code.Flags&encoder.AnonymousHeadFlags == 0 {
|
2021-11-28 15:46:32 +03:00
|
|
|
b = appendNullComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
code = code.End.Next
|
|
|
|
break
|
|
|
|
}
|
2021-05-29 08:47:18 +03:00
|
|
|
if code.Flags&encoder.AnonymousHeadFlags == 0 {
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendStructHead(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
b = appendStructKey(ctx, code, b)
|
2021-05-31 19:36:30 +03:00
|
|
|
bb, err := appendNumber(ctx, b, ptrToNumber(p+uintptr(code.Offset)))
|
2021-05-19 06:34:40 +03:00
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendComma(ctx, bb)
|
2021-05-19 06:34:40 +03:00
|
|
|
code = code.Next
|
|
|
|
case encoder.OpStructPtrHeadOmitEmptyNumber:
|
2021-05-29 08:47:18 +03:00
|
|
|
if (code.Flags & encoder.IndirectFlags) != 0 {
|
2021-05-19 06:34:40 +03:00
|
|
|
p := load(ctxptr, code.Idx)
|
|
|
|
if p == 0 {
|
2021-05-29 08:47:18 +03:00
|
|
|
if code.Flags&encoder.AnonymousHeadFlags == 0 {
|
2021-11-28 15:46:32 +03:00
|
|
|
b = appendNullComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
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 {
|
2021-05-29 08:47:18 +03:00
|
|
|
if code.Flags&encoder.AnonymousHeadFlags == 0 {
|
2021-11-28 15:46:32 +03:00
|
|
|
b = appendNullComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
code = code.End.Next
|
|
|
|
break
|
|
|
|
}
|
2021-05-29 08:47:18 +03:00
|
|
|
if code.Flags&encoder.AnonymousHeadFlags == 0 {
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendStructHead(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
2021-05-29 08:47:18 +03:00
|
|
|
v := ptrToNumber(p + uintptr(code.Offset))
|
2021-05-19 06:34:40 +03:00
|
|
|
if v == "" {
|
|
|
|
code = code.NextField
|
|
|
|
} else {
|
|
|
|
b = appendStructKey(ctx, code, b)
|
2021-05-31 19:36:30 +03:00
|
|
|
bb, err := appendNumber(ctx, b, v)
|
2021-05-19 06:34:40 +03:00
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendComma(ctx, bb)
|
2021-05-19 06:34:40 +03:00
|
|
|
code = code.Next
|
|
|
|
}
|
|
|
|
case encoder.OpStructPtrHeadNumberString:
|
2021-05-29 08:47:18 +03:00
|
|
|
if (code.Flags & encoder.IndirectFlags) != 0 {
|
2021-05-19 06:34:40 +03:00
|
|
|
p := load(ctxptr, code.Idx)
|
|
|
|
if p == 0 {
|
2021-05-29 08:47:18 +03:00
|
|
|
if code.Flags&encoder.AnonymousHeadFlags == 0 {
|
2021-11-28 15:46:32 +03:00
|
|
|
b = appendNullComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
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 {
|
2021-05-29 08:47:18 +03:00
|
|
|
if code.Flags&encoder.AnonymousHeadFlags == 0 {
|
2021-11-28 15:46:32 +03:00
|
|
|
b = appendNullComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
code = code.End.Next
|
|
|
|
break
|
|
|
|
}
|
2021-05-29 08:47:18 +03:00
|
|
|
if code.Flags&encoder.AnonymousHeadFlags == 0 {
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendStructHead(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
b = appendStructKey(ctx, code, b)
|
|
|
|
b = append(b, '"')
|
2021-05-31 19:36:30 +03:00
|
|
|
bb, err := appendNumber(ctx, b, ptrToNumber(p+uintptr(code.Offset)))
|
2021-05-19 06:34:40 +03:00
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
b = append(bb, '"')
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
code = code.Next
|
|
|
|
case encoder.OpStructPtrHeadOmitEmptyNumberString:
|
2021-05-29 08:47:18 +03:00
|
|
|
if (code.Flags & encoder.IndirectFlags) != 0 {
|
2021-05-19 06:34:40 +03:00
|
|
|
p := load(ctxptr, code.Idx)
|
|
|
|
if p == 0 {
|
2021-05-29 08:47:18 +03:00
|
|
|
if code.Flags&encoder.AnonymousHeadFlags == 0 {
|
2021-11-28 15:46:32 +03:00
|
|
|
b = appendNullComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
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 {
|
2021-05-29 08:47:18 +03:00
|
|
|
if code.Flags&encoder.AnonymousHeadFlags == 0 {
|
2021-11-28 15:46:32 +03:00
|
|
|
b = appendNullComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
code = code.End.Next
|
|
|
|
break
|
|
|
|
}
|
2021-05-29 08:47:18 +03:00
|
|
|
if code.Flags&encoder.AnonymousHeadFlags == 0 {
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendStructHead(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
2021-05-29 08:47:18 +03:00
|
|
|
v := ptrToNumber(p + uintptr(code.Offset))
|
2021-05-19 06:34:40 +03:00
|
|
|
if v == "" {
|
|
|
|
code = code.NextField
|
|
|
|
} else {
|
|
|
|
b = appendStructKey(ctx, code, b)
|
|
|
|
b = append(b, '"')
|
2021-05-31 19:36:30 +03:00
|
|
|
bb, err := appendNumber(ctx, b, v)
|
2021-05-19 06:34:40 +03:00
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
b = append(bb, '"')
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
code = code.Next
|
|
|
|
}
|
|
|
|
case encoder.OpStructPtrHeadNumberPtr:
|
|
|
|
p := load(ctxptr, code.Idx)
|
|
|
|
if p == 0 {
|
2021-05-29 08:47:18 +03:00
|
|
|
if code.Flags&encoder.AnonymousHeadFlags == 0 {
|
2021-11-28 15:46:32 +03:00
|
|
|
b = appendNullComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
code = code.End.Next
|
|
|
|
break
|
|
|
|
}
|
|
|
|
store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
|
|
|
|
fallthrough
|
|
|
|
case encoder.OpStructHeadNumberPtr:
|
|
|
|
p := load(ctxptr, code.Idx)
|
2021-05-29 08:47:18 +03:00
|
|
|
if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 {
|
|
|
|
if code.Flags&encoder.AnonymousHeadFlags == 0 {
|
2021-11-28 15:46:32 +03:00
|
|
|
b = appendNullComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
code = code.End.Next
|
|
|
|
break
|
|
|
|
}
|
2021-05-29 08:47:18 +03:00
|
|
|
if code.Flags&encoder.AnonymousHeadFlags == 0 {
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendStructHead(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
b = appendStructKey(ctx, code, b)
|
2021-05-29 08:47:18 +03:00
|
|
|
if (code.Flags & encoder.IndirectFlags) != 0 {
|
|
|
|
p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
if p == 0 {
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendNull(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
} else {
|
2021-05-31 19:36:30 +03:00
|
|
|
bb, err := appendNumber(ctx, b, ptrToNumber(p))
|
2021-05-19 06:34:40 +03:00
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
b = bb
|
|
|
|
}
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
code = code.Next
|
|
|
|
case encoder.OpStructPtrHeadOmitEmptyNumberPtr:
|
|
|
|
p := load(ctxptr, code.Idx)
|
|
|
|
if p == 0 {
|
2021-05-29 08:47:18 +03:00
|
|
|
if code.Flags&encoder.AnonymousHeadFlags == 0 {
|
2021-11-28 15:46:32 +03:00
|
|
|
b = appendNullComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
code = code.End.Next
|
|
|
|
break
|
|
|
|
}
|
|
|
|
store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
|
|
|
|
fallthrough
|
|
|
|
case encoder.OpStructHeadOmitEmptyNumberPtr:
|
|
|
|
p := load(ctxptr, code.Idx)
|
2021-05-29 08:47:18 +03:00
|
|
|
if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 {
|
|
|
|
if code.Flags&encoder.AnonymousHeadFlags == 0 {
|
2021-11-28 15:46:32 +03:00
|
|
|
b = appendNullComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
code = code.End.Next
|
|
|
|
break
|
|
|
|
}
|
2021-05-29 08:47:18 +03:00
|
|
|
if code.Flags&encoder.AnonymousHeadFlags == 0 {
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendStructHead(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
2021-05-29 08:47:18 +03:00
|
|
|
if (code.Flags & encoder.IndirectFlags) != 0 {
|
|
|
|
p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
if p != 0 {
|
|
|
|
b = appendStructKey(ctx, code, b)
|
2021-05-31 19:36:30 +03:00
|
|
|
bb, err := appendNumber(ctx, b, ptrToNumber(p))
|
2021-05-19 06:34:40 +03:00
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendComma(ctx, bb)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
code = code.Next
|
|
|
|
case encoder.OpStructPtrHeadNumberPtrString:
|
|
|
|
p := load(ctxptr, code.Idx)
|
|
|
|
if p == 0 {
|
2021-05-29 08:47:18 +03:00
|
|
|
if code.Flags&encoder.AnonymousHeadFlags == 0 {
|
2021-11-28 15:46:32 +03:00
|
|
|
b = appendNullComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
code = code.End.Next
|
|
|
|
break
|
|
|
|
}
|
|
|
|
store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
|
|
|
|
fallthrough
|
|
|
|
case encoder.OpStructHeadNumberPtrString:
|
|
|
|
p := load(ctxptr, code.Idx)
|
2021-05-29 08:47:18 +03:00
|
|
|
if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 {
|
|
|
|
if code.Flags&encoder.AnonymousHeadFlags == 0 {
|
2021-11-28 15:46:32 +03:00
|
|
|
b = appendNullComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
code = code.End.Next
|
|
|
|
break
|
|
|
|
}
|
2021-05-29 08:47:18 +03:00
|
|
|
if code.Flags&encoder.AnonymousHeadFlags == 0 {
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendStructHead(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
b = appendStructKey(ctx, code, b)
|
2021-05-29 08:47:18 +03:00
|
|
|
if (code.Flags & encoder.IndirectFlags) != 0 {
|
|
|
|
p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
if p == 0 {
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendNull(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
} else {
|
|
|
|
b = append(b, '"')
|
2021-05-31 19:36:30 +03:00
|
|
|
bb, err := appendNumber(ctx, b, ptrToNumber(p))
|
2021-05-19 06:34:40 +03:00
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
b = append(bb, '"')
|
|
|
|
}
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
code = code.Next
|
|
|
|
case encoder.OpStructPtrHeadOmitEmptyNumberPtrString:
|
|
|
|
p := load(ctxptr, code.Idx)
|
|
|
|
if p == 0 {
|
2021-05-29 08:47:18 +03:00
|
|
|
if code.Flags&encoder.AnonymousHeadFlags == 0 {
|
2021-11-28 15:46:32 +03:00
|
|
|
b = appendNullComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
code = code.End.Next
|
|
|
|
break
|
|
|
|
}
|
|
|
|
store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
|
|
|
|
fallthrough
|
|
|
|
case encoder.OpStructHeadOmitEmptyNumberPtrString:
|
|
|
|
p := load(ctxptr, code.Idx)
|
2021-05-29 08:47:18 +03:00
|
|
|
if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 {
|
|
|
|
if code.Flags&encoder.AnonymousHeadFlags == 0 {
|
2021-11-28 15:46:32 +03:00
|
|
|
b = appendNullComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
code = code.End.Next
|
|
|
|
break
|
|
|
|
}
|
2021-05-29 08:47:18 +03:00
|
|
|
if code.Flags&encoder.AnonymousHeadFlags == 0 {
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendStructHead(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
2021-05-29 08:47:18 +03:00
|
|
|
if (code.Flags & encoder.IndirectFlags) != 0 {
|
|
|
|
p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
if p != 0 {
|
|
|
|
b = appendStructKey(ctx, code, b)
|
|
|
|
b = append(b, '"')
|
2021-05-31 19:36:30 +03:00
|
|
|
bb, err := appendNumber(ctx, b, ptrToNumber(p))
|
2021-05-19 06:34:40 +03:00
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
b = append(bb, '"')
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
code = code.Next
|
|
|
|
case encoder.OpStructPtrHeadArray, encoder.OpStructPtrHeadSlice:
|
2021-05-29 08:47:18 +03:00
|
|
|
if (code.Flags & encoder.IndirectFlags) != 0 {
|
2021-05-19 06:34:40 +03:00
|
|
|
p := load(ctxptr, code.Idx)
|
|
|
|
if p == 0 {
|
2021-05-29 08:47:18 +03:00
|
|
|
if code.Flags&encoder.AnonymousHeadFlags == 0 {
|
2021-11-28 15:46:32 +03:00
|
|
|
b = appendNullComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
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 {
|
2021-05-29 08:47:18 +03:00
|
|
|
if code.Flags&encoder.AnonymousHeadFlags == 0 {
|
2021-11-28 15:46:32 +03:00
|
|
|
b = appendNullComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
code = code.End.Next
|
|
|
|
break
|
|
|
|
}
|
2021-05-29 08:47:18 +03:00
|
|
|
if code.Flags&encoder.AnonymousHeadFlags == 0 {
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendStructHead(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
b = appendStructKey(ctx, code, b)
|
2021-05-29 08:47:18 +03:00
|
|
|
p += uintptr(code.Offset)
|
2021-05-19 06:34:40 +03:00
|
|
|
code = code.Next
|
|
|
|
store(ctxptr, code.Idx, p)
|
|
|
|
case encoder.OpStructPtrHeadOmitEmptyArray:
|
2021-05-29 08:47:18 +03:00
|
|
|
if (code.Flags & encoder.IndirectFlags) != 0 {
|
2021-05-19 06:34:40 +03:00
|
|
|
p := load(ctxptr, code.Idx)
|
|
|
|
if p == 0 {
|
2021-05-29 08:47:18 +03:00
|
|
|
if code.Flags&encoder.AnonymousHeadFlags == 0 {
|
2021-11-28 15:46:32 +03:00
|
|
|
b = appendNullComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
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 {
|
2021-05-29 08:47:18 +03:00
|
|
|
if code.Flags&encoder.AnonymousHeadFlags == 0 {
|
2021-11-28 15:46:32 +03:00
|
|
|
b = appendNullComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
code = code.End.Next
|
|
|
|
break
|
|
|
|
}
|
2021-05-29 08:47:18 +03:00
|
|
|
if code.Flags&encoder.AnonymousHeadFlags == 0 {
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendStructHead(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
2021-05-29 08:47:18 +03:00
|
|
|
p += uintptr(code.Offset)
|
2021-05-19 06:34:40 +03:00
|
|
|
b = appendStructKey(ctx, code, b)
|
|
|
|
code = code.Next
|
|
|
|
store(ctxptr, code.Idx, p)
|
|
|
|
case encoder.OpStructPtrHeadOmitEmptySlice:
|
2021-05-29 08:47:18 +03:00
|
|
|
if (code.Flags & encoder.IndirectFlags) != 0 {
|
2021-05-19 06:34:40 +03:00
|
|
|
p := load(ctxptr, code.Idx)
|
|
|
|
if p == 0 {
|
2021-05-29 08:47:18 +03:00
|
|
|
if code.Flags&encoder.AnonymousHeadFlags == 0 {
|
2021-11-28 15:46:32 +03:00
|
|
|
b = appendNullComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
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 {
|
2021-05-29 08:47:18 +03:00
|
|
|
if code.Flags&encoder.AnonymousHeadFlags == 0 {
|
2021-11-28 15:46:32 +03:00
|
|
|
b = appendNullComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
code = code.End.Next
|
|
|
|
break
|
|
|
|
}
|
2021-05-29 08:47:18 +03:00
|
|
|
if code.Flags&encoder.AnonymousHeadFlags == 0 {
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendStructHead(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
2021-05-29 08:47:18 +03:00
|
|
|
p += uintptr(code.Offset)
|
2021-05-19 06:34:40 +03:00
|
|
|
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 {
|
2021-05-29 08:47:18 +03:00
|
|
|
if code.Flags&encoder.AnonymousHeadFlags == 0 {
|
2021-11-28 15:46:32 +03:00
|
|
|
b = appendNullComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
code = code.End.Next
|
|
|
|
break
|
|
|
|
}
|
|
|
|
store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
|
|
|
|
fallthrough
|
|
|
|
case encoder.OpStructHeadArrayPtr, encoder.OpStructHeadSlicePtr:
|
|
|
|
p := load(ctxptr, code.Idx)
|
2021-05-29 08:47:18 +03:00
|
|
|
if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 {
|
|
|
|
if code.Flags&encoder.AnonymousHeadFlags == 0 {
|
2021-11-28 15:46:32 +03:00
|
|
|
b = appendNullComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
code = code.End.Next
|
|
|
|
break
|
|
|
|
}
|
2021-05-29 08:47:18 +03:00
|
|
|
if code.Flags&encoder.AnonymousHeadFlags == 0 {
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendStructHead(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
b = appendStructKey(ctx, code, b)
|
2021-05-29 08:47:18 +03:00
|
|
|
if (code.Flags & encoder.IndirectFlags) != 0 {
|
|
|
|
p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
if p == 0 {
|
2021-11-28 15:46:32 +03:00
|
|
|
b = appendNullComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
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 {
|
2021-05-29 08:47:18 +03:00
|
|
|
if code.Flags&encoder.AnonymousHeadFlags == 0 {
|
2021-11-28 15:46:32 +03:00
|
|
|
b = appendNullComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
code = code.End.Next
|
|
|
|
break
|
|
|
|
}
|
|
|
|
store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
|
|
|
|
fallthrough
|
|
|
|
case encoder.OpStructHeadOmitEmptyArrayPtr, encoder.OpStructHeadOmitEmptySlicePtr:
|
|
|
|
p := load(ctxptr, code.Idx)
|
2021-05-29 08:47:18 +03:00
|
|
|
if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 {
|
|
|
|
if code.Flags&encoder.AnonymousHeadFlags == 0 {
|
2021-11-28 15:46:32 +03:00
|
|
|
b = appendNullComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
code = code.End.Next
|
|
|
|
break
|
|
|
|
}
|
2021-05-29 08:47:18 +03:00
|
|
|
if code.Flags&encoder.AnonymousHeadFlags == 0 {
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendStructHead(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
2021-05-29 08:47:18 +03:00
|
|
|
if (code.Flags & encoder.IndirectFlags) != 0 {
|
|
|
|
p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
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 {
|
2021-05-29 08:47:18 +03:00
|
|
|
if code.Flags&encoder.AnonymousHeadFlags == 0 {
|
2021-11-28 15:46:32 +03:00
|
|
|
b = appendNullComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
code = code.End.Next
|
|
|
|
break
|
|
|
|
}
|
|
|
|
store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
|
|
|
|
fallthrough
|
|
|
|
case encoder.OpStructHeadMap:
|
|
|
|
p := load(ctxptr, code.Idx)
|
2021-05-29 08:47:18 +03:00
|
|
|
if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 {
|
|
|
|
if code.Flags&encoder.AnonymousHeadFlags == 0 {
|
2021-11-28 15:46:32 +03:00
|
|
|
b = appendNullComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
code = code.End.Next
|
|
|
|
break
|
|
|
|
}
|
2021-05-29 08:47:18 +03:00
|
|
|
if code.Flags&encoder.AnonymousHeadFlags == 0 {
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendStructHead(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
b = appendStructKey(ctx, code, b)
|
2021-05-29 08:47:18 +03:00
|
|
|
if p != 0 && (code.Flags&encoder.IndirectFlags) != 0 {
|
|
|
|
p = ptrToPtr(p + uintptr(code.Offset))
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
code = code.Next
|
|
|
|
store(ctxptr, code.Idx, p)
|
|
|
|
case encoder.OpStructPtrHeadOmitEmptyMap:
|
|
|
|
p := load(ctxptr, code.Idx)
|
|
|
|
if p == 0 {
|
2021-05-29 08:47:18 +03:00
|
|
|
if code.Flags&encoder.AnonymousHeadFlags == 0 {
|
2021-11-28 15:46:32 +03:00
|
|
|
b = appendNullComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
code = code.End.Next
|
|
|
|
break
|
|
|
|
}
|
|
|
|
store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
|
|
|
|
fallthrough
|
|
|
|
case encoder.OpStructHeadOmitEmptyMap:
|
|
|
|
p := load(ctxptr, code.Idx)
|
2021-05-29 08:47:18 +03:00
|
|
|
if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 {
|
|
|
|
if code.Flags&encoder.AnonymousHeadFlags == 0 {
|
2021-11-28 15:46:32 +03:00
|
|
|
b = appendNullComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
code = code.End.Next
|
|
|
|
break
|
|
|
|
}
|
2021-05-29 08:47:18 +03:00
|
|
|
if code.Flags&encoder.AnonymousHeadFlags == 0 {
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendStructHead(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
2021-05-29 08:47:18 +03:00
|
|
|
if p != 0 && (code.Flags&encoder.IndirectFlags) != 0 {
|
|
|
|
p = ptrToPtr(p + uintptr(code.Offset))
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
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 {
|
2021-05-29 08:47:18 +03:00
|
|
|
if code.Flags&encoder.AnonymousHeadFlags == 0 {
|
2021-11-28 15:46:32 +03:00
|
|
|
b = appendNullComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
code = code.End.Next
|
|
|
|
break
|
|
|
|
}
|
|
|
|
store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
|
|
|
|
fallthrough
|
|
|
|
case encoder.OpStructHeadMapPtr:
|
|
|
|
p := load(ctxptr, code.Idx)
|
2021-05-29 08:47:18 +03:00
|
|
|
if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 {
|
|
|
|
if code.Flags&encoder.AnonymousHeadFlags == 0 {
|
2021-11-28 15:46:32 +03:00
|
|
|
b = appendNullComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
code = code.End.Next
|
|
|
|
break
|
|
|
|
}
|
2021-05-29 08:47:18 +03:00
|
|
|
if code.Flags&encoder.AnonymousHeadFlags == 0 {
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendStructHead(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
b = appendStructKey(ctx, code, b)
|
|
|
|
if p == 0 {
|
2021-11-28 15:46:32 +03:00
|
|
|
b = appendNullComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
code = code.NextField
|
|
|
|
break
|
|
|
|
}
|
2021-05-29 08:47:18 +03:00
|
|
|
p = ptrToPtr(p + uintptr(code.Offset))
|
2021-05-19 06:34:40 +03:00
|
|
|
if p == 0 {
|
2021-11-28 15:46:32 +03:00
|
|
|
b = appendNullComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
code = code.NextField
|
|
|
|
} else {
|
2021-05-29 08:47:18 +03:00
|
|
|
if (code.Flags & encoder.IndirectFlags) != 0 {
|
2021-05-19 06:34:40 +03:00
|
|
|
p = ptrToNPtr(p, code.PtrNum)
|
|
|
|
}
|
|
|
|
code = code.Next
|
|
|
|
store(ctxptr, code.Idx, p)
|
|
|
|
}
|
|
|
|
case encoder.OpStructPtrHeadOmitEmptyMapPtr:
|
|
|
|
p := load(ctxptr, code.Idx)
|
|
|
|
if p == 0 {
|
2021-05-29 08:47:18 +03:00
|
|
|
if code.Flags&encoder.AnonymousHeadFlags == 0 {
|
2021-11-28 15:46:32 +03:00
|
|
|
b = appendNullComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
code = code.End.Next
|
|
|
|
break
|
|
|
|
}
|
|
|
|
store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
|
|
|
|
fallthrough
|
|
|
|
case encoder.OpStructHeadOmitEmptyMapPtr:
|
|
|
|
p := load(ctxptr, code.Idx)
|
2021-05-29 08:47:18 +03:00
|
|
|
if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 {
|
|
|
|
if code.Flags&encoder.AnonymousHeadFlags == 0 {
|
2021-11-28 15:46:32 +03:00
|
|
|
b = appendNullComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
code = code.End.Next
|
|
|
|
break
|
|
|
|
}
|
2021-05-29 08:47:18 +03:00
|
|
|
if code.Flags&encoder.AnonymousHeadFlags == 0 {
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendStructHead(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
if p == 0 {
|
|
|
|
code = code.NextField
|
|
|
|
break
|
|
|
|
}
|
2021-05-29 08:47:18 +03:00
|
|
|
p = ptrToPtr(p + uintptr(code.Offset))
|
2021-05-19 06:34:40 +03:00
|
|
|
if p == 0 {
|
|
|
|
code = code.NextField
|
|
|
|
} else {
|
2021-05-29 08:47:18 +03:00
|
|
|
if (code.Flags & encoder.IndirectFlags) != 0 {
|
2021-05-19 06:34:40 +03:00
|
|
|
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 {
|
2021-05-29 08:47:18 +03:00
|
|
|
if code.Flags&encoder.AnonymousHeadFlags == 0 {
|
2021-11-28 15:46:32 +03:00
|
|
|
b = appendNullComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
code = code.End.Next
|
|
|
|
break
|
|
|
|
}
|
2021-05-29 08:47:18 +03:00
|
|
|
if (code.Flags & encoder.IndirectFlags) != 0 {
|
2021-05-19 06:34:40 +03:00
|
|
|
store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
|
|
|
|
}
|
|
|
|
fallthrough
|
|
|
|
case encoder.OpStructHeadMarshalJSON:
|
|
|
|
p := load(ctxptr, code.Idx)
|
2021-05-29 08:47:18 +03:00
|
|
|
if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 {
|
|
|
|
if code.Flags&encoder.AnonymousHeadFlags == 0 {
|
2021-11-28 15:46:32 +03:00
|
|
|
b = appendNullComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
code = code.End.Next
|
|
|
|
break
|
|
|
|
}
|
2021-05-29 08:47:18 +03:00
|
|
|
if code.Flags&encoder.AnonymousHeadFlags == 0 {
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendStructHead(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
b = appendStructKey(ctx, code, b)
|
2022-01-11 09:11:17 +03:00
|
|
|
p += uintptr(code.Offset)
|
2021-05-29 08:47:18 +03:00
|
|
|
if (code.Flags & encoder.IsNilableTypeFlags) != 0 {
|
|
|
|
if (code.Flags&encoder.IndirectFlags) != 0 || code.Op == encoder.OpStructPtrHeadMarshalJSON {
|
2022-01-11 09:11:17 +03:00
|
|
|
p = ptrToPtr(p)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
}
|
2021-05-29 08:47:18 +03:00
|
|
|
if p == 0 && (code.Flags&encoder.NilCheckFlags) != 0 {
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendNull(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
} else {
|
|
|
|
bb, err := appendMarshalJSON(ctx, code, b, ptrToInterface(code, p))
|
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
b = bb
|
|
|
|
}
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
code = code.Next
|
|
|
|
case encoder.OpStructPtrHeadOmitEmptyMarshalJSON:
|
|
|
|
p := load(ctxptr, code.Idx)
|
|
|
|
if p == 0 {
|
2021-05-29 08:47:18 +03:00
|
|
|
if code.Flags&encoder.AnonymousHeadFlags == 0 {
|
2021-11-28 15:46:32 +03:00
|
|
|
b = appendNullComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
code = code.End.Next
|
|
|
|
break
|
|
|
|
}
|
2021-05-29 08:47:18 +03:00
|
|
|
if (code.Flags & encoder.IndirectFlags) != 0 {
|
2021-05-19 06:34:40 +03:00
|
|
|
store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
|
|
|
|
}
|
|
|
|
fallthrough
|
|
|
|
case encoder.OpStructHeadOmitEmptyMarshalJSON:
|
|
|
|
p := load(ctxptr, code.Idx)
|
2021-05-29 08:47:18 +03:00
|
|
|
if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 {
|
|
|
|
if code.Flags&encoder.AnonymousHeadFlags == 0 {
|
2021-11-28 15:46:32 +03:00
|
|
|
b = appendNullComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
code = code.End.Next
|
|
|
|
break
|
|
|
|
}
|
2021-05-29 08:47:18 +03:00
|
|
|
if code.Flags&encoder.AnonymousHeadFlags == 0 {
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendStructHead(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
2022-01-11 09:11:17 +03:00
|
|
|
p += uintptr(code.Offset)
|
2021-05-29 08:47:18 +03:00
|
|
|
if (code.Flags & encoder.IsNilableTypeFlags) != 0 {
|
|
|
|
if (code.Flags&encoder.IndirectFlags) != 0 || code.Op == encoder.OpStructPtrHeadOmitEmptyMarshalJSON {
|
2022-01-11 09:11:17 +03:00
|
|
|
p = ptrToPtr(p)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
iface := ptrToInterface(code, p)
|
2021-05-29 08:47:18 +03:00
|
|
|
if (code.Flags&encoder.NilCheckFlags) != 0 && encoder.IsNilForMarshaler(iface) {
|
2021-05-19 06:34:40 +03:00
|
|
|
code = code.NextField
|
|
|
|
} else {
|
|
|
|
b = appendStructKey(ctx, code, b)
|
|
|
|
bb, err := appendMarshalJSON(ctx, code, b, iface)
|
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
b = bb
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
code = code.Next
|
|
|
|
}
|
|
|
|
case encoder.OpStructPtrHeadMarshalJSONPtr:
|
|
|
|
p := load(ctxptr, code.Idx)
|
|
|
|
if p == 0 {
|
2021-05-29 08:47:18 +03:00
|
|
|
if code.Flags&encoder.AnonymousHeadFlags == 0 {
|
2021-11-28 15:46:32 +03:00
|
|
|
b = appendNullComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
code = code.End.Next
|
|
|
|
break
|
|
|
|
}
|
|
|
|
store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
|
|
|
|
fallthrough
|
|
|
|
case encoder.OpStructHeadMarshalJSONPtr:
|
|
|
|
p := load(ctxptr, code.Idx)
|
2021-05-29 08:47:18 +03:00
|
|
|
if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 {
|
|
|
|
if code.Flags&encoder.AnonymousHeadFlags == 0 {
|
2021-11-28 15:46:32 +03:00
|
|
|
b = appendNullComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
code = code.End.Next
|
|
|
|
break
|
|
|
|
}
|
2021-05-29 08:47:18 +03:00
|
|
|
if code.Flags&encoder.AnonymousHeadFlags == 0 {
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendStructHead(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
b = appendStructKey(ctx, code, b)
|
2021-05-29 08:47:18 +03:00
|
|
|
if (code.Flags & encoder.IndirectFlags) != 0 {
|
|
|
|
p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
if p == 0 {
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendNull(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
} else {
|
|
|
|
bb, err := appendMarshalJSON(ctx, code, b, ptrToInterface(code, p))
|
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
b = bb
|
|
|
|
}
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
code = code.Next
|
|
|
|
case encoder.OpStructPtrHeadOmitEmptyMarshalJSONPtr:
|
|
|
|
p := load(ctxptr, code.Idx)
|
|
|
|
if p == 0 {
|
2021-05-29 08:47:18 +03:00
|
|
|
if code.Flags&encoder.AnonymousHeadFlags == 0 {
|
2021-11-28 15:46:32 +03:00
|
|
|
b = appendNullComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
code = code.End.Next
|
|
|
|
break
|
|
|
|
}
|
|
|
|
store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
|
|
|
|
fallthrough
|
|
|
|
case encoder.OpStructHeadOmitEmptyMarshalJSONPtr:
|
|
|
|
p := load(ctxptr, code.Idx)
|
2021-05-29 08:47:18 +03:00
|
|
|
if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 {
|
|
|
|
if code.Flags&encoder.AnonymousHeadFlags == 0 {
|
2021-11-28 15:46:32 +03:00
|
|
|
b = appendNullComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
code = code.End.Next
|
|
|
|
break
|
|
|
|
}
|
2021-05-29 08:47:18 +03:00
|
|
|
if (code.Flags & encoder.IndirectFlags) != 0 {
|
|
|
|
p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
2021-05-29 08:47:18 +03:00
|
|
|
if code.Flags&encoder.AnonymousHeadFlags == 0 {
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendStructHead(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
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
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
code = code.Next
|
|
|
|
}
|
|
|
|
case encoder.OpStructPtrHeadMarshalText:
|
|
|
|
p := load(ctxptr, code.Idx)
|
|
|
|
if p == 0 {
|
2021-05-29 08:47:18 +03:00
|
|
|
if code.Flags&encoder.AnonymousHeadFlags == 0 {
|
2021-11-28 15:46:32 +03:00
|
|
|
b = appendNullComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
code = code.End.Next
|
|
|
|
break
|
|
|
|
}
|
2021-05-29 08:47:18 +03:00
|
|
|
if (code.Flags & encoder.IndirectFlags) != 0 {
|
2021-05-19 06:34:40 +03:00
|
|
|
store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
|
|
|
|
}
|
|
|
|
fallthrough
|
|
|
|
case encoder.OpStructHeadMarshalText:
|
|
|
|
p := load(ctxptr, code.Idx)
|
2021-05-29 08:47:18 +03:00
|
|
|
if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 {
|
|
|
|
if code.Flags&encoder.AnonymousHeadFlags == 0 {
|
2021-11-28 15:46:32 +03:00
|
|
|
b = appendNullComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
code = code.End.Next
|
|
|
|
break
|
|
|
|
}
|
2021-05-29 08:47:18 +03:00
|
|
|
if code.Flags&encoder.AnonymousHeadFlags == 0 {
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendStructHead(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
b = appendStructKey(ctx, code, b)
|
2022-01-11 09:11:17 +03:00
|
|
|
p += uintptr(code.Offset)
|
2021-05-29 08:47:18 +03:00
|
|
|
if (code.Flags & encoder.IsNilableTypeFlags) != 0 {
|
|
|
|
if (code.Flags&encoder.IndirectFlags) != 0 || code.Op == encoder.OpStructPtrHeadMarshalText {
|
2022-01-11 09:11:17 +03:00
|
|
|
p = ptrToPtr(p)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
}
|
2021-05-29 08:47:18 +03:00
|
|
|
if p == 0 && (code.Flags&encoder.NilCheckFlags) != 0 {
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendNull(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
} else {
|
2021-05-31 19:25:05 +03:00
|
|
|
bb, err := appendMarshalText(ctx, code, b, ptrToInterface(code, p))
|
2021-05-19 06:34:40 +03:00
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
b = bb
|
|
|
|
}
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
code = code.Next
|
|
|
|
case encoder.OpStructPtrHeadOmitEmptyMarshalText:
|
|
|
|
p := load(ctxptr, code.Idx)
|
|
|
|
if p == 0 {
|
2021-05-29 08:47:18 +03:00
|
|
|
if code.Flags&encoder.AnonymousHeadFlags == 0 {
|
2021-11-28 15:46:32 +03:00
|
|
|
b = appendNullComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
code = code.End.Next
|
|
|
|
break
|
|
|
|
}
|
2021-05-29 08:47:18 +03:00
|
|
|
if (code.Flags & encoder.IndirectFlags) != 0 {
|
2021-05-19 06:34:40 +03:00
|
|
|
store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
|
|
|
|
}
|
|
|
|
fallthrough
|
|
|
|
case encoder.OpStructHeadOmitEmptyMarshalText:
|
|
|
|
p := load(ctxptr, code.Idx)
|
2021-05-29 08:47:18 +03:00
|
|
|
if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 {
|
|
|
|
if code.Flags&encoder.AnonymousHeadFlags == 0 {
|
2021-11-28 15:46:32 +03:00
|
|
|
b = appendNullComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
code = code.End.Next
|
|
|
|
break
|
|
|
|
}
|
2021-05-29 08:47:18 +03:00
|
|
|
if code.Flags&encoder.AnonymousHeadFlags == 0 {
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendStructHead(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
2022-01-11 09:11:17 +03:00
|
|
|
p += uintptr(code.Offset)
|
2021-05-29 08:47:18 +03:00
|
|
|
if (code.Flags & encoder.IsNilableTypeFlags) != 0 {
|
|
|
|
if (code.Flags&encoder.IndirectFlags) != 0 || code.Op == encoder.OpStructPtrHeadOmitEmptyMarshalText {
|
2022-01-11 09:11:17 +03:00
|
|
|
p = ptrToPtr(p)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
}
|
2021-05-29 08:47:18 +03:00
|
|
|
if p == 0 && (code.Flags&encoder.NilCheckFlags) != 0 {
|
2021-05-19 06:34:40 +03:00
|
|
|
code = code.NextField
|
|
|
|
} else {
|
|
|
|
b = appendStructKey(ctx, code, b)
|
2021-05-31 19:25:05 +03:00
|
|
|
bb, err := appendMarshalText(ctx, code, b, ptrToInterface(code, p))
|
2021-05-19 06:34:40 +03:00
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
b = bb
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
code = code.Next
|
|
|
|
}
|
|
|
|
case encoder.OpStructPtrHeadMarshalTextPtr:
|
|
|
|
p := load(ctxptr, code.Idx)
|
|
|
|
if p == 0 {
|
2021-05-29 08:47:18 +03:00
|
|
|
if code.Flags&encoder.AnonymousHeadFlags == 0 {
|
2021-11-28 15:46:32 +03:00
|
|
|
b = appendNullComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
code = code.End.Next
|
|
|
|
break
|
|
|
|
}
|
|
|
|
store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
|
|
|
|
fallthrough
|
|
|
|
case encoder.OpStructHeadMarshalTextPtr:
|
|
|
|
p := load(ctxptr, code.Idx)
|
2021-05-29 08:47:18 +03:00
|
|
|
if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 {
|
|
|
|
if code.Flags&encoder.AnonymousHeadFlags == 0 {
|
2021-11-28 15:46:32 +03:00
|
|
|
b = appendNullComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
code = code.End.Next
|
|
|
|
break
|
|
|
|
}
|
2021-05-29 08:47:18 +03:00
|
|
|
if code.Flags&encoder.AnonymousHeadFlags == 0 {
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendStructHead(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
b = appendStructKey(ctx, code, b)
|
2021-05-29 08:47:18 +03:00
|
|
|
if (code.Flags & encoder.IndirectFlags) != 0 {
|
|
|
|
p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
if p == 0 {
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendNull(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
} else {
|
2021-05-31 19:25:05 +03:00
|
|
|
bb, err := appendMarshalText(ctx, code, b, ptrToInterface(code, p))
|
2021-05-19 06:34:40 +03:00
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
b = bb
|
|
|
|
}
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
code = code.Next
|
|
|
|
case encoder.OpStructPtrHeadOmitEmptyMarshalTextPtr:
|
|
|
|
p := load(ctxptr, code.Idx)
|
|
|
|
if p == 0 {
|
2021-05-29 08:47:18 +03:00
|
|
|
if code.Flags&encoder.AnonymousHeadFlags == 0 {
|
2021-11-28 15:46:32 +03:00
|
|
|
b = appendNullComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
code = code.End.Next
|
|
|
|
break
|
|
|
|
}
|
|
|
|
store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
|
|
|
|
fallthrough
|
|
|
|
case encoder.OpStructHeadOmitEmptyMarshalTextPtr:
|
|
|
|
p := load(ctxptr, code.Idx)
|
2021-05-29 08:47:18 +03:00
|
|
|
if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 {
|
|
|
|
if code.Flags&encoder.AnonymousHeadFlags == 0 {
|
2021-11-28 15:46:32 +03:00
|
|
|
b = appendNullComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
code = code.End.Next
|
|
|
|
break
|
|
|
|
}
|
2021-05-29 08:47:18 +03:00
|
|
|
if (code.Flags & encoder.IndirectFlags) != 0 {
|
|
|
|
p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
2021-05-29 08:47:18 +03:00
|
|
|
if code.Flags&encoder.AnonymousHeadFlags == 0 {
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendStructHead(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
if p == 0 {
|
|
|
|
code = code.NextField
|
|
|
|
} else {
|
|
|
|
b = appendStructKey(ctx, code, b)
|
2021-05-31 19:25:05 +03:00
|
|
|
bb, err := appendMarshalText(ctx, code, b, ptrToInterface(code, p))
|
2021-05-19 06:34:40 +03:00
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
b = bb
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
code = code.Next
|
|
|
|
}
|
|
|
|
case encoder.OpStructField:
|
2021-08-12 07:03:34 +03:00
|
|
|
if code.Flags&encoder.IsTaggedKeyFlags != 0 || code.Flags&encoder.AnonymousKeyFlags == 0 {
|
2021-05-19 06:34:40 +03:00
|
|
|
b = appendStructKey(ctx, code, b)
|
|
|
|
}
|
2021-05-29 08:47:18 +03:00
|
|
|
p := load(ctxptr, code.Idx) + uintptr(code.Offset)
|
2021-05-19 06:34:40 +03:00
|
|
|
code = code.Next
|
|
|
|
store(ctxptr, code.Idx, p)
|
|
|
|
case encoder.OpStructFieldOmitEmpty:
|
2021-05-29 08:47:18 +03:00
|
|
|
p := load(ctxptr, code.Idx)
|
|
|
|
p += uintptr(code.Offset)
|
|
|
|
if ptrToPtr(p) == 0 && (code.Flags&encoder.IsNextOpPtrTypeFlags) != 0 {
|
2021-05-19 06:34:40 +03:00
|
|
|
code = code.NextField
|
|
|
|
} else {
|
|
|
|
b = appendStructKey(ctx, code, b)
|
|
|
|
code = code.Next
|
|
|
|
store(ctxptr, code.Idx, p)
|
|
|
|
}
|
|
|
|
case encoder.OpStructFieldInt:
|
2021-05-29 08:47:18 +03:00
|
|
|
p := load(ctxptr, code.Idx)
|
2021-05-19 06:34:40 +03:00
|
|
|
b = appendStructKey(ctx, code, b)
|
2021-10-14 09:00:28 +03:00
|
|
|
b = appendInt(ctx, b, p+uintptr(code.Offset), code)
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
code = code.Next
|
|
|
|
case encoder.OpStructFieldOmitEmptyInt:
|
2021-05-29 08:47:18 +03:00
|
|
|
p := load(ctxptr, code.Idx)
|
2021-10-14 09:00:28 +03:00
|
|
|
u64 := ptrToUint64(p+uintptr(code.Offset), code.NumBitSize)
|
2021-05-29 08:47:18 +03:00
|
|
|
v := u64 & ((1 << code.NumBitSize) - 1)
|
2021-05-19 06:34:40 +03:00
|
|
|
if v != 0 {
|
|
|
|
b = appendStructKey(ctx, code, b)
|
2021-10-14 09:00:28 +03:00
|
|
|
b = appendInt(ctx, b, p+uintptr(code.Offset), code)
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
code = code.Next
|
|
|
|
case encoder.OpStructFieldIntString:
|
2021-05-29 08:47:18 +03:00
|
|
|
p := load(ctxptr, code.Idx)
|
2021-05-19 06:34:40 +03:00
|
|
|
b = appendStructKey(ctx, code, b)
|
|
|
|
b = append(b, '"')
|
2021-10-14 09:00:28 +03:00
|
|
|
b = appendInt(ctx, b, p+uintptr(code.Offset), code)
|
2021-05-19 06:34:40 +03:00
|
|
|
b = append(b, '"')
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
code = code.Next
|
|
|
|
case encoder.OpStructFieldOmitEmptyIntString:
|
2021-05-29 08:47:18 +03:00
|
|
|
p := load(ctxptr, code.Idx)
|
2021-10-14 09:00:28 +03:00
|
|
|
u64 := ptrToUint64(p+uintptr(code.Offset), code.NumBitSize)
|
2021-05-29 08:47:18 +03:00
|
|
|
v := u64 & ((1 << code.NumBitSize) - 1)
|
2021-05-19 06:34:40 +03:00
|
|
|
if v != 0 {
|
|
|
|
b = appendStructKey(ctx, code, b)
|
|
|
|
b = append(b, '"')
|
2021-10-14 09:00:28 +03:00
|
|
|
b = appendInt(ctx, b, p+uintptr(code.Offset), code)
|
2021-05-19 06:34:40 +03:00
|
|
|
b = append(b, '"')
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
code = code.Next
|
|
|
|
case encoder.OpStructFieldIntPtr:
|
2021-05-29 08:47:18 +03:00
|
|
|
p := load(ctxptr, code.Idx)
|
|
|
|
p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
|
2021-05-19 06:34:40 +03:00
|
|
|
b = appendStructKey(ctx, code, b)
|
|
|
|
if p == 0 {
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendNull(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
} else {
|
2021-10-14 09:00:28 +03:00
|
|
|
b = appendInt(ctx, b, p, code)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
code = code.Next
|
|
|
|
case encoder.OpStructFieldOmitEmptyIntPtr:
|
2021-05-29 08:47:18 +03:00
|
|
|
p := load(ctxptr, code.Idx)
|
|
|
|
p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
|
2021-05-19 06:34:40 +03:00
|
|
|
if p != 0 {
|
|
|
|
b = appendStructKey(ctx, code, b)
|
2021-10-14 09:00:28 +03:00
|
|
|
b = appendInt(ctx, b, p, code)
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
code = code.Next
|
|
|
|
case encoder.OpStructFieldIntPtrString:
|
2021-05-29 08:47:18 +03:00
|
|
|
p := load(ctxptr, code.Idx)
|
|
|
|
p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
|
2021-05-19 06:34:40 +03:00
|
|
|
b = appendStructKey(ctx, code, b)
|
|
|
|
if p == 0 {
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendNull(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
} else {
|
|
|
|
b = append(b, '"')
|
2021-10-14 09:00:28 +03:00
|
|
|
b = appendInt(ctx, b, p, code)
|
2021-05-19 06:34:40 +03:00
|
|
|
b = append(b, '"')
|
|
|
|
}
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
code = code.Next
|
|
|
|
case encoder.OpStructFieldOmitEmptyIntPtrString:
|
2021-05-29 08:47:18 +03:00
|
|
|
p := load(ctxptr, code.Idx)
|
|
|
|
p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
|
2021-05-19 06:34:40 +03:00
|
|
|
if p != 0 {
|
|
|
|
b = appendStructKey(ctx, code, b)
|
|
|
|
b = append(b, '"')
|
2021-10-14 09:00:28 +03:00
|
|
|
b = appendInt(ctx, b, p, code)
|
2021-05-19 06:34:40 +03:00
|
|
|
b = append(b, '"')
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
code = code.Next
|
|
|
|
case encoder.OpStructFieldUint:
|
2021-05-29 08:47:18 +03:00
|
|
|
p := load(ctxptr, code.Idx)
|
2021-05-19 06:34:40 +03:00
|
|
|
b = appendStructKey(ctx, code, b)
|
2021-10-14 09:00:28 +03:00
|
|
|
b = appendUint(ctx, b, p+uintptr(code.Offset), code)
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
code = code.Next
|
|
|
|
case encoder.OpStructFieldOmitEmptyUint:
|
2021-05-29 08:47:18 +03:00
|
|
|
p := load(ctxptr, code.Idx)
|
2021-10-14 09:00:28 +03:00
|
|
|
u64 := ptrToUint64(p+uintptr(code.Offset), code.NumBitSize)
|
2021-05-29 08:47:18 +03:00
|
|
|
v := u64 & ((1 << code.NumBitSize) - 1)
|
2021-05-19 06:34:40 +03:00
|
|
|
if v != 0 {
|
|
|
|
b = appendStructKey(ctx, code, b)
|
2021-10-14 09:00:28 +03:00
|
|
|
b = appendUint(ctx, b, p+uintptr(code.Offset), code)
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
code = code.Next
|
|
|
|
case encoder.OpStructFieldUintString:
|
2021-05-29 08:47:18 +03:00
|
|
|
p := load(ctxptr, code.Idx)
|
2021-05-19 06:34:40 +03:00
|
|
|
b = appendStructKey(ctx, code, b)
|
|
|
|
b = append(b, '"')
|
2021-10-14 09:00:28 +03:00
|
|
|
b = appendUint(ctx, b, p+uintptr(code.Offset), code)
|
2021-05-19 06:34:40 +03:00
|
|
|
b = append(b, '"')
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
code = code.Next
|
|
|
|
case encoder.OpStructFieldOmitEmptyUintString:
|
2021-05-29 08:47:18 +03:00
|
|
|
p := load(ctxptr, code.Idx)
|
2021-10-14 09:00:28 +03:00
|
|
|
u64 := ptrToUint64(p+uintptr(code.Offset), code.NumBitSize)
|
2021-05-29 08:47:18 +03:00
|
|
|
v := u64 & ((1 << code.NumBitSize) - 1)
|
2021-05-19 06:34:40 +03:00
|
|
|
if v != 0 {
|
|
|
|
b = appendStructKey(ctx, code, b)
|
|
|
|
b = append(b, '"')
|
2021-10-14 09:00:28 +03:00
|
|
|
b = appendUint(ctx, b, p+uintptr(code.Offset), code)
|
2021-05-19 06:34:40 +03:00
|
|
|
b = append(b, '"')
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
code = code.Next
|
|
|
|
case encoder.OpStructFieldUintPtr:
|
2021-05-29 08:47:18 +03:00
|
|
|
p := load(ctxptr, code.Idx)
|
|
|
|
p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
|
2021-05-19 06:34:40 +03:00
|
|
|
b = appendStructKey(ctx, code, b)
|
|
|
|
if p == 0 {
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendNull(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
} else {
|
2021-10-14 09:00:28 +03:00
|
|
|
b = appendUint(ctx, b, p, code)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
code = code.Next
|
|
|
|
case encoder.OpStructFieldOmitEmptyUintPtr:
|
2021-05-29 08:47:18 +03:00
|
|
|
p := load(ctxptr, code.Idx)
|
|
|
|
p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
|
2021-05-19 06:34:40 +03:00
|
|
|
if p != 0 {
|
|
|
|
b = appendStructKey(ctx, code, b)
|
2021-10-14 09:00:28 +03:00
|
|
|
b = appendUint(ctx, b, p, code)
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
code = code.Next
|
|
|
|
case encoder.OpStructFieldUintPtrString:
|
2021-05-29 08:47:18 +03:00
|
|
|
p := load(ctxptr, code.Idx)
|
|
|
|
p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
|
2021-05-19 06:34:40 +03:00
|
|
|
b = appendStructKey(ctx, code, b)
|
|
|
|
if p == 0 {
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendNull(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
} else {
|
|
|
|
b = append(b, '"')
|
2021-10-14 09:00:28 +03:00
|
|
|
b = appendUint(ctx, b, p, code)
|
2021-05-19 06:34:40 +03:00
|
|
|
b = append(b, '"')
|
|
|
|
}
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
code = code.Next
|
|
|
|
case encoder.OpStructFieldOmitEmptyUintPtrString:
|
2021-05-29 08:47:18 +03:00
|
|
|
p := load(ctxptr, code.Idx)
|
|
|
|
p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
|
2021-05-19 06:34:40 +03:00
|
|
|
if p != 0 {
|
|
|
|
b = appendStructKey(ctx, code, b)
|
|
|
|
b = append(b, '"')
|
2021-10-14 09:00:28 +03:00
|
|
|
b = appendUint(ctx, b, p, code)
|
2021-05-19 06:34:40 +03:00
|
|
|
b = append(b, '"')
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
code = code.Next
|
|
|
|
case encoder.OpStructFieldFloat32:
|
2021-05-29 08:47:18 +03:00
|
|
|
p := load(ctxptr, code.Idx)
|
2021-05-19 06:34:40 +03:00
|
|
|
b = appendStructKey(ctx, code, b)
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendFloat32(ctx, b, ptrToFloat32(p+uintptr(code.Offset)))
|
|
|
|
b = appendComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
code = code.Next
|
|
|
|
case encoder.OpStructFieldOmitEmptyFloat32:
|
2021-05-29 08:47:18 +03:00
|
|
|
p := load(ctxptr, code.Idx)
|
|
|
|
v := ptrToFloat32(p + uintptr(code.Offset))
|
2021-05-19 06:34:40 +03:00
|
|
|
if v != 0 {
|
|
|
|
b = appendStructKey(ctx, code, b)
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendFloat32(ctx, b, v)
|
|
|
|
b = appendComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
code = code.Next
|
|
|
|
case encoder.OpStructFieldFloat32String:
|
2021-05-29 08:47:18 +03:00
|
|
|
p := load(ctxptr, code.Idx)
|
2021-05-19 06:34:40 +03:00
|
|
|
b = appendStructKey(ctx, code, b)
|
|
|
|
b = append(b, '"')
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendFloat32(ctx, b, ptrToFloat32(p+uintptr(code.Offset)))
|
2021-05-19 06:34:40 +03:00
|
|
|
b = append(b, '"')
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
code = code.Next
|
|
|
|
case encoder.OpStructFieldOmitEmptyFloat32String:
|
2021-05-29 08:47:18 +03:00
|
|
|
p := load(ctxptr, code.Idx)
|
|
|
|
v := ptrToFloat32(p + uintptr(code.Offset))
|
2021-05-19 06:34:40 +03:00
|
|
|
if v != 0 {
|
|
|
|
b = appendStructKey(ctx, code, b)
|
|
|
|
b = append(b, '"')
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendFloat32(ctx, b, v)
|
2021-05-19 06:34:40 +03:00
|
|
|
b = append(b, '"')
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
code = code.Next
|
|
|
|
case encoder.OpStructFieldFloat32Ptr:
|
2021-05-29 08:47:18 +03:00
|
|
|
p := load(ctxptr, code.Idx)
|
|
|
|
p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
|
2021-05-19 06:34:40 +03:00
|
|
|
b = appendStructKey(ctx, code, b)
|
|
|
|
if p == 0 {
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendNull(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
} else {
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendFloat32(ctx, b, ptrToFloat32(p))
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
code = code.Next
|
|
|
|
case encoder.OpStructFieldOmitEmptyFloat32Ptr:
|
2021-05-29 08:47:18 +03:00
|
|
|
p := load(ctxptr, code.Idx)
|
|
|
|
p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
|
2021-05-19 06:34:40 +03:00
|
|
|
if p != 0 {
|
|
|
|
b = appendStructKey(ctx, code, b)
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendFloat32(ctx, b, ptrToFloat32(p))
|
|
|
|
b = appendComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
code = code.Next
|
|
|
|
case encoder.OpStructFieldFloat32PtrString:
|
2021-05-29 08:47:18 +03:00
|
|
|
p := load(ctxptr, code.Idx)
|
|
|
|
p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
|
2021-05-19 06:34:40 +03:00
|
|
|
b = appendStructKey(ctx, code, b)
|
|
|
|
if p == 0 {
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendNull(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
} else {
|
|
|
|
b = append(b, '"')
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendFloat32(ctx, b, ptrToFloat32(p))
|
2021-05-19 06:34:40 +03:00
|
|
|
b = append(b, '"')
|
|
|
|
}
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
code = code.Next
|
|
|
|
case encoder.OpStructFieldOmitEmptyFloat32PtrString:
|
2021-05-29 08:47:18 +03:00
|
|
|
p := load(ctxptr, code.Idx)
|
|
|
|
p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
|
2021-05-19 06:34:40 +03:00
|
|
|
if p != 0 {
|
|
|
|
b = appendStructKey(ctx, code, b)
|
|
|
|
b = append(b, '"')
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendFloat32(ctx, b, ptrToFloat32(p))
|
2021-05-19 06:34:40 +03:00
|
|
|
b = append(b, '"')
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
code = code.Next
|
|
|
|
case encoder.OpStructFieldFloat64:
|
2021-05-29 08:47:18 +03:00
|
|
|
p := load(ctxptr, code.Idx)
|
2021-05-19 06:34:40 +03:00
|
|
|
b = appendStructKey(ctx, code, b)
|
2021-05-29 08:47:18 +03:00
|
|
|
v := ptrToFloat64(p + uintptr(code.Offset))
|
2021-05-19 06:34:40 +03:00
|
|
|
if math.IsInf(v, 0) || math.IsNaN(v) {
|
|
|
|
return nil, errUnsupportedFloat(v)
|
|
|
|
}
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendFloat64(ctx, b, v)
|
|
|
|
b = appendComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
code = code.Next
|
|
|
|
case encoder.OpStructFieldOmitEmptyFloat64:
|
2021-05-29 08:47:18 +03:00
|
|
|
p := load(ctxptr, code.Idx)
|
|
|
|
v := ptrToFloat64(p + uintptr(code.Offset))
|
2021-05-19 06:34:40 +03:00
|
|
|
if v != 0 {
|
|
|
|
if math.IsInf(v, 0) || math.IsNaN(v) {
|
|
|
|
return nil, errUnsupportedFloat(v)
|
|
|
|
}
|
|
|
|
b = appendStructKey(ctx, code, b)
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendFloat64(ctx, b, v)
|
|
|
|
b = appendComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
code = code.Next
|
|
|
|
case encoder.OpStructFieldFloat64String:
|
2021-05-29 08:47:18 +03:00
|
|
|
p := load(ctxptr, code.Idx)
|
|
|
|
v := ptrToFloat64(p + uintptr(code.Offset))
|
2021-05-19 06:34:40 +03:00
|
|
|
if math.IsInf(v, 0) || math.IsNaN(v) {
|
|
|
|
return nil, errUnsupportedFloat(v)
|
|
|
|
}
|
|
|
|
b = appendStructKey(ctx, code, b)
|
|
|
|
b = append(b, '"')
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendFloat64(ctx, b, v)
|
2021-05-19 06:34:40 +03:00
|
|
|
b = append(b, '"')
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
code = code.Next
|
|
|
|
case encoder.OpStructFieldOmitEmptyFloat64String:
|
2021-05-29 08:47:18 +03:00
|
|
|
p := load(ctxptr, code.Idx)
|
|
|
|
v := ptrToFloat64(p + uintptr(code.Offset))
|
2021-05-19 06:34:40 +03:00
|
|
|
if v != 0 {
|
|
|
|
if math.IsInf(v, 0) || math.IsNaN(v) {
|
|
|
|
return nil, errUnsupportedFloat(v)
|
|
|
|
}
|
|
|
|
b = appendStructKey(ctx, code, b)
|
|
|
|
b = append(b, '"')
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendFloat64(ctx, b, v)
|
2021-05-19 06:34:40 +03:00
|
|
|
b = append(b, '"')
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
code = code.Next
|
|
|
|
case encoder.OpStructFieldFloat64Ptr:
|
2021-05-29 08:47:18 +03:00
|
|
|
p := load(ctxptr, code.Idx)
|
|
|
|
p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
|
2021-05-19 06:34:40 +03:00
|
|
|
b = appendStructKey(ctx, code, b)
|
|
|
|
if p == 0 {
|
2021-11-28 15:46:32 +03:00
|
|
|
b = appendNullComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
code = code.Next
|
|
|
|
break
|
|
|
|
}
|
|
|
|
v := ptrToFloat64(p)
|
|
|
|
if math.IsInf(v, 0) || math.IsNaN(v) {
|
|
|
|
return nil, errUnsupportedFloat(v)
|
|
|
|
}
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendFloat64(ctx, b, v)
|
|
|
|
b = appendComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
code = code.Next
|
|
|
|
case encoder.OpStructFieldOmitEmptyFloat64Ptr:
|
2021-05-29 08:47:18 +03:00
|
|
|
p := load(ctxptr, code.Idx)
|
|
|
|
p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
|
2021-05-19 06:34:40 +03:00
|
|
|
if p != 0 {
|
|
|
|
b = appendStructKey(ctx, code, b)
|
|
|
|
v := ptrToFloat64(p)
|
|
|
|
if math.IsInf(v, 0) || math.IsNaN(v) {
|
|
|
|
return nil, errUnsupportedFloat(v)
|
|
|
|
}
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendFloat64(ctx, b, v)
|
|
|
|
b = appendComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
code = code.Next
|
|
|
|
case encoder.OpStructFieldFloat64PtrString:
|
2021-05-29 08:47:18 +03:00
|
|
|
p := load(ctxptr, code.Idx)
|
|
|
|
p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
|
2021-05-19 06:34:40 +03:00
|
|
|
b = appendStructKey(ctx, code, b)
|
|
|
|
if p == 0 {
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendNull(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
} else {
|
|
|
|
v := ptrToFloat64(p)
|
|
|
|
if math.IsInf(v, 0) || math.IsNaN(v) {
|
|
|
|
return nil, errUnsupportedFloat(v)
|
|
|
|
}
|
|
|
|
b = append(b, '"')
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendFloat64(ctx, b, v)
|
2021-05-19 06:34:40 +03:00
|
|
|
b = append(b, '"')
|
|
|
|
}
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
code = code.Next
|
|
|
|
case encoder.OpStructFieldOmitEmptyFloat64PtrString:
|
2021-05-29 08:47:18 +03:00
|
|
|
p := load(ctxptr, code.Idx)
|
|
|
|
p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
|
2021-05-19 06:34:40 +03:00
|
|
|
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)
|
|
|
|
}
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendFloat64(ctx, b, v)
|
2021-05-19 06:34:40 +03:00
|
|
|
b = append(b, '"')
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
code = code.Next
|
|
|
|
case encoder.OpStructFieldString:
|
2021-05-29 08:47:18 +03:00
|
|
|
p := load(ctxptr, code.Idx)
|
2021-05-19 06:34:40 +03:00
|
|
|
b = appendStructKey(ctx, code, b)
|
2021-05-31 19:25:05 +03:00
|
|
|
b = appendString(ctx, b, ptrToString(p+uintptr(code.Offset)))
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
code = code.Next
|
|
|
|
case encoder.OpStructFieldOmitEmptyString:
|
2021-05-29 08:47:18 +03:00
|
|
|
p := load(ctxptr, code.Idx)
|
|
|
|
v := ptrToString(p + uintptr(code.Offset))
|
2021-05-19 06:34:40 +03:00
|
|
|
if v != "" {
|
|
|
|
b = appendStructKey(ctx, code, b)
|
2021-05-31 19:25:05 +03:00
|
|
|
b = appendString(ctx, b, v)
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
code = code.Next
|
|
|
|
case encoder.OpStructFieldStringString:
|
2021-05-29 08:47:18 +03:00
|
|
|
p := load(ctxptr, code.Idx)
|
|
|
|
s := ptrToString(p + uintptr(code.Offset))
|
2021-05-19 06:34:40 +03:00
|
|
|
b = appendStructKey(ctx, code, b)
|
2021-05-31 19:25:05 +03:00
|
|
|
b = appendString(ctx, b, string(appendString(ctx, []byte{}, s)))
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
code = code.Next
|
|
|
|
case encoder.OpStructFieldOmitEmptyStringString:
|
2021-05-29 08:47:18 +03:00
|
|
|
p := load(ctxptr, code.Idx)
|
|
|
|
v := ptrToString(p + uintptr(code.Offset))
|
2021-05-19 06:34:40 +03:00
|
|
|
if v != "" {
|
|
|
|
b = appendStructKey(ctx, code, b)
|
2021-05-31 19:25:05 +03:00
|
|
|
b = appendString(ctx, b, string(appendString(ctx, []byte{}, v)))
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
code = code.Next
|
|
|
|
case encoder.OpStructFieldStringPtr:
|
2021-05-29 08:47:18 +03:00
|
|
|
p := load(ctxptr, code.Idx)
|
|
|
|
p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
|
2021-05-19 06:34:40 +03:00
|
|
|
b = appendStructKey(ctx, code, b)
|
|
|
|
if p == 0 {
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendNull(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
} else {
|
2021-05-31 19:25:05 +03:00
|
|
|
b = appendString(ctx, b, ptrToString(p))
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
code = code.Next
|
|
|
|
case encoder.OpStructFieldOmitEmptyStringPtr:
|
2021-05-29 08:47:18 +03:00
|
|
|
p := load(ctxptr, code.Idx)
|
|
|
|
p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
|
2021-05-19 06:34:40 +03:00
|
|
|
if p != 0 {
|
|
|
|
b = appendStructKey(ctx, code, b)
|
2021-05-31 19:25:05 +03:00
|
|
|
b = appendString(ctx, b, ptrToString(p))
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
code = code.Next
|
|
|
|
case encoder.OpStructFieldStringPtrString:
|
2021-05-29 08:47:18 +03:00
|
|
|
p := load(ctxptr, code.Idx)
|
|
|
|
p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
|
2021-05-19 06:34:40 +03:00
|
|
|
b = appendStructKey(ctx, code, b)
|
|
|
|
if p == 0 {
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendNull(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
} else {
|
2021-05-31 19:25:05 +03:00
|
|
|
b = appendString(ctx, b, string(appendString(ctx, []byte{}, ptrToString(p))))
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
code = code.Next
|
|
|
|
case encoder.OpStructFieldOmitEmptyStringPtrString:
|
2021-05-29 08:47:18 +03:00
|
|
|
p := load(ctxptr, code.Idx)
|
|
|
|
p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
|
2021-05-19 06:34:40 +03:00
|
|
|
if p != 0 {
|
|
|
|
b = appendStructKey(ctx, code, b)
|
2021-05-31 19:25:05 +03:00
|
|
|
b = appendString(ctx, b, string(appendString(ctx, []byte{}, ptrToString(p))))
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
code = code.Next
|
|
|
|
case encoder.OpStructFieldBool:
|
2021-05-29 08:47:18 +03:00
|
|
|
p := load(ctxptr, code.Idx)
|
2021-05-19 06:34:40 +03:00
|
|
|
b = appendStructKey(ctx, code, b)
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendBool(ctx, b, ptrToBool(p+uintptr(code.Offset)))
|
|
|
|
b = appendComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
code = code.Next
|
|
|
|
case encoder.OpStructFieldOmitEmptyBool:
|
2021-05-29 08:47:18 +03:00
|
|
|
p := load(ctxptr, code.Idx)
|
|
|
|
v := ptrToBool(p + uintptr(code.Offset))
|
2021-05-19 06:34:40 +03:00
|
|
|
if v {
|
|
|
|
b = appendStructKey(ctx, code, b)
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendBool(ctx, b, v)
|
|
|
|
b = appendComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
code = code.Next
|
|
|
|
case encoder.OpStructFieldBoolString:
|
2021-05-29 08:47:18 +03:00
|
|
|
p := load(ctxptr, code.Idx)
|
2021-05-19 06:34:40 +03:00
|
|
|
b = appendStructKey(ctx, code, b)
|
|
|
|
b = append(b, '"')
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendBool(ctx, b, ptrToBool(p+uintptr(code.Offset)))
|
2021-05-19 06:34:40 +03:00
|
|
|
b = append(b, '"')
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
code = code.Next
|
|
|
|
case encoder.OpStructFieldOmitEmptyBoolString:
|
2021-05-29 08:47:18 +03:00
|
|
|
p := load(ctxptr, code.Idx)
|
|
|
|
v := ptrToBool(p + uintptr(code.Offset))
|
2021-05-19 06:34:40 +03:00
|
|
|
if v {
|
|
|
|
b = appendStructKey(ctx, code, b)
|
|
|
|
b = append(b, '"')
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendBool(ctx, b, v)
|
2021-05-19 06:34:40 +03:00
|
|
|
b = append(b, '"')
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
code = code.Next
|
|
|
|
case encoder.OpStructFieldBoolPtr:
|
2021-05-29 08:47:18 +03:00
|
|
|
p := load(ctxptr, code.Idx)
|
|
|
|
p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
|
2021-05-19 06:34:40 +03:00
|
|
|
b = appendStructKey(ctx, code, b)
|
|
|
|
if p == 0 {
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendNull(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
} else {
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendBool(ctx, b, ptrToBool(p))
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
code = code.Next
|
|
|
|
case encoder.OpStructFieldOmitEmptyBoolPtr:
|
2021-05-29 08:47:18 +03:00
|
|
|
p := load(ctxptr, code.Idx)
|
|
|
|
p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
|
2021-05-19 06:34:40 +03:00
|
|
|
if p != 0 {
|
|
|
|
b = appendStructKey(ctx, code, b)
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendBool(ctx, b, ptrToBool(p))
|
|
|
|
b = appendComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
code = code.Next
|
|
|
|
case encoder.OpStructFieldBoolPtrString:
|
2021-05-29 08:47:18 +03:00
|
|
|
p := load(ctxptr, code.Idx)
|
|
|
|
p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
|
2021-05-19 06:34:40 +03:00
|
|
|
b = appendStructKey(ctx, code, b)
|
|
|
|
if p == 0 {
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendNull(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
} else {
|
|
|
|
b = append(b, '"')
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendBool(ctx, b, ptrToBool(p))
|
2021-05-19 06:34:40 +03:00
|
|
|
b = append(b, '"')
|
|
|
|
}
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
code = code.Next
|
|
|
|
case encoder.OpStructFieldOmitEmptyBoolPtrString:
|
2021-05-29 08:47:18 +03:00
|
|
|
p := load(ctxptr, code.Idx)
|
|
|
|
p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
|
2021-05-19 06:34:40 +03:00
|
|
|
if p != 0 {
|
|
|
|
b = appendStructKey(ctx, code, b)
|
|
|
|
b = append(b, '"')
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendBool(ctx, b, ptrToBool(p))
|
2021-05-19 06:34:40 +03:00
|
|
|
b = append(b, '"')
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
code = code.Next
|
|
|
|
case encoder.OpStructFieldBytes:
|
2021-05-29 08:47:18 +03:00
|
|
|
p := load(ctxptr, code.Idx)
|
2021-05-19 06:34:40 +03:00
|
|
|
b = appendStructKey(ctx, code, b)
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendByteSlice(ctx, b, ptrToBytes(p+uintptr(code.Offset)))
|
|
|
|
b = appendComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
code = code.Next
|
|
|
|
case encoder.OpStructFieldOmitEmptyBytes:
|
2021-05-29 08:47:18 +03:00
|
|
|
p := load(ctxptr, code.Idx)
|
|
|
|
v := ptrToBytes(p + uintptr(code.Offset))
|
2021-05-19 06:34:40 +03:00
|
|
|
if len(v) > 0 {
|
|
|
|
b = appendStructKey(ctx, code, b)
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendByteSlice(ctx, b, v)
|
|
|
|
b = appendComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
code = code.Next
|
|
|
|
case encoder.OpStructFieldBytesPtr:
|
2021-05-29 08:47:18 +03:00
|
|
|
p := load(ctxptr, code.Idx)
|
|
|
|
p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
|
2021-05-19 06:34:40 +03:00
|
|
|
b = appendStructKey(ctx, code, b)
|
|
|
|
if p == 0 {
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendNull(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
} else {
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendByteSlice(ctx, b, ptrToBytes(p))
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
code = code.Next
|
|
|
|
case encoder.OpStructFieldOmitEmptyBytesPtr:
|
2021-05-29 08:47:18 +03:00
|
|
|
p := load(ctxptr, code.Idx)
|
|
|
|
p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
|
2021-05-19 06:34:40 +03:00
|
|
|
if p != 0 {
|
|
|
|
b = appendStructKey(ctx, code, b)
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendByteSlice(ctx, b, ptrToBytes(p))
|
|
|
|
b = appendComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
code = code.Next
|
|
|
|
case encoder.OpStructFieldNumber:
|
2021-05-29 08:47:18 +03:00
|
|
|
p := load(ctxptr, code.Idx)
|
2021-05-19 06:34:40 +03:00
|
|
|
b = appendStructKey(ctx, code, b)
|
2021-05-31 19:36:30 +03:00
|
|
|
bb, err := appendNumber(ctx, b, ptrToNumber(p+uintptr(code.Offset)))
|
2021-05-19 06:34:40 +03:00
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendComma(ctx, bb)
|
2021-05-19 06:34:40 +03:00
|
|
|
code = code.Next
|
|
|
|
case encoder.OpStructFieldOmitEmptyNumber:
|
2021-05-29 08:47:18 +03:00
|
|
|
p := load(ctxptr, code.Idx)
|
|
|
|
v := ptrToNumber(p + uintptr(code.Offset))
|
2021-05-19 06:34:40 +03:00
|
|
|
if v != "" {
|
|
|
|
b = appendStructKey(ctx, code, b)
|
2021-05-31 19:36:30 +03:00
|
|
|
bb, err := appendNumber(ctx, b, v)
|
2021-05-19 06:34:40 +03:00
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendComma(ctx, bb)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
code = code.Next
|
|
|
|
case encoder.OpStructFieldNumberString:
|
2021-05-29 08:47:18 +03:00
|
|
|
p := load(ctxptr, code.Idx)
|
2021-05-19 06:34:40 +03:00
|
|
|
b = appendStructKey(ctx, code, b)
|
|
|
|
b = append(b, '"')
|
2021-05-31 19:36:30 +03:00
|
|
|
bb, err := appendNumber(ctx, b, ptrToNumber(p+uintptr(code.Offset)))
|
2021-05-19 06:34:40 +03:00
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
b = append(bb, '"')
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
code = code.Next
|
|
|
|
case encoder.OpStructFieldOmitEmptyNumberString:
|
2021-05-29 08:47:18 +03:00
|
|
|
p := load(ctxptr, code.Idx)
|
|
|
|
v := ptrToNumber(p + uintptr(code.Offset))
|
2021-05-19 06:34:40 +03:00
|
|
|
if v != "" {
|
|
|
|
b = appendStructKey(ctx, code, b)
|
|
|
|
b = append(b, '"')
|
2021-05-31 19:36:30 +03:00
|
|
|
bb, err := appendNumber(ctx, b, v)
|
2021-05-19 06:34:40 +03:00
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
b = append(bb, '"')
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
code = code.Next
|
|
|
|
case encoder.OpStructFieldNumberPtr:
|
2021-05-29 08:47:18 +03:00
|
|
|
p := load(ctxptr, code.Idx)
|
|
|
|
p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
|
2021-05-19 06:34:40 +03:00
|
|
|
b = appendStructKey(ctx, code, b)
|
|
|
|
if p == 0 {
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendNull(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
} else {
|
2021-05-31 19:36:30 +03:00
|
|
|
bb, err := appendNumber(ctx, b, ptrToNumber(p))
|
2021-05-19 06:34:40 +03:00
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
b = bb
|
|
|
|
}
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
code = code.Next
|
|
|
|
case encoder.OpStructFieldOmitEmptyNumberPtr:
|
2021-05-29 08:47:18 +03:00
|
|
|
p := load(ctxptr, code.Idx)
|
|
|
|
p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
|
2021-05-19 06:34:40 +03:00
|
|
|
if p != 0 {
|
|
|
|
b = appendStructKey(ctx, code, b)
|
2021-05-31 19:36:30 +03:00
|
|
|
bb, err := appendNumber(ctx, b, ptrToNumber(p))
|
2021-05-19 06:34:40 +03:00
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendComma(ctx, bb)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
code = code.Next
|
|
|
|
case encoder.OpStructFieldNumberPtrString:
|
2021-05-29 08:47:18 +03:00
|
|
|
p := load(ctxptr, code.Idx)
|
|
|
|
p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
|
2021-05-19 06:34:40 +03:00
|
|
|
b = appendStructKey(ctx, code, b)
|
|
|
|
if p == 0 {
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendNull(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
} else {
|
|
|
|
b = append(b, '"')
|
2021-05-31 19:36:30 +03:00
|
|
|
bb, err := appendNumber(ctx, b, ptrToNumber(p))
|
2021-05-19 06:34:40 +03:00
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
b = append(bb, '"')
|
|
|
|
}
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
code = code.Next
|
|
|
|
case encoder.OpStructFieldOmitEmptyNumberPtrString:
|
2021-05-29 08:47:18 +03:00
|
|
|
p := load(ctxptr, code.Idx)
|
|
|
|
p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
|
2021-05-19 06:34:40 +03:00
|
|
|
if p != 0 {
|
|
|
|
b = appendStructKey(ctx, code, b)
|
|
|
|
b = append(b, '"')
|
2021-05-31 19:36:30 +03:00
|
|
|
bb, err := appendNumber(ctx, b, ptrToNumber(p))
|
2021-05-19 06:34:40 +03:00
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
b = append(bb, '"')
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
code = code.Next
|
|
|
|
case encoder.OpStructFieldMarshalJSON:
|
2021-05-29 08:47:18 +03:00
|
|
|
p := load(ctxptr, code.Idx)
|
2021-05-19 06:34:40 +03:00
|
|
|
b = appendStructKey(ctx, code, b)
|
2021-05-29 08:47:18 +03:00
|
|
|
p += uintptr(code.Offset)
|
|
|
|
if (code.Flags & encoder.IsNilableTypeFlags) != 0 {
|
2021-05-19 06:34:40 +03:00
|
|
|
p = ptrToPtr(p)
|
|
|
|
}
|
2021-05-29 08:47:18 +03:00
|
|
|
if p == 0 && (code.Flags&encoder.NilCheckFlags) != 0 {
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendNull(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
} else {
|
|
|
|
bb, err := appendMarshalJSON(ctx, code, b, ptrToInterface(code, p))
|
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
b = bb
|
|
|
|
}
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
code = code.Next
|
|
|
|
case encoder.OpStructFieldOmitEmptyMarshalJSON:
|
2021-05-29 08:47:18 +03:00
|
|
|
p := load(ctxptr, code.Idx)
|
|
|
|
p += uintptr(code.Offset)
|
|
|
|
if (code.Flags & encoder.IsNilableTypeFlags) != 0 {
|
2021-05-19 06:34:40 +03:00
|
|
|
p = ptrToPtr(p)
|
|
|
|
}
|
2021-05-29 08:47:18 +03:00
|
|
|
if p == 0 && (code.Flags&encoder.NilCheckFlags) != 0 {
|
2021-05-19 06:34:40 +03:00
|
|
|
code = code.NextField
|
|
|
|
break
|
|
|
|
}
|
|
|
|
iface := ptrToInterface(code, p)
|
2021-05-29 08:47:18 +03:00
|
|
|
if (code.Flags&encoder.NilCheckFlags) != 0 && encoder.IsNilForMarshaler(iface) {
|
2021-05-19 06:34:40 +03:00
|
|
|
code = code.NextField
|
|
|
|
break
|
|
|
|
}
|
|
|
|
b = appendStructKey(ctx, code, b)
|
|
|
|
bb, err := appendMarshalJSON(ctx, code, b, iface)
|
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendComma(ctx, bb)
|
2021-05-19 06:34:40 +03:00
|
|
|
code = code.Next
|
|
|
|
case encoder.OpStructFieldMarshalJSONPtr:
|
2021-05-29 08:47:18 +03:00
|
|
|
p := load(ctxptr, code.Idx)
|
2021-05-19 06:34:40 +03:00
|
|
|
b = appendStructKey(ctx, code, b)
|
2021-05-29 08:47:18 +03:00
|
|
|
p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
|
2021-05-19 06:34:40 +03:00
|
|
|
if p == 0 {
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendNull(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
} else {
|
|
|
|
bb, err := appendMarshalJSON(ctx, code, b, ptrToInterface(code, p))
|
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
b = bb
|
|
|
|
}
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
code = code.Next
|
|
|
|
case encoder.OpStructFieldOmitEmptyMarshalJSONPtr:
|
2021-05-29 08:47:18 +03:00
|
|
|
p := load(ctxptr, code.Idx)
|
|
|
|
p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
|
2021-05-19 06:34:40 +03:00
|
|
|
if p != 0 {
|
|
|
|
b = appendStructKey(ctx, code, b)
|
|
|
|
bb, err := appendMarshalJSON(ctx, code, b, ptrToInterface(code, p))
|
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendComma(ctx, bb)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
code = code.Next
|
|
|
|
case encoder.OpStructFieldMarshalText:
|
2021-05-29 08:47:18 +03:00
|
|
|
p := load(ctxptr, code.Idx)
|
2021-05-19 06:34:40 +03:00
|
|
|
b = appendStructKey(ctx, code, b)
|
2021-05-29 08:47:18 +03:00
|
|
|
p += uintptr(code.Offset)
|
|
|
|
if (code.Flags & encoder.IsNilableTypeFlags) != 0 {
|
2021-05-19 06:34:40 +03:00
|
|
|
p = ptrToPtr(p)
|
|
|
|
}
|
2021-05-29 08:47:18 +03:00
|
|
|
if p == 0 && (code.Flags&encoder.NilCheckFlags) != 0 {
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendNull(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
} else {
|
2021-05-31 19:25:05 +03:00
|
|
|
bb, err := appendMarshalText(ctx, code, b, ptrToInterface(code, p))
|
2021-05-19 06:34:40 +03:00
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
b = bb
|
|
|
|
}
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
code = code.Next
|
|
|
|
case encoder.OpStructFieldOmitEmptyMarshalText:
|
2021-05-29 08:47:18 +03:00
|
|
|
p := load(ctxptr, code.Idx)
|
|
|
|
p += uintptr(code.Offset)
|
|
|
|
if (code.Flags & encoder.IsNilableTypeFlags) != 0 {
|
2021-05-19 06:34:40 +03:00
|
|
|
p = ptrToPtr(p)
|
|
|
|
}
|
2021-05-29 08:47:18 +03:00
|
|
|
if p == 0 && (code.Flags&encoder.NilCheckFlags) != 0 {
|
2021-05-19 06:34:40 +03:00
|
|
|
code = code.NextField
|
|
|
|
break
|
|
|
|
}
|
|
|
|
b = appendStructKey(ctx, code, b)
|
2021-05-31 19:25:05 +03:00
|
|
|
bb, err := appendMarshalText(ctx, code, b, ptrToInterface(code, p))
|
2021-05-19 06:34:40 +03:00
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendComma(ctx, bb)
|
2021-05-19 06:34:40 +03:00
|
|
|
code = code.Next
|
|
|
|
case encoder.OpStructFieldMarshalTextPtr:
|
2021-05-29 08:47:18 +03:00
|
|
|
p := load(ctxptr, code.Idx)
|
2021-05-19 06:34:40 +03:00
|
|
|
b = appendStructKey(ctx, code, b)
|
2021-05-29 08:47:18 +03:00
|
|
|
p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
|
2021-05-19 06:34:40 +03:00
|
|
|
if p == 0 {
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendNull(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
} else {
|
2021-05-31 19:25:05 +03:00
|
|
|
bb, err := appendMarshalText(ctx, code, b, ptrToInterface(code, p))
|
2021-05-19 06:34:40 +03:00
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
b = bb
|
|
|
|
}
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendComma(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
code = code.Next
|
|
|
|
case encoder.OpStructFieldOmitEmptyMarshalTextPtr:
|
2021-05-29 08:47:18 +03:00
|
|
|
p := load(ctxptr, code.Idx)
|
|
|
|
p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
|
2021-05-19 06:34:40 +03:00
|
|
|
if p != 0 {
|
|
|
|
b = appendStructKey(ctx, code, b)
|
2021-05-31 19:25:05 +03:00
|
|
|
bb, err := appendMarshalText(ctx, code, b, ptrToInterface(code, p))
|
2021-05-19 06:34:40 +03:00
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendComma(ctx, bb)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
code = code.Next
|
|
|
|
case encoder.OpStructFieldArray:
|
|
|
|
b = appendStructKey(ctx, code, b)
|
2021-05-29 08:47:18 +03:00
|
|
|
p := load(ctxptr, code.Idx)
|
|
|
|
p += uintptr(code.Offset)
|
2021-05-19 06:34:40 +03:00
|
|
|
code = code.Next
|
|
|
|
store(ctxptr, code.Idx, p)
|
|
|
|
case encoder.OpStructFieldOmitEmptyArray:
|
|
|
|
b = appendStructKey(ctx, code, b)
|
2021-05-29 08:47:18 +03:00
|
|
|
p := load(ctxptr, code.Idx)
|
|
|
|
p += uintptr(code.Offset)
|
2021-05-19 06:34:40 +03:00
|
|
|
code = code.Next
|
|
|
|
store(ctxptr, code.Idx, p)
|
|
|
|
case encoder.OpStructFieldArrayPtr:
|
|
|
|
b = appendStructKey(ctx, code, b)
|
2021-05-29 08:47:18 +03:00
|
|
|
p := load(ctxptr, code.Idx)
|
|
|
|
p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
|
2021-05-19 06:34:40 +03:00
|
|
|
code = code.Next
|
|
|
|
store(ctxptr, code.Idx, p)
|
|
|
|
case encoder.OpStructFieldOmitEmptyArrayPtr:
|
2021-05-29 08:47:18 +03:00
|
|
|
p := load(ctxptr, code.Idx)
|
|
|
|
p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
|
2021-05-19 06:34:40 +03:00
|
|
|
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)
|
2021-05-29 08:47:18 +03:00
|
|
|
p := load(ctxptr, code.Idx)
|
|
|
|
p += uintptr(code.Offset)
|
2021-05-19 06:34:40 +03:00
|
|
|
code = code.Next
|
|
|
|
store(ctxptr, code.Idx, p)
|
|
|
|
case encoder.OpStructFieldOmitEmptySlice:
|
2021-05-29 08:47:18 +03:00
|
|
|
p := load(ctxptr, code.Idx)
|
|
|
|
p += uintptr(code.Offset)
|
2021-05-19 06:34:40 +03:00
|
|
|
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)
|
2021-05-29 08:47:18 +03:00
|
|
|
p := load(ctxptr, code.Idx)
|
|
|
|
p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
|
2021-05-19 06:34:40 +03:00
|
|
|
code = code.Next
|
|
|
|
store(ctxptr, code.Idx, p)
|
|
|
|
case encoder.OpStructFieldOmitEmptySlicePtr:
|
2021-05-29 08:47:18 +03:00
|
|
|
p := load(ctxptr, code.Idx)
|
|
|
|
p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
|
2021-05-19 06:34:40 +03:00
|
|
|
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)
|
2021-05-29 08:47:18 +03:00
|
|
|
p := load(ctxptr, code.Idx)
|
|
|
|
p = ptrToPtr(p + uintptr(code.Offset))
|
2021-05-19 06:34:40 +03:00
|
|
|
code = code.Next
|
|
|
|
store(ctxptr, code.Idx, p)
|
|
|
|
case encoder.OpStructFieldOmitEmptyMap:
|
2021-05-29 08:47:18 +03:00
|
|
|
p := load(ctxptr, code.Idx)
|
|
|
|
p = ptrToPtr(p + uintptr(code.Offset))
|
2021-05-19 06:34:40 +03:00
|
|
|
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)
|
2021-05-29 08:47:18 +03:00
|
|
|
p := load(ctxptr, code.Idx)
|
|
|
|
p = ptrToPtr(p + uintptr(code.Offset))
|
2021-05-19 06:34:40 +03:00
|
|
|
if p != 0 {
|
|
|
|
p = ptrToNPtr(p, code.PtrNum)
|
|
|
|
}
|
|
|
|
code = code.Next
|
|
|
|
store(ctxptr, code.Idx, p)
|
|
|
|
case encoder.OpStructFieldOmitEmptyMapPtr:
|
2021-05-29 08:47:18 +03:00
|
|
|
p := load(ctxptr, code.Idx)
|
|
|
|
p = ptrToPtr(p + uintptr(code.Offset))
|
2021-05-19 06:34:40 +03:00
|
|
|
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)
|
2021-05-29 08:47:18 +03:00
|
|
|
p := load(ctxptr, code.Idx)
|
|
|
|
p += uintptr(code.Offset)
|
2021-05-19 06:34:40 +03:00
|
|
|
code = code.Next
|
|
|
|
store(ctxptr, code.Idx, p)
|
|
|
|
case encoder.OpStructFieldOmitEmptyStruct:
|
2021-05-29 08:47:18 +03:00
|
|
|
p := load(ctxptr, code.Idx)
|
|
|
|
p += uintptr(code.Offset)
|
|
|
|
if ptrToPtr(p) == 0 && (code.Flags&encoder.IsNextOpPtrTypeFlags) != 0 {
|
2021-05-19 06:34:40 +03:00
|
|
|
code = code.NextField
|
|
|
|
} else {
|
|
|
|
b = appendStructKey(ctx, code, b)
|
|
|
|
code = code.Next
|
|
|
|
store(ctxptr, code.Idx, p)
|
|
|
|
}
|
|
|
|
case encoder.OpStructEnd:
|
|
|
|
b = appendStructEndSkipLast(ctx, code, b)
|
|
|
|
code = code.Next
|
|
|
|
case encoder.OpStructEndInt:
|
2021-05-29 08:47:18 +03:00
|
|
|
p := load(ctxptr, code.Idx)
|
2021-05-19 06:34:40 +03:00
|
|
|
b = appendStructKey(ctx, code, b)
|
2021-10-14 09:00:28 +03:00
|
|
|
b = appendInt(ctx, b, p+uintptr(code.Offset), code)
|
2021-05-19 06:34:40 +03:00
|
|
|
b = appendStructEnd(ctx, code, b)
|
|
|
|
code = code.Next
|
|
|
|
case encoder.OpStructEndOmitEmptyInt:
|
2021-05-29 08:47:18 +03:00
|
|
|
p := load(ctxptr, code.Idx)
|
2021-10-14 09:00:28 +03:00
|
|
|
u64 := ptrToUint64(p+uintptr(code.Offset), code.NumBitSize)
|
2021-05-29 08:47:18 +03:00
|
|
|
v := u64 & ((1 << code.NumBitSize) - 1)
|
2021-05-19 06:34:40 +03:00
|
|
|
if v != 0 {
|
|
|
|
b = appendStructKey(ctx, code, b)
|
2021-10-14 09:00:28 +03:00
|
|
|
b = appendInt(ctx, b, p+uintptr(code.Offset), code)
|
2021-05-19 06:34:40 +03:00
|
|
|
b = appendStructEnd(ctx, code, b)
|
|
|
|
} else {
|
|
|
|
b = appendStructEndSkipLast(ctx, code, b)
|
|
|
|
}
|
|
|
|
code = code.Next
|
|
|
|
case encoder.OpStructEndIntString:
|
2021-05-29 08:47:18 +03:00
|
|
|
p := load(ctxptr, code.Idx)
|
2021-05-19 06:34:40 +03:00
|
|
|
b = appendStructKey(ctx, code, b)
|
|
|
|
b = append(b, '"')
|
2021-10-14 09:00:28 +03:00
|
|
|
b = appendInt(ctx, b, p+uintptr(code.Offset), code)
|
2021-05-19 06:34:40 +03:00
|
|
|
b = append(b, '"')
|
|
|
|
b = appendStructEnd(ctx, code, b)
|
|
|
|
code = code.Next
|
|
|
|
case encoder.OpStructEndOmitEmptyIntString:
|
2021-05-29 08:47:18 +03:00
|
|
|
p := load(ctxptr, code.Idx)
|
2021-10-14 09:00:28 +03:00
|
|
|
u64 := ptrToUint64(p+uintptr(code.Offset), code.NumBitSize)
|
2021-05-29 08:47:18 +03:00
|
|
|
v := u64 & ((1 << code.NumBitSize) - 1)
|
2021-05-19 06:34:40 +03:00
|
|
|
if v != 0 {
|
|
|
|
b = appendStructKey(ctx, code, b)
|
|
|
|
b = append(b, '"')
|
2021-10-14 09:00:28 +03:00
|
|
|
b = appendInt(ctx, b, p+uintptr(code.Offset), code)
|
2021-05-19 06:34:40 +03:00
|
|
|
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)
|
2021-05-29 08:47:18 +03:00
|
|
|
p := load(ctxptr, code.Idx)
|
|
|
|
p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
|
2021-05-19 06:34:40 +03:00
|
|
|
if p == 0 {
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendNull(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
} else {
|
2021-10-14 09:00:28 +03:00
|
|
|
b = appendInt(ctx, b, p, code)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
b = appendStructEnd(ctx, code, b)
|
|
|
|
code = code.Next
|
|
|
|
case encoder.OpStructEndOmitEmptyIntPtr:
|
2021-05-29 08:47:18 +03:00
|
|
|
p := load(ctxptr, code.Idx)
|
|
|
|
p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
|
2021-05-19 06:34:40 +03:00
|
|
|
if p != 0 {
|
|
|
|
b = appendStructKey(ctx, code, b)
|
2021-10-14 09:00:28 +03:00
|
|
|
b = appendInt(ctx, b, p, code)
|
2021-05-19 06:34:40 +03:00
|
|
|
b = appendStructEnd(ctx, code, b)
|
|
|
|
} else {
|
|
|
|
b = appendStructEndSkipLast(ctx, code, b)
|
|
|
|
}
|
|
|
|
code = code.Next
|
|
|
|
case encoder.OpStructEndIntPtrString:
|
|
|
|
b = appendStructKey(ctx, code, b)
|
2021-05-29 08:47:18 +03:00
|
|
|
p := load(ctxptr, code.Idx)
|
|
|
|
p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
|
2021-05-19 06:34:40 +03:00
|
|
|
if p == 0 {
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendNull(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
} else {
|
|
|
|
b = append(b, '"')
|
2021-10-14 09:00:28 +03:00
|
|
|
b = appendInt(ctx, b, p, code)
|
2021-05-19 06:34:40 +03:00
|
|
|
b = append(b, '"')
|
|
|
|
}
|
|
|
|
b = appendStructEnd(ctx, code, b)
|
|
|
|
code = code.Next
|
|
|
|
case encoder.OpStructEndOmitEmptyIntPtrString:
|
2021-05-29 08:47:18 +03:00
|
|
|
p := load(ctxptr, code.Idx)
|
|
|
|
p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
|
2021-05-19 06:34:40 +03:00
|
|
|
if p != 0 {
|
|
|
|
b = appendStructKey(ctx, code, b)
|
|
|
|
b = append(b, '"')
|
2021-10-14 09:00:28 +03:00
|
|
|
b = appendInt(ctx, b, p, code)
|
2021-05-19 06:34:40 +03:00
|
|
|
b = append(b, '"')
|
|
|
|
b = appendStructEnd(ctx, code, b)
|
|
|
|
} else {
|
|
|
|
b = appendStructEndSkipLast(ctx, code, b)
|
|
|
|
}
|
|
|
|
code = code.Next
|
|
|
|
case encoder.OpStructEndUint:
|
2021-05-29 08:47:18 +03:00
|
|
|
p := load(ctxptr, code.Idx)
|
2021-05-19 06:34:40 +03:00
|
|
|
b = appendStructKey(ctx, code, b)
|
2021-10-14 09:00:28 +03:00
|
|
|
b = appendUint(ctx, b, p+uintptr(code.Offset), code)
|
2021-05-19 06:34:40 +03:00
|
|
|
b = appendStructEnd(ctx, code, b)
|
|
|
|
code = code.Next
|
|
|
|
case encoder.OpStructEndOmitEmptyUint:
|
2021-05-29 08:47:18 +03:00
|
|
|
p := load(ctxptr, code.Idx)
|
2021-10-14 09:00:28 +03:00
|
|
|
u64 := ptrToUint64(p+uintptr(code.Offset), code.NumBitSize)
|
2021-05-29 08:47:18 +03:00
|
|
|
v := u64 & ((1 << code.NumBitSize) - 1)
|
2021-05-19 06:34:40 +03:00
|
|
|
if v != 0 {
|
|
|
|
b = appendStructKey(ctx, code, b)
|
2021-10-14 09:00:28 +03:00
|
|
|
b = appendUint(ctx, b, p+uintptr(code.Offset), code)
|
2021-05-19 06:34:40 +03:00
|
|
|
b = appendStructEnd(ctx, code, b)
|
|
|
|
} else {
|
|
|
|
b = appendStructEndSkipLast(ctx, code, b)
|
|
|
|
}
|
|
|
|
code = code.Next
|
|
|
|
case encoder.OpStructEndUintString:
|
2021-05-29 08:47:18 +03:00
|
|
|
p := load(ctxptr, code.Idx)
|
2021-05-19 06:34:40 +03:00
|
|
|
b = appendStructKey(ctx, code, b)
|
|
|
|
b = append(b, '"')
|
2021-10-14 09:00:28 +03:00
|
|
|
b = appendUint(ctx, b, p+uintptr(code.Offset), code)
|
2021-05-19 06:34:40 +03:00
|
|
|
b = append(b, '"')
|
|
|
|
b = appendStructEnd(ctx, code, b)
|
|
|
|
code = code.Next
|
|
|
|
case encoder.OpStructEndOmitEmptyUintString:
|
2021-05-29 08:47:18 +03:00
|
|
|
p := load(ctxptr, code.Idx)
|
2021-10-14 09:00:28 +03:00
|
|
|
u64 := ptrToUint64(p+uintptr(code.Offset), code.NumBitSize)
|
2021-05-29 08:47:18 +03:00
|
|
|
v := u64 & ((1 << code.NumBitSize) - 1)
|
2021-05-19 06:34:40 +03:00
|
|
|
if v != 0 {
|
|
|
|
b = appendStructKey(ctx, code, b)
|
|
|
|
b = append(b, '"')
|
2021-10-14 09:00:28 +03:00
|
|
|
b = appendUint(ctx, b, p+uintptr(code.Offset), code)
|
2021-05-19 06:34:40 +03:00
|
|
|
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)
|
2021-05-29 08:47:18 +03:00
|
|
|
p := load(ctxptr, code.Idx)
|
|
|
|
p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
|
2021-05-19 06:34:40 +03:00
|
|
|
if p == 0 {
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendNull(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
} else {
|
2021-10-14 09:00:28 +03:00
|
|
|
b = appendUint(ctx, b, p, code)
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
b = appendStructEnd(ctx, code, b)
|
|
|
|
code = code.Next
|
|
|
|
case encoder.OpStructEndOmitEmptyUintPtr:
|
2021-05-29 08:47:18 +03:00
|
|
|
p := load(ctxptr, code.Idx)
|
|
|
|
p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
|
2021-05-19 06:34:40 +03:00
|
|
|
if p != 0 {
|
|
|
|
b = appendStructKey(ctx, code, b)
|
2021-10-14 09:00:28 +03:00
|
|
|
b = appendUint(ctx, b, p, code)
|
2021-05-19 06:34:40 +03:00
|
|
|
b = appendStructEnd(ctx, code, b)
|
|
|
|
} else {
|
|
|
|
b = appendStructEndSkipLast(ctx, code, b)
|
|
|
|
}
|
|
|
|
code = code.Next
|
|
|
|
case encoder.OpStructEndUintPtrString:
|
|
|
|
b = appendStructKey(ctx, code, b)
|
2021-05-29 08:47:18 +03:00
|
|
|
p := load(ctxptr, code.Idx)
|
|
|
|
p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
|
2021-05-19 06:34:40 +03:00
|
|
|
if p == 0 {
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendNull(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
} else {
|
|
|
|
b = append(b, '"')
|
2021-10-14 09:00:28 +03:00
|
|
|
b = appendUint(ctx, b, p, code)
|
2021-05-19 06:34:40 +03:00
|
|
|
b = append(b, '"')
|
|
|
|
}
|
|
|
|
b = appendStructEnd(ctx, code, b)
|
|
|
|
code = code.Next
|
|
|
|
case encoder.OpStructEndOmitEmptyUintPtrString:
|
2021-05-29 08:47:18 +03:00
|
|
|
p := load(ctxptr, code.Idx)
|
|
|
|
p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
|
2021-05-19 06:34:40 +03:00
|
|
|
if p != 0 {
|
|
|
|
b = appendStructKey(ctx, code, b)
|
|
|
|
b = append(b, '"')
|
2021-10-14 09:00:28 +03:00
|
|
|
b = appendUint(ctx, b, p, code)
|
2021-05-19 06:34:40 +03:00
|
|
|
b = append(b, '"')
|
|
|
|
b = appendStructEnd(ctx, code, b)
|
|
|
|
} else {
|
|
|
|
b = appendStructEndSkipLast(ctx, code, b)
|
|
|
|
}
|
|
|
|
code = code.Next
|
|
|
|
case encoder.OpStructEndFloat32:
|
2021-05-29 08:47:18 +03:00
|
|
|
p := load(ctxptr, code.Idx)
|
2021-05-19 06:34:40 +03:00
|
|
|
b = appendStructKey(ctx, code, b)
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendFloat32(ctx, b, ptrToFloat32(p+uintptr(code.Offset)))
|
2021-05-19 06:34:40 +03:00
|
|
|
b = appendStructEnd(ctx, code, b)
|
|
|
|
code = code.Next
|
|
|
|
case encoder.OpStructEndOmitEmptyFloat32:
|
2021-05-29 08:47:18 +03:00
|
|
|
p := load(ctxptr, code.Idx)
|
|
|
|
v := ptrToFloat32(p + uintptr(code.Offset))
|
2021-05-19 06:34:40 +03:00
|
|
|
if v != 0 {
|
|
|
|
b = appendStructKey(ctx, code, b)
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendFloat32(ctx, b, v)
|
2021-05-19 06:34:40 +03:00
|
|
|
b = appendStructEnd(ctx, code, b)
|
|
|
|
} else {
|
|
|
|
b = appendStructEndSkipLast(ctx, code, b)
|
|
|
|
}
|
|
|
|
code = code.Next
|
|
|
|
case encoder.OpStructEndFloat32String:
|
2021-05-29 08:47:18 +03:00
|
|
|
p := load(ctxptr, code.Idx)
|
2021-05-19 06:34:40 +03:00
|
|
|
b = appendStructKey(ctx, code, b)
|
|
|
|
b = append(b, '"')
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendFloat32(ctx, b, ptrToFloat32(p+uintptr(code.Offset)))
|
2021-05-19 06:34:40 +03:00
|
|
|
b = append(b, '"')
|
|
|
|
b = appendStructEnd(ctx, code, b)
|
|
|
|
code = code.Next
|
|
|
|
case encoder.OpStructEndOmitEmptyFloat32String:
|
2021-05-29 08:47:18 +03:00
|
|
|
p := load(ctxptr, code.Idx)
|
|
|
|
v := ptrToFloat32(p + uintptr(code.Offset))
|
2021-05-19 06:34:40 +03:00
|
|
|
if v != 0 {
|
|
|
|
b = appendStructKey(ctx, code, b)
|
|
|
|
b = append(b, '"')
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendFloat32(ctx, b, v)
|
2021-05-19 06:34:40 +03:00
|
|
|
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)
|
2021-05-29 08:47:18 +03:00
|
|
|
p := load(ctxptr, code.Idx)
|
|
|
|
p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
|
2021-05-19 06:34:40 +03:00
|
|
|
if p == 0 {
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendNull(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
} else {
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendFloat32(ctx, b, ptrToFloat32(p))
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
b = appendStructEnd(ctx, code, b)
|
|
|
|
code = code.Next
|
|
|
|
case encoder.OpStructEndOmitEmptyFloat32Ptr:
|
2021-05-29 08:47:18 +03:00
|
|
|
p := load(ctxptr, code.Idx)
|
|
|
|
p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
|
2021-05-19 06:34:40 +03:00
|
|
|
if p != 0 {
|
|
|
|
b = appendStructKey(ctx, code, b)
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendFloat32(ctx, b, ptrToFloat32(p))
|
2021-05-19 06:34:40 +03:00
|
|
|
b = appendStructEnd(ctx, code, b)
|
|
|
|
} else {
|
|
|
|
b = appendStructEndSkipLast(ctx, code, b)
|
|
|
|
}
|
|
|
|
code = code.Next
|
|
|
|
case encoder.OpStructEndFloat32PtrString:
|
|
|
|
b = appendStructKey(ctx, code, b)
|
2021-05-29 08:47:18 +03:00
|
|
|
p := load(ctxptr, code.Idx)
|
|
|
|
p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
|
2021-05-19 06:34:40 +03:00
|
|
|
if p == 0 {
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendNull(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
} else {
|
|
|
|
b = append(b, '"')
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendFloat32(ctx, b, ptrToFloat32(p))
|
2021-05-19 06:34:40 +03:00
|
|
|
b = append(b, '"')
|
|
|
|
}
|
|
|
|
b = appendStructEnd(ctx, code, b)
|
|
|
|
code = code.Next
|
|
|
|
case encoder.OpStructEndOmitEmptyFloat32PtrString:
|
2021-05-29 08:47:18 +03:00
|
|
|
p := load(ctxptr, code.Idx)
|
|
|
|
p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
|
2021-05-19 06:34:40 +03:00
|
|
|
if p != 0 {
|
|
|
|
b = appendStructKey(ctx, code, b)
|
|
|
|
b = append(b, '"')
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendFloat32(ctx, b, ptrToFloat32(p))
|
2021-05-19 06:34:40 +03:00
|
|
|
b = append(b, '"')
|
|
|
|
b = appendStructEnd(ctx, code, b)
|
|
|
|
} else {
|
|
|
|
b = appendStructEndSkipLast(ctx, code, b)
|
|
|
|
}
|
|
|
|
code = code.Next
|
|
|
|
case encoder.OpStructEndFloat64:
|
2021-05-29 08:47:18 +03:00
|
|
|
p := load(ctxptr, code.Idx)
|
|
|
|
v := ptrToFloat64(p + uintptr(code.Offset))
|
2021-05-19 06:34:40 +03:00
|
|
|
if math.IsInf(v, 0) || math.IsNaN(v) {
|
|
|
|
return nil, errUnsupportedFloat(v)
|
|
|
|
}
|
|
|
|
b = appendStructKey(ctx, code, b)
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendFloat64(ctx, b, v)
|
2021-05-19 06:34:40 +03:00
|
|
|
b = appendStructEnd(ctx, code, b)
|
|
|
|
code = code.Next
|
|
|
|
case encoder.OpStructEndOmitEmptyFloat64:
|
2021-05-29 08:47:18 +03:00
|
|
|
p := load(ctxptr, code.Idx)
|
|
|
|
v := ptrToFloat64(p + uintptr(code.Offset))
|
2021-05-19 06:34:40 +03:00
|
|
|
if v != 0 {
|
|
|
|
if math.IsInf(v, 0) || math.IsNaN(v) {
|
|
|
|
return nil, errUnsupportedFloat(v)
|
|
|
|
}
|
|
|
|
b = appendStructKey(ctx, code, b)
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendFloat64(ctx, b, v)
|
2021-05-19 06:34:40 +03:00
|
|
|
b = appendStructEnd(ctx, code, b)
|
|
|
|
} else {
|
|
|
|
b = appendStructEndSkipLast(ctx, code, b)
|
|
|
|
}
|
|
|
|
code = code.Next
|
|
|
|
case encoder.OpStructEndFloat64String:
|
2021-05-29 08:47:18 +03:00
|
|
|
p := load(ctxptr, code.Idx)
|
|
|
|
v := ptrToFloat64(p + uintptr(code.Offset))
|
2021-05-19 06:34:40 +03:00
|
|
|
if math.IsInf(v, 0) || math.IsNaN(v) {
|
|
|
|
return nil, errUnsupportedFloat(v)
|
|
|
|
}
|
|
|
|
b = appendStructKey(ctx, code, b)
|
|
|
|
b = append(b, '"')
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendFloat64(ctx, b, v)
|
2021-05-19 06:34:40 +03:00
|
|
|
b = append(b, '"')
|
|
|
|
b = appendStructEnd(ctx, code, b)
|
|
|
|
code = code.Next
|
|
|
|
case encoder.OpStructEndOmitEmptyFloat64String:
|
2021-05-29 08:47:18 +03:00
|
|
|
p := load(ctxptr, code.Idx)
|
|
|
|
v := ptrToFloat64(p + uintptr(code.Offset))
|
2021-05-19 06:34:40 +03:00
|
|
|
if v != 0 {
|
|
|
|
if math.IsInf(v, 0) || math.IsNaN(v) {
|
|
|
|
return nil, errUnsupportedFloat(v)
|
|
|
|
}
|
|
|
|
b = appendStructKey(ctx, code, b)
|
|
|
|
b = append(b, '"')
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendFloat64(ctx, b, v)
|
2021-05-19 06:34:40 +03:00
|
|
|
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)
|
2021-05-29 08:47:18 +03:00
|
|
|
p := load(ctxptr, code.Idx)
|
|
|
|
p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
|
2021-05-19 06:34:40 +03:00
|
|
|
if p == 0 {
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendNull(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
b = appendStructEnd(ctx, code, b)
|
|
|
|
code = code.Next
|
|
|
|
break
|
|
|
|
}
|
|
|
|
v := ptrToFloat64(p)
|
|
|
|
if math.IsInf(v, 0) || math.IsNaN(v) {
|
|
|
|
return nil, errUnsupportedFloat(v)
|
|
|
|
}
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendFloat64(ctx, b, v)
|
2021-05-19 06:34:40 +03:00
|
|
|
b = appendStructEnd(ctx, code, b)
|
|
|
|
code = code.Next
|
|
|
|
case encoder.OpStructEndOmitEmptyFloat64Ptr:
|
2021-05-29 08:47:18 +03:00
|
|
|
p := load(ctxptr, code.Idx)
|
|
|
|
p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
|
2021-05-19 06:34:40 +03:00
|
|
|
if p != 0 {
|
|
|
|
b = appendStructKey(ctx, code, b)
|
|
|
|
v := ptrToFloat64(p)
|
|
|
|
if math.IsInf(v, 0) || math.IsNaN(v) {
|
|
|
|
return nil, errUnsupportedFloat(v)
|
|
|
|
}
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendFloat64(ctx, b, v)
|
2021-05-19 06:34:40 +03:00
|
|
|
b = appendStructEnd(ctx, code, b)
|
|
|
|
} else {
|
|
|
|
b = appendStructEndSkipLast(ctx, code, b)
|
|
|
|
}
|
|
|
|
code = code.Next
|
|
|
|
case encoder.OpStructEndFloat64PtrString:
|
|
|
|
b = appendStructKey(ctx, code, b)
|
2021-05-29 08:47:18 +03:00
|
|
|
p := load(ctxptr, code.Idx)
|
|
|
|
p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
|
2021-05-19 06:34:40 +03:00
|
|
|
if p == 0 {
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendNull(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
} else {
|
|
|
|
b = append(b, '"')
|
|
|
|
v := ptrToFloat64(p)
|
|
|
|
if math.IsInf(v, 0) || math.IsNaN(v) {
|
|
|
|
return nil, errUnsupportedFloat(v)
|
|
|
|
}
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendFloat64(ctx, b, v)
|
2021-05-19 06:34:40 +03:00
|
|
|
b = append(b, '"')
|
|
|
|
}
|
|
|
|
b = appendStructEnd(ctx, code, b)
|
|
|
|
code = code.Next
|
|
|
|
case encoder.OpStructEndOmitEmptyFloat64PtrString:
|
2021-05-29 08:47:18 +03:00
|
|
|
p := load(ctxptr, code.Idx)
|
|
|
|
p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
|
2021-05-19 06:34:40 +03:00
|
|
|
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, '"')
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendFloat64(ctx, b, v)
|
2021-05-19 06:34:40 +03:00
|
|
|
b = append(b, '"')
|
|
|
|
b = appendStructEnd(ctx, code, b)
|
|
|
|
} else {
|
|
|
|
b = appendStructEndSkipLast(ctx, code, b)
|
|
|
|
}
|
|
|
|
code = code.Next
|
|
|
|
case encoder.OpStructEndString:
|
2021-05-29 08:47:18 +03:00
|
|
|
p := load(ctxptr, code.Idx)
|
2021-05-19 06:34:40 +03:00
|
|
|
b = appendStructKey(ctx, code, b)
|
2021-05-31 19:25:05 +03:00
|
|
|
b = appendString(ctx, b, ptrToString(p+uintptr(code.Offset)))
|
2021-05-19 06:34:40 +03:00
|
|
|
b = appendStructEnd(ctx, code, b)
|
|
|
|
code = code.Next
|
|
|
|
case encoder.OpStructEndOmitEmptyString:
|
2021-05-29 08:47:18 +03:00
|
|
|
p := load(ctxptr, code.Idx)
|
|
|
|
v := ptrToString(p + uintptr(code.Offset))
|
2021-05-19 06:34:40 +03:00
|
|
|
if v != "" {
|
|
|
|
b = appendStructKey(ctx, code, b)
|
2021-05-31 19:25:05 +03:00
|
|
|
b = appendString(ctx, b, v)
|
2021-05-19 06:34:40 +03:00
|
|
|
b = appendStructEnd(ctx, code, b)
|
|
|
|
} else {
|
|
|
|
b = appendStructEndSkipLast(ctx, code, b)
|
|
|
|
}
|
|
|
|
code = code.Next
|
|
|
|
case encoder.OpStructEndStringString:
|
2021-05-29 08:47:18 +03:00
|
|
|
p := load(ctxptr, code.Idx)
|
2021-05-19 06:34:40 +03:00
|
|
|
b = appendStructKey(ctx, code, b)
|
2021-05-29 08:47:18 +03:00
|
|
|
s := ptrToString(p + uintptr(code.Offset))
|
2021-05-31 19:25:05 +03:00
|
|
|
b = appendString(ctx, b, string(appendString(ctx, []byte{}, s)))
|
2021-05-19 06:34:40 +03:00
|
|
|
b = appendStructEnd(ctx, code, b)
|
|
|
|
code = code.Next
|
|
|
|
case encoder.OpStructEndOmitEmptyStringString:
|
2021-05-29 08:47:18 +03:00
|
|
|
p := load(ctxptr, code.Idx)
|
|
|
|
v := ptrToString(p + uintptr(code.Offset))
|
2021-05-19 06:34:40 +03:00
|
|
|
if v != "" {
|
|
|
|
b = appendStructKey(ctx, code, b)
|
2021-05-31 19:25:05 +03:00
|
|
|
b = appendString(ctx, b, string(appendString(ctx, []byte{}, v)))
|
2021-05-19 06:34:40 +03:00
|
|
|
b = appendStructEnd(ctx, code, b)
|
|
|
|
} else {
|
|
|
|
b = appendStructEndSkipLast(ctx, code, b)
|
|
|
|
}
|
|
|
|
code = code.Next
|
|
|
|
case encoder.OpStructEndStringPtr:
|
|
|
|
b = appendStructKey(ctx, code, b)
|
2021-05-29 08:47:18 +03:00
|
|
|
p := load(ctxptr, code.Idx)
|
|
|
|
p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
|
2021-05-19 06:34:40 +03:00
|
|
|
if p == 0 {
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendNull(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
} else {
|
2021-05-31 19:25:05 +03:00
|
|
|
b = appendString(ctx, b, ptrToString(p))
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
b = appendStructEnd(ctx, code, b)
|
|
|
|
code = code.Next
|
|
|
|
case encoder.OpStructEndOmitEmptyStringPtr:
|
2021-05-29 08:47:18 +03:00
|
|
|
p := load(ctxptr, code.Idx)
|
|
|
|
p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
|
2021-05-19 06:34:40 +03:00
|
|
|
if p != 0 {
|
|
|
|
b = appendStructKey(ctx, code, b)
|
2021-05-31 19:25:05 +03:00
|
|
|
b = appendString(ctx, b, ptrToString(p))
|
2021-05-19 06:34:40 +03:00
|
|
|
b = appendStructEnd(ctx, code, b)
|
|
|
|
} else {
|
|
|
|
b = appendStructEndSkipLast(ctx, code, b)
|
|
|
|
}
|
|
|
|
code = code.Next
|
|
|
|
case encoder.OpStructEndStringPtrString:
|
|
|
|
b = appendStructKey(ctx, code, b)
|
2021-05-29 08:47:18 +03:00
|
|
|
p := load(ctxptr, code.Idx)
|
|
|
|
p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
|
2021-05-19 06:34:40 +03:00
|
|
|
if p == 0 {
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendNull(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
} else {
|
2021-05-31 19:25:05 +03:00
|
|
|
b = appendString(ctx, b, string(appendString(ctx, []byte{}, ptrToString(p))))
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
b = appendStructEnd(ctx, code, b)
|
|
|
|
code = code.Next
|
|
|
|
case encoder.OpStructEndOmitEmptyStringPtrString:
|
2021-05-29 08:47:18 +03:00
|
|
|
p := load(ctxptr, code.Idx)
|
|
|
|
p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
|
2021-05-19 06:34:40 +03:00
|
|
|
if p != 0 {
|
|
|
|
b = appendStructKey(ctx, code, b)
|
2021-05-31 19:25:05 +03:00
|
|
|
b = appendString(ctx, b, string(appendString(ctx, []byte{}, ptrToString(p))))
|
2021-05-19 06:34:40 +03:00
|
|
|
b = appendStructEnd(ctx, code, b)
|
|
|
|
} else {
|
|
|
|
b = appendStructEndSkipLast(ctx, code, b)
|
|
|
|
}
|
|
|
|
code = code.Next
|
|
|
|
case encoder.OpStructEndBool:
|
2021-05-29 08:47:18 +03:00
|
|
|
p := load(ctxptr, code.Idx)
|
2021-05-19 06:34:40 +03:00
|
|
|
b = appendStructKey(ctx, code, b)
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendBool(ctx, b, ptrToBool(p+uintptr(code.Offset)))
|
2021-05-19 06:34:40 +03:00
|
|
|
b = appendStructEnd(ctx, code, b)
|
|
|
|
code = code.Next
|
|
|
|
case encoder.OpStructEndOmitEmptyBool:
|
2021-05-29 08:47:18 +03:00
|
|
|
p := load(ctxptr, code.Idx)
|
|
|
|
v := ptrToBool(p + uintptr(code.Offset))
|
2021-05-19 06:34:40 +03:00
|
|
|
if v {
|
|
|
|
b = appendStructKey(ctx, code, b)
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendBool(ctx, b, v)
|
2021-05-19 06:34:40 +03:00
|
|
|
b = appendStructEnd(ctx, code, b)
|
|
|
|
} else {
|
|
|
|
b = appendStructEndSkipLast(ctx, code, b)
|
|
|
|
}
|
|
|
|
code = code.Next
|
|
|
|
case encoder.OpStructEndBoolString:
|
2021-05-29 08:47:18 +03:00
|
|
|
p := load(ctxptr, code.Idx)
|
2021-05-19 06:34:40 +03:00
|
|
|
b = appendStructKey(ctx, code, b)
|
|
|
|
b = append(b, '"')
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendBool(ctx, b, ptrToBool(p+uintptr(code.Offset)))
|
2021-05-19 06:34:40 +03:00
|
|
|
b = append(b, '"')
|
|
|
|
b = appendStructEnd(ctx, code, b)
|
|
|
|
code = code.Next
|
|
|
|
case encoder.OpStructEndOmitEmptyBoolString:
|
2021-05-29 08:47:18 +03:00
|
|
|
p := load(ctxptr, code.Idx)
|
|
|
|
v := ptrToBool(p + uintptr(code.Offset))
|
2021-05-19 06:34:40 +03:00
|
|
|
if v {
|
|
|
|
b = appendStructKey(ctx, code, b)
|
|
|
|
b = append(b, '"')
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendBool(ctx, b, v)
|
2021-05-19 06:34:40 +03:00
|
|
|
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)
|
2021-05-29 08:47:18 +03:00
|
|
|
p := load(ctxptr, code.Idx)
|
|
|
|
p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
|
2021-05-19 06:34:40 +03:00
|
|
|
if p == 0 {
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendNull(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
} else {
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendBool(ctx, b, ptrToBool(p))
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
b = appendStructEnd(ctx, code, b)
|
|
|
|
code = code.Next
|
|
|
|
case encoder.OpStructEndOmitEmptyBoolPtr:
|
2021-05-29 08:47:18 +03:00
|
|
|
p := load(ctxptr, code.Idx)
|
|
|
|
p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
|
2021-05-19 06:34:40 +03:00
|
|
|
if p != 0 {
|
|
|
|
b = appendStructKey(ctx, code, b)
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendBool(ctx, b, ptrToBool(p))
|
2021-05-19 06:34:40 +03:00
|
|
|
b = appendStructEnd(ctx, code, b)
|
|
|
|
} else {
|
|
|
|
b = appendStructEndSkipLast(ctx, code, b)
|
|
|
|
}
|
|
|
|
code = code.Next
|
|
|
|
case encoder.OpStructEndBoolPtrString:
|
|
|
|
b = appendStructKey(ctx, code, b)
|
2021-05-29 08:47:18 +03:00
|
|
|
p := load(ctxptr, code.Idx)
|
|
|
|
p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
|
2021-05-19 06:34:40 +03:00
|
|
|
if p == 0 {
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendNull(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
} else {
|
|
|
|
b = append(b, '"')
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendBool(ctx, b, ptrToBool(p))
|
2021-05-19 06:34:40 +03:00
|
|
|
b = append(b, '"')
|
|
|
|
}
|
|
|
|
b = appendStructEnd(ctx, code, b)
|
|
|
|
code = code.Next
|
|
|
|
case encoder.OpStructEndOmitEmptyBoolPtrString:
|
2021-05-29 08:47:18 +03:00
|
|
|
p := load(ctxptr, code.Idx)
|
|
|
|
p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
|
2021-05-19 06:34:40 +03:00
|
|
|
if p != 0 {
|
|
|
|
b = appendStructKey(ctx, code, b)
|
|
|
|
b = append(b, '"')
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendBool(ctx, b, ptrToBool(p))
|
2021-05-19 06:34:40 +03:00
|
|
|
b = append(b, '"')
|
|
|
|
b = appendStructEnd(ctx, code, b)
|
|
|
|
} else {
|
|
|
|
b = appendStructEndSkipLast(ctx, code, b)
|
|
|
|
}
|
|
|
|
code = code.Next
|
|
|
|
case encoder.OpStructEndBytes:
|
2021-05-29 08:47:18 +03:00
|
|
|
p := load(ctxptr, code.Idx)
|
2021-05-19 06:34:40 +03:00
|
|
|
b = appendStructKey(ctx, code, b)
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendByteSlice(ctx, b, ptrToBytes(p+uintptr(code.Offset)))
|
2021-05-19 06:34:40 +03:00
|
|
|
b = appendStructEnd(ctx, code, b)
|
|
|
|
code = code.Next
|
|
|
|
case encoder.OpStructEndOmitEmptyBytes:
|
2021-05-29 08:47:18 +03:00
|
|
|
p := load(ctxptr, code.Idx)
|
|
|
|
v := ptrToBytes(p + uintptr(code.Offset))
|
2021-05-19 06:34:40 +03:00
|
|
|
if len(v) > 0 {
|
|
|
|
b = appendStructKey(ctx, code, b)
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendByteSlice(ctx, b, v)
|
2021-05-19 06:34:40 +03:00
|
|
|
b = appendStructEnd(ctx, code, b)
|
|
|
|
} else {
|
|
|
|
b = appendStructEndSkipLast(ctx, code, b)
|
|
|
|
}
|
|
|
|
code = code.Next
|
|
|
|
case encoder.OpStructEndBytesPtr:
|
|
|
|
b = appendStructKey(ctx, code, b)
|
2021-05-29 08:47:18 +03:00
|
|
|
p := load(ctxptr, code.Idx)
|
|
|
|
p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
|
2021-05-19 06:34:40 +03:00
|
|
|
if p == 0 {
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendNull(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
} else {
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendByteSlice(ctx, b, ptrToBytes(p))
|
2021-05-19 06:34:40 +03:00
|
|
|
}
|
|
|
|
b = appendStructEnd(ctx, code, b)
|
|
|
|
code = code.Next
|
|
|
|
case encoder.OpStructEndOmitEmptyBytesPtr:
|
2021-05-29 08:47:18 +03:00
|
|
|
p := load(ctxptr, code.Idx)
|
|
|
|
p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
|
2021-05-19 06:34:40 +03:00
|
|
|
if p != 0 {
|
|
|
|
b = appendStructKey(ctx, code, b)
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendByteSlice(ctx, b, ptrToBytes(p))
|
2021-05-19 06:34:40 +03:00
|
|
|
b = appendStructEnd(ctx, code, b)
|
|
|
|
} else {
|
|
|
|
b = appendStructEndSkipLast(ctx, code, b)
|
|
|
|
}
|
|
|
|
code = code.Next
|
|
|
|
case encoder.OpStructEndNumber:
|
2021-05-29 08:47:18 +03:00
|
|
|
p := load(ctxptr, code.Idx)
|
2021-05-19 06:34:40 +03:00
|
|
|
b = appendStructKey(ctx, code, b)
|
2021-05-31 19:36:30 +03:00
|
|
|
bb, err := appendNumber(ctx, b, ptrToNumber(p+uintptr(code.Offset)))
|
2021-05-19 06:34:40 +03:00
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
b = appendStructEnd(ctx, code, bb)
|
|
|
|
code = code.Next
|
|
|
|
case encoder.OpStructEndOmitEmptyNumber:
|
2021-05-29 08:47:18 +03:00
|
|
|
p := load(ctxptr, code.Idx)
|
|
|
|
v := ptrToNumber(p + uintptr(code.Offset))
|
2021-05-19 06:34:40 +03:00
|
|
|
if v != "" {
|
|
|
|
b = appendStructKey(ctx, code, b)
|
2021-05-31 19:36:30 +03:00
|
|
|
bb, err := appendNumber(ctx, b, v)
|
2021-05-19 06:34:40 +03:00
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
b = appendStructEnd(ctx, code, bb)
|
|
|
|
} else {
|
|
|
|
b = appendStructEndSkipLast(ctx, code, b)
|
|
|
|
}
|
|
|
|
code = code.Next
|
|
|
|
case encoder.OpStructEndNumberString:
|
2021-05-29 08:47:18 +03:00
|
|
|
p := load(ctxptr, code.Idx)
|
2021-05-19 06:34:40 +03:00
|
|
|
b = appendStructKey(ctx, code, b)
|
|
|
|
b = append(b, '"')
|
2021-05-31 19:36:30 +03:00
|
|
|
bb, err := appendNumber(ctx, b, ptrToNumber(p+uintptr(code.Offset)))
|
2021-05-19 06:34:40 +03:00
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
b = append(bb, '"')
|
|
|
|
b = appendStructEnd(ctx, code, b)
|
|
|
|
code = code.Next
|
|
|
|
case encoder.OpStructEndOmitEmptyNumberString:
|
2021-05-29 08:47:18 +03:00
|
|
|
p := load(ctxptr, code.Idx)
|
|
|
|
v := ptrToNumber(p + uintptr(code.Offset))
|
2021-05-19 06:34:40 +03:00
|
|
|
if v != "" {
|
|
|
|
b = appendStructKey(ctx, code, b)
|
|
|
|
b = append(b, '"')
|
2021-05-31 19:36:30 +03:00
|
|
|
bb, err := appendNumber(ctx, b, v)
|
2021-05-19 06:34:40 +03:00
|
|
|
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)
|
2021-05-29 08:47:18 +03:00
|
|
|
p := load(ctxptr, code.Idx)
|
|
|
|
p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
|
2021-05-19 06:34:40 +03:00
|
|
|
if p == 0 {
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendNull(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
} else {
|
2021-05-31 19:36:30 +03:00
|
|
|
bb, err := appendNumber(ctx, b, ptrToNumber(p))
|
2021-05-19 06:34:40 +03:00
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
b = bb
|
|
|
|
}
|
|
|
|
b = appendStructEnd(ctx, code, b)
|
|
|
|
code = code.Next
|
|
|
|
case encoder.OpStructEndOmitEmptyNumberPtr:
|
2021-05-29 08:47:18 +03:00
|
|
|
p := load(ctxptr, code.Idx)
|
|
|
|
p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
|
2021-05-19 06:34:40 +03:00
|
|
|
if p != 0 {
|
|
|
|
b = appendStructKey(ctx, code, b)
|
2021-05-31 19:36:30 +03:00
|
|
|
bb, err := appendNumber(ctx, b, ptrToNumber(p))
|
2021-05-19 06:34:40 +03:00
|
|
|
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)
|
2021-05-29 08:47:18 +03:00
|
|
|
p := load(ctxptr, code.Idx)
|
|
|
|
p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
|
2021-05-19 06:34:40 +03:00
|
|
|
if p == 0 {
|
2021-05-31 19:36:30 +03:00
|
|
|
b = appendNull(ctx, b)
|
2021-05-19 06:34:40 +03:00
|
|
|
} else {
|
|
|
|
b = append(b, '"')
|
2021-05-31 19:36:30 +03:00
|
|
|
bb, err := appendNumber(ctx, b, ptrToNumber(p))
|
2021-05-19 06:34:40 +03:00
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
b = append(bb, '"')
|
|
|
|
}
|
|
|
|
b = appendStructEnd(ctx, code, b)
|
|
|
|
code = code.Next
|
|
|
|
case encoder.OpStructEndOmitEmptyNumberPtrString:
|
2021-05-29 08:47:18 +03:00
|
|
|
p := load(ctxptr, code.Idx)
|
|
|
|
p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
|
2021-05-19 06:34:40 +03:00
|
|
|
if p != 0 {
|
|
|
|
b = appendStructKey(ctx, code, b)
|
|
|
|
b = append(b, '"')
|
2021-05-31 19:36:30 +03:00
|
|
|
bb, err := appendNumber(ctx, b, ptrToNumber(p))
|
2021-05-19 06:34:40 +03:00
|
|
|
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
|
|
|
|
}
|