go-json/encode_vm_escaped_indent.go

4852 lines
136 KiB
Go
Raw Normal View History

2021-01-10 23:16:37 +03:00
package json
import (
"bytes"
"encoding"
"fmt"
"math"
"reflect"
"sort"
"unsafe"
)
func (e *Encoder) runEscapedIndent(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte, error) {
recursiveLevel := 0
var seenPtr map[uintptr]struct{}
ptrOffset := uintptr(0)
ctxptr := ctx.ptr()
for {
switch code.op {
default:
return nil, fmt.Errorf("failed to handle opcode. doesn't implement %s", code.op)
2021-01-11 13:05:06 +03:00
case opPtr:
2021-01-10 23:16:37 +03:00
ptr := load(ctxptr, code.idx)
code = code.next
store(ctxptr, code.idx, e.ptrToPtr(ptr))
2021-01-11 13:05:06 +03:00
case opInt:
2021-01-10 23:16:37 +03:00
b = appendInt(b, int64(e.ptrToInt(load(ctxptr, code.idx))))
b = encodeIndentComma(b)
code = code.next
2021-01-11 13:05:06 +03:00
case opInt8:
2021-01-10 23:16:37 +03:00
b = appendInt(b, int64(e.ptrToInt8(load(ctxptr, code.idx))))
b = encodeIndentComma(b)
code = code.next
2021-01-11 13:05:06 +03:00
case opInt16:
2021-01-10 23:16:37 +03:00
b = appendInt(b, int64(e.ptrToInt16(load(ctxptr, code.idx))))
b = encodeIndentComma(b)
code = code.next
2021-01-11 13:05:06 +03:00
case opInt32:
2021-01-10 23:16:37 +03:00
b = appendInt(b, int64(e.ptrToInt32(load(ctxptr, code.idx))))
b = encodeIndentComma(b)
code = code.next
2021-01-11 13:05:06 +03:00
case opInt64:
2021-01-10 23:16:37 +03:00
b = appendInt(b, e.ptrToInt64(load(ctxptr, code.idx)))
b = encodeIndentComma(b)
code = code.next
2021-01-11 13:05:06 +03:00
case opUint:
2021-01-10 23:16:37 +03:00
b = appendUint(b, uint64(e.ptrToUint(load(ctxptr, code.idx))))
b = encodeIndentComma(b)
code = code.next
2021-01-11 13:05:06 +03:00
case opUint8:
2021-01-10 23:16:37 +03:00
b = appendUint(b, uint64(e.ptrToUint8(load(ctxptr, code.idx))))
b = encodeIndentComma(b)
code = code.next
2021-01-11 13:05:06 +03:00
case opUint16:
2021-01-10 23:16:37 +03:00
b = appendUint(b, uint64(e.ptrToUint16(load(ctxptr, code.idx))))
b = encodeIndentComma(b)
code = code.next
2021-01-11 13:05:06 +03:00
case opUint32:
2021-01-10 23:16:37 +03:00
b = appendUint(b, uint64(e.ptrToUint32(load(ctxptr, code.idx))))
b = encodeIndentComma(b)
code = code.next
2021-01-11 13:05:06 +03:00
case opUint64:
2021-01-10 23:16:37 +03:00
b = appendUint(b, e.ptrToUint64(load(ctxptr, code.idx)))
b = encodeIndentComma(b)
code = code.next
2021-01-11 13:05:06 +03:00
case opIntString:
2021-01-10 23:16:37 +03:00
b = append(b, '"')
b = appendInt(b, int64(e.ptrToInt(load(ctxptr, code.idx))))
b = append(b, '"')
b = encodeIndentComma(b)
code = code.next
2021-01-11 13:05:06 +03:00
case opInt8String:
2021-01-10 23:16:37 +03:00
b = append(b, '"')
b = appendInt(b, int64(e.ptrToInt8(load(ctxptr, code.idx))))
b = append(b, '"')
b = encodeIndentComma(b)
code = code.next
2021-01-11 13:05:06 +03:00
case opInt16String:
2021-01-10 23:16:37 +03:00
b = append(b, '"')
b = appendInt(b, int64(e.ptrToInt16(load(ctxptr, code.idx))))
b = append(b, '"')
b = encodeIndentComma(b)
code = code.next
2021-01-11 13:05:06 +03:00
case opInt32String:
2021-01-10 23:16:37 +03:00
b = append(b, '"')
b = appendInt(b, int64(e.ptrToInt32(load(ctxptr, code.idx))))
b = append(b, '"')
b = encodeIndentComma(b)
code = code.next
2021-01-11 13:05:06 +03:00
case opInt64String:
2021-01-10 23:16:37 +03:00
b = append(b, '"')
b = appendInt(b, e.ptrToInt64(load(ctxptr, code.idx)))
b = append(b, '"')
b = encodeIndentComma(b)
code = code.next
2021-01-11 13:05:06 +03:00
case opUintString:
2021-01-10 23:16:37 +03:00
b = append(b, '"')
b = appendUint(b, uint64(e.ptrToUint(load(ctxptr, code.idx))))
b = append(b, '"')
b = encodeIndentComma(b)
code = code.next
2021-01-11 13:05:06 +03:00
case opUint8String:
2021-01-10 23:16:37 +03:00
b = append(b, '"')
b = appendUint(b, uint64(e.ptrToUint8(load(ctxptr, code.idx))))
b = append(b, '"')
b = encodeIndentComma(b)
code = code.next
2021-01-11 13:05:06 +03:00
case opUint16String:
2021-01-10 23:16:37 +03:00
b = append(b, '"')
b = appendUint(b, uint64(e.ptrToUint16(load(ctxptr, code.idx))))
b = append(b, '"')
b = encodeIndentComma(b)
code = code.next
2021-01-11 13:05:06 +03:00
case opUint32String:
2021-01-10 23:16:37 +03:00
b = append(b, '"')
b = appendUint(b, uint64(e.ptrToUint32(load(ctxptr, code.idx))))
b = append(b, '"')
b = encodeIndentComma(b)
code = code.next
2021-01-11 13:05:06 +03:00
case opUint64String:
2021-01-10 23:16:37 +03:00
b = append(b, '"')
b = appendUint(b, e.ptrToUint64(load(ctxptr, code.idx)))
b = append(b, '"')
b = encodeIndentComma(b)
code = code.next
2021-01-11 13:05:06 +03:00
case opFloat32:
2021-01-10 23:16:37 +03:00
b = encodeFloat32(b, e.ptrToFloat32(load(ctxptr, code.idx)))
b = encodeIndentComma(b)
code = code.next
2021-01-11 13:05:06 +03:00
case opFloat64:
2021-01-10 23:16:37 +03:00
v := e.ptrToFloat64(load(ctxptr, code.idx))
if math.IsInf(v, 0) || math.IsNaN(v) {
return nil, errUnsupportedFloat(v)
}
b = encodeFloat64(b, v)
b = encodeIndentComma(b)
code = code.next
2021-01-11 13:05:06 +03:00
case opEscapedString:
2021-01-10 23:16:37 +03:00
b = encodeEscapedString(b, e.ptrToString(load(ctxptr, code.idx)))
b = encodeIndentComma(b)
code = code.next
2021-01-11 13:05:06 +03:00
case opBool:
2021-01-10 23:16:37 +03:00
b = encodeBool(b, e.ptrToBool(load(ctxptr, code.idx)))
b = encodeIndentComma(b)
code = code.next
2021-01-11 13:05:06 +03:00
case opBytes:
2021-01-10 23:16:37 +03:00
ptr := load(ctxptr, code.idx)
slice := e.ptrToSlice(ptr)
if ptr == 0 || uintptr(slice.data) == 0 {
b = encodeNull(b)
} else {
b = encodeByteSlice(b, e.ptrToBytes(ptr))
}
b = encodeIndentComma(b)
code = code.next
2021-01-11 13:05:06 +03:00
case opInterface:
2021-01-10 23:16:37 +03:00
ptr := load(ctxptr, code.idx)
if ptr == 0 {
b = encodeNull(b)
b = encodeIndentComma(b)
code = code.next
break
}
if seenPtr == nil {
seenPtr = map[uintptr]struct{}{}
}
if _, exists := seenPtr[ptr]; exists {
return nil, errUnsupportedValue(code, ptr)
}
seenPtr[ptr] = struct{}{}
v := e.ptrToInterface(code, ptr)
ctx.keepRefs = append(ctx.keepRefs, unsafe.Pointer(&v))
rv := reflect.ValueOf(v)
if rv.IsNil() {
b = encodeNull(b)
b = encodeIndentComma(b)
code = code.next
break
}
vv := rv.Interface()
header := (*interfaceHeader)(unsafe.Pointer(&vv))
typ := header.typ
if typ.Kind() == reflect.Ptr {
typ = typ.Elem()
}
var c *opcode
if typ.Kind() == reflect.Map {
code, err := e.compileMap(&encodeCompileContext{
typ: typ,
root: code.root,
indent: code.indent,
structTypeToCompiledCode: map[uintptr]*compiledCode{},
}, false)
if err != nil {
return nil, err
}
c = code
} else {
code, err := e.compile(&encodeCompileContext{
typ: typ,
root: code.root,
indent: code.indent,
structTypeToCompiledCode: map[uintptr]*compiledCode{},
})
if err != nil {
return nil, err
}
c = code
}
c = toEscaped(c)
beforeLastCode := c.beforeLastCode()
lastCode := beforeLastCode.next
lastCode.idx = beforeLastCode.idx + uintptrSize
totalLength := uintptr(code.totalLength())
nextTotalLength := uintptr(c.totalLength())
curlen := uintptr(len(ctx.ptrs))
offsetNum := ptrOffset / uintptrSize
oldOffset := ptrOffset
ptrOffset += totalLength * uintptrSize
newLen := offsetNum + totalLength + nextTotalLength
if curlen < newLen {
ctx.ptrs = append(ctx.ptrs, make([]uintptr, newLen-curlen)...)
}
ctxptr = ctx.ptr() + ptrOffset // assign new ctxptr
store(ctxptr, 0, uintptr(header.ptr))
store(ctxptr, lastCode.idx, oldOffset)
// link lastCode ( opInterfaceEnd ) => code.next
2021-01-11 13:05:06 +03:00
lastCode.op = opInterfaceEnd
2021-01-10 23:16:37 +03:00
lastCode.next = code.next
code = c
recursiveLevel++
2021-01-11 13:05:06 +03:00
case opInterfaceEnd:
2021-01-10 23:16:37 +03:00
recursiveLevel--
// restore ctxptr
offset := load(ctxptr, code.idx)
ctxptr = ctx.ptr() + offset
ptrOffset = offset
code = code.next
2021-01-11 13:05:06 +03:00
case opMarshalJSON:
2021-01-10 23:16:37 +03:00
ptr := load(ctxptr, code.idx)
v := e.ptrToInterface(code, ptr)
bb, err := v.(Marshaler).MarshalJSON()
if err != nil {
return nil, errMarshaler(code, err)
}
if len(bb) == 0 {
return nil, errUnexpectedEndOfJSON(
fmt.Sprintf("error calling MarshalJSON for type %s", code.typ),
0,
)
}
var buf bytes.Buffer
if err := encodeWithIndent(
&buf,
bb,
string(e.prefix)+string(bytes.Repeat(e.indentStr, code.indent)),
string(e.indentStr),
); err != nil {
return nil, err
}
b = append(b, buf.Bytes()...)
b = encodeIndentComma(b)
code = code.next
2021-01-11 13:05:06 +03:00
case opMarshalText:
2021-01-10 23:16:37 +03:00
ptr := load(ctxptr, code.idx)
isPtr := code.typ.Kind() == reflect.Ptr
p := e.ptrToUnsafePtr(ptr)
if p == nil {
b = encodeNull(b)
b = encodeIndentComma(b)
} else if isPtr && *(*unsafe.Pointer)(p) == nil {
b = append(b, '"', '"', ',', '\n')
} else {
if isPtr && code.typ.Elem().Implements(marshalTextType) {
p = *(*unsafe.Pointer)(p)
}
v := *(*interface{})(unsafe.Pointer(&interfaceHeader{
typ: code.typ,
ptr: p,
}))
bytes, err := v.(encoding.TextMarshaler).MarshalText()
if err != nil {
return nil, errMarshaler(code, err)
}
b = encodeEscapedString(b, *(*string)(unsafe.Pointer(&bytes)))
b = encodeIndentComma(b)
}
code = code.next
2021-01-11 13:05:06 +03:00
case opSliceHead:
2021-01-10 23:16:37 +03:00
p := load(ctxptr, code.idx)
if p == 0 {
b = e.encodeIndent(b, code.indent)
b = encodeNull(b)
b = encodeIndentComma(b)
code = code.end.next
} else {
slice := e.ptrToSlice(p)
store(ctxptr, code.elemIdx, 0)
store(ctxptr, code.length, uintptr(slice.len))
store(ctxptr, code.idx, uintptr(slice.data))
if slice.len > 0 {
b = append(b, '[', '\n')
b = e.encodeIndent(b, code.indent+1)
code = code.next
store(ctxptr, code.idx, uintptr(slice.data))
} else {
b = e.encodeIndent(b, code.indent)
b = append(b, '[', ']', '\n')
code = code.end.next
}
}
2021-01-11 13:05:06 +03:00
case opRootSliceHead:
2021-01-10 23:16:37 +03:00
p := load(ctxptr, code.idx)
if p == 0 {
b = e.encodeIndent(b, code.indent)
b = encodeNull(b)
b = encodeIndentComma(b)
code = code.end.next
} else {
slice := e.ptrToSlice(p)
store(ctxptr, code.elemIdx, 0)
store(ctxptr, code.length, uintptr(slice.len))
store(ctxptr, code.idx, uintptr(slice.data))
if slice.len > 0 {
b = append(b, '[', '\n')
b = e.encodeIndent(b, code.indent+1)
code = code.next
store(ctxptr, code.idx, uintptr(slice.data))
} else {
b = e.encodeIndent(b, code.indent)
b = append(b, '[', ']', ',', '\n')
code = code.end.next
}
}
2021-01-11 13:05:06 +03:00
case opSliceElem:
2021-01-10 23:16:37 +03:00
idx := load(ctxptr, code.elemIdx)
length := load(ctxptr, code.length)
idx++
if idx < length {
b = e.encodeIndent(b, code.indent+1)
store(ctxptr, code.elemIdx, idx)
data := load(ctxptr, code.headIdx)
size := code.size
code = code.next
store(ctxptr, code.idx, data+idx*size)
} else {
b = b[:len(b)-2]
b = append(b, '\n')
b = e.encodeIndent(b, code.indent)
b = append(b, ']', ',', '\n')
code = code.end.next
}
2021-01-11 13:05:06 +03:00
case opRootSliceElem:
2021-01-10 23:16:37 +03:00
idx := load(ctxptr, code.elemIdx)
length := load(ctxptr, code.length)
idx++
if idx < length {
b = e.encodeIndent(b, code.indent+1)
store(ctxptr, code.elemIdx, idx)
code = code.next
data := load(ctxptr, code.headIdx)
store(ctxptr, code.idx, data+idx*code.size)
} else {
b = append(b, '\n')
b = e.encodeIndent(b, code.indent)
b = append(b, ']')
code = code.end.next
}
2021-01-11 13:05:06 +03:00
case opArrayHead:
2021-01-10 23:16:37 +03:00
p := load(ctxptr, code.idx)
if p == 0 {
b = e.encodeIndent(b, code.indent)
b = encodeNull(b)
b = encodeIndentComma(b)
code = code.end.next
} else {
if code.length > 0 {
b = append(b, '[', '\n')
b = e.encodeIndent(b, code.indent+1)
store(ctxptr, code.elemIdx, 0)
code = code.next
store(ctxptr, code.idx, p)
} else {
b = e.encodeIndent(b, code.indent)
b = append(b, '[', ']', ',', '\n')
code = code.end.next
}
}
2021-01-11 13:05:06 +03:00
case opArrayElem:
2021-01-10 23:16:37 +03:00
idx := load(ctxptr, code.elemIdx)
idx++
if idx < code.length {
b = e.encodeIndent(b, code.indent+1)
store(ctxptr, code.elemIdx, idx)
p := load(ctxptr, code.headIdx)
size := code.size
code = code.next
store(ctxptr, code.idx, p+idx*size)
} else {
b = b[:len(b)-2]
b = append(b, '\n')
b = e.encodeIndent(b, code.indent)
b = append(b, ']', ',', '\n')
code = code.end.next
}
2021-01-11 13:05:06 +03:00
case opMapHead:
2021-01-10 23:16:37 +03:00
ptr := load(ctxptr, code.idx)
if ptr == 0 {
b = e.encodeIndent(b, code.indent)
b = encodeNull(b)
b = encodeIndentComma(b)
code = code.end.next
} else {
uptr := e.ptrToUnsafePtr(ptr)
mlen := maplen(uptr)
if mlen > 0 {
b = append(b, '{', '\n')
iter := mapiterinit(code.typ, uptr)
ctx.keepRefs = append(ctx.keepRefs, iter)
store(ctxptr, code.elemIdx, 0)
store(ctxptr, code.length, uintptr(mlen))
store(ctxptr, code.mapIter, uintptr(iter))
if !e.unorderedMap {
pos := make([]int, 0, mlen)
pos = append(pos, len(b))
posPtr := unsafe.Pointer(&pos)
ctx.keepRefs = append(ctx.keepRefs, posPtr)
store(ctxptr, code.end.mapPos, uintptr(posPtr))
} else {
b = e.encodeIndent(b, code.next.indent)
}
key := mapiterkey(iter)
store(ctxptr, code.next.idx, uintptr(key))
code = code.next
} else {
b = e.encodeIndent(b, code.indent)
b = append(b, '{', '}', ',', '\n')
code = code.end.next
}
}
2021-01-11 13:05:06 +03:00
case opMapHeadLoad:
2021-01-10 23:16:37 +03:00
ptr := load(ctxptr, code.idx)
if ptr == 0 {
b = e.encodeIndent(b, code.indent)
b = encodeNull(b)
code = code.end.next
} else {
// load pointer
ptr = e.ptrToPtr(ptr)
uptr := e.ptrToUnsafePtr(ptr)
if uintptr(uptr) == 0 {
b = e.encodeIndent(b, code.indent)
b = encodeNull(b)
b = encodeIndentComma(b)
code = code.end.next
break
}
mlen := maplen(uptr)
if mlen > 0 {
b = append(b, '{', '\n')
iter := mapiterinit(code.typ, uptr)
ctx.keepRefs = append(ctx.keepRefs, iter)
store(ctxptr, code.elemIdx, 0)
store(ctxptr, code.length, uintptr(mlen))
store(ctxptr, code.mapIter, uintptr(iter))
key := mapiterkey(iter)
store(ctxptr, code.next.idx, uintptr(key))
if !e.unorderedMap {
pos := make([]int, 0, mlen)
pos = append(pos, len(b))
posPtr := unsafe.Pointer(&pos)
ctx.keepRefs = append(ctx.keepRefs, posPtr)
store(ctxptr, code.end.mapPos, uintptr(posPtr))
} else {
b = e.encodeIndent(b, code.next.indent)
}
code = code.next
} else {
b = e.encodeIndent(b, code.indent)
b = append(b, '{', '}', ',', '\n')
code = code.end.next
}
}
2021-01-11 13:05:06 +03:00
case opMapKey:
2021-01-10 23:16:37 +03:00
idx := load(ctxptr, code.elemIdx)
length := load(ctxptr, code.length)
idx++
if e.unorderedMap {
if idx < length {
b = e.encodeIndent(b, code.indent)
store(ctxptr, code.elemIdx, idx)
ptr := load(ctxptr, code.mapIter)
iter := e.ptrToUnsafePtr(ptr)
key := mapiterkey(iter)
store(ctxptr, code.next.idx, uintptr(key))
code = code.next
} else {
last := len(b) - 1
b[last] = '\n'
b = e.encodeIndent(b, code.indent-1)
b = append(b, '}', ',', '\n')
code = code.end.next
}
} else {
ptr := load(ctxptr, code.end.mapPos)
posPtr := (*[]int)(*(*unsafe.Pointer)(unsafe.Pointer(&ptr)))
*posPtr = append(*posPtr, len(b))
if idx < length {
ptr := load(ctxptr, code.mapIter)
iter := e.ptrToUnsafePtr(ptr)
store(ctxptr, code.elemIdx, idx)
key := mapiterkey(iter)
store(ctxptr, code.next.idx, uintptr(key))
code = code.next
} else {
code = code.end
}
}
2021-01-11 13:05:06 +03:00
case opMapValue:
2021-01-10 23:16:37 +03:00
if e.unorderedMap {
b = append(b, ':', ' ')
} else {
ptr := load(ctxptr, code.end.mapPos)
posPtr := (*[]int)(*(*unsafe.Pointer)(unsafe.Pointer(&ptr)))
*posPtr = append(*posPtr, len(b))
}
ptr := load(ctxptr, code.mapIter)
iter := e.ptrToUnsafePtr(ptr)
value := mapitervalue(iter)
store(ctxptr, code.next.idx, uintptr(value))
mapiternext(iter)
code = code.next
2021-01-11 13:05:06 +03:00
case opMapEnd:
2021-01-10 23:16:37 +03:00
// this operation only used by sorted map
length := int(load(ctxptr, code.length))
type mapKV struct {
key string
value string
}
kvs := make([]mapKV, 0, length)
ptr := load(ctxptr, code.mapPos)
pos := *(*[]int)(*(*unsafe.Pointer)(unsafe.Pointer(&ptr)))
for i := 0; i < length; i++ {
startKey := pos[i*2]
startValue := pos[i*2+1]
var endValue int
if i+1 < length {
endValue = pos[i*2+2]
} else {
endValue = len(b)
}
kvs = append(kvs, mapKV{
key: string(b[startKey:startValue]),
value: string(b[startValue:endValue]),
})
}
sort.Slice(kvs, func(i, j int) bool {
return kvs[i].key < kvs[j].key
})
buf := b[pos[0]:]
buf = buf[:0]
for _, kv := range kvs {
buf = append(buf, e.prefix...)
buf = append(buf, bytes.Repeat(e.indentStr, code.indent+1)...)
buf = append(buf, []byte(kv.key)...)
buf[len(buf)-2] = ':'
buf[len(buf)-1] = ' '
buf = append(buf, []byte(kv.value)...)
}
buf = buf[:len(buf)-2]
buf = append(buf, '\n')
buf = append(buf, e.prefix...)
buf = append(buf, bytes.Repeat(e.indentStr, code.indent)...)
buf = append(buf, '}', ',', '\n')
b = b[:pos[0]]
b = append(b, buf...)
code = code.next
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldPtrHead:
2021-01-10 23:16:37 +03:00
p := load(ctxptr, code.idx)
if p == 0 {
b = encodeNull(b)
code = code.end.next
break
}
store(ctxptr, code.idx, e.ptrToPtr(p))
fallthrough
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldHead:
2021-01-10 23:16:37 +03:00
ptr := load(ctxptr, code.idx)
if ptr == 0 {
b = e.encodeIndent(b, code.indent)
b = encodeNull(b)
b = encodeIndentComma(b)
code = code.end.next
} else if code.next == code.end {
// not exists fields
b = e.encodeIndent(b, code.indent)
b = append(b, '{', '}', ',', '\n')
code = code.end.next
store(ctxptr, code.idx, ptr)
} else {
b = append(b, '{', '\n')
if !code.anonymousKey {
b = e.encodeIndent(b, code.indent+1)
b = append(b, code.escapedKey...)
b = append(b, ' ')
}
p := ptr + code.offset
code = code.next
store(ctxptr, code.idx, p)
}
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldHeadOnly:
2021-01-10 23:16:37 +03:00
ptr := load(ctxptr, code.idx)
b = append(b, '{', '\n')
if !code.anonymousKey {
b = e.encodeIndent(b, code.indent+1)
b = append(b, code.escapedKey...)
b = append(b, ' ')
}
p := ptr + code.offset
code = code.next
store(ctxptr, code.idx, p)
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldPtrHeadInt:
2021-01-10 23:16:37 +03:00
store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx)))
fallthrough
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldHeadInt:
2021-01-10 23:16:37 +03:00
ptr := load(ctxptr, code.idx)
if ptr == 0 {
b = encodeNull(b)
b = encodeIndentComma(b)
code = code.end.next
} else {
b = append(b, '{', '\n')
b = e.encodeIndent(b, code.indent+1)
b = append(b, code.escapedKey...)
b = append(b, ' ')
b = appendInt(b, int64(e.ptrToInt(ptr+code.offset)))
b = encodeIndentComma(b)
code = code.next
}
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldPtrHeadIntOnly, opStructEscapedFieldHeadIntOnly:
2021-01-10 23:16:37 +03:00
p := load(ctxptr, code.idx)
b = append(b, '{', '\n')
b = e.encodeIndent(b, code.indent+1)
b = append(b, code.escapedKey...)
b = append(b, ' ')
b = appendInt(b, int64(e.ptrToInt(p)))
b = encodeIndentComma(b)
code = code.next
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldPtrHeadIntPtr:
2021-01-10 23:16:37 +03:00
store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx)))
fallthrough
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldHeadIntPtr:
2021-01-10 23:16:37 +03:00
p := load(ctxptr, code.idx)
if p == 0 {
b = encodeNull(b)
b = encodeIndentComma(b)
code = code.end.next
break
} else {
b = append(b, '{', '\n')
b = e.encodeIndent(b, code.indent+1)
b = append(b, code.escapedKey...)
b = append(b, ' ')
p = e.ptrToPtr(p)
if p == 0 {
b = encodeNull(b)
} else {
b = appendInt(b, int64(e.ptrToInt(p+code.offset)))
}
}
b = encodeIndentComma(b)
code = code.next
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldPtrHeadIntPtrOnly:
2021-01-10 23:16:37 +03:00
p := load(ctxptr, code.idx)
if p == 0 {
b = encodeNull(b)
b = encodeIndentComma(b)
code = code.end.next
break
}
store(ctxptr, code.idx, e.ptrToPtr(p))
fallthrough
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldHeadIntPtrOnly:
2021-01-10 23:16:37 +03:00
p := load(ctxptr, code.idx)
b = append(b, '{', '\n')
b = e.encodeIndent(b, code.indent+1)
b = append(b, code.escapedKey...)
b = append(b, ' ')
if p == 0 {
b = encodeNull(b)
} else {
b = appendInt(b, int64(e.ptrToInt(p+code.offset)))
}
b = encodeIndentComma(b)
code = code.next
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldHeadIntNPtr:
2021-01-10 23:16:37 +03:00
p := load(ctxptr, code.idx)
if p == 0 {
b = encodeNull(b)
} else {
b = append(b, '{', '\n')
b = e.encodeIndent(b, code.indent+1)
b = append(b, code.escapedKey...)
b = append(b, ' ')
for i := 0; i < code.ptrNum; i++ {
if p == 0 {
break
}
p = e.ptrToPtr(p)
}
if p == 0 {
b = encodeNull(b)
} else {
b = appendInt(b, int64(e.ptrToInt(p+code.offset)))
}
}
b = encodeIndentComma(b)
code = code.next
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldPtrAnonymousHeadInt:
2021-01-10 23:16:37 +03:00
store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx)))
fallthrough
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldAnonymousHeadInt:
2021-01-10 23:16:37 +03:00
ptr := load(ctxptr, code.idx)
if ptr == 0 {
code = code.end.next
} else {
b = e.encodeIndent(b, code.indent)
b = append(b, code.escapedKey...)
b = append(b, ' ')
b = appendInt(b, int64(e.ptrToInt(ptr+code.offset)))
b = encodeIndentComma(b)
code = code.next
}
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldPtrAnonymousHeadIntOnly, opStructEscapedFieldAnonymousHeadIntOnly:
2021-01-10 23:16:37 +03:00
ptr := load(ctxptr, code.idx)
if ptr == 0 {
code = code.end.next
} else {
b = e.encodeIndent(b, code.indent)
b = append(b, code.escapedKey...)
b = append(b, ' ')
b = appendInt(b, int64(e.ptrToInt(ptr+code.offset)))
b = encodeIndentComma(b)
code = code.next
}
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldPtrAnonymousHeadIntPtr:
2021-01-10 23:16:37 +03:00
store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx)))
fallthrough
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldAnonymousHeadIntPtr:
2021-01-10 23:16:37 +03:00
p := load(ctxptr, code.idx)
if p == 0 {
code = code.end.next
break
}
b = e.encodeIndent(b, code.indent)
b = append(b, code.escapedKey...)
b = append(b, ' ')
p = e.ptrToPtr(p)
if p == 0 {
b = encodeNull(b)
} else {
b = appendInt(b, int64(e.ptrToInt(p+code.offset)))
}
b = encodeIndentComma(b)
code = code.next
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldPtrAnonymousHeadIntPtrOnly:
2021-01-10 23:16:37 +03:00
p := load(ctxptr, code.idx)
if p == 0 {
code = code.end.next
break
}
store(ctxptr, code.idx, e.ptrToPtr(p))
fallthrough
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldAnonymousHeadIntPtrOnly:
2021-01-10 23:16:37 +03:00
p := load(ctxptr, code.idx)
b = e.encodeIndent(b, code.indent)
b = append(b, code.escapedKey...)
b = append(b, ' ')
if p == 0 {
b = encodeNull(b)
} else {
b = appendInt(b, int64(e.ptrToInt(p+code.offset)))
}
b = encodeIndentComma(b)
code = code.next
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldPtrHeadInt8:
2021-01-10 23:16:37 +03:00
store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx)))
fallthrough
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldHeadInt8:
2021-01-10 23:16:37 +03:00
ptr := load(ctxptr, code.idx)
if ptr == 0 {
b = encodeNull(b)
b = encodeIndentComma(b)
code = code.end.next
} else {
b = append(b, '{', '\n')
b = e.encodeIndent(b, code.indent+1)
b = append(b, code.escapedKey...)
b = append(b, ' ')
b = appendInt(b, int64(e.ptrToInt8(ptr)))
b = encodeIndentComma(b)
code = code.next
}
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldPtrHeadInt8Only, opStructEscapedFieldHeadInt8Only:
2021-01-10 23:16:37 +03:00
p := load(ctxptr, code.idx)
b = append(b, '{', '\n')
b = e.encodeIndent(b, code.indent+1)
b = append(b, code.escapedKey...)
b = append(b, ' ')
b = appendInt(b, int64(e.ptrToInt8(p)))
b = encodeIndentComma(b)
code = code.next
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldPtrHeadInt8Ptr:
2021-01-10 23:16:37 +03:00
store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx)))
fallthrough
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldHeadInt8Ptr:
2021-01-10 23:16:37 +03:00
p := load(ctxptr, code.idx)
if p == 0 {
b = encodeNull(b)
b = encodeIndentComma(b)
code = code.end.next
break
} else {
b = append(b, '{', '\n')
b = e.encodeIndent(b, code.indent+1)
b = append(b, code.escapedKey...)
b = append(b, ' ')
p = e.ptrToPtr(p)
if p == 0 {
b = encodeNull(b)
} else {
b = appendInt(b, int64(e.ptrToInt8(p+code.offset)))
}
}
b = encodeIndentComma(b)
code = code.next
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldPtrHeadInt8PtrOnly:
2021-01-10 23:16:37 +03:00
p := load(ctxptr, code.idx)
if p == 0 {
b = encodeNull(b)
b = encodeIndentComma(b)
code = code.end.next
break
}
store(ctxptr, code.idx, e.ptrToPtr(p))
fallthrough
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldHeadInt8PtrOnly:
2021-01-10 23:16:37 +03:00
p := load(ctxptr, code.idx)
b = append(b, '{', '\n')
b = e.encodeIndent(b, code.indent+1)
b = append(b, code.escapedKey...)
b = append(b, ' ')
if p == 0 {
b = encodeNull(b)
} else {
b = appendInt(b, int64(e.ptrToInt8(p+code.offset)))
}
b = encodeIndentComma(b)
code = code.next
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldHeadInt8NPtr:
2021-01-10 23:16:37 +03:00
p := load(ctxptr, code.idx)
if p == 0 {
b = encodeNull(b)
} else {
b = append(b, '{', '\n')
b = e.encodeIndent(b, code.indent+1)
b = append(b, code.escapedKey...)
b = append(b, ' ')
for i := 0; i < code.ptrNum; i++ {
if p == 0 {
break
}
p = e.ptrToPtr(p)
}
if p == 0 {
b = encodeNull(b)
} else {
b = appendInt(b, int64(e.ptrToInt8(p+code.offset)))
}
}
b = encodeIndentComma(b)
code = code.next
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldPtrAnonymousHeadInt8:
2021-01-10 23:16:37 +03:00
store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx)))
fallthrough
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldAnonymousHeadInt8:
2021-01-10 23:16:37 +03:00
ptr := load(ctxptr, code.idx)
if ptr == 0 {
code = code.end.next
} else {
b = e.encodeIndent(b, code.indent)
b = append(b, code.escapedKey...)
b = append(b, ' ')
b = appendInt(b, int64(e.ptrToInt8(ptr+code.offset)))
b = encodeIndentComma(b)
code = code.next
}
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldPtrAnonymousHeadInt8Only, opStructEscapedFieldAnonymousHeadInt8Only:
2021-01-10 23:16:37 +03:00
ptr := load(ctxptr, code.idx)
if ptr == 0 {
code = code.end.next
} else {
b = e.encodeIndent(b, code.indent)
b = append(b, code.escapedKey...)
b = append(b, ' ')
b = appendInt(b, int64(e.ptrToInt8(ptr+code.offset)))
b = encodeIndentComma(b)
code = code.next
}
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldPtrAnonymousHeadInt8Ptr:
2021-01-10 23:16:37 +03:00
store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx)))
fallthrough
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldAnonymousHeadInt8Ptr:
2021-01-10 23:16:37 +03:00
p := load(ctxptr, code.idx)
if p == 0 {
code = code.end.next
break
}
b = e.encodeIndent(b, code.indent)
b = append(b, code.escapedKey...)
b = append(b, ' ')
p = e.ptrToPtr(p)
if p == 0 {
b = encodeNull(b)
} else {
b = appendInt(b, int64(e.ptrToInt8(p+code.offset)))
}
b = encodeIndentComma(b)
code = code.next
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldPtrAnonymousHeadInt8PtrOnly:
2021-01-10 23:16:37 +03:00
p := load(ctxptr, code.idx)
if p == 0 {
code = code.end.next
break
}
store(ctxptr, code.idx, e.ptrToPtr(p))
fallthrough
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldAnonymousHeadInt8PtrOnly:
2021-01-10 23:16:37 +03:00
p := load(ctxptr, code.idx)
b = e.encodeIndent(b, code.indent)
b = append(b, code.escapedKey...)
b = append(b, ' ')
if p == 0 {
b = encodeNull(b)
} else {
b = appendInt(b, int64(e.ptrToInt8(p+code.offset)))
}
b = encodeIndentComma(b)
code = code.next
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldPtrHeadInt16:
2021-01-10 23:16:37 +03:00
store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx)))
fallthrough
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldHeadInt16:
2021-01-10 23:16:37 +03:00
ptr := load(ctxptr, code.idx)
if ptr == 0 {
b = encodeNull(b)
b = encodeIndentComma(b)
code = code.end.next
} else {
b = append(b, '{', '\n')
b = e.encodeIndent(b, code.indent+1)
b = append(b, code.escapedKey...)
b = append(b, ' ')
b = appendInt(b, int64(e.ptrToInt16(ptr)))
b = encodeIndentComma(b)
code = code.next
}
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldPtrHeadInt16Only, opStructEscapedFieldHeadInt16Only:
2021-01-10 23:16:37 +03:00
p := load(ctxptr, code.idx)
b = append(b, '{', '\n')
b = e.encodeIndent(b, code.indent+1)
b = append(b, code.escapedKey...)
b = append(b, ' ')
b = appendInt(b, int64(e.ptrToInt16(p)))
b = encodeIndentComma(b)
code = code.next
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldPtrHeadInt16Ptr:
2021-01-10 23:16:37 +03:00
store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx)))
fallthrough
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldHeadInt16Ptr:
2021-01-10 23:16:37 +03:00
p := load(ctxptr, code.idx)
if p == 0 {
b = encodeNull(b)
b = encodeIndentComma(b)
code = code.end.next
break
} else {
b = append(b, '{', '\n')
b = e.encodeIndent(b, code.indent+1)
b = append(b, code.escapedKey...)
b = append(b, ' ')
p = e.ptrToPtr(p)
if p == 0 {
b = encodeNull(b)
} else {
b = appendInt(b, int64(e.ptrToInt16(p+code.offset)))
}
}
b = encodeIndentComma(b)
code = code.next
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldPtrHeadInt16PtrOnly:
2021-01-10 23:16:37 +03:00
p := load(ctxptr, code.idx)
if p == 0 {
b = encodeNull(b)
b = encodeIndentComma(b)
code = code.end.next
break
}
store(ctxptr, code.idx, e.ptrToPtr(p))
fallthrough
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldHeadInt16PtrOnly:
2021-01-10 23:16:37 +03:00
p := load(ctxptr, code.idx)
b = append(b, '{', '\n')
b = e.encodeIndent(b, code.indent+1)
b = append(b, code.escapedKey...)
b = append(b, ' ')
if p == 0 {
b = encodeNull(b)
} else {
b = appendInt(b, int64(e.ptrToInt16(p+code.offset)))
}
b = encodeIndentComma(b)
code = code.next
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldHeadInt16NPtr:
2021-01-10 23:16:37 +03:00
p := load(ctxptr, code.idx)
if p == 0 {
b = encodeNull(b)
} else {
b = append(b, '{', '\n')
b = e.encodeIndent(b, code.indent+1)
b = append(b, code.escapedKey...)
b = append(b, ' ')
for i := 0; i < code.ptrNum; i++ {
if p == 0 {
break
}
p = e.ptrToPtr(p)
}
if p == 0 {
b = encodeNull(b)
} else {
b = appendInt(b, int64(e.ptrToInt16(p+code.offset)))
}
}
b = encodeIndentComma(b)
code = code.next
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldPtrAnonymousHeadInt16:
2021-01-10 23:16:37 +03:00
store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx)))
fallthrough
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldAnonymousHeadInt16:
2021-01-10 23:16:37 +03:00
ptr := load(ctxptr, code.idx)
if ptr == 0 {
code = code.end.next
} else {
b = e.encodeIndent(b, code.indent)
b = append(b, code.escapedKey...)
b = append(b, ' ')
b = appendInt(b, int64(e.ptrToInt16(ptr+code.offset)))
b = encodeIndentComma(b)
code = code.next
}
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldPtrAnonymousHeadInt16Only, opStructEscapedFieldAnonymousHeadInt16Only:
2021-01-10 23:16:37 +03:00
ptr := load(ctxptr, code.idx)
if ptr == 0 {
code = code.end.next
} else {
b = e.encodeIndent(b, code.indent)
b = append(b, code.escapedKey...)
b = append(b, ' ')
b = appendInt(b, int64(e.ptrToInt16(ptr+code.offset)))
b = encodeIndentComma(b)
code = code.next
}
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldPtrAnonymousHeadInt16Ptr:
2021-01-10 23:16:37 +03:00
store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx)))
fallthrough
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldAnonymousHeadInt16Ptr:
2021-01-10 23:16:37 +03:00
p := load(ctxptr, code.idx)
if p == 0 {
code = code.end.next
break
}
b = e.encodeIndent(b, code.indent)
b = append(b, code.escapedKey...)
b = append(b, ' ')
p = e.ptrToPtr(p)
if p == 0 {
b = encodeNull(b)
} else {
b = appendInt(b, int64(e.ptrToInt16(p+code.offset)))
}
b = encodeIndentComma(b)
code = code.next
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldPtrAnonymousHeadInt16PtrOnly:
2021-01-10 23:16:37 +03:00
p := load(ctxptr, code.idx)
if p == 0 {
code = code.end.next
break
}
store(ctxptr, code.idx, e.ptrToPtr(p))
fallthrough
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldAnonymousHeadInt16PtrOnly:
2021-01-10 23:16:37 +03:00
p := load(ctxptr, code.idx)
b = e.encodeIndent(b, code.indent)
b = append(b, code.escapedKey...)
b = append(b, ' ')
if p == 0 {
b = encodeNull(b)
} else {
b = appendInt(b, int64(e.ptrToInt16(p+code.offset)))
}
b = encodeIndentComma(b)
code = code.next
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldPtrHeadInt32:
2021-01-10 23:16:37 +03:00
store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx)))
fallthrough
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldHeadInt32:
2021-01-10 23:16:37 +03:00
ptr := load(ctxptr, code.idx)
if ptr == 0 {
b = encodeNull(b)
b = encodeIndentComma(b)
code = code.end.next
} else {
b = append(b, '{', '\n')
b = e.encodeIndent(b, code.indent+1)
b = append(b, code.escapedKey...)
b = append(b, ' ')
b = appendInt(b, int64(e.ptrToInt32(ptr)))
b = encodeIndentComma(b)
code = code.next
}
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldPtrHeadInt32Only, opStructEscapedFieldHeadInt32Only:
2021-01-10 23:16:37 +03:00
p := load(ctxptr, code.idx)
b = append(b, '{', '\n')
b = e.encodeIndent(b, code.indent+1)
b = append(b, code.escapedKey...)
b = append(b, ' ')
b = appendInt(b, int64(e.ptrToInt32(p)))
b = encodeIndentComma(b)
code = code.next
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldPtrHeadInt32Ptr:
2021-01-10 23:16:37 +03:00
store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx)))
fallthrough
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldHeadInt32Ptr:
2021-01-10 23:16:37 +03:00
p := load(ctxptr, code.idx)
if p == 0 {
b = encodeNull(b)
b = encodeIndentComma(b)
code = code.end.next
break
} else {
b = append(b, '{', '\n')
b = e.encodeIndent(b, code.indent+1)
b = append(b, code.escapedKey...)
b = append(b, ' ')
p = e.ptrToPtr(p)
if p == 0 {
b = encodeNull(b)
} else {
b = appendInt(b, int64(e.ptrToInt32(p+code.offset)))
}
}
b = encodeIndentComma(b)
code = code.next
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldPtrHeadInt32PtrOnly:
2021-01-10 23:16:37 +03:00
p := load(ctxptr, code.idx)
if p == 0 {
b = encodeNull(b)
b = encodeIndentComma(b)
code = code.end.next
break
}
store(ctxptr, code.idx, e.ptrToPtr(p))
fallthrough
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldHeadInt32PtrOnly:
2021-01-10 23:16:37 +03:00
p := load(ctxptr, code.idx)
b = append(b, '{', '\n')
b = e.encodeIndent(b, code.indent+1)
b = append(b, code.escapedKey...)
b = append(b, ' ')
if p == 0 {
b = encodeNull(b)
} else {
b = appendInt(b, int64(e.ptrToInt32(p+code.offset)))
}
b = encodeIndentComma(b)
code = code.next
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldHeadInt32NPtr:
2021-01-10 23:16:37 +03:00
p := load(ctxptr, code.idx)
if p == 0 {
b = encodeNull(b)
} else {
b = append(b, '{', '\n')
b = e.encodeIndent(b, code.indent+1)
b = append(b, code.escapedKey...)
b = append(b, ' ')
for i := 0; i < code.ptrNum; i++ {
if p == 0 {
break
}
p = e.ptrToPtr(p)
}
if p == 0 {
b = encodeNull(b)
} else {
b = appendInt(b, int64(e.ptrToInt32(p+code.offset)))
}
}
b = encodeIndentComma(b)
code = code.next
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldPtrAnonymousHeadInt32:
2021-01-10 23:16:37 +03:00
store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx)))
fallthrough
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldAnonymousHeadInt32:
2021-01-10 23:16:37 +03:00
ptr := load(ctxptr, code.idx)
if ptr == 0 {
code = code.end.next
} else {
b = e.encodeIndent(b, code.indent)
b = append(b, code.escapedKey...)
b = append(b, ' ')
b = appendInt(b, int64(e.ptrToInt32(ptr+code.offset)))
b = encodeIndentComma(b)
code = code.next
}
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldPtrAnonymousHeadInt32Only, opStructEscapedFieldAnonymousHeadInt32Only:
2021-01-10 23:16:37 +03:00
ptr := load(ctxptr, code.idx)
if ptr == 0 {
code = code.end.next
} else {
b = e.encodeIndent(b, code.indent)
b = append(b, code.escapedKey...)
b = append(b, ' ')
b = appendInt(b, int64(e.ptrToInt32(ptr+code.offset)))
b = encodeIndentComma(b)
code = code.next
}
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldPtrAnonymousHeadInt32Ptr:
2021-01-10 23:16:37 +03:00
store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx)))
fallthrough
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldAnonymousHeadInt32Ptr:
2021-01-10 23:16:37 +03:00
p := load(ctxptr, code.idx)
if p == 0 {
code = code.end.next
break
}
b = e.encodeIndent(b, code.indent)
b = append(b, code.escapedKey...)
b = append(b, ' ')
p = e.ptrToPtr(p)
if p == 0 {
b = encodeNull(b)
} else {
b = appendInt(b, int64(e.ptrToInt32(p+code.offset)))
}
b = encodeIndentComma(b)
code = code.next
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldPtrAnonymousHeadInt32PtrOnly:
2021-01-10 23:16:37 +03:00
p := load(ctxptr, code.idx)
if p == 0 {
code = code.end.next
break
}
store(ctxptr, code.idx, e.ptrToPtr(p))
fallthrough
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldAnonymousHeadInt32PtrOnly:
2021-01-10 23:16:37 +03:00
p := load(ctxptr, code.idx)
b = e.encodeIndent(b, code.indent)
b = append(b, code.escapedKey...)
b = append(b, ' ')
if p == 0 {
b = encodeNull(b)
} else {
b = appendInt(b, int64(e.ptrToInt32(p+code.offset)))
}
b = encodeIndentComma(b)
code = code.next
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldPtrHeadInt64:
2021-01-10 23:16:37 +03:00
store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx)))
fallthrough
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldHeadInt64:
2021-01-10 23:16:37 +03:00
ptr := load(ctxptr, code.idx)
if ptr == 0 {
b = encodeNull(b)
b = encodeIndentComma(b)
code = code.end.next
} else {
b = append(b, '{', '\n')
b = e.encodeIndent(b, code.indent+1)
b = append(b, code.escapedKey...)
b = append(b, ' ')
b = appendInt(b, e.ptrToInt64(ptr))
b = encodeIndentComma(b)
code = code.next
}
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldPtrHeadInt64Only, opStructEscapedFieldHeadInt64Only:
2021-01-10 23:16:37 +03:00
p := load(ctxptr, code.idx)
b = append(b, '{', '\n')
b = e.encodeIndent(b, code.indent+1)
b = append(b, code.escapedKey...)
b = append(b, ' ')
b = appendInt(b, e.ptrToInt64(p))
b = encodeIndentComma(b)
code = code.next
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldPtrHeadInt64Ptr:
2021-01-10 23:16:37 +03:00
store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx)))
fallthrough
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldHeadInt64Ptr:
2021-01-10 23:16:37 +03:00
p := load(ctxptr, code.idx)
if p == 0 {
b = encodeNull(b)
b = encodeIndentComma(b)
code = code.end.next
break
} else {
b = append(b, '{', '\n')
b = e.encodeIndent(b, code.indent+1)
b = append(b, code.escapedKey...)
b = append(b, ' ')
p = e.ptrToPtr(p)
if p == 0 {
b = encodeNull(b)
} else {
b = appendInt(b, e.ptrToInt64(p+code.offset))
}
}
b = encodeIndentComma(b)
code = code.next
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldPtrHeadInt64PtrOnly:
2021-01-10 23:16:37 +03:00
p := load(ctxptr, code.idx)
if p == 0 {
b = encodeNull(b)
b = encodeIndentComma(b)
code = code.end.next
break
}
store(ctxptr, code.idx, e.ptrToPtr(p))
fallthrough
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldHeadInt64PtrOnly:
2021-01-10 23:16:37 +03:00
p := load(ctxptr, code.idx)
b = append(b, '{', '\n')
b = e.encodeIndent(b, code.indent+1)
b = append(b, code.escapedKey...)
b = append(b, ' ')
if p == 0 {
b = encodeNull(b)
} else {
b = appendInt(b, e.ptrToInt64(p+code.offset))
}
b = encodeIndentComma(b)
code = code.next
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldHeadInt64NPtr:
2021-01-10 23:16:37 +03:00
p := load(ctxptr, code.idx)
if p == 0 {
b = encodeNull(b)
} else {
b = append(b, '{', '\n')
b = e.encodeIndent(b, code.indent+1)
b = append(b, code.escapedKey...)
b = append(b, ' ')
for i := 0; i < code.ptrNum; i++ {
if p == 0 {
break
}
p = e.ptrToPtr(p)
}
if p == 0 {
b = encodeNull(b)
} else {
b = appendInt(b, e.ptrToInt64(p+code.offset))
}
}
b = encodeIndentComma(b)
code = code.next
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldPtrAnonymousHeadInt64:
2021-01-10 23:16:37 +03:00
store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx)))
fallthrough
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldAnonymousHeadInt64:
2021-01-10 23:16:37 +03:00
ptr := load(ctxptr, code.idx)
if ptr == 0 {
code = code.end.next
} else {
b = e.encodeIndent(b, code.indent)
b = append(b, code.escapedKey...)
b = append(b, ' ')
b = appendInt(b, e.ptrToInt64(ptr+code.offset))
b = encodeIndentComma(b)
code = code.next
}
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldPtrAnonymousHeadInt64Only, opStructEscapedFieldAnonymousHeadInt64Only:
2021-01-10 23:16:37 +03:00
ptr := load(ctxptr, code.idx)
if ptr == 0 {
code = code.end.next
} else {
b = e.encodeIndent(b, code.indent)
b = append(b, code.escapedKey...)
b = append(b, ' ')
b = appendInt(b, e.ptrToInt64(ptr+code.offset))
b = encodeIndentComma(b)
code = code.next
}
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldPtrAnonymousHeadInt64Ptr:
2021-01-10 23:16:37 +03:00
store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx)))
fallthrough
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldAnonymousHeadInt64Ptr:
2021-01-10 23:16:37 +03:00
p := load(ctxptr, code.idx)
if p == 0 {
code = code.end.next
break
}
b = e.encodeIndent(b, code.indent)
b = append(b, code.escapedKey...)
b = append(b, ' ')
p = e.ptrToPtr(p)
if p == 0 {
b = encodeNull(b)
} else {
b = appendInt(b, e.ptrToInt64(p+code.offset))
}
b = encodeIndentComma(b)
code = code.next
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldPtrAnonymousHeadInt64PtrOnly:
2021-01-10 23:16:37 +03:00
p := load(ctxptr, code.idx)
if p == 0 {
code = code.end.next
break
}
store(ctxptr, code.idx, e.ptrToPtr(p))
fallthrough
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldAnonymousHeadInt64PtrOnly:
2021-01-10 23:16:37 +03:00
p := load(ctxptr, code.idx)
b = e.encodeIndent(b, code.indent)
b = append(b, code.escapedKey...)
b = append(b, ' ')
if p == 0 {
b = encodeNull(b)
} else {
b = appendInt(b, e.ptrToInt64(p+code.offset))
}
b = encodeIndentComma(b)
code = code.next
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldPtrHeadUint:
2021-01-10 23:16:37 +03:00
store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx)))
fallthrough
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldHeadUint:
2021-01-10 23:16:37 +03:00
ptr := load(ctxptr, code.idx)
if ptr == 0 {
b = encodeNull(b)
b = encodeIndentComma(b)
code = code.end.next
} else {
b = append(b, '{', '\n')
b = e.encodeIndent(b, code.indent+1)
b = append(b, code.escapedKey...)
b = append(b, ' ')
b = appendUint(b, uint64(e.ptrToUint(ptr+code.offset)))
b = encodeIndentComma(b)
code = code.next
}
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldPtrHeadUintOnly, opStructEscapedFieldHeadUintOnly:
2021-01-10 23:16:37 +03:00
p := load(ctxptr, code.idx)
b = append(b, '{', '\n')
b = e.encodeIndent(b, code.indent+1)
b = append(b, code.escapedKey...)
b = append(b, ' ')
b = appendUint(b, uint64(e.ptrToUint(p)))
b = encodeIndentComma(b)
code = code.next
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldPtrHeadUintPtr:
2021-01-10 23:16:37 +03:00
store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx)))
fallthrough
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldHeadUintPtr:
2021-01-10 23:16:37 +03:00
p := load(ctxptr, code.idx)
if p == 0 {
b = encodeNull(b)
b = encodeIndentComma(b)
code = code.end.next
break
} else {
b = append(b, '{', '\n')
b = e.encodeIndent(b, code.indent+1)
b = append(b, code.escapedKey...)
b = append(b, ' ')
p = e.ptrToPtr(p)
if p == 0 {
b = encodeNull(b)
} else {
b = appendUint(b, uint64(e.ptrToUint(p+code.offset)))
}
}
b = encodeIndentComma(b)
code = code.next
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldPtrHeadUintPtrOnly:
2021-01-10 23:16:37 +03:00
p := load(ctxptr, code.idx)
if p == 0 {
b = encodeNull(b)
b = encodeIndentComma(b)
code = code.end.next
break
}
store(ctxptr, code.idx, e.ptrToPtr(p))
fallthrough
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldHeadUintPtrOnly:
2021-01-10 23:16:37 +03:00
p := load(ctxptr, code.idx)
b = append(b, '{', '\n')
b = e.encodeIndent(b, code.indent+1)
b = append(b, code.escapedKey...)
b = append(b, ' ')
if p == 0 {
b = encodeNull(b)
} else {
b = appendUint(b, uint64(e.ptrToUint(p+code.offset)))
}
b = encodeIndentComma(b)
code = code.next
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldHeadUintNPtr:
2021-01-10 23:16:37 +03:00
p := load(ctxptr, code.idx)
if p == 0 {
b = encodeNull(b)
} else {
b = append(b, '{', '\n')
b = e.encodeIndent(b, code.indent+1)
b = append(b, code.escapedKey...)
b = append(b, ' ')
for i := 0; i < code.ptrNum; i++ {
if p == 0 {
break
}
p = e.ptrToPtr(p)
}
if p == 0 {
b = encodeNull(b)
} else {
b = appendUint(b, uint64(e.ptrToUint(p+code.offset)))
}
}
b = encodeIndentComma(b)
code = code.next
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldPtrAnonymousHeadUint:
2021-01-10 23:16:37 +03:00
store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx)))
fallthrough
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldAnonymousHeadUint:
2021-01-10 23:16:37 +03:00
ptr := load(ctxptr, code.idx)
if ptr == 0 {
code = code.end.next
} else {
b = e.encodeIndent(b, code.indent)
b = append(b, code.escapedKey...)
b = append(b, ' ')
b = appendUint(b, uint64(e.ptrToUint(ptr+code.offset)))
b = encodeIndentComma(b)
code = code.next
}
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldPtrAnonymousHeadUintOnly, opStructEscapedFieldAnonymousHeadUintOnly:
2021-01-10 23:16:37 +03:00
ptr := load(ctxptr, code.idx)
if ptr == 0 {
code = code.end.next
} else {
b = e.encodeIndent(b, code.indent)
b = append(b, code.escapedKey...)
b = append(b, ' ')
b = appendUint(b, uint64(e.ptrToUint(ptr+code.offset)))
b = encodeIndentComma(b)
code = code.next
}
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldPtrAnonymousHeadUintPtr:
2021-01-10 23:16:37 +03:00
store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx)))
fallthrough
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldAnonymousHeadUintPtr:
2021-01-10 23:16:37 +03:00
p := load(ctxptr, code.idx)
if p == 0 {
code = code.end.next
break
}
b = e.encodeIndent(b, code.indent)
b = append(b, code.escapedKey...)
b = append(b, ' ')
p = e.ptrToPtr(p)
if p == 0 {
b = encodeNull(b)
} else {
b = appendUint(b, uint64(e.ptrToUint(p+code.offset)))
}
b = encodeIndentComma(b)
code = code.next
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldPtrAnonymousHeadUintPtrOnly:
2021-01-10 23:16:37 +03:00
p := load(ctxptr, code.idx)
if p == 0 {
code = code.end.next
break
}
store(ctxptr, code.idx, e.ptrToPtr(p))
fallthrough
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldAnonymousHeadUintPtrOnly:
2021-01-10 23:16:37 +03:00
p := load(ctxptr, code.idx)
b = e.encodeIndent(b, code.indent)
b = append(b, code.escapedKey...)
b = append(b, ' ')
if p == 0 {
b = encodeNull(b)
} else {
b = appendUint(b, uint64(e.ptrToUint(p+code.offset)))
}
b = encodeIndentComma(b)
code = code.next
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldPtrHeadUint8:
2021-01-10 23:16:37 +03:00
store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx)))
fallthrough
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldHeadUint8:
2021-01-10 23:16:37 +03:00
ptr := load(ctxptr, code.idx)
if ptr == 0 {
b = encodeNull(b)
b = encodeIndentComma(b)
code = code.end.next
} else {
b = append(b, '{', '\n')
b = e.encodeIndent(b, code.indent+1)
b = append(b, code.escapedKey...)
b = append(b, ' ')
b = appendUint(b, uint64(e.ptrToUint8(ptr)))
b = encodeIndentComma(b)
code = code.next
}
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldPtrHeadUint8Only, opStructEscapedFieldHeadUint8Only:
2021-01-10 23:16:37 +03:00
p := load(ctxptr, code.idx)
b = append(b, '{', '\n')
b = e.encodeIndent(b, code.indent+1)
b = append(b, code.escapedKey...)
b = append(b, ' ')
b = appendUint(b, uint64(e.ptrToUint8(p)))
b = encodeIndentComma(b)
code = code.next
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldPtrHeadUint8Ptr:
2021-01-10 23:16:37 +03:00
store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx)))
fallthrough
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldHeadUint8Ptr:
2021-01-10 23:16:37 +03:00
p := load(ctxptr, code.idx)
if p == 0 {
b = encodeNull(b)
b = encodeIndentComma(b)
code = code.end.next
break
} else {
b = append(b, '{', '\n')
b = e.encodeIndent(b, code.indent+1)
b = append(b, code.escapedKey...)
b = append(b, ' ')
p = e.ptrToPtr(p)
if p == 0 {
b = encodeNull(b)
} else {
b = appendUint(b, uint64(e.ptrToUint8(p+code.offset)))
}
}
b = encodeIndentComma(b)
code = code.next
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldPtrHeadUint8PtrOnly:
2021-01-10 23:16:37 +03:00
p := load(ctxptr, code.idx)
if p == 0 {
b = encodeNull(b)
b = encodeIndentComma(b)
code = code.end.next
break
}
store(ctxptr, code.idx, e.ptrToPtr(p))
fallthrough
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldHeadUint8PtrOnly:
2021-01-10 23:16:37 +03:00
p := load(ctxptr, code.idx)
b = append(b, '{', '\n')
b = e.encodeIndent(b, code.indent+1)
b = append(b, code.escapedKey...)
b = append(b, ' ')
if p == 0 {
b = encodeNull(b)
} else {
b = appendUint(b, uint64(e.ptrToUint8(p+code.offset)))
}
b = encodeIndentComma(b)
code = code.next
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldHeadUint8NPtr:
2021-01-10 23:16:37 +03:00
p := load(ctxptr, code.idx)
if p == 0 {
b = encodeNull(b)
} else {
b = append(b, '{', '\n')
b = e.encodeIndent(b, code.indent+1)
b = append(b, code.escapedKey...)
b = append(b, ' ')
for i := 0; i < code.ptrNum; i++ {
if p == 0 {
break
}
p = e.ptrToPtr(p)
}
if p == 0 {
b = encodeNull(b)
} else {
b = appendUint(b, uint64(e.ptrToUint8(p+code.offset)))
}
}
b = encodeIndentComma(b)
code = code.next
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldPtrAnonymousHeadUint8:
2021-01-10 23:16:37 +03:00
store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx)))
fallthrough
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldAnonymousHeadUint8:
2021-01-10 23:16:37 +03:00
ptr := load(ctxptr, code.idx)
if ptr == 0 {
code = code.end.next
} else {
b = e.encodeIndent(b, code.indent)
b = append(b, code.escapedKey...)
b = append(b, ' ')
b = appendUint(b, uint64(e.ptrToUint8(ptr+code.offset)))
b = encodeIndentComma(b)
code = code.next
}
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldPtrAnonymousHeadUint8Only, opStructEscapedFieldAnonymousHeadUint8Only:
2021-01-10 23:16:37 +03:00
ptr := load(ctxptr, code.idx)
if ptr == 0 {
code = code.end.next
} else {
b = e.encodeIndent(b, code.indent)
b = append(b, code.escapedKey...)
b = append(b, ' ')
b = appendUint(b, uint64(e.ptrToUint8(ptr+code.offset)))
b = encodeIndentComma(b)
code = code.next
}
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldPtrAnonymousHeadUint8Ptr:
2021-01-10 23:16:37 +03:00
store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx)))
fallthrough
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldAnonymousHeadUint8Ptr:
2021-01-10 23:16:37 +03:00
p := load(ctxptr, code.idx)
if p == 0 {
code = code.end.next
break
}
b = e.encodeIndent(b, code.indent)
b = append(b, code.escapedKey...)
b = append(b, ' ')
p = e.ptrToPtr(p)
if p == 0 {
b = encodeNull(b)
} else {
b = appendUint(b, uint64(e.ptrToUint8(p+code.offset)))
}
b = encodeIndentComma(b)
code = code.next
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldPtrAnonymousHeadUint8PtrOnly:
2021-01-10 23:16:37 +03:00
p := load(ctxptr, code.idx)
if p == 0 {
code = code.end.next
break
}
store(ctxptr, code.idx, e.ptrToPtr(p))
fallthrough
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldAnonymousHeadUint8PtrOnly:
2021-01-10 23:16:37 +03:00
p := load(ctxptr, code.idx)
b = e.encodeIndent(b, code.indent)
b = append(b, code.escapedKey...)
b = append(b, ' ')
if p == 0 {
b = encodeNull(b)
} else {
b = appendUint(b, uint64(e.ptrToUint8(p+code.offset)))
}
b = encodeIndentComma(b)
code = code.next
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldPtrHeadUint16:
2021-01-10 23:16:37 +03:00
store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx)))
fallthrough
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldHeadUint16:
2021-01-10 23:16:37 +03:00
ptr := load(ctxptr, code.idx)
if ptr == 0 {
b = encodeNull(b)
b = encodeIndentComma(b)
code = code.end.next
} else {
b = append(b, '{', '\n')
b = e.encodeIndent(b, code.indent+1)
b = append(b, code.escapedKey...)
b = append(b, ' ')
b = appendUint(b, uint64(e.ptrToUint16(ptr)))
b = encodeIndentComma(b)
code = code.next
}
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldPtrHeadUint16Only, opStructEscapedFieldHeadUint16Only:
2021-01-10 23:16:37 +03:00
p := load(ctxptr, code.idx)
b = append(b, '{', '\n')
b = e.encodeIndent(b, code.indent+1)
b = append(b, code.escapedKey...)
b = append(b, ' ')
b = appendUint(b, uint64(e.ptrToUint16(p)))
b = encodeIndentComma(b)
code = code.next
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldPtrHeadUint16Ptr:
2021-01-10 23:16:37 +03:00
store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx)))
fallthrough
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldHeadUint16Ptr:
2021-01-10 23:16:37 +03:00
p := load(ctxptr, code.idx)
if p == 0 {
b = encodeNull(b)
b = encodeIndentComma(b)
code = code.end.next
break
} else {
b = append(b, '{', '\n')
b = e.encodeIndent(b, code.indent+1)
b = append(b, code.escapedKey...)
b = append(b, ' ')
p = e.ptrToPtr(p)
if p == 0 {
b = encodeNull(b)
} else {
b = appendUint(b, uint64(e.ptrToUint16(p+code.offset)))
}
}
b = encodeIndentComma(b)
code = code.next
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldPtrHeadUint16PtrOnly:
2021-01-10 23:16:37 +03:00
p := load(ctxptr, code.idx)
if p == 0 {
b = encodeNull(b)
b = encodeIndentComma(b)
code = code.end.next
break
}
store(ctxptr, code.idx, e.ptrToPtr(p))
fallthrough
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldHeadUint16PtrOnly:
2021-01-10 23:16:37 +03:00
p := load(ctxptr, code.idx)
b = append(b, '{', '\n')
b = e.encodeIndent(b, code.indent+1)
b = append(b, code.escapedKey...)
b = append(b, ' ')
if p == 0 {
b = encodeNull(b)
} else {
b = appendUint(b, uint64(e.ptrToUint16(p+code.offset)))
}
b = encodeIndentComma(b)
code = code.next
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldHeadUint16NPtr:
2021-01-10 23:16:37 +03:00
p := load(ctxptr, code.idx)
if p == 0 {
b = encodeNull(b)
} else {
b = append(b, '{', '\n')
b = e.encodeIndent(b, code.indent+1)
b = append(b, code.escapedKey...)
b = append(b, ' ')
for i := 0; i < code.ptrNum; i++ {
if p == 0 {
break
}
p = e.ptrToPtr(p)
}
if p == 0 {
b = encodeNull(b)
} else {
b = appendUint(b, uint64(e.ptrToUint16(p+code.offset)))
}
}
b = encodeIndentComma(b)
code = code.next
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldPtrAnonymousHeadUint16:
2021-01-10 23:16:37 +03:00
store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx)))
fallthrough
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldAnonymousHeadUint16:
2021-01-10 23:16:37 +03:00
ptr := load(ctxptr, code.idx)
if ptr == 0 {
code = code.end.next
} else {
b = e.encodeIndent(b, code.indent)
b = append(b, code.escapedKey...)
b = append(b, ' ')
b = appendUint(b, uint64(e.ptrToUint16(ptr+code.offset)))
b = encodeIndentComma(b)
code = code.next
}
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldPtrAnonymousHeadUint16Only, opStructEscapedFieldAnonymousHeadUint16Only:
2021-01-10 23:16:37 +03:00
ptr := load(ctxptr, code.idx)
if ptr == 0 {
code = code.end.next
} else {
b = e.encodeIndent(b, code.indent)
b = append(b, code.escapedKey...)
b = append(b, ' ')
b = appendUint(b, uint64(e.ptrToUint16(ptr+code.offset)))
b = encodeIndentComma(b)
code = code.next
}
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldPtrAnonymousHeadUint16Ptr:
2021-01-10 23:16:37 +03:00
store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx)))
fallthrough
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldAnonymousHeadUint16Ptr:
2021-01-10 23:16:37 +03:00
p := load(ctxptr, code.idx)
if p == 0 {
code = code.end.next
break
}
b = e.encodeIndent(b, code.indent)
b = append(b, code.escapedKey...)
b = append(b, ' ')
p = e.ptrToPtr(p)
if p == 0 {
b = encodeNull(b)
} else {
b = appendUint(b, uint64(e.ptrToUint16(p+code.offset)))
}
b = encodeIndentComma(b)
code = code.next
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldPtrAnonymousHeadUint16PtrOnly:
2021-01-10 23:16:37 +03:00
p := load(ctxptr, code.idx)
if p == 0 {
code = code.end.next
break
}
store(ctxptr, code.idx, e.ptrToPtr(p))
fallthrough
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldAnonymousHeadUint16PtrOnly:
2021-01-10 23:16:37 +03:00
p := load(ctxptr, code.idx)
b = e.encodeIndent(b, code.indent)
b = append(b, code.escapedKey...)
b = append(b, ' ')
if p == 0 {
b = encodeNull(b)
} else {
b = appendUint(b, uint64(e.ptrToUint16(p+code.offset)))
}
b = encodeIndentComma(b)
code = code.next
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldPtrHeadUint32:
2021-01-10 23:16:37 +03:00
store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx)))
fallthrough
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldHeadUint32:
2021-01-10 23:16:37 +03:00
ptr := load(ctxptr, code.idx)
if ptr == 0 {
b = encodeNull(b)
b = encodeIndentComma(b)
code = code.end.next
} else {
b = append(b, '{', '\n')
b = e.encodeIndent(b, code.indent+1)
b = append(b, code.escapedKey...)
b = append(b, ' ')
b = appendUint(b, uint64(e.ptrToUint32(ptr)))
b = encodeIndentComma(b)
code = code.next
}
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldPtrHeadUint32Only, opStructEscapedFieldHeadUint32Only:
2021-01-10 23:16:37 +03:00
p := load(ctxptr, code.idx)
b = append(b, '{', '\n')
b = e.encodeIndent(b, code.indent+1)
b = append(b, code.escapedKey...)
b = append(b, ' ')
b = appendUint(b, uint64(e.ptrToUint32(p)))
b = encodeIndentComma(b)
code = code.next
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldPtrHeadUint32Ptr:
2021-01-10 23:16:37 +03:00
store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx)))
fallthrough
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldHeadUint32Ptr:
2021-01-10 23:16:37 +03:00
p := load(ctxptr, code.idx)
if p == 0 {
b = encodeNull(b)
b = encodeIndentComma(b)
code = code.end.next
break
} else {
b = append(b, '{', '\n')
b = e.encodeIndent(b, code.indent+1)
b = append(b, code.escapedKey...)
b = append(b, ' ')
p = e.ptrToPtr(p)
if p == 0 {
b = encodeNull(b)
} else {
b = appendUint(b, uint64(e.ptrToUint32(p+code.offset)))
}
}
b = encodeIndentComma(b)
code = code.next
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldPtrHeadUint32PtrOnly:
2021-01-10 23:16:37 +03:00
p := load(ctxptr, code.idx)
if p == 0 {
b = encodeNull(b)
b = encodeIndentComma(b)
code = code.end.next
break
}
store(ctxptr, code.idx, e.ptrToPtr(p))
fallthrough
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldHeadUint32PtrOnly:
2021-01-10 23:16:37 +03:00
p := load(ctxptr, code.idx)
b = append(b, '{', '\n')
b = e.encodeIndent(b, code.indent+1)
b = append(b, code.escapedKey...)
b = append(b, ' ')
if p == 0 {
b = encodeNull(b)
} else {
b = appendUint(b, uint64(e.ptrToUint32(p+code.offset)))
}
b = encodeIndentComma(b)
code = code.next
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldHeadUint32NPtr:
2021-01-10 23:16:37 +03:00
p := load(ctxptr, code.idx)
if p == 0 {
b = encodeNull(b)
} else {
b = append(b, '{', '\n')
b = e.encodeIndent(b, code.indent+1)
b = append(b, code.escapedKey...)
b = append(b, ' ')
for i := 0; i < code.ptrNum; i++ {
if p == 0 {
break
}
p = e.ptrToPtr(p)
}
if p == 0 {
b = encodeNull(b)
} else {
b = appendUint(b, uint64(e.ptrToUint32(p+code.offset)))
}
}
b = encodeIndentComma(b)
code = code.next
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldPtrAnonymousHeadUint32:
2021-01-10 23:16:37 +03:00
store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx)))
fallthrough
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldAnonymousHeadUint32:
2021-01-10 23:16:37 +03:00
ptr := load(ctxptr, code.idx)
if ptr == 0 {
code = code.end.next
} else {
b = e.encodeIndent(b, code.indent)
b = append(b, code.escapedKey...)
b = append(b, ' ')
b = appendUint(b, uint64(e.ptrToUint32(ptr+code.offset)))
b = encodeIndentComma(b)
code = code.next
}
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldPtrAnonymousHeadUint32Only, opStructEscapedFieldAnonymousHeadUint32Only:
2021-01-10 23:16:37 +03:00
ptr := load(ctxptr, code.idx)
if ptr == 0 {
code = code.end.next
} else {
b = e.encodeIndent(b, code.indent)
b = append(b, code.escapedKey...)
b = append(b, ' ')
b = appendUint(b, uint64(e.ptrToUint32(ptr+code.offset)))
b = encodeIndentComma(b)
code = code.next
}
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldPtrAnonymousHeadUint32Ptr:
2021-01-10 23:16:37 +03:00
store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx)))
fallthrough
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldAnonymousHeadUint32Ptr:
2021-01-10 23:16:37 +03:00
p := load(ctxptr, code.idx)
if p == 0 {
code = code.end.next
break
}
b = e.encodeIndent(b, code.indent)
b = append(b, code.escapedKey...)
b = append(b, ' ')
p = e.ptrToPtr(p)
if p == 0 {
b = encodeNull(b)
} else {
b = appendUint(b, uint64(e.ptrToUint32(p+code.offset)))
}
b = encodeIndentComma(b)
code = code.next
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldPtrAnonymousHeadUint32PtrOnly:
2021-01-10 23:16:37 +03:00
p := load(ctxptr, code.idx)
if p == 0 {
code = code.end.next
break
}
store(ctxptr, code.idx, e.ptrToPtr(p))
fallthrough
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldAnonymousHeadUint32PtrOnly:
2021-01-10 23:16:37 +03:00
p := load(ctxptr, code.idx)
b = e.encodeIndent(b, code.indent)
b = append(b, code.escapedKey...)
b = append(b, ' ')
if p == 0 {
b = encodeNull(b)
} else {
b = appendUint(b, uint64(e.ptrToUint32(p+code.offset)))
}
b = encodeIndentComma(b)
code = code.next
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldPtrHeadUint64:
2021-01-10 23:16:37 +03:00
store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx)))
fallthrough
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldHeadUint64:
2021-01-10 23:16:37 +03:00
ptr := load(ctxptr, code.idx)
if ptr == 0 {
b = encodeNull(b)
b = encodeIndentComma(b)
code = code.end.next
} else {
b = append(b, '{', '\n')
b = e.encodeIndent(b, code.indent+1)
b = append(b, code.escapedKey...)
b = append(b, ' ')
b = appendUint(b, e.ptrToUint64(ptr))
b = encodeIndentComma(b)
code = code.next
}
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldPtrHeadUint64Only, opStructEscapedFieldHeadUint64Only:
2021-01-10 23:16:37 +03:00
p := load(ctxptr, code.idx)
b = append(b, '{', '\n')
b = e.encodeIndent(b, code.indent+1)
b = append(b, code.escapedKey...)
b = append(b, ' ')
b = appendUint(b, e.ptrToUint64(p))
b = encodeIndentComma(b)
code = code.next
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldPtrHeadUint64Ptr:
2021-01-10 23:16:37 +03:00
store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx)))
fallthrough
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldHeadUint64Ptr:
2021-01-10 23:16:37 +03:00
p := load(ctxptr, code.idx)
if p == 0 {
b = encodeNull(b)
b = encodeIndentComma(b)
code = code.end.next
break
} else {
b = append(b, '{', '\n')
b = e.encodeIndent(b, code.indent+1)
b = append(b, code.escapedKey...)
b = append(b, ' ')
p = e.ptrToPtr(p)
if p == 0 {
b = encodeNull(b)
} else {
b = appendUint(b, e.ptrToUint64(p+code.offset))
}
}
b = encodeIndentComma(b)
code = code.next
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldPtrHeadUint64PtrOnly:
2021-01-10 23:16:37 +03:00
p := load(ctxptr, code.idx)
if p == 0 {
b = encodeNull(b)
b = encodeIndentComma(b)
code = code.end.next
break
}
store(ctxptr, code.idx, e.ptrToPtr(p))
fallthrough
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldHeadUint64PtrOnly:
2021-01-10 23:16:37 +03:00
p := load(ctxptr, code.idx)
b = append(b, '{', '\n')
b = e.encodeIndent(b, code.indent+1)
b = append(b, code.escapedKey...)
b = append(b, ' ')
if p == 0 {
b = encodeNull(b)
} else {
b = appendUint(b, e.ptrToUint64(p+code.offset))
}
b = encodeIndentComma(b)
code = code.next
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldHeadUint64NPtr:
2021-01-10 23:16:37 +03:00
p := load(ctxptr, code.idx)
if p == 0 {
b = encodeNull(b)
} else {
b = append(b, '{', '\n')
b = e.encodeIndent(b, code.indent+1)
b = append(b, code.escapedKey...)
b = append(b, ' ')
for i := 0; i < code.ptrNum; i++ {
if p == 0 {
break
}
p = e.ptrToPtr(p)
}
if p == 0 {
b = encodeNull(b)
} else {
b = appendUint(b, e.ptrToUint64(p+code.offset))
}
}
b = encodeIndentComma(b)
code = code.next
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldPtrAnonymousHeadUint64:
2021-01-10 23:16:37 +03:00
store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx)))
fallthrough
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldAnonymousHeadUint64:
2021-01-10 23:16:37 +03:00
ptr := load(ctxptr, code.idx)
if ptr == 0 {
code = code.end.next
} else {
b = e.encodeIndent(b, code.indent)
b = append(b, code.escapedKey...)
b = append(b, ' ')
b = appendUint(b, e.ptrToUint64(ptr+code.offset))
b = encodeIndentComma(b)
code = code.next
}
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldPtrAnonymousHeadUint64Only, opStructEscapedFieldAnonymousHeadUint64Only:
2021-01-10 23:16:37 +03:00
ptr := load(ctxptr, code.idx)
if ptr == 0 {
code = code.end.next
} else {
b = e.encodeIndent(b, code.indent)
b = append(b, code.escapedKey...)
b = append(b, ' ')
b = appendUint(b, e.ptrToUint64(ptr+code.offset))
b = encodeIndentComma(b)
code = code.next
}
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldPtrAnonymousHeadUint64Ptr:
2021-01-10 23:16:37 +03:00
store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx)))
fallthrough
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldAnonymousHeadUint64Ptr:
2021-01-10 23:16:37 +03:00
p := load(ctxptr, code.idx)
if p == 0 {
code = code.end.next
break
}
b = e.encodeIndent(b, code.indent)
b = append(b, code.escapedKey...)
b = append(b, ' ')
p = e.ptrToPtr(p)
if p == 0 {
b = encodeNull(b)
} else {
b = appendUint(b, e.ptrToUint64(p+code.offset))
}
b = encodeIndentComma(b)
code = code.next
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldPtrAnonymousHeadUint64PtrOnly:
2021-01-10 23:16:37 +03:00
p := load(ctxptr, code.idx)
if p == 0 {
code = code.end.next
break
}
store(ctxptr, code.idx, e.ptrToPtr(p))
fallthrough
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldAnonymousHeadUint64PtrOnly:
2021-01-10 23:16:37 +03:00
p := load(ctxptr, code.idx)
b = e.encodeIndent(b, code.indent)
b = append(b, code.escapedKey...)
b = append(b, ' ')
if p == 0 {
b = encodeNull(b)
} else {
b = appendUint(b, e.ptrToUint64(p+code.offset))
}
b = encodeIndentComma(b)
code = code.next
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldPtrHeadFloat32:
2021-01-10 23:16:37 +03:00
store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx)))
fallthrough
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldHeadFloat32:
2021-01-10 23:16:37 +03:00
ptr := load(ctxptr, code.idx)
if ptr == 0 {
b = encodeNull(b)
b = encodeIndentComma(b)
code = code.end.next
} else {
b = append(b, '{', '\n')
b = e.encodeIndent(b, code.indent+1)
b = append(b, code.escapedKey...)
b = append(b, ' ')
b = encodeFloat32(b, e.ptrToFloat32(ptr))
b = encodeIndentComma(b)
code = code.next
}
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldPtrHeadFloat32Only, opStructEscapedFieldHeadFloat32Only:
2021-01-10 23:16:37 +03:00
p := load(ctxptr, code.idx)
b = append(b, '{', '\n')
b = e.encodeIndent(b, code.indent+1)
b = append(b, code.escapedKey...)
b = append(b, ' ')
b = encodeFloat32(b, e.ptrToFloat32(p))
b = encodeIndentComma(b)
code = code.next
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldPtrHeadFloat32Ptr:
2021-01-10 23:16:37 +03:00
store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx)))
fallthrough
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldHeadFloat32Ptr:
2021-01-10 23:16:37 +03:00
p := load(ctxptr, code.idx)
if p == 0 {
b = encodeNull(b)
b = encodeIndentComma(b)
code = code.end.next
break
} else {
b = append(b, '{', '\n')
b = e.encodeIndent(b, code.indent+1)
b = append(b, code.escapedKey...)
b = append(b, ' ')
p = e.ptrToPtr(p)
if p == 0 {
b = encodeNull(b)
} else {
b = encodeFloat32(b, e.ptrToFloat32(p))
}
}
b = encodeIndentComma(b)
code = code.next
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldPtrHeadFloat32PtrOnly:
2021-01-10 23:16:37 +03:00
p := load(ctxptr, code.idx)
if p == 0 {
b = encodeNull(b)
b = encodeIndentComma(b)
code = code.end.next
break
}
store(ctxptr, code.idx, e.ptrToPtr(p))
fallthrough
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldHeadFloat32PtrOnly:
2021-01-10 23:16:37 +03:00
p := load(ctxptr, code.idx)
b = append(b, '{', '\n')
b = e.encodeIndent(b, code.indent+1)
b = append(b, code.escapedKey...)
b = append(b, ' ')
if p == 0 {
b = encodeNull(b)
} else {
b = encodeFloat32(b, e.ptrToFloat32(p))
}
b = encodeIndentComma(b)
code = code.next
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldHeadFloat32NPtr:
2021-01-10 23:16:37 +03:00
p := load(ctxptr, code.idx)
if p == 0 {
b = encodeNull(b)
} else {
b = append(b, '{', '\n')
b = e.encodeIndent(b, code.indent+1)
b = append(b, code.escapedKey...)
b = append(b, ' ')
for i := 0; i < code.ptrNum; i++ {
if p == 0 {
break
}
p = e.ptrToPtr(p)
}
if p == 0 {
b = encodeNull(b)
} else {
b = encodeFloat32(b, e.ptrToFloat32(p))
}
}
b = encodeIndentComma(b)
code = code.next
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldPtrAnonymousHeadFloat32:
2021-01-10 23:16:37 +03:00
store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx)))
fallthrough
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldAnonymousHeadFloat32:
2021-01-10 23:16:37 +03:00
ptr := load(ctxptr, code.idx)
if ptr == 0 {
code = code.end.next
} else {
b = e.encodeIndent(b, code.indent)
b = append(b, code.escapedKey...)
b = append(b, ' ')
b = encodeFloat32(b, e.ptrToFloat32(ptr))
b = encodeIndentComma(b)
code = code.next
}
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldPtrAnonymousHeadFloat32Only, opStructEscapedFieldAnonymousHeadFloat32Only:
2021-01-10 23:16:37 +03:00
ptr := load(ctxptr, code.idx)
if ptr == 0 {
code = code.end.next
} else {
b = e.encodeIndent(b, code.indent)
b = append(b, code.escapedKey...)
b = append(b, ' ')
b = encodeFloat32(b, e.ptrToFloat32(ptr))
b = encodeIndentComma(b)
code = code.next
}
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldPtrAnonymousHeadFloat32Ptr:
2021-01-10 23:16:37 +03:00
store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx)))
fallthrough
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldAnonymousHeadFloat32Ptr:
2021-01-10 23:16:37 +03:00
p := load(ctxptr, code.idx)
if p == 0 {
code = code.end.next
break
}
b = e.encodeIndent(b, code.indent)
b = append(b, code.escapedKey...)
b = append(b, ' ')
p = e.ptrToPtr(p)
if p == 0 {
b = encodeNull(b)
} else {
b = encodeFloat32(b, e.ptrToFloat32(p))
}
b = encodeIndentComma(b)
code = code.next
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldPtrAnonymousHeadFloat32PtrOnly:
2021-01-10 23:16:37 +03:00
p := load(ctxptr, code.idx)
if p == 0 {
code = code.end.next
break
}
store(ctxptr, code.idx, e.ptrToPtr(p))
fallthrough
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldAnonymousHeadFloat32PtrOnly:
2021-01-10 23:16:37 +03:00
p := load(ctxptr, code.idx)
b = e.encodeIndent(b, code.indent)
b = append(b, code.escapedKey...)
b = append(b, ' ')
if p == 0 {
b = encodeNull(b)
} else {
b = encodeFloat32(b, e.ptrToFloat32(p))
}
b = encodeIndentComma(b)
code = code.next
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldPtrHeadFloat64:
2021-01-10 23:16:37 +03:00
store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx)))
fallthrough
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldHeadFloat64:
2021-01-10 23:16:37 +03:00
ptr := load(ctxptr, code.idx)
if ptr == 0 {
b = encodeNull(b)
b = encodeIndentComma(b)
code = code.end.next
} else {
v := e.ptrToFloat64(ptr)
if math.IsInf(v, 0) || math.IsNaN(v) {
return nil, errUnsupportedFloat(v)
}
b = append(b, '{', '\n')
b = e.encodeIndent(b, code.indent+1)
b = append(b, code.escapedKey...)
b = append(b, ' ')
b = encodeFloat64(b, v)
b = encodeIndentComma(b)
code = code.next
}
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldPtrHeadFloat64Only, opStructEscapedFieldHeadFloat64Only:
2021-01-10 23:16:37 +03:00
p := load(ctxptr, code.idx)
b = append(b, '{', '\n')
b = e.encodeIndent(b, code.indent+1)
b = append(b, code.escapedKey...)
b = append(b, ' ')
v := e.ptrToFloat64(p)
if math.IsInf(v, 0) || math.IsNaN(v) {
return nil, errUnsupportedFloat(v)
}
b = encodeFloat64(b, v)
b = encodeIndentComma(b)
code = code.next
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldPtrHeadFloat64Ptr:
2021-01-10 23:16:37 +03:00
store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx)))
fallthrough
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldHeadFloat64Ptr:
2021-01-10 23:16:37 +03:00
p := load(ctxptr, code.idx)
if p == 0 {
b = encodeNull(b)
b = encodeIndentComma(b)
code = code.end.next
break
} else {
b = append(b, '{', '\n')
b = e.encodeIndent(b, code.indent+1)
b = append(b, code.escapedKey...)
b = append(b, ' ')
p = e.ptrToPtr(p)
if p == 0 {
b = encodeNull(b)
} else {
v := e.ptrToFloat64(p)
if math.IsInf(v, 0) || math.IsNaN(v) {
return nil, errUnsupportedFloat(v)
}
b = encodeFloat64(b, v)
}
}
b = encodeIndentComma(b)
code = code.next
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldPtrHeadFloat64PtrOnly:
2021-01-10 23:16:37 +03:00
p := load(ctxptr, code.idx)
if p == 0 {
b = encodeNull(b)
b = encodeIndentComma(b)
code = code.end.next
break
}
store(ctxptr, code.idx, e.ptrToPtr(p))
fallthrough
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldHeadFloat64PtrOnly:
2021-01-10 23:16:37 +03:00
p := load(ctxptr, code.idx)
b = append(b, '{', '\n')
b = e.encodeIndent(b, code.indent+1)
b = append(b, code.escapedKey...)
b = append(b, ' ')
if p == 0 {
b = encodeNull(b)
} else {
v := e.ptrToFloat64(p)
if math.IsInf(v, 0) || math.IsNaN(v) {
return nil, errUnsupportedFloat(v)
}
b = encodeFloat64(b, v)
}
b = encodeIndentComma(b)
code = code.next
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldHeadFloat64NPtr:
2021-01-10 23:16:37 +03:00
p := load(ctxptr, code.idx)
if p == 0 {
b = encodeNull(b)
} else {
b = append(b, '{', '\n')
b = e.encodeIndent(b, code.indent+1)
b = append(b, code.escapedKey...)
b = append(b, ' ')
for i := 0; i < code.ptrNum; i++ {
if p == 0 {
break
}
p = e.ptrToPtr(p)
}
if p == 0 {
b = encodeNull(b)
} else {
v := e.ptrToFloat64(p)
if math.IsInf(v, 0) || math.IsNaN(v) {
return nil, errUnsupportedFloat(v)
}
b = encodeFloat64(b, v)
}
}
b = encodeIndentComma(b)
code = code.next
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldPtrAnonymousHeadFloat64:
2021-01-10 23:16:37 +03:00
store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx)))
fallthrough
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldAnonymousHeadFloat64:
2021-01-10 23:16:37 +03:00
ptr := load(ctxptr, code.idx)
if ptr == 0 {
code = code.end.next
} else {
b = e.encodeIndent(b, code.indent)
b = append(b, code.escapedKey...)
b = append(b, ' ')
v := e.ptrToFloat64(ptr)
if math.IsInf(v, 0) || math.IsNaN(v) {
return nil, errUnsupportedFloat(v)
}
b = encodeFloat64(b, v)
b = encodeIndentComma(b)
code = code.next
}
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldPtrAnonymousHeadFloat64Only, opStructEscapedFieldAnonymousHeadFloat64Only:
2021-01-10 23:16:37 +03:00
ptr := load(ctxptr, code.idx)
if ptr == 0 {
code = code.end.next
} else {
b = e.encodeIndent(b, code.indent)
b = append(b, code.escapedKey...)
b = append(b, ' ')
v := e.ptrToFloat64(ptr)
if math.IsInf(v, 0) || math.IsNaN(v) {
return nil, errUnsupportedFloat(v)
}
b = encodeFloat64(b, v)
b = encodeIndentComma(b)
code = code.next
}
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldPtrAnonymousHeadFloat64Ptr:
2021-01-10 23:16:37 +03:00
store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx)))
fallthrough
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldAnonymousHeadFloat64Ptr:
2021-01-10 23:16:37 +03:00
p := load(ctxptr, code.idx)
if p == 0 {
code = code.end.next
break
}
b = e.encodeIndent(b, code.indent)
b = append(b, code.escapedKey...)
b = append(b, ' ')
p = e.ptrToPtr(p)
if p == 0 {
b = encodeNull(b)
} else {
v := e.ptrToFloat64(p)
if math.IsInf(v, 0) || math.IsNaN(v) {
return nil, errUnsupportedFloat(v)
}
b = encodeFloat64(b, v)
}
b = encodeIndentComma(b)
code = code.next
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldPtrAnonymousHeadFloat64PtrOnly:
2021-01-10 23:16:37 +03:00
p := load(ctxptr, code.idx)
if p == 0 {
code = code.end.next
break
}
store(ctxptr, code.idx, e.ptrToPtr(p))
fallthrough
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldAnonymousHeadFloat64PtrOnly:
2021-01-10 23:16:37 +03:00
p := load(ctxptr, code.idx)
b = e.encodeIndent(b, code.indent)
b = append(b, code.escapedKey...)
b = append(b, ' ')
if p == 0 {
b = encodeNull(b)
} else {
v := e.ptrToFloat64(p)
if math.IsInf(v, 0) || math.IsNaN(v) {
return nil, errUnsupportedFloat(v)
}
b = encodeFloat64(b, v)
}
b = encodeIndentComma(b)
code = code.next
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldPtrHeadEscapedString:
2021-01-10 23:16:37 +03:00
store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx)))
fallthrough
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldHeadEscapedString:
2021-01-10 23:16:37 +03:00
ptr := load(ctxptr, code.idx)
if ptr == 0 {
b = e.encodeIndent(b, code.indent)
b = encodeNull(b)
b = encodeIndentComma(b)
code = code.end.next
} else {
b = e.encodeIndent(b, code.indent)
b = append(b, '{', '\n')
b = e.encodeIndent(b, code.indent+1)
b = append(b, code.escapedKey...)
b = append(b, ' ')
b = encodeEscapedString(b, e.ptrToString(ptr))
b = encodeIndentComma(b)
code = code.next
}
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldPtrHeadBool:
2021-01-10 23:16:37 +03:00
store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx)))
fallthrough
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldHeadBool:
2021-01-10 23:16:37 +03:00
ptr := load(ctxptr, code.idx)
if ptr == 0 {
b = e.encodeIndent(b, code.indent)
b = encodeNull(b)
b = encodeIndentComma(b)
code = code.end.next
} else {
b = e.encodeIndent(b, code.indent)
b = append(b, '{', '\n')
b = e.encodeIndent(b, code.indent+1)
b = append(b, code.escapedKey...)
b = append(b, ' ')
b = encodeBool(b, e.ptrToBool(ptr))
b = encodeIndentComma(b)
code = code.next
}
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldPtrHeadBytes:
2021-01-10 23:16:37 +03:00
store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx)))
fallthrough
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldHeadBytes:
2021-01-10 23:16:37 +03:00
ptr := load(ctxptr, code.idx)
if ptr == 0 {
b = e.encodeIndent(b, code.indent)
b = encodeNull(b)
b = encodeIndentComma(b)
code = code.end.next
} else {
b = e.encodeIndent(b, code.indent)
b = append(b, '{', '\n')
b = e.encodeIndent(b, code.indent+1)
b = append(b, code.escapedKey...)
b = append(b, ' ')
b = encodeByteSlice(b, e.ptrToBytes(ptr))
b = encodeIndentComma(b)
code = code.next
}
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldPtrHeadOmitEmpty:
2021-01-10 23:16:37 +03:00
ptr := load(ctxptr, code.idx)
if ptr != 0 {
store(ctxptr, code.idx, e.ptrToPtr(ptr))
}
fallthrough
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldHeadOmitEmpty:
2021-01-10 23:16:37 +03:00
ptr := load(ctxptr, code.idx)
if ptr == 0 {
b = e.encodeIndent(b, code.indent)
b = encodeNull(b)
b = encodeIndentComma(b)
code = code.end.next
} else {
b = e.encodeIndent(b, code.indent)
b = append(b, '{', '\n')
p := ptr + code.offset
if p == 0 || *(*uintptr)(*(*unsafe.Pointer)(unsafe.Pointer(&p))) == 0 {
code = code.nextField
} else {
b = e.encodeIndent(b, code.indent+1)
b = append(b, code.escapedKey...)
b = append(b, ' ')
code = code.next
store(ctxptr, code.idx, p)
}
}
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldPtrHeadOmitEmptyInt:
2021-01-10 23:16:37 +03:00
ptr := load(ctxptr, code.idx)
if ptr != 0 {
store(ctxptr, code.idx, e.ptrToPtr(ptr))
}
fallthrough
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldHeadOmitEmptyInt:
2021-01-10 23:16:37 +03:00
ptr := load(ctxptr, code.idx)
if ptr == 0 {
b = e.encodeIndent(b, code.indent)
b = encodeNull(b)
b = encodeIndentComma(b)
code = code.end.next
} else {
b = e.encodeIndent(b, code.indent)
b = append(b, '{', '\n')
v := e.ptrToInt(ptr + code.offset)
if v == 0 {
code = code.nextField
} else {
b = e.encodeIndent(b, code.indent+1)
b = append(b, code.escapedKey...)
b = append(b, ' ')
b = appendInt(b, int64(v))
b = encodeIndentComma(b)
code = code.next
}
}
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldPtrHeadOmitEmptyInt8:
2021-01-10 23:16:37 +03:00
ptr := load(ctxptr, code.idx)
if ptr != 0 {
store(ctxptr, code.idx, e.ptrToPtr(ptr))
}
fallthrough
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldHeadOmitEmptyInt8:
2021-01-10 23:16:37 +03:00
ptr := load(ctxptr, code.idx)
if ptr == 0 {
b = e.encodeIndent(b, code.indent)
b = encodeNull(b)
b = encodeIndentComma(b)
code = code.end.next
} else {
b = e.encodeIndent(b, code.indent)
b = append(b, '{', '\n')
v := e.ptrToInt8(ptr + code.offset)
if v == 0 {
code = code.nextField
} else {
b = e.encodeIndent(b, code.indent+1)
b = append(b, code.escapedKey...)
b = append(b, ' ')
b = appendInt(b, int64(v))
b = encodeIndentComma(b)
code = code.next
}
}
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldPtrHeadOmitEmptyInt16:
2021-01-10 23:16:37 +03:00
ptr := load(ctxptr, code.idx)
if ptr != 0 {
store(ctxptr, code.idx, e.ptrToPtr(ptr))
}
fallthrough
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldHeadOmitEmptyInt16:
2021-01-10 23:16:37 +03:00
ptr := load(ctxptr, code.idx)
if ptr == 0 {
b = e.encodeIndent(b, code.indent)
b = encodeNull(b)
b = encodeIndentComma(b)
code = code.end.next
} else {
b = e.encodeIndent(b, code.indent)
b = append(b, '{', '\n')
v := e.ptrToInt16(ptr + code.offset)
if v == 0 {
code = code.nextField
} else {
b = e.encodeIndent(b, code.indent+1)
b = append(b, code.escapedKey...)
b = append(b, ' ')
b = appendInt(b, int64(v))
b = encodeIndentComma(b)
code = code.next
}
}
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldPtrHeadOmitEmptyInt32:
2021-01-10 23:16:37 +03:00
ptr := load(ctxptr, code.idx)
if ptr != 0 {
store(ctxptr, code.idx, e.ptrToPtr(ptr))
}
fallthrough
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldHeadOmitEmptyInt32:
2021-01-10 23:16:37 +03:00
ptr := load(ctxptr, code.idx)
if ptr == 0 {
b = e.encodeIndent(b, code.indent)
b = encodeNull(b)
b = encodeIndentComma(b)
code = code.end.next
} else {
b = e.encodeIndent(b, code.indent)
b = append(b, '{', '\n')
v := e.ptrToInt32(ptr + code.offset)
if v == 0 {
code = code.nextField
} else {
b = e.encodeIndent(b, code.indent+1)
b = append(b, code.escapedKey...)
b = append(b, ' ')
b = appendInt(b, int64(v))
b = encodeIndentComma(b)
code = code.next
}
}
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldPtrHeadOmitEmptyInt64:
2021-01-10 23:16:37 +03:00
ptr := load(ctxptr, code.idx)
if ptr != 0 {
store(ctxptr, code.idx, e.ptrToPtr(ptr))
}
fallthrough
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldHeadOmitEmptyInt64:
2021-01-10 23:16:37 +03:00
ptr := load(ctxptr, code.idx)
if ptr == 0 {
b = e.encodeIndent(b, code.indent)
b = encodeNull(b)
b = encodeIndentComma(b)
code = code.end.next
} else {
b = e.encodeIndent(b, code.indent)
b = append(b, '{', '\n')
v := e.ptrToInt64(ptr + code.offset)
if v == 0 {
code = code.nextField
} else {
b = e.encodeIndent(b, code.indent+1)
b = append(b, code.escapedKey...)
b = append(b, ' ')
b = appendInt(b, v)
b = encodeIndentComma(b)
code = code.next
}
}
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldPtrHeadOmitEmptyUint:
2021-01-10 23:16:37 +03:00
ptr := load(ctxptr, code.idx)
if ptr != 0 {
store(ctxptr, code.idx, e.ptrToPtr(ptr))
}
fallthrough
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldHeadOmitEmptyUint:
2021-01-10 23:16:37 +03:00
ptr := load(ctxptr, code.idx)
if ptr == 0 {
b = e.encodeIndent(b, code.indent)
b = encodeNull(b)
b = encodeIndentComma(b)
code = code.end.next
} else {
b = e.encodeIndent(b, code.indent)
b = append(b, '{', '\n')
v := e.ptrToUint(ptr + code.offset)
if v == 0 {
code = code.nextField
} else {
b = e.encodeIndent(b, code.indent+1)
b = append(b, code.escapedKey...)
b = append(b, ' ')
b = appendUint(b, uint64(v))
b = encodeIndentComma(b)
code = code.next
}
}
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldPtrHeadOmitEmptyUint8:
2021-01-10 23:16:37 +03:00
ptr := load(ctxptr, code.idx)
if ptr != 0 {
store(ctxptr, code.idx, e.ptrToPtr(ptr))
}
fallthrough
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldHeadOmitEmptyUint8:
2021-01-10 23:16:37 +03:00
ptr := load(ctxptr, code.idx)
if ptr == 0 {
b = e.encodeIndent(b, code.indent)
b = encodeNull(b)
b = encodeIndentComma(b)
code = code.end.next
} else {
b = e.encodeIndent(b, code.indent)
b = append(b, '{', '\n')
v := e.ptrToUint8(ptr + code.offset)
if v == 0 {
code = code.nextField
} else {
b = e.encodeIndent(b, code.indent+1)
b = append(b, code.escapedKey...)
b = append(b, ' ')
b = appendUint(b, uint64(v))
b = encodeIndentComma(b)
code = code.next
}
}
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldPtrHeadOmitEmptyUint16:
2021-01-10 23:16:37 +03:00
ptr := load(ctxptr, code.idx)
if ptr != 0 {
store(ctxptr, code.idx, e.ptrToPtr(ptr))
}
fallthrough
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldHeadOmitEmptyUint16:
2021-01-10 23:16:37 +03:00
ptr := load(ctxptr, code.idx)
if ptr == 0 {
b = e.encodeIndent(b, code.indent)
b = encodeNull(b)
b = encodeIndentComma(b)
code = code.end.next
} else {
b = e.encodeIndent(b, code.indent)
b = append(b, '{', '\n')
v := e.ptrToUint16(ptr + code.offset)
if v == 0 {
code = code.nextField
} else {
b = e.encodeIndent(b, code.indent+1)
b = append(b, code.escapedKey...)
b = append(b, ' ')
b = appendUint(b, uint64(v))
b = encodeIndentComma(b)
code = code.next
}
}
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldPtrHeadOmitEmptyUint32:
2021-01-10 23:16:37 +03:00
ptr := load(ctxptr, code.idx)
if ptr != 0 {
store(ctxptr, code.idx, e.ptrToPtr(ptr))
}
fallthrough
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldHeadOmitEmptyUint32:
2021-01-10 23:16:37 +03:00
ptr := load(ctxptr, code.idx)
if ptr == 0 {
b = e.encodeIndent(b, code.indent)
b = encodeNull(b)
b = encodeIndentComma(b)
code = code.end.next
} else {
b = e.encodeIndent(b, code.indent)
b = append(b, '{', '\n')
v := e.ptrToUint32(ptr + code.offset)
if v == 0 {
code = code.nextField
} else {
b = e.encodeIndent(b, code.indent+1)
b = append(b, code.escapedKey...)
b = append(b, ' ')
b = appendUint(b, uint64(v))
b = encodeIndentComma(b)
code = code.next
}
}
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldPtrHeadOmitEmptyUint64:
2021-01-10 23:16:37 +03:00
ptr := load(ctxptr, code.idx)
if ptr != 0 {
store(ctxptr, code.idx, e.ptrToPtr(ptr))
}
fallthrough
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldHeadOmitEmptyUint64:
2021-01-10 23:16:37 +03:00
ptr := load(ctxptr, code.idx)
if ptr == 0 {
b = e.encodeIndent(b, code.indent)
b = encodeNull(b)
b = encodeIndentComma(b)
code = code.end.next
} else {
b = e.encodeIndent(b, code.indent)
b = append(b, '{', '\n')
v := e.ptrToUint64(ptr + code.offset)
if v == 0 {
code = code.nextField
} else {
b = e.encodeIndent(b, code.indent+1)
b = append(b, code.escapedKey...)
b = append(b, ' ')
b = appendUint(b, v)
b = encodeIndentComma(b)
code = code.next
}
}
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldPtrHeadOmitEmptyFloat32:
2021-01-10 23:16:37 +03:00
ptr := load(ctxptr, code.idx)
if ptr != 0 {
store(ctxptr, code.idx, e.ptrToPtr(ptr))
}
fallthrough
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldHeadOmitEmptyFloat32:
2021-01-10 23:16:37 +03:00
ptr := load(ctxptr, code.idx)
if ptr == 0 {
b = e.encodeIndent(b, code.indent)
b = encodeNull(b)
b = encodeIndentComma(b)
code = code.end.next
} else {
b = e.encodeIndent(b, code.indent)
b = append(b, '{', '\n')
v := e.ptrToFloat32(ptr + code.offset)
if v == 0 {
code = code.nextField
} else {
b = e.encodeIndent(b, code.indent+1)
b = append(b, code.escapedKey...)
b = append(b, ' ')
b = encodeFloat32(b, v)
b = encodeIndentComma(b)
code = code.next
}
}
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldPtrHeadOmitEmptyFloat64:
2021-01-10 23:16:37 +03:00
ptr := load(ctxptr, code.idx)
if ptr != 0 {
store(ctxptr, code.idx, e.ptrToPtr(ptr))
}
fallthrough
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldHeadOmitEmptyFloat64:
2021-01-10 23:16:37 +03:00
ptr := load(ctxptr, code.idx)
if ptr == 0 {
b = e.encodeIndent(b, code.indent)
b = encodeNull(b)
b = encodeIndentComma(b)
code = code.end.next
} else {
b = e.encodeIndent(b, code.indent)
b = append(b, '{', '\n')
v := e.ptrToFloat64(ptr + code.offset)
if v == 0 {
code = code.nextField
} else {
if math.IsInf(v, 0) || math.IsNaN(v) {
return nil, errUnsupportedFloat(v)
}
b = e.encodeIndent(b, code.indent+1)
b = append(b, code.escapedKey...)
b = append(b, ' ')
b = encodeFloat64(b, v)
b = encodeIndentComma(b)
code = code.next
}
}
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldPtrHeadOmitEmptyEscapedString:
2021-01-10 23:16:37 +03:00
ptr := load(ctxptr, code.idx)
if ptr != 0 {
store(ctxptr, code.idx, e.ptrToPtr(ptr))
}
fallthrough
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldHeadOmitEmptyEscapedString:
2021-01-10 23:16:37 +03:00
ptr := load(ctxptr, code.idx)
if ptr == 0 {
b = e.encodeIndent(b, code.indent)
b = encodeNull(b)
b = encodeIndentComma(b)
code = code.end.next
} else {
b = e.encodeIndent(b, code.indent)
b = append(b, '{', '\n')
v := e.ptrToString(ptr + code.offset)
if v == "" {
code = code.nextField
} else {
b = e.encodeIndent(b, code.indent+1)
b = append(b, code.escapedKey...)
b = append(b, ' ')
b = encodeEscapedString(b, v)
b = encodeIndentComma(b)
code = code.next
}
}
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldPtrHeadOmitEmptyBool:
2021-01-10 23:16:37 +03:00
ptr := load(ctxptr, code.idx)
if ptr != 0 {
store(ctxptr, code.idx, e.ptrToPtr(ptr))
}
fallthrough
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldHeadOmitEmptyBool:
2021-01-10 23:16:37 +03:00
ptr := load(ctxptr, code.idx)
if ptr == 0 {
b = e.encodeIndent(b, code.indent)
b = encodeNull(b)
b = encodeIndentComma(b)
code = code.end.next
} else {
b = e.encodeIndent(b, code.indent)
b = append(b, '{', '\n')
v := e.ptrToBool(ptr + code.offset)
if !v {
code = code.nextField
} else {
b = e.encodeIndent(b, code.indent+1)
b = append(b, code.escapedKey...)
b = append(b, ' ')
b = encodeBool(b, v)
b = encodeIndentComma(b)
code = code.next
}
}
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldPtrHeadOmitEmptyBytes:
2021-01-10 23:16:37 +03:00
ptr := load(ctxptr, code.idx)
if ptr != 0 {
store(ctxptr, code.idx, e.ptrToPtr(ptr))
}
fallthrough
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldHeadOmitEmptyBytes:
2021-01-10 23:16:37 +03:00
ptr := load(ctxptr, code.idx)
if ptr == 0 {
b = e.encodeIndent(b, code.indent)
b = encodeNull(b)
b = encodeIndentComma(b)
code = code.end.next
} else {
b = e.encodeIndent(b, code.indent)
b = append(b, '{', '\n')
v := e.ptrToBytes(ptr + code.offset)
if len(v) == 0 {
code = code.nextField
} else {
b = e.encodeIndent(b, code.indent+1)
b = append(b, code.escapedKey...)
b = append(b, ' ')
b = encodeByteSlice(b, v)
b = encodeIndentComma(b)
code = code.next
}
}
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldPtrHeadStringTag:
2021-01-10 23:16:37 +03:00
ptr := load(ctxptr, code.idx)
if ptr != 0 {
store(ctxptr, code.idx, e.ptrToPtr(ptr))
}
fallthrough
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldHeadStringTag:
2021-01-10 23:16:37 +03:00
ptr := load(ctxptr, code.idx)
if ptr == 0 {
b = e.encodeIndent(b, code.indent)
b = encodeNull(b)
b = encodeIndentComma(b)
code = code.end.next
} else {
b = append(b, '{', '\n')
p := ptr + code.offset
b = e.encodeIndent(b, code.indent+1)
b = append(b, code.escapedKey...)
b = append(b, ' ')
code = code.next
store(ctxptr, code.idx, p)
}
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldPtrHeadStringTagInt:
2021-01-10 23:16:37 +03:00
ptr := load(ctxptr, code.idx)
if ptr != 0 {
store(ctxptr, code.idx, e.ptrToPtr(ptr))
}
fallthrough
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldHeadStringTagInt:
2021-01-10 23:16:37 +03:00
ptr := load(ctxptr, code.idx)
if ptr == 0 {
b = e.encodeIndent(b, code.indent)
b = encodeNull(b)
b = encodeIndentComma(b)
code = code.end.next
} else {
b = append(b, '{', '\n')
b = e.encodeIndent(b, code.indent+1)
b = append(b, code.escapedKey...)
b = append(b, ' ', '"')
b = appendInt(b, int64(e.ptrToInt(ptr+code.offset)))
b = append(b, '"')
b = encodeIndentComma(b)
code = code.next
}
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldPtrHeadStringTagInt8:
2021-01-10 23:16:37 +03:00
ptr := load(ctxptr, code.idx)
if ptr != 0 {
store(ctxptr, code.idx, e.ptrToPtr(ptr))
}
fallthrough
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldHeadStringTagInt8:
2021-01-10 23:16:37 +03:00
ptr := load(ctxptr, code.idx)
if ptr == 0 {
b = e.encodeIndent(b, code.indent)
b = encodeNull(b)
b = encodeIndentComma(b)
code = code.end.next
} else {
b = append(b, '{', '\n')
b = e.encodeIndent(b, code.indent+1)
b = append(b, code.escapedKey...)
b = append(b, ' ', '"')
b = appendInt(b, int64(e.ptrToInt8(ptr+code.offset)))
b = append(b, '"')
b = encodeIndentComma(b)
code = code.next
}
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldPtrHeadStringTagInt16:
2021-01-10 23:16:37 +03:00
ptr := load(ctxptr, code.idx)
if ptr != 0 {
store(ctxptr, code.idx, e.ptrToPtr(ptr))
}
fallthrough
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldHeadStringTagInt16:
2021-01-10 23:16:37 +03:00
ptr := load(ctxptr, code.idx)
if ptr == 0 {
b = e.encodeIndent(b, code.indent)
b = encodeNull(b)
b = encodeIndentComma(b)
code = code.end.next
} else {
b = append(b, '{', '\n')
b = e.encodeIndent(b, code.indent+1)
b = append(b, code.escapedKey...)
b = append(b, ' ', '"')
b = appendInt(b, int64(e.ptrToInt16(ptr+code.offset)))
b = append(b, '"')
b = encodeIndentComma(b)
code = code.next
}
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldPtrHeadStringTagInt32:
2021-01-10 23:16:37 +03:00
ptr := load(ctxptr, code.idx)
if ptr != 0 {
store(ctxptr, code.idx, e.ptrToPtr(ptr))
}
fallthrough
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldHeadStringTagInt32:
2021-01-10 23:16:37 +03:00
ptr := load(ctxptr, code.idx)
if ptr == 0 {
b = e.encodeIndent(b, code.indent)
b = encodeNull(b)
b = encodeIndentComma(b)
code = code.end.next
} else {
b = append(b, '{', '\n')
b = e.encodeIndent(b, code.indent+1)
b = append(b, code.escapedKey...)
b = append(b, ' ', '"')
b = appendInt(b, int64(e.ptrToInt32(ptr+code.offset)))
b = append(b, '"')
b = encodeIndentComma(b)
code = code.next
}
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldPtrHeadStringTagInt64:
2021-01-10 23:16:37 +03:00
ptr := load(ctxptr, code.idx)
if ptr != 0 {
store(ctxptr, code.idx, e.ptrToPtr(ptr))
}
fallthrough
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldHeadStringTagInt64:
2021-01-10 23:16:37 +03:00
ptr := load(ctxptr, code.idx)
if ptr == 0 {
b = e.encodeIndent(b, code.indent)
b = encodeNull(b)
b = encodeIndentComma(b)
code = code.end.next
} else {
b = append(b, '{', '\n')
b = e.encodeIndent(b, code.indent+1)
b = append(b, code.escapedKey...)
b = append(b, ' ', '"')
b = appendInt(b, e.ptrToInt64(ptr+code.offset))
b = append(b, '"')
b = encodeIndentComma(b)
code = code.next
}
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldPtrHeadStringTagUint:
2021-01-10 23:16:37 +03:00
ptr := load(ctxptr, code.idx)
if ptr != 0 {
store(ctxptr, code.idx, e.ptrToPtr(ptr))
}
fallthrough
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldHeadStringTagUint:
2021-01-10 23:16:37 +03:00
ptr := load(ctxptr, code.idx)
if ptr == 0 {
b = e.encodeIndent(b, code.indent)
b = encodeNull(b)
b = encodeIndentComma(b)
code = code.end.next
} else {
b = append(b, '{', '\n')
b = e.encodeIndent(b, code.indent+1)
b = append(b, code.escapedKey...)
b = append(b, ' ', '"')
b = appendUint(b, uint64(e.ptrToUint(ptr+code.offset)))
b = append(b, '"')
b = encodeIndentComma(b)
code = code.next
}
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldPtrHeadStringTagUint8:
2021-01-10 23:16:37 +03:00
ptr := load(ctxptr, code.idx)
if ptr != 0 {
store(ctxptr, code.idx, e.ptrToPtr(ptr))
}
fallthrough
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldHeadStringTagUint8:
2021-01-10 23:16:37 +03:00
ptr := load(ctxptr, code.idx)
if ptr == 0 {
b = e.encodeIndent(b, code.indent)
b = encodeNull(b)
b = encodeIndentComma(b)
code = code.end.next
} else {
b = append(b, '{', '\n')
b = e.encodeIndent(b, code.indent+1)
b = append(b, code.escapedKey...)
b = append(b, ' ', '"')
b = appendUint(b, uint64(e.ptrToUint8(ptr+code.offset)))
b = append(b, '"')
b = encodeIndentComma(b)
code = code.next
}
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldPtrHeadStringTagUint16:
2021-01-10 23:16:37 +03:00
ptr := load(ctxptr, code.idx)
if ptr != 0 {
store(ctxptr, code.idx, e.ptrToPtr(ptr))
}
fallthrough
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldHeadStringTagUint16:
2021-01-10 23:16:37 +03:00
ptr := load(ctxptr, code.idx)
if ptr == 0 {
b = e.encodeIndent(b, code.indent)
b = encodeNull(b)
b = encodeIndentComma(b)
code = code.end.next
} else {
b = append(b, '{', '\n')
b = e.encodeIndent(b, code.indent+1)
b = append(b, code.escapedKey...)
b = append(b, ' ', '"')
b = appendUint(b, uint64(e.ptrToUint16(ptr+code.offset)))
b = append(b, '"')
b = encodeIndentComma(b)
code = code.next
}
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldPtrHeadStringTagUint32:
2021-01-10 23:16:37 +03:00
ptr := load(ctxptr, code.idx)
if ptr != 0 {
store(ctxptr, code.idx, e.ptrToPtr(ptr))
}
fallthrough
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldHeadStringTagUint32:
2021-01-10 23:16:37 +03:00
ptr := load(ctxptr, code.idx)
if ptr == 0 {
b = e.encodeIndent(b, code.indent)
b = encodeNull(b)
b = encodeIndentComma(b)
code = code.end.next
} else {
b = append(b, '{', '\n')
b = e.encodeIndent(b, code.indent+1)
b = append(b, code.escapedKey...)
b = append(b, ' ', '"')
b = appendUint(b, uint64(e.ptrToUint32(ptr+code.offset)))
b = append(b, '"')
b = encodeIndentComma(b)
code = code.next
}
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldPtrHeadStringTagUint64:
2021-01-10 23:16:37 +03:00
ptr := load(ctxptr, code.idx)
if ptr != 0 {
store(ctxptr, code.idx, e.ptrToPtr(ptr))
}
fallthrough
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldHeadStringTagUint64:
2021-01-10 23:16:37 +03:00
ptr := load(ctxptr, code.idx)
if ptr == 0 {
b = e.encodeIndent(b, code.indent)
b = encodeNull(b)
b = encodeIndentComma(b)
code = code.end.next
} else {
b = append(b, '{', '\n')
b = e.encodeIndent(b, code.indent+1)
b = append(b, code.escapedKey...)
b = append(b, ' ', '"')
b = appendUint(b, e.ptrToUint64(ptr+code.offset))
b = append(b, '"')
b = encodeIndentComma(b)
code = code.next
}
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldPtrHeadStringTagFloat32:
2021-01-10 23:16:37 +03:00
ptr := load(ctxptr, code.idx)
if ptr != 0 {
store(ctxptr, code.idx, e.ptrToPtr(ptr))
}
fallthrough
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldHeadStringTagFloat32:
2021-01-10 23:16:37 +03:00
ptr := load(ctxptr, code.idx)
if ptr == 0 {
b = e.encodeIndent(b, code.indent)
b = encodeNull(b)
b = encodeIndentComma(b)
code = code.end.next
} else {
b = append(b, '{', '\n')
b = e.encodeIndent(b, code.indent+1)
b = append(b, code.escapedKey...)
b = append(b, ' ', '"')
b = encodeFloat32(b, e.ptrToFloat32(ptr+code.offset))
b = append(b, '"')
b = encodeIndentComma(b)
code = code.next
}
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldPtrHeadStringTagFloat64:
2021-01-10 23:16:37 +03:00
ptr := load(ctxptr, code.idx)
if ptr != 0 {
store(ctxptr, code.idx, e.ptrToPtr(ptr))
}
fallthrough
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldHeadStringTagFloat64:
2021-01-10 23:16:37 +03:00
ptr := load(ctxptr, code.idx)
if ptr == 0 {
b = e.encodeIndent(b, code.indent)
b = encodeNull(b)
b = encodeIndentComma(b)
code = code.end.next
} else {
b = append(b, '{', '\n')
v := e.ptrToFloat64(ptr + code.offset)
if math.IsInf(v, 0) || math.IsNaN(v) {
return nil, errUnsupportedFloat(v)
}
b = e.encodeIndent(b, code.indent+1)
b = append(b, code.escapedKey...)
b = append(b, ' ', '"')
b = encodeFloat64(b, v)
b = append(b, '"')
b = encodeIndentComma(b)
code = code.next
}
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldPtrHeadStringTagEscapedString:
2021-01-10 23:16:37 +03:00
ptr := load(ctxptr, code.idx)
if ptr != 0 {
store(ctxptr, code.idx, e.ptrToPtr(ptr))
}
fallthrough
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldHeadStringTagEscapedString:
2021-01-10 23:16:37 +03:00
ptr := load(ctxptr, code.idx)
if ptr == 0 {
b = e.encodeIndent(b, code.indent)
b = encodeNull(b)
b = encodeIndentComma(b)
code = code.end.next
} else {
b = append(b, '{', '\n')
b = e.encodeIndent(b, code.indent+1)
b = append(b, code.escapedKey...)
b = append(b, ' ')
s := e.ptrToString(ptr + code.offset)
b = encodeEscapedString(b, string(encodeEscapedString([]byte{}, s)))
b = encodeIndentComma(b)
code = code.next
}
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldPtrHeadStringTagBool:
2021-01-10 23:16:37 +03:00
ptr := load(ctxptr, code.idx)
if ptr != 0 {
store(ctxptr, code.idx, e.ptrToPtr(ptr))
}
fallthrough
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldHeadStringTagBool:
2021-01-10 23:16:37 +03:00
ptr := load(ctxptr, code.idx)
if ptr == 0 {
b = e.encodeIndent(b, code.indent)
b = encodeNull(b)
b = encodeIndentComma(b)
code = code.end.next
} else {
b = append(b, '{', '\n')
b = e.encodeIndent(b, code.indent+1)
b = append(b, code.escapedKey...)
b = append(b, ' ', '"')
b = encodeBool(b, e.ptrToBool(ptr+code.offset))
b = append(b, '"')
b = encodeIndentComma(b)
code = code.next
}
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldPtrHeadStringTagBytes:
2021-01-10 23:16:37 +03:00
ptr := load(ctxptr, code.idx)
if ptr != 0 {
store(ctxptr, code.idx, e.ptrToPtr(ptr))
}
fallthrough
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldHeadStringTagBytes:
2021-01-10 23:16:37 +03:00
ptr := load(ctxptr, code.idx)
if ptr == 0 {
b = e.encodeIndent(b, code.indent)
b = encodeNull(b)
b = encodeIndentComma(b)
code = code.end.next
} else {
b = append(b, '{', '\n')
b = e.encodeIndent(b, code.indent+1)
b = append(b, code.escapedKey...)
b = append(b, ' ')
b = encodeByteSlice(b, e.ptrToBytes(ptr+code.offset))
b = encodeIndentComma(b)
code = code.next
}
2021-01-11 13:05:06 +03:00
case opStructEscapedField:
2021-01-10 23:16:37 +03:00
b = e.encodeIndent(b, code.indent)
b = append(b, code.escapedKey...)
b = append(b, ' ')
ptr := load(ctxptr, code.headIdx)
p := ptr + code.offset
code = code.next
store(ctxptr, code.idx, p)
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldInt:
2021-01-10 23:16:37 +03:00
b = e.encodeIndent(b, code.indent)
b = append(b, code.escapedKey...)
b = append(b, ' ')
ptr := load(ctxptr, code.headIdx)
b = appendInt(b, int64(e.ptrToInt(ptr+code.offset)))
b = encodeIndentComma(b)
code = code.next
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldInt8:
2021-01-10 23:16:37 +03:00
b = e.encodeIndent(b, code.indent)
b = append(b, code.escapedKey...)
b = append(b, ' ')
ptr := load(ctxptr, code.headIdx)
b = appendInt(b, int64(e.ptrToInt8(ptr+code.offset)))
b = encodeIndentComma(b)
code = code.next
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldInt16:
2021-01-10 23:16:37 +03:00
b = e.encodeIndent(b, code.indent)
b = append(b, code.escapedKey...)
b = append(b, ' ')
ptr := load(ctxptr, code.headIdx)
b = appendInt(b, int64(e.ptrToInt16(ptr+code.offset)))
b = encodeIndentComma(b)
code = code.next
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldInt32:
2021-01-10 23:16:37 +03:00
b = e.encodeIndent(b, code.indent)
b = append(b, code.escapedKey...)
b = append(b, ' ')
ptr := load(ctxptr, code.headIdx)
b = appendInt(b, int64(e.ptrToInt32(ptr+code.offset)))
b = encodeIndentComma(b)
code = code.next
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldInt64:
2021-01-10 23:16:37 +03:00
b = e.encodeIndent(b, code.indent)
b = append(b, code.escapedKey...)
b = append(b, ' ')
ptr := load(ctxptr, code.headIdx)
b = appendInt(b, e.ptrToInt64(ptr+code.offset))
b = encodeIndentComma(b)
code = code.next
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldUint:
2021-01-10 23:16:37 +03:00
b = e.encodeIndent(b, code.indent)
b = append(b, code.escapedKey...)
b = append(b, ' ')
ptr := load(ctxptr, code.headIdx)
b = appendUint(b, uint64(e.ptrToUint(ptr+code.offset)))
b = encodeIndentComma(b)
code = code.next
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldUint8:
2021-01-10 23:16:37 +03:00
b = e.encodeIndent(b, code.indent)
b = append(b, code.escapedKey...)
b = append(b, ' ')
ptr := load(ctxptr, code.headIdx)
b = appendUint(b, uint64(e.ptrToUint8(ptr+code.offset)))
b = encodeIndentComma(b)
code = code.next
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldUint16:
2021-01-10 23:16:37 +03:00
b = e.encodeIndent(b, code.indent)
b = append(b, code.escapedKey...)
b = append(b, ' ')
ptr := load(ctxptr, code.headIdx)
b = appendUint(b, uint64(e.ptrToUint16(ptr+code.offset)))
b = encodeIndentComma(b)
code = code.next
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldUint32:
2021-01-10 23:16:37 +03:00
b = e.encodeIndent(b, code.indent)
b = append(b, code.escapedKey...)
b = append(b, ' ')
ptr := load(ctxptr, code.headIdx)
b = appendUint(b, uint64(e.ptrToUint32(ptr+code.offset)))
b = encodeIndentComma(b)
code = code.next
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldUint64:
2021-01-10 23:16:37 +03:00
b = e.encodeIndent(b, code.indent)
b = append(b, code.escapedKey...)
b = append(b, ' ')
ptr := load(ctxptr, code.headIdx)
b = appendUint(b, e.ptrToUint64(ptr+code.offset))
b = encodeIndentComma(b)
code = code.next
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldFloat32:
2021-01-10 23:16:37 +03:00
b = e.encodeIndent(b, code.indent)
b = append(b, code.escapedKey...)
b = append(b, ' ')
ptr := load(ctxptr, code.headIdx)
b = encodeFloat32(b, e.ptrToFloat32(ptr+code.offset))
b = encodeIndentComma(b)
code = code.next
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldFloat64:
2021-01-10 23:16:37 +03:00
b = e.encodeIndent(b, code.indent)
b = append(b, code.escapedKey...)
b = append(b, ' ')
ptr := load(ctxptr, code.headIdx)
v := e.ptrToFloat64(ptr + code.offset)
if math.IsInf(v, 0) || math.IsNaN(v) {
return nil, errUnsupportedFloat(v)
}
b = encodeFloat64(b, v)
b = encodeIndentComma(b)
code = code.next
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldEscapedString:
2021-01-10 23:16:37 +03:00
b = e.encodeIndent(b, code.indent)
b = append(b, code.escapedKey...)
b = append(b, ' ')
ptr := load(ctxptr, code.headIdx)
b = encodeEscapedString(b, e.ptrToString(ptr+code.offset))
b = encodeIndentComma(b)
code = code.next
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldBool:
2021-01-10 23:16:37 +03:00
b = e.encodeIndent(b, code.indent)
b = append(b, code.escapedKey...)
b = append(b, ' ')
ptr := load(ctxptr, code.headIdx)
b = encodeBool(b, e.ptrToBool(ptr+code.offset))
b = encodeIndentComma(b)
code = code.next
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldBytes:
2021-01-10 23:16:37 +03:00
b = e.encodeIndent(b, code.indent)
b = append(b, code.escapedKey...)
b = append(b, ' ')
ptr := load(ctxptr, code.headIdx)
b = encodeByteSlice(b, e.ptrToBytes(ptr+code.offset))
b = encodeIndentComma(b)
code = code.next
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldMarshalJSON:
2021-01-10 23:16:37 +03:00
b = e.encodeIndent(b, code.indent)
b = append(b, code.escapedKey...)
b = append(b, ' ')
ptr := load(ctxptr, code.headIdx)
p := ptr + code.offset
v := e.ptrToInterface(code, p)
bb, err := v.(Marshaler).MarshalJSON()
if err != nil {
return nil, errMarshaler(code, err)
}
var buf bytes.Buffer
if err := compact(&buf, bb, e.enabledHTMLEscape); err != nil {
return nil, err
}
b = append(b, buf.Bytes()...)
b = encodeIndentComma(b)
code = code.next
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldArray:
2021-01-10 23:16:37 +03:00
b = e.encodeIndent(b, code.indent)
b = append(b, code.escapedKey...)
b = append(b, ' ')
ptr := load(ctxptr, code.headIdx)
p := ptr + code.offset
array := e.ptrToSlice(p)
if p == 0 || uintptr(array.data) == 0 {
b = encodeNull(b)
b = encodeIndentComma(b)
code = code.nextField
} else {
code = code.next
}
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldSlice:
2021-01-10 23:16:37 +03:00
b = e.encodeIndent(b, code.indent)
b = append(b, code.escapedKey...)
b = append(b, ' ')
ptr := load(ctxptr, code.headIdx)
p := ptr + code.offset
slice := e.ptrToSlice(p)
if p == 0 || uintptr(slice.data) == 0 {
b = encodeNull(b)
b = encodeIndentComma(b)
code = code.nextField
} else {
code = code.next
}
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldMap:
2021-01-10 23:16:37 +03:00
b = e.encodeIndent(b, code.indent)
b = append(b, code.escapedKey...)
b = append(b, ' ')
ptr := load(ctxptr, code.headIdx)
p := ptr + code.offset
if p == 0 {
b = encodeNull(b)
code = code.nextField
} else {
p = e.ptrToPtr(p)
mlen := maplen(e.ptrToUnsafePtr(p))
if mlen == 0 {
b = append(b, '{', '}', ',', '\n')
mapCode := code.next
code = mapCode.end.next
} else {
code = code.next
}
}
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldMapLoad:
2021-01-10 23:16:37 +03:00
b = e.encodeIndent(b, code.indent)
b = append(b, code.escapedKey...)
b = append(b, ' ')
ptr := load(ctxptr, code.headIdx)
p := ptr + code.offset
if p == 0 {
b = encodeNull(b)
code = code.nextField
} else {
p = e.ptrToPtr(p)
mlen := maplen(e.ptrToUnsafePtr(p))
if mlen == 0 {
b = append(b, '{', '}', ',', '\n')
code = code.nextField
} else {
code = code.next
}
}
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldStruct:
2021-01-10 23:16:37 +03:00
ptr := load(ctxptr, code.headIdx)
p := ptr + code.offset
b = e.encodeIndent(b, code.indent)
b = append(b, code.escapedKey...)
b = append(b, ' ')
if p == 0 {
b = append(b, '{', '}', ',', '\n')
code = code.nextField
} else {
headCode := code.next
if headCode.next == headCode.end {
// not exists fields
b = append(b, '{', '}', ',', '\n')
code = code.nextField
} else {
code = code.next
store(ctxptr, code.idx, p)
}
}
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldOmitEmpty:
2021-01-10 23:16:37 +03:00
ptr := load(ctxptr, code.headIdx)
p := ptr + code.offset
if p == 0 || **(**uintptr)(unsafe.Pointer(&p)) == 0 {
code = code.nextField
} else {
b = e.encodeIndent(b, code.indent)
b = append(b, code.escapedKey...)
b = append(b, ' ')
code = code.next
store(ctxptr, code.idx, p)
}
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldOmitEmptyInt:
2021-01-10 23:16:37 +03:00
ptr := load(ctxptr, code.headIdx)
v := e.ptrToInt(ptr + code.offset)
if v != 0 {
b = e.encodeIndent(b, code.indent)
b = append(b, code.escapedKey...)
b = append(b, ' ')
b = appendInt(b, int64(v))
b = encodeIndentComma(b)
}
code = code.next
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldOmitEmptyInt8:
2021-01-10 23:16:37 +03:00
ptr := load(ctxptr, code.headIdx)
v := e.ptrToInt8(ptr + code.offset)
if v != 0 {
b = e.encodeIndent(b, code.indent)
b = append(b, code.escapedKey...)
b = append(b, ' ')
b = appendInt(b, int64(v))
b = encodeIndentComma(b)
}
code = code.next
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldOmitEmptyInt16:
2021-01-10 23:16:37 +03:00
ptr := load(ctxptr, code.headIdx)
v := e.ptrToInt16(ptr + code.offset)
if v != 0 {
b = e.encodeIndent(b, code.indent)
b = append(b, code.escapedKey...)
b = append(b, ' ')
b = appendInt(b, int64(v))
b = encodeIndentComma(b)
}
code = code.next
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldOmitEmptyInt32:
2021-01-10 23:16:37 +03:00
ptr := load(ctxptr, code.headIdx)
v := e.ptrToInt32(ptr + code.offset)
if v != 0 {
b = e.encodeIndent(b, code.indent)
b = append(b, code.escapedKey...)
b = append(b, ' ')
b = appendInt(b, int64(v))
b = encodeIndentComma(b)
}
code = code.next
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldOmitEmptyInt64:
2021-01-10 23:16:37 +03:00
ptr := load(ctxptr, code.headIdx)
v := e.ptrToInt64(ptr + code.offset)
if v != 0 {
b = e.encodeIndent(b, code.indent)
b = append(b, code.escapedKey...)
b = append(b, ' ')
b = appendInt(b, v)
b = encodeIndentComma(b)
}
code = code.next
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldOmitEmptyUint:
2021-01-10 23:16:37 +03:00
ptr := load(ctxptr, code.headIdx)
v := e.ptrToUint(ptr + code.offset)
if v != 0 {
b = e.encodeIndent(b, code.indent)
b = append(b, code.escapedKey...)
b = append(b, ' ')
b = appendUint(b, uint64(v))
b = encodeIndentComma(b)
}
code = code.next
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldOmitEmptyUint8:
2021-01-10 23:16:37 +03:00
ptr := load(ctxptr, code.headIdx)
v := e.ptrToUint8(ptr + code.offset)
if v != 0 {
b = e.encodeIndent(b, code.indent)
b = append(b, code.escapedKey...)
b = append(b, ' ')
b = appendUint(b, uint64(v))
b = encodeIndentComma(b)
}
code = code.next
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldOmitEmptyUint16:
2021-01-10 23:16:37 +03:00
ptr := load(ctxptr, code.headIdx)
v := e.ptrToUint16(ptr + code.offset)
if v != 0 {
b = e.encodeIndent(b, code.indent)
b = append(b, code.escapedKey...)
b = append(b, ' ')
b = appendUint(b, uint64(v))
b = encodeIndentComma(b)
}
code = code.next
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldOmitEmptyUint32:
2021-01-10 23:16:37 +03:00
ptr := load(ctxptr, code.headIdx)
v := e.ptrToUint32(ptr + code.offset)
if v != 0 {
b = e.encodeIndent(b, code.indent)
b = append(b, code.escapedKey...)
b = append(b, ' ')
b = appendUint(b, uint64(v))
b = encodeIndentComma(b)
}
code = code.next
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldOmitEmptyUint64:
2021-01-10 23:16:37 +03:00
ptr := load(ctxptr, code.headIdx)
v := e.ptrToUint64(ptr + code.offset)
if v != 0 {
b = e.encodeIndent(b, code.indent)
b = append(b, code.escapedKey...)
b = append(b, ' ')
b = appendUint(b, v)
b = encodeIndentComma(b)
}
code = code.next
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldOmitEmptyFloat32:
2021-01-10 23:16:37 +03:00
ptr := load(ctxptr, code.headIdx)
v := e.ptrToFloat32(ptr + code.offset)
if v != 0 {
b = e.encodeIndent(b, code.indent)
b = append(b, code.escapedKey...)
b = append(b, ' ')
b = encodeFloat32(b, v)
b = encodeIndentComma(b)
}
code = code.next
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldOmitEmptyFloat64:
2021-01-10 23:16:37 +03:00
ptr := load(ctxptr, code.headIdx)
v := e.ptrToFloat64(ptr + code.offset)
if v != 0 {
if math.IsInf(v, 0) || math.IsNaN(v) {
return nil, errUnsupportedFloat(v)
}
b = e.encodeIndent(b, code.indent)
b = append(b, code.escapedKey...)
b = append(b, ' ')
b = encodeFloat64(b, v)
b = encodeIndentComma(b)
}
code = code.next
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldOmitEmptyEscapedString:
2021-01-10 23:16:37 +03:00
ptr := load(ctxptr, code.headIdx)
v := e.ptrToString(ptr + code.offset)
if v != "" {
b = e.encodeIndent(b, code.indent)
b = append(b, code.escapedKey...)
b = append(b, ' ')
b = encodeEscapedString(b, v)
b = encodeIndentComma(b)
}
code = code.next
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldOmitEmptyBool:
2021-01-10 23:16:37 +03:00
ptr := load(ctxptr, code.headIdx)
v := e.ptrToBool(ptr + code.offset)
if v {
b = e.encodeIndent(b, code.indent)
b = append(b, code.escapedKey...)
b = append(b, ' ')
b = encodeBool(b, v)
b = encodeIndentComma(b)
}
code = code.next
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldOmitEmptyBytes:
2021-01-10 23:16:37 +03:00
ptr := load(ctxptr, code.headIdx)
v := e.ptrToBytes(ptr + code.offset)
if len(v) > 0 {
b = e.encodeIndent(b, code.indent)
b = append(b, code.escapedKey...)
b = append(b, ' ')
b = encodeByteSlice(b, v)
b = encodeIndentComma(b)
}
code = code.next
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldOmitEmptyArray:
2021-01-10 23:16:37 +03:00
ptr := load(ctxptr, code.headIdx)
p := ptr + code.offset
array := e.ptrToSlice(p)
if p == 0 || uintptr(array.data) == 0 {
code = code.nextField
} else {
b = e.encodeIndent(b, code.indent)
b = append(b, code.escapedKey...)
b = append(b, ' ')
code = code.next
}
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldOmitEmptySlice:
2021-01-10 23:16:37 +03:00
ptr := load(ctxptr, code.headIdx)
p := ptr + code.offset
slice := e.ptrToSlice(p)
if p == 0 || uintptr(slice.data) == 0 {
code = code.nextField
} else {
b = e.encodeIndent(b, code.indent)
b = append(b, code.escapedKey...)
b = append(b, ' ')
code = code.next
}
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldOmitEmptyMap:
2021-01-10 23:16:37 +03:00
ptr := load(ctxptr, code.headIdx)
p := ptr + code.offset
if p == 0 {
code = code.nextField
} else {
mlen := maplen(**(**unsafe.Pointer)(unsafe.Pointer(&p)))
if mlen == 0 {
code = code.nextField
} else {
b = e.encodeIndent(b, code.indent)
b = append(b, code.escapedKey...)
b = append(b, ' ')
code = code.next
}
}
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldOmitEmptyMapLoad:
2021-01-10 23:16:37 +03:00
ptr := load(ctxptr, code.headIdx)
p := ptr + code.offset
if p == 0 {
code = code.nextField
} else {
mlen := maplen(**(**unsafe.Pointer)(unsafe.Pointer(&p)))
if mlen == 0 {
code = code.nextField
} else {
b = e.encodeIndent(b, code.indent)
b = append(b, code.escapedKey...)
b = append(b, ' ')
code = code.next
}
}
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldOmitEmptyStruct:
2021-01-10 23:16:37 +03:00
ptr := load(ctxptr, code.headIdx)
p := ptr + code.offset
if p == 0 {
code = code.nextField
} else {
b = e.encodeIndent(b, code.indent)
b = append(b, code.escapedKey...)
b = append(b, ' ')
headCode := code.next
if headCode.next == headCode.end {
// not exists fields
b = append(b, '{', '}', ',', '\n')
code = code.nextField
} else {
code = code.next
store(ctxptr, code.idx, p)
}
}
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldStringTag:
2021-01-10 23:16:37 +03:00
ptr := load(ctxptr, code.headIdx)
p := ptr + code.offset
b = e.encodeIndent(b, code.indent)
b = append(b, code.escapedKey...)
b = append(b, ' ')
code = code.next
store(ctxptr, code.idx, p)
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldStringTagInt:
2021-01-10 23:16:37 +03:00
ptr := load(ctxptr, code.headIdx)
b = e.encodeIndent(b, code.indent)
b = append(b, code.escapedKey...)
b = append(b, ' ', '"')
b = appendInt(b, int64(e.ptrToInt(ptr+code.offset)))
b = append(b, '"')
b = encodeIndentComma(b)
code = code.next
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldStringTagInt8:
2021-01-10 23:16:37 +03:00
ptr := load(ctxptr, code.headIdx)
b = e.encodeIndent(b, code.indent)
b = append(b, code.escapedKey...)
b = append(b, ' ', '"')
b = appendInt(b, int64(e.ptrToInt8(ptr+code.offset)))
b = append(b, '"')
b = encodeIndentComma(b)
code = code.next
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldStringTagInt16:
2021-01-10 23:16:37 +03:00
ptr := load(ctxptr, code.headIdx)
b = e.encodeIndent(b, code.indent)
b = append(b, code.escapedKey...)
b = append(b, ' ', '"')
b = appendInt(b, int64(e.ptrToInt16(ptr+code.offset)))
b = append(b, '"')
b = encodeIndentComma(b)
code = code.next
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldStringTagInt32:
2021-01-10 23:16:37 +03:00
ptr := load(ctxptr, code.headIdx)
b = e.encodeIndent(b, code.indent)
b = append(b, code.escapedKey...)
b = append(b, ' ', '"')
b = appendInt(b, int64(e.ptrToInt32(ptr+code.offset)))
b = append(b, '"')
b = encodeIndentComma(b)
code = code.next
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldStringTagInt64:
2021-01-10 23:16:37 +03:00
ptr := load(ctxptr, code.headIdx)
b = e.encodeIndent(b, code.indent)
b = append(b, code.escapedKey...)
b = append(b, ' ', '"')
b = appendInt(b, e.ptrToInt64(ptr+code.offset))
b = append(b, '"')
b = encodeIndentComma(b)
code = code.next
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldStringTagUint:
2021-01-10 23:16:37 +03:00
ptr := load(ctxptr, code.headIdx)
b = e.encodeIndent(b, code.indent)
b = append(b, code.escapedKey...)
b = append(b, ' ', '"')
b = appendUint(b, uint64(e.ptrToUint(ptr+code.offset)))
b = append(b, '"')
b = encodeIndentComma(b)
code = code.next
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldStringTagUint8:
2021-01-10 23:16:37 +03:00
ptr := load(ctxptr, code.headIdx)
b = e.encodeIndent(b, code.indent)
b = append(b, code.escapedKey...)
b = append(b, ' ', '"')
b = appendUint(b, uint64(e.ptrToUint8(ptr+code.offset)))
b = append(b, '"')
b = encodeIndentComma(b)
code = code.next
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldStringTagUint16:
2021-01-10 23:16:37 +03:00
ptr := load(ctxptr, code.headIdx)
b = e.encodeIndent(b, code.indent)
b = append(b, code.escapedKey...)
b = append(b, ' ', '"')
b = appendUint(b, uint64(e.ptrToUint16(ptr+code.offset)))
b = append(b, '"')
b = encodeIndentComma(b)
code = code.next
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldStringTagUint32:
2021-01-10 23:16:37 +03:00
ptr := load(ctxptr, code.headIdx)
b = e.encodeIndent(b, code.indent)
b = append(b, code.escapedKey...)
b = append(b, ' ', '"')
b = appendUint(b, uint64(e.ptrToUint32(ptr+code.offset)))
b = append(b, '"')
b = encodeIndentComma(b)
code = code.next
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldStringTagUint64:
2021-01-10 23:16:37 +03:00
ptr := load(ctxptr, code.headIdx)
b = e.encodeIndent(b, code.indent)
b = append(b, code.escapedKey...)
b = append(b, ' ', '"')
b = appendUint(b, e.ptrToUint64(ptr+code.offset))
b = append(b, '"')
b = encodeIndentComma(b)
code = code.next
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldStringTagFloat32:
2021-01-10 23:16:37 +03:00
ptr := load(ctxptr, code.headIdx)
b = e.encodeIndent(b, code.indent)
b = append(b, code.escapedKey...)
b = append(b, ' ', '"')
b = encodeFloat32(b, e.ptrToFloat32(ptr+code.offset))
b = append(b, '"')
b = encodeIndentComma(b)
code = code.next
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldStringTagFloat64:
2021-01-10 23:16:37 +03:00
ptr := load(ctxptr, code.headIdx)
v := e.ptrToFloat64(ptr + code.offset)
if math.IsInf(v, 0) || math.IsNaN(v) {
return nil, errUnsupportedFloat(v)
}
b = e.encodeIndent(b, code.indent)
b = append(b, code.escapedKey...)
b = append(b, ' ', '"')
b = encodeFloat64(b, v)
b = append(b, '"')
b = encodeIndentComma(b)
code = code.next
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldStringTagEscapedString:
2021-01-10 23:16:37 +03:00
ptr := load(ctxptr, code.headIdx)
b = e.encodeIndent(b, code.indent)
b = append(b, code.escapedKey...)
b = append(b, ' ')
s := e.ptrToString(ptr + code.offset)
b = encodeEscapedString(b, string(encodeEscapedString([]byte{}, s)))
b = encodeIndentComma(b)
code = code.next
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldStringTagBool:
2021-01-10 23:16:37 +03:00
ptr := load(ctxptr, code.headIdx)
b = e.encodeIndent(b, code.indent)
b = append(b, code.escapedKey...)
b = append(b, ' ', '"')
b = encodeBool(b, e.ptrToBool(ptr+code.offset))
b = append(b, '"')
b = encodeIndentComma(b)
code = code.next
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldStringTagBytes:
2021-01-10 23:16:37 +03:00
ptr := load(ctxptr, code.headIdx)
b = e.encodeIndent(b, code.indent)
b = append(b, code.escapedKey...)
b = append(b, ' ')
b = encodeByteSlice(b, e.ptrToBytes(ptr+code.offset))
b = encodeIndentComma(b)
code = code.next
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldStringTagMarshalJSON:
2021-01-10 23:16:37 +03:00
ptr := load(ctxptr, code.headIdx)
b = e.encodeIndent(b, code.indent)
b = append(b, code.escapedKey...)
b = append(b, ' ')
p := ptr + code.offset
v := e.ptrToInterface(code, p)
bb, err := v.(Marshaler).MarshalJSON()
if err != nil {
return nil, errMarshaler(code, err)
}
var buf bytes.Buffer
if err := compact(&buf, bb, e.enabledHTMLEscape); err != nil {
return nil, err
}
b = encodeEscapedString(b, buf.String())
b = encodeIndentComma(b)
code = code.next
2021-01-11 13:05:06 +03:00
case opStructEscapedFieldStringTagMarshalText:
2021-01-10 23:16:37 +03:00
ptr := load(ctxptr, code.headIdx)
b = e.encodeIndent(b, code.indent)
b = append(b, code.escapedKey...)
b = append(b, ' ')
p := ptr + code.offset
v := e.ptrToInterface(code, p)
bytes, err := v.(encoding.TextMarshaler).MarshalText()
if err != nil {
return nil, errMarshaler(code, err)
}
b = encodeEscapedString(b, *(*string)(unsafe.Pointer(&bytes)))
b = encodeIndentComma(b)
code = code.next
2021-01-11 13:05:06 +03:00
case opStructAnonymousEnd:
2021-01-10 23:16:37 +03:00
code = code.next
2021-01-11 13:05:06 +03:00
case opStructEscapedEnd:
2021-01-10 23:16:37 +03:00
last := len(b) - 1
if b[last-1] == '{' {
b[last] = '}'
b = encodeIndentComma(b)
code = code.next
break
}
if b[last] == '\n' {
// to remove ',' and '\n' characters
b = b[:len(b)-2]
}
b = append(b, '\n')
b = e.encodeIndent(b, code.indent)
b = append(b, '}')
b = encodeIndentComma(b)
code = code.next
2021-01-11 13:05:06 +03:00
case opStructEscapedEndInt:
2021-01-10 23:16:37 +03:00
b = e.encodeIndent(b, code.indent)
b = append(b, code.escapedKey...)
b = append(b, ' ')
ptr := load(ctxptr, code.headIdx)
b = appendInt(b, int64(e.ptrToInt(ptr+code.offset)))
b = e.appendStructEndIndent(b, code.indent-1)
code = code.next
2021-01-11 13:05:06 +03:00
case opStructEscapedEndIntPtr:
2021-01-10 23:16:37 +03:00
b = e.encodeIndent(b, code.indent)
b = append(b, code.escapedKey...)
b = append(b, ' ')
ptr := load(ctxptr, code.headIdx)
p := e.ptrToPtr(ptr + code.offset)
if p == 0 {
b = encodeNull(b)
} else {
b = appendInt(b, int64(e.ptrToInt(p)))
}
b = e.appendStructEndIndent(b, code.indent-1)
code = code.next
2021-01-11 13:05:06 +03:00
case opStructEscapedEndInt8:
2021-01-10 23:16:37 +03:00
b = e.encodeIndent(b, code.indent)
b = append(b, code.escapedKey...)
b = append(b, ' ')
ptr := load(ctxptr, code.headIdx)
b = appendInt(b, int64(e.ptrToInt8(ptr+code.offset)))
b = e.appendStructEndIndent(b, code.indent-1)
code = code.next
2021-01-11 13:05:06 +03:00
case opStructEscapedEndInt8Ptr:
2021-01-10 23:16:37 +03:00
b = e.encodeIndent(b, code.indent)
b = append(b, code.escapedKey...)
b = append(b, ' ')
ptr := load(ctxptr, code.headIdx)
p := e.ptrToPtr(ptr + code.offset)
if p == 0 {
b = encodeNull(b)
} else {
b = appendInt(b, int64(e.ptrToInt8(p)))
}
b = e.appendStructEndIndent(b, code.indent-1)
code = code.next
2021-01-11 13:05:06 +03:00
case opStructEscapedEndInt16:
2021-01-10 23:16:37 +03:00
b = e.encodeIndent(b, code.indent)
b = append(b, code.escapedKey...)
b = append(b, ' ')
ptr := load(ctxptr, code.headIdx)
b = appendInt(b, int64(e.ptrToInt16(ptr+code.offset)))
b = e.appendStructEndIndent(b, code.indent-1)
code = code.next
2021-01-11 13:05:06 +03:00
case opStructEscapedEndInt16Ptr:
2021-01-10 23:16:37 +03:00
b = e.encodeIndent(b, code.indent)
b = append(b, code.escapedKey...)
b = append(b, ' ')
ptr := load(ctxptr, code.headIdx)
p := e.ptrToPtr(ptr + code.offset)
if p == 0 {
b = encodeNull(b)
} else {
b = appendInt(b, int64(e.ptrToInt16(p)))
}
b = e.appendStructEndIndent(b, code.indent-1)
code = code.next
2021-01-11 13:05:06 +03:00
case opStructEscapedEndInt32:
2021-01-10 23:16:37 +03:00
b = e.encodeIndent(b, code.indent)
b = append(b, code.escapedKey...)
b = append(b, ' ')
ptr := load(ctxptr, code.headIdx)
b = appendInt(b, int64(e.ptrToInt32(ptr+code.offset)))
b = e.appendStructEndIndent(b, code.indent-1)
code = code.next
2021-01-11 13:05:06 +03:00
case opStructEscapedEndInt32Ptr:
2021-01-10 23:16:37 +03:00
b = e.encodeIndent(b, code.indent)
b = append(b, code.escapedKey...)
b = append(b, ' ')
ptr := load(ctxptr, code.headIdx)
p := e.ptrToPtr(ptr + code.offset)
if p == 0 {
b = encodeNull(b)
} else {
b = appendInt(b, int64(e.ptrToInt32(p)))
}
b = e.appendStructEndIndent(b, code.indent-1)
code = code.next
2021-01-11 13:05:06 +03:00
case opStructEscapedEndInt64:
2021-01-10 23:16:37 +03:00
b = e.encodeIndent(b, code.indent)
b = append(b, code.escapedKey...)
b = append(b, ' ')
ptr := load(ctxptr, code.headIdx)
b = appendInt(b, e.ptrToInt64(ptr+code.offset))
b = e.appendStructEndIndent(b, code.indent-1)
code = code.next
2021-01-11 13:05:06 +03:00
case opStructEscapedEndInt64Ptr:
2021-01-10 23:16:37 +03:00
b = e.encodeIndent(b, code.indent)
b = append(b, code.escapedKey...)
b = append(b, ' ')
ptr := load(ctxptr, code.headIdx)
p := e.ptrToPtr(ptr + code.offset)
if p == 0 {
b = encodeNull(b)
} else {
b = appendInt(b, e.ptrToInt64(p))
}
b = e.appendStructEndIndent(b, code.indent-1)
code = code.next
2021-01-11 13:05:06 +03:00
case opStructEscapedEndUint:
2021-01-10 23:16:37 +03:00
b = e.encodeIndent(b, code.indent)
b = append(b, code.escapedKey...)
b = append(b, ' ')
ptr := load(ctxptr, code.headIdx)
b = appendUint(b, uint64(e.ptrToUint(ptr+code.offset)))
b = e.appendStructEndIndent(b, code.indent-1)
code = code.next
2021-01-11 13:05:06 +03:00
case opStructEscapedEndUintPtr:
2021-01-10 23:16:37 +03:00
b = e.encodeIndent(b, code.indent)
b = append(b, code.escapedKey...)
b = append(b, ' ')
ptr := load(ctxptr, code.headIdx)
p := e.ptrToPtr(ptr + code.offset)
if p == 0 {
b = encodeNull(b)
} else {
b = appendUint(b, uint64(e.ptrToUint(p)))
}
b = e.appendStructEndIndent(b, code.indent-1)
code = code.next
2021-01-11 13:05:06 +03:00
case opStructEscapedEndUint8:
2021-01-10 23:16:37 +03:00
b = e.encodeIndent(b, code.indent)
b = append(b, code.escapedKey...)
b = append(b, ' ')
ptr := load(ctxptr, code.headIdx)
b = appendUint(b, uint64(e.ptrToUint8(ptr+code.offset)))
b = e.appendStructEndIndent(b, code.indent-1)
code = code.next
2021-01-11 13:05:06 +03:00
case opStructEscapedEndUint8Ptr:
2021-01-10 23:16:37 +03:00
b = e.encodeIndent(b, code.indent)
b = append(b, code.escapedKey...)
b = append(b, ' ')
ptr := load(ctxptr, code.headIdx)
p := e.ptrToPtr(ptr + code.offset)
if p == 0 {
b = encodeNull(b)
} else {
b = appendUint(b, uint64(e.ptrToUint8(p)))
}
b = e.appendStructEndIndent(b, code.indent-1)
code = code.next
2021-01-11 13:05:06 +03:00
case opStructEscapedEndUint16:
2021-01-10 23:16:37 +03:00
b = e.encodeIndent(b, code.indent)
b = append(b, code.escapedKey...)
b = append(b, ' ')
ptr := load(ctxptr, code.headIdx)
b = appendUint(b, uint64(e.ptrToUint16(ptr+code.offset)))
b = e.appendStructEndIndent(b, code.indent-1)
code = code.next
2021-01-11 13:05:06 +03:00
case opStructEscapedEndUint16Ptr:
2021-01-10 23:16:37 +03:00
b = e.encodeIndent(b, code.indent)
b = append(b, code.escapedKey...)
b = append(b, ' ')
ptr := load(ctxptr, code.headIdx)
p := e.ptrToPtr(ptr + code.offset)
if p == 0 {
b = encodeNull(b)
} else {
b = appendUint(b, uint64(e.ptrToUint16(p)))
}
b = e.appendStructEndIndent(b, code.indent-1)
code = code.next
2021-01-11 13:05:06 +03:00
case opStructEscapedEndUint32:
2021-01-10 23:16:37 +03:00
b = e.encodeIndent(b, code.indent)
b = append(b, code.escapedKey...)
b = append(b, ' ')
ptr := load(ctxptr, code.headIdx)
b = appendUint(b, uint64(e.ptrToUint32(ptr+code.offset)))
b = e.appendStructEndIndent(b, code.indent-1)
code = code.next
2021-01-11 13:05:06 +03:00
case opStructEscapedEndUint32Ptr:
2021-01-10 23:16:37 +03:00
b = e.encodeIndent(b, code.indent)
b = append(b, code.escapedKey...)
b = append(b, ' ')
ptr := load(ctxptr, code.headIdx)
p := e.ptrToPtr(ptr + code.offset)
if p == 0 {
b = encodeNull(b)
} else {
b = appendUint(b, uint64(e.ptrToUint32(p)))
}
b = e.appendStructEndIndent(b, code.indent-1)
code = code.next
2021-01-11 13:05:06 +03:00
case opStructEscapedEndUint64:
2021-01-10 23:16:37 +03:00
b = e.encodeIndent(b, code.indent)
b = append(b, code.escapedKey...)
b = append(b, ' ')
ptr := load(ctxptr, code.headIdx)
b = appendUint(b, e.ptrToUint64(ptr+code.offset))
b = e.appendStructEndIndent(b, code.indent-1)
code = code.next
2021-01-11 13:05:06 +03:00
case opStructEscapedEndUint64Ptr:
2021-01-10 23:16:37 +03:00
b = e.encodeIndent(b, code.indent)
b = append(b, code.escapedKey...)
b = append(b, ' ')
ptr := load(ctxptr, code.headIdx)
p := e.ptrToPtr(ptr + code.offset)
if p == 0 {
b = encodeNull(b)
} else {
b = appendUint(b, e.ptrToUint64(p))
}
b = e.appendStructEndIndent(b, code.indent-1)
code = code.next
2021-01-11 13:05:06 +03:00
case opStructEscapedEndFloat32:
2021-01-10 23:16:37 +03:00
b = e.encodeIndent(b, code.indent)
b = append(b, code.escapedKey...)
b = append(b, ' ')
ptr := load(ctxptr, code.headIdx)
b = encodeFloat32(b, e.ptrToFloat32(ptr+code.offset))
b = e.appendStructEndIndent(b, code.indent-1)
code = code.next
2021-01-11 13:05:06 +03:00
case opStructEscapedEndFloat32Ptr:
2021-01-10 23:16:37 +03:00
b = e.encodeIndent(b, code.indent)
b = append(b, code.escapedKey...)
b = append(b, ' ')
ptr := load(ctxptr, code.headIdx)
p := e.ptrToPtr(ptr + code.offset)
if p == 0 {
b = encodeNull(b)
} else {
b = encodeFloat32(b, e.ptrToFloat32(p))
}
b = e.appendStructEndIndent(b, code.indent-1)
code = code.next
2021-01-11 13:05:06 +03:00
case opStructEscapedEndFloat64:
2021-01-10 23:16:37 +03:00
b = e.encodeIndent(b, code.indent)
b = append(b, code.escapedKey...)
b = append(b, ' ')
ptr := load(ctxptr, code.headIdx)
v := e.ptrToFloat64(ptr + code.offset)
if math.IsInf(v, 0) || math.IsNaN(v) {
return nil, errUnsupportedFloat(v)
}
b = encodeFloat64(b, v)
b = e.appendStructEndIndent(b, code.indent-1)
code = code.next
2021-01-11 13:05:06 +03:00
case opStructEscapedEndFloat64Ptr:
2021-01-10 23:16:37 +03:00
b = e.encodeIndent(b, code.indent)
b = append(b, code.escapedKey...)
b = append(b, ' ')
ptr := load(ctxptr, code.headIdx)
p := e.ptrToPtr(ptr + code.offset)
if p == 0 {
b = encodeNull(b)
} else {
v := e.ptrToFloat64(p)
if math.IsInf(v, 0) || math.IsNaN(v) {
return nil, errUnsupportedFloat(v)
}
b = encodeFloat64(b, v)
}
b = e.appendStructEndIndent(b, code.indent-1)
code = code.next
2021-01-11 13:05:06 +03:00
case opStructEscapedEndEscapedString:
2021-01-10 23:16:37 +03:00
b = e.encodeIndent(b, code.indent)
b = append(b, code.escapedKey...)
b = append(b, ' ')
ptr := load(ctxptr, code.headIdx)
b = encodeEscapedString(b, e.ptrToString(ptr+code.offset))
b = e.appendStructEndIndent(b, code.indent-1)
code = code.next
2021-01-11 13:05:06 +03:00
case opStructEscapedEndBool:
2021-01-10 23:16:37 +03:00
b = e.encodeIndent(b, code.indent)
b = append(b, code.escapedKey...)
b = append(b, ' ')
ptr := load(ctxptr, code.headIdx)
b = encodeBool(b, e.ptrToBool(ptr+code.offset))
b = e.appendStructEndIndent(b, code.indent-1)
code = code.next
2021-01-11 13:05:06 +03:00
case opStructEscapedEndBytes:
2021-01-10 23:16:37 +03:00
b = e.encodeIndent(b, code.indent)
b = append(b, code.escapedKey...)
b = append(b, ' ')
ptr := load(ctxptr, code.headIdx)
b = encodeByteSlice(b, e.ptrToBytes(ptr+code.offset))
b = e.appendStructEndIndent(b, code.indent-1)
code = code.next
2021-01-11 13:05:06 +03:00
case opStructEscapedEndMarshalJSON:
2021-01-10 23:16:37 +03:00
b = e.encodeIndent(b, code.indent)
b = append(b, code.escapedKey...)
b = append(b, ' ')
ptr := load(ctxptr, code.headIdx)
p := ptr + code.offset
v := e.ptrToInterface(code, p)
bb, err := v.(Marshaler).MarshalJSON()
if err != nil {
return nil, errMarshaler(code, err)
}
var buf bytes.Buffer
if err := compact(&buf, bb, e.enabledHTMLEscape); err != nil {
return nil, err
}
b = append(b, buf.Bytes()...)
b = e.appendStructEndIndent(b, code.indent-1)
code = code.next
2021-01-11 13:05:06 +03:00
case opStructEscapedEndOmitEmptyInt:
2021-01-10 23:16:37 +03:00
ptr := load(ctxptr, code.headIdx)
v := e.ptrToInt(ptr + code.offset)
if v != 0 {
b = e.encodeIndent(b, code.indent)
b = append(b, code.escapedKey...)
b = append(b, ' ')
b = appendInt(b, int64(v))
}
b = e.appendStructEndIndent(b, code.indent-1)
code = code.next
2021-01-11 13:05:06 +03:00
case opStructEscapedEndOmitEmptyInt8:
2021-01-10 23:16:37 +03:00
ptr := load(ctxptr, code.headIdx)
v := e.ptrToInt8(ptr + code.offset)
if v != 0 {
b = e.encodeIndent(b, code.indent)
b = append(b, code.escapedKey...)
b = append(b, ' ')
b = appendInt(b, int64(v))
}
b = e.appendStructEndIndent(b, code.indent-1)
code = code.next
2021-01-11 13:05:06 +03:00
case opStructEscapedEndOmitEmptyInt16:
2021-01-10 23:16:37 +03:00
ptr := load(ctxptr, code.headIdx)
v := e.ptrToInt16(ptr + code.offset)
if v != 0 {
b = e.encodeIndent(b, code.indent)
b = append(b, code.escapedKey...)
b = append(b, ' ')
b = appendInt(b, int64(v))
}
b = e.appendStructEndIndent(b, code.indent-1)
code = code.next
2021-01-11 13:05:06 +03:00
case opStructEscapedEndOmitEmptyInt32:
2021-01-10 23:16:37 +03:00
ptr := load(ctxptr, code.headIdx)
v := e.ptrToInt32(ptr + code.offset)
if v != 0 {
b = e.encodeIndent(b, code.indent)
b = append(b, code.escapedKey...)
b = append(b, ' ')
b = appendInt(b, int64(v))
}
b = e.appendStructEndIndent(b, code.indent-1)
code = code.next
2021-01-11 13:05:06 +03:00
case opStructEscapedEndOmitEmptyInt64:
2021-01-10 23:16:37 +03:00
ptr := load(ctxptr, code.headIdx)
v := e.ptrToInt64(ptr + code.offset)
if v != 0 {
b = e.encodeIndent(b, code.indent)
b = append(b, code.escapedKey...)
b = append(b, ' ')
b = appendInt(b, v)
}
b = e.appendStructEndIndent(b, code.indent-1)
code = code.next
2021-01-11 13:05:06 +03:00
case opStructEscapedEndOmitEmptyUint:
2021-01-10 23:16:37 +03:00
ptr := load(ctxptr, code.headIdx)
v := e.ptrToUint(ptr + code.offset)
if v != 0 {
b = e.encodeIndent(b, code.indent)
b = append(b, code.escapedKey...)
b = append(b, ' ')
b = appendUint(b, uint64(v))
}
b = e.appendStructEndIndent(b, code.indent-1)
code = code.next
2021-01-11 13:05:06 +03:00
case opStructEscapedEndOmitEmptyUint8:
2021-01-10 23:16:37 +03:00
ptr := load(ctxptr, code.headIdx)
v := e.ptrToUint8(ptr + code.offset)
if v != 0 {
b = e.encodeIndent(b, code.indent)
b = append(b, code.escapedKey...)
b = append(b, ' ')
b = appendUint(b, uint64(v))
}
b = e.appendStructEndIndent(b, code.indent-1)
code = code.next
2021-01-11 13:05:06 +03:00
case opStructEscapedEndOmitEmptyUint16:
2021-01-10 23:16:37 +03:00
ptr := load(ctxptr, code.headIdx)
v := e.ptrToUint16(ptr + code.offset)
if v != 0 {
b = e.encodeIndent(b, code.indent)
b = append(b, code.escapedKey...)
b = append(b, ' ')
b = appendUint(b, uint64(v))
}
b = e.appendStructEndIndent(b, code.indent-1)
code = code.next
2021-01-11 13:05:06 +03:00
case opStructEscapedEndOmitEmptyUint32:
2021-01-10 23:16:37 +03:00
ptr := load(ctxptr, code.headIdx)
v := e.ptrToUint32(ptr + code.offset)
if v != 0 {
b = e.encodeIndent(b, code.indent)
b = append(b, code.escapedKey...)
b = append(b, ' ')
b = appendUint(b, uint64(v))
}
b = e.appendStructEndIndent(b, code.indent-1)
code = code.next
2021-01-11 13:05:06 +03:00
case opStructEscapedEndOmitEmptyUint64:
2021-01-10 23:16:37 +03:00
ptr := load(ctxptr, code.headIdx)
v := e.ptrToUint64(ptr + code.offset)
if v != 0 {
b = e.encodeIndent(b, code.indent)
b = append(b, code.escapedKey...)
b = append(b, ' ')
b = appendUint(b, v)
}
b = e.appendStructEndIndent(b, code.indent-1)
code = code.next
2021-01-11 13:05:06 +03:00
case opStructEscapedEndOmitEmptyFloat32:
2021-01-10 23:16:37 +03:00
ptr := load(ctxptr, code.headIdx)
v := e.ptrToFloat32(ptr + code.offset)
if v != 0 {
b = e.encodeIndent(b, code.indent)
b = append(b, code.escapedKey...)
b = append(b, ' ')
b = encodeFloat32(b, v)
}
b = e.appendStructEndIndent(b, code.indent-1)
code = code.next
2021-01-11 13:05:06 +03:00
case opStructEscapedEndOmitEmptyFloat64:
2021-01-10 23:16:37 +03:00
ptr := load(ctxptr, code.headIdx)
v := e.ptrToFloat64(ptr + code.offset)
if v != 0 {
if math.IsInf(v, 0) || math.IsNaN(v) {
return nil, errUnsupportedFloat(v)
}
b = e.encodeIndent(b, code.indent)
b = append(b, code.escapedKey...)
b = append(b, ' ')
b = encodeFloat64(b, v)
}
b = e.appendStructEndIndent(b, code.indent-1)
code = code.next
2021-01-11 13:05:06 +03:00
case opStructEscapedEndOmitEmptyEscapedString:
2021-01-10 23:16:37 +03:00
ptr := load(ctxptr, code.headIdx)
v := e.ptrToString(ptr + code.offset)
if v != "" {
b = e.encodeIndent(b, code.indent)
b = append(b, code.escapedKey...)
b = append(b, ' ')
b = encodeEscapedString(b, v)
}
b = e.appendStructEndIndent(b, code.indent-1)
code = code.next
2021-01-11 13:05:06 +03:00
case opStructEscapedEndOmitEmptyBool:
2021-01-10 23:16:37 +03:00
ptr := load(ctxptr, code.headIdx)
v := e.ptrToBool(ptr + code.offset)
if v {
b = e.encodeIndent(b, code.indent)
b = append(b, code.escapedKey...)
b = append(b, ' ')
b = encodeBool(b, v)
}
b = e.appendStructEndIndent(b, code.indent-1)
code = code.next
2021-01-11 13:05:06 +03:00
case opStructEscapedEndOmitEmptyBytes:
2021-01-10 23:16:37 +03:00
ptr := load(ctxptr, code.headIdx)
v := e.ptrToBytes(ptr + code.offset)
if len(v) > 0 {
b = e.encodeIndent(b, code.indent)
b = append(b, code.escapedKey...)
b = append(b, ' ')
b = encodeByteSlice(b, v)
}
b = e.appendStructEndIndent(b, code.indent-1)
code = code.next
2021-01-11 13:05:06 +03:00
case opStructEscapedEndStringTagInt:
2021-01-10 23:16:37 +03:00
ptr := load(ctxptr, code.headIdx)
b = e.encodeIndent(b, code.indent)
b = append(b, code.escapedKey...)
b = append(b, ' ', '"')
b = appendInt(b, int64(e.ptrToInt(ptr+code.offset)))
b = append(b, '"')
b = e.appendStructEndIndent(b, code.indent-1)
code = code.next
2021-01-11 13:05:06 +03:00
case opStructEscapedEndStringTagInt8:
2021-01-10 23:16:37 +03:00
ptr := load(ctxptr, code.headIdx)
b = e.encodeIndent(b, code.indent)
b = append(b, code.escapedKey...)
b = append(b, ' ', '"')
b = appendInt(b, int64(e.ptrToInt8(ptr+code.offset)))
b = append(b, '"')
b = e.appendStructEndIndent(b, code.indent-1)
code = code.next
2021-01-11 13:05:06 +03:00
case opStructEscapedEndStringTagInt16:
2021-01-10 23:16:37 +03:00
ptr := load(ctxptr, code.headIdx)
b = e.encodeIndent(b, code.indent)
b = append(b, code.escapedKey...)
b = append(b, ' ', '"')
b = appendInt(b, int64(e.ptrToInt16(ptr+code.offset)))
b = append(b, '"')
b = e.appendStructEndIndent(b, code.indent-1)
code = code.next
2021-01-11 13:05:06 +03:00
case opStructEscapedEndStringTagInt32:
2021-01-10 23:16:37 +03:00
ptr := load(ctxptr, code.headIdx)
b = e.encodeIndent(b, code.indent)
b = append(b, code.escapedKey...)
b = append(b, ' ', '"')
b = appendInt(b, int64(e.ptrToInt32(ptr+code.offset)))
b = append(b, '"')
b = e.appendStructEndIndent(b, code.indent-1)
code = code.next
2021-01-11 13:05:06 +03:00
case opStructEscapedEndStringTagInt64:
2021-01-10 23:16:37 +03:00
ptr := load(ctxptr, code.headIdx)
b = e.encodeIndent(b, code.indent)
b = append(b, code.escapedKey...)
b = append(b, ' ', '"')
b = appendInt(b, e.ptrToInt64(ptr+code.offset))
b = append(b, '"')
b = e.appendStructEndIndent(b, code.indent-1)
code = code.next
2021-01-11 13:05:06 +03:00
case opStructEscapedEndStringTagUint:
2021-01-10 23:16:37 +03:00
ptr := load(ctxptr, code.headIdx)
b = e.encodeIndent(b, code.indent)
b = append(b, code.escapedKey...)
b = append(b, ' ', '"')
b = appendUint(b, uint64(e.ptrToUint(ptr+code.offset)))
b = append(b, '"')
b = e.appendStructEndIndent(b, code.indent-1)
code = code.next
2021-01-11 13:05:06 +03:00
case opStructEscapedEndStringTagUint8:
2021-01-10 23:16:37 +03:00
ptr := load(ctxptr, code.headIdx)
b = e.encodeIndent(b, code.indent)
b = append(b, code.escapedKey...)
b = append(b, ' ', '"')
b = appendUint(b, uint64(e.ptrToUint8(ptr+code.offset)))
b = append(b, '"')
b = e.appendStructEndIndent(b, code.indent-1)
code = code.next
2021-01-11 13:05:06 +03:00
case opStructEscapedEndStringTagUint16:
2021-01-10 23:16:37 +03:00
ptr := load(ctxptr, code.headIdx)
b = e.encodeIndent(b, code.indent)
b = append(b, code.escapedKey...)
b = append(b, ' ', '"')
b = appendUint(b, uint64(e.ptrToUint16(ptr+code.offset)))
b = append(b, '"')
b = e.appendStructEndIndent(b, code.indent-1)
code = code.next
2021-01-11 13:05:06 +03:00
case opStructEscapedEndStringTagUint32:
2021-01-10 23:16:37 +03:00
ptr := load(ctxptr, code.headIdx)
b = e.encodeIndent(b, code.indent)
b = append(b, code.escapedKey...)
b = append(b, ' ', '"')
b = appendUint(b, uint64(e.ptrToUint32(ptr+code.offset)))
b = append(b, '"')
b = e.appendStructEndIndent(b, code.indent-1)
code = code.next
2021-01-11 13:05:06 +03:00
case opStructEscapedEndStringTagUint64:
2021-01-10 23:16:37 +03:00
ptr := load(ctxptr, code.headIdx)
b = e.encodeIndent(b, code.indent)
b = append(b, code.escapedKey...)
b = append(b, ' ', '"')
b = appendUint(b, e.ptrToUint64(ptr+code.offset))
b = append(b, '"')
b = e.appendStructEndIndent(b, code.indent-1)
code = code.next
2021-01-11 13:05:06 +03:00
case opStructEscapedEndStringTagFloat32:
2021-01-10 23:16:37 +03:00
ptr := load(ctxptr, code.headIdx)
b = e.encodeIndent(b, code.indent)
b = append(b, code.escapedKey...)
b = append(b, ' ', '"')
b = encodeFloat32(b, e.ptrToFloat32(ptr+code.offset))
b = append(b, '"')
b = e.appendStructEndIndent(b, code.indent-1)
code = code.next
2021-01-11 13:05:06 +03:00
case opStructEscapedEndStringTagFloat64:
2021-01-10 23:16:37 +03:00
ptr := load(ctxptr, code.headIdx)
v := e.ptrToFloat64(ptr + code.offset)
if math.IsInf(v, 0) || math.IsNaN(v) {
return nil, errUnsupportedFloat(v)
}
b = e.encodeIndent(b, code.indent)
b = append(b, code.escapedKey...)
b = append(b, ' ', '"')
b = encodeFloat64(b, v)
b = append(b, '"')
b = e.appendStructEndIndent(b, code.indent-1)
code = code.next
2021-01-11 13:05:06 +03:00
case opStructEscapedEndStringTagEscapedString:
2021-01-10 23:16:37 +03:00
ptr := load(ctxptr, code.headIdx)
b = e.encodeIndent(b, code.indent)
b = append(b, code.escapedKey...)
b = append(b, ' ')
s := e.ptrToString(ptr + code.offset)
b = encodeEscapedString(b, string(encodeEscapedString([]byte{}, s)))
b = e.appendStructEndIndent(b, code.indent-1)
code = code.next
2021-01-11 13:05:06 +03:00
case opStructEscapedEndStringTagBool:
2021-01-10 23:16:37 +03:00
ptr := load(ctxptr, code.headIdx)
b = e.encodeIndent(b, code.indent)
b = append(b, code.escapedKey...)
b = append(b, ' ', '"')
b = encodeBool(b, e.ptrToBool(ptr+code.offset))
b = append(b, '"')
b = e.appendStructEndIndent(b, code.indent-1)
code = code.next
2021-01-11 13:05:06 +03:00
case opStructEscapedEndStringTagBytes:
2021-01-10 23:16:37 +03:00
ptr := load(ctxptr, code.headIdx)
b = e.encodeIndent(b, code.indent)
b = append(b, code.escapedKey...)
b = append(b, ' ')
b = encodeByteSlice(b, e.ptrToBytes(ptr+code.offset))
b = e.appendStructEndIndent(b, code.indent-1)
code = code.next
2021-01-11 13:05:06 +03:00
case opStructEscapedEndStringTagMarshalJSON:
2021-01-10 23:16:37 +03:00
ptr := load(ctxptr, code.headIdx)
b = e.encodeIndent(b, code.indent)
b = append(b, code.escapedKey...)
b = append(b, ' ')
p := ptr + code.offset
v := e.ptrToInterface(code, p)
bb, err := v.(Marshaler).MarshalJSON()
if err != nil {
return nil, errMarshaler(code, err)
}
var buf bytes.Buffer
if err := compact(&buf, bb, e.enabledHTMLEscape); err != nil {
return nil, err
}
b = encodeEscapedString(b, buf.String())
b = e.appendStructEndIndent(b, code.indent-1)
code = code.next
2021-01-11 13:05:06 +03:00
case opStructEscapedEndStringTagMarshalText:
2021-01-10 23:16:37 +03:00
ptr := load(ctxptr, code.headIdx)
b = e.encodeIndent(b, code.indent)
b = append(b, code.escapedKey...)
b = append(b, ' ')
p := ptr + code.offset
v := e.ptrToInterface(code, p)
bytes, err := v.(encoding.TextMarshaler).MarshalText()
if err != nil {
return nil, errMarshaler(code, err)
}
b = encodeEscapedString(b, *(*string)(unsafe.Pointer(&bytes)))
b = e.appendStructEndIndent(b, code.indent-1)
code = code.next
case opEnd:
goto END
}
}
END:
return b, nil
}