diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index c5d2f50..dd12494 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -5,7 +5,7 @@ jobs: name: Test strategy: matrix: - os: [ "ubuntu-latest", "macos-latest" ] + os: [ "ubuntu-latest", "macos-latest", "windows-latest" ] go-version: [ "1.13", "1.14", "1.15" ] runs-on: ${{ matrix.os }} steps: @@ -22,7 +22,6 @@ jobs: env: GOGC: 1 - name: test with race detector - if: ${{ matrix.os == 'macos-latest' }} run: go test -v -race ./ -count=1 coverage: name: Coverage diff --git a/encode.go b/encode.go index 0874e84..20e8531 100644 --- a/encode.go +++ b/encode.go @@ -194,24 +194,21 @@ func (e *Encoder) encode(header *interfaceHeader, isNil bool) ([]byte, error) { typeptr := uintptr(unsafe.Pointer(typ)) opcodeMap := loadOpcodeMap() if codeSet, exists := opcodeMap[typeptr]; exists { - var code *opcode - if e.enabledIndent { - if e.enabledHTMLEscape { - code = codeSet.escapedCodeIndent - } else { - code = codeSet.codeIndent - } - } else { - if e.enabledHTMLEscape { - code = codeSet.escapedCode - } else { - code = codeSet.code - } - } ctx := e.ctx p := uintptr(header.ptr) ctx.init(p, codeSet.codeLength) - return e.run(ctx, b, code) + + if e.enabledIndent { + if e.enabledHTMLEscape { + return e.runEscapedIndent(ctx, b, codeSet.escapedCodeIndent) + } else { + return e.runIndent(ctx, b, codeSet.codeIndent) + } + } + if e.enabledHTMLEscape { + return e.runEscaped(ctx, b, codeSet.escapedCode) + } + return e.run(ctx, b, codeSet.code) } // noescape trick for header.typ ( reflect.*rtype ) @@ -241,26 +238,17 @@ func (e *Encoder) encode(header *interfaceHeader, isNil bool) ([]byte, error) { ctx := e.ctx ctx.init(p, codeLength) - var c *opcode if e.enabledIndent { if e.enabledHTMLEscape { - c = codeSet.escapedCodeIndent + return e.runEscapedIndent(ctx, b, codeSet.escapedCodeIndent) } else { - c = codeSet.codeIndent - } - } else { - if e.enabledHTMLEscape { - c = codeSet.escapedCode - } else { - c = codeSet.code + return e.runIndent(ctx, b, codeSet.codeIndent) } } - - b, err = e.run(ctx, b, c) - if err != nil { - return nil, err + if e.enabledHTMLEscape { + return e.runEscaped(ctx, b, codeSet.escapedCode) } - return b, nil + return e.run(ctx, b, codeSet.code) } func encodeFloat32(b []byte, v float32) []byte { diff --git a/encode_vm.go b/encode_vm.go index 05009f8..ace6e73 100644 --- a/encode_vm.go +++ b/encode_vm.go @@ -58,7 +58,7 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte switch code.op { default: return nil, fmt.Errorf("failed to handle opcode. doesn't implement %s", code.op) - case opPtr, opPtrIndent: + case opPtr: ptr := load(ctxptr, code.idx) code = code.next store(ctxptr, code.idx, e.ptrToPtr(ptr)) @@ -66,210 +66,106 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte b = appendInt(b, int64(e.ptrToInt(load(ctxptr, code.idx)))) b = encodeComma(b) code = code.next - case opIntIndent: - b = appendInt(b, int64(e.ptrToInt(load(ctxptr, code.idx)))) - b = encodeIndentComma(b) - code = code.next case opInt8: b = appendInt(b, int64(e.ptrToInt8(load(ctxptr, code.idx)))) b = encodeComma(b) code = code.next - case opInt8Indent: - b = appendInt(b, int64(e.ptrToInt8(load(ctxptr, code.idx)))) - b = encodeIndentComma(b) - code = code.next case opInt16: b = appendInt(b, int64(e.ptrToInt16(load(ctxptr, code.idx)))) b = encodeComma(b) code = code.next - case opInt16Indent: - b = appendInt(b, int64(e.ptrToInt16(load(ctxptr, code.idx)))) - b = encodeIndentComma(b) - code = code.next case opInt32: b = appendInt(b, int64(e.ptrToInt32(load(ctxptr, code.idx)))) b = encodeComma(b) code = code.next - case opInt32Indent: - b = appendInt(b, int64(e.ptrToInt32(load(ctxptr, code.idx)))) - b = encodeIndentComma(b) - code = code.next case opInt64: b = appendInt(b, e.ptrToInt64(load(ctxptr, code.idx))) b = encodeComma(b) code = code.next - case opInt64Indent: - b = appendInt(b, e.ptrToInt64(load(ctxptr, code.idx))) - b = encodeIndentComma(b) - code = code.next case opUint: b = appendUint(b, uint64(e.ptrToUint(load(ctxptr, code.idx)))) b = encodeComma(b) code = code.next - case opUintIndent: - b = appendUint(b, uint64(e.ptrToUint(load(ctxptr, code.idx)))) - b = encodeIndentComma(b) - code = code.next case opUint8: b = appendUint(b, uint64(e.ptrToUint8(load(ctxptr, code.idx)))) b = encodeComma(b) code = code.next - case opUint8Indent: - b = appendUint(b, uint64(e.ptrToUint8(load(ctxptr, code.idx)))) - b = encodeIndentComma(b) - code = code.next case opUint16: b = appendUint(b, uint64(e.ptrToUint16(load(ctxptr, code.idx)))) b = encodeComma(b) code = code.next - case opUint16Indent: - b = appendUint(b, uint64(e.ptrToUint16(load(ctxptr, code.idx)))) - b = encodeIndentComma(b) - code = code.next case opUint32: b = appendUint(b, uint64(e.ptrToUint32(load(ctxptr, code.idx)))) b = encodeComma(b) code = code.next - case opUint32Indent: - b = appendUint(b, uint64(e.ptrToUint32(load(ctxptr, code.idx)))) - b = encodeIndentComma(b) - code = code.next case opUint64: b = appendUint(b, e.ptrToUint64(load(ctxptr, code.idx))) b = encodeComma(b) code = code.next - case opUint64Indent: - b = appendUint(b, e.ptrToUint64(load(ctxptr, code.idx))) - b = encodeIndentComma(b) - code = code.next case opIntString: b = append(b, '"') b = appendInt(b, int64(e.ptrToInt(load(ctxptr, code.idx)))) b = append(b, '"') b = encodeComma(b) code = code.next - case opIntStringIndent: - b = append(b, '"') - b = appendInt(b, int64(e.ptrToInt(load(ctxptr, code.idx)))) - b = append(b, '"') - b = encodeIndentComma(b) - code = code.next case opInt8String: b = append(b, '"') b = appendInt(b, int64(e.ptrToInt8(load(ctxptr, code.idx)))) b = append(b, '"') b = encodeComma(b) code = code.next - case opInt8StringIndent: - b = append(b, '"') - b = appendInt(b, int64(e.ptrToInt8(load(ctxptr, code.idx)))) - b = append(b, '"') - b = encodeIndentComma(b) - code = code.next case opInt16String: b = append(b, '"') b = appendInt(b, int64(e.ptrToInt16(load(ctxptr, code.idx)))) b = append(b, '"') b = encodeComma(b) code = code.next - case opInt16StringIndent: - b = append(b, '"') - b = appendInt(b, int64(e.ptrToInt16(load(ctxptr, code.idx)))) - b = append(b, '"') - b = encodeIndentComma(b) - code = code.next case opInt32String: b = append(b, '"') b = appendInt(b, int64(e.ptrToInt32(load(ctxptr, code.idx)))) b = append(b, '"') b = encodeComma(b) code = code.next - case opInt32StringIndent: - b = append(b, '"') - b = appendInt(b, int64(e.ptrToInt32(load(ctxptr, code.idx)))) - b = append(b, '"') - b = encodeIndentComma(b) - code = code.next case opInt64String: b = append(b, '"') b = appendInt(b, e.ptrToInt64(load(ctxptr, code.idx))) b = append(b, '"') b = encodeComma(b) code = code.next - case opInt64StringIndent: - b = append(b, '"') - b = appendInt(b, e.ptrToInt64(load(ctxptr, code.idx))) - b = append(b, '"') - b = encodeIndentComma(b) - code = code.next case opUintString: b = append(b, '"') b = appendUint(b, uint64(e.ptrToUint(load(ctxptr, code.idx)))) b = append(b, '"') b = encodeComma(b) code = code.next - case opUintStringIndent: - b = append(b, '"') - b = appendUint(b, uint64(e.ptrToUint(load(ctxptr, code.idx)))) - b = append(b, '"') - b = encodeIndentComma(b) - code = code.next case opUint8String: b = append(b, '"') b = appendUint(b, uint64(e.ptrToUint8(load(ctxptr, code.idx)))) b = append(b, '"') b = encodeComma(b) code = code.next - case opUint8StringIndent: - b = append(b, '"') - b = appendUint(b, uint64(e.ptrToUint8(load(ctxptr, code.idx)))) - b = append(b, '"') - b = encodeIndentComma(b) - code = code.next case opUint16String: b = append(b, '"') b = appendUint(b, uint64(e.ptrToUint16(load(ctxptr, code.idx)))) b = append(b, '"') b = encodeComma(b) code = code.next - case opUint16StringIndent: - b = append(b, '"') - b = appendUint(b, uint64(e.ptrToUint16(load(ctxptr, code.idx)))) - b = append(b, '"') - b = encodeIndentComma(b) - code = code.next case opUint32String: b = append(b, '"') b = appendUint(b, uint64(e.ptrToUint32(load(ctxptr, code.idx)))) b = append(b, '"') b = encodeComma(b) code = code.next - case opUint32StringIndent: - b = append(b, '"') - b = appendUint(b, uint64(e.ptrToUint32(load(ctxptr, code.idx)))) - b = append(b, '"') - b = encodeIndentComma(b) - code = code.next case opUint64String: b = append(b, '"') b = appendUint(b, e.ptrToUint64(load(ctxptr, code.idx))) b = append(b, '"') b = encodeComma(b) code = code.next - case opUint64StringIndent: - b = append(b, '"') - b = appendUint(b, e.ptrToUint64(load(ctxptr, code.idx))) - b = append(b, '"') - b = encodeIndentComma(b) - code = code.next case opFloat32: b = encodeFloat32(b, e.ptrToFloat32(load(ctxptr, code.idx))) b = encodeComma(b) code = code.next - case opFloat32Indent: - b = encodeFloat32(b, e.ptrToFloat32(load(ctxptr, code.idx))) - b = encodeIndentComma(b) - code = code.next case opFloat64: v := e.ptrToFloat64(load(ctxptr, code.idx)) if math.IsInf(v, 0) || math.IsNaN(v) { @@ -278,38 +174,14 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte b = encodeFloat64(b, v) b = encodeComma(b) code = code.next - case opFloat64Indent: - 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 case opString: b = encodeNoEscapedString(b, e.ptrToString(load(ctxptr, code.idx))) b = encodeComma(b) code = code.next - case opEscapedString: - b = encodeEscapedString(b, e.ptrToString(load(ctxptr, code.idx))) - b = encodeComma(b) - code = code.next - case opStringIndent: - b = encodeNoEscapedString(b, e.ptrToString(load(ctxptr, code.idx))) - b = encodeIndentComma(b) - code = code.next - case opEscapedStringIndent: - b = encodeEscapedString(b, e.ptrToString(load(ctxptr, code.idx))) - b = encodeIndentComma(b) - code = code.next case opBool: b = encodeBool(b, e.ptrToBool(load(ctxptr, code.idx))) b = encodeComma(b) code = code.next - case opBoolIndent: - b = encodeBool(b, e.ptrToBool(load(ctxptr, code.idx))) - b = encodeIndentComma(b) - code = code.next case opBytes: ptr := load(ctxptr, code.idx) slice := e.ptrToSlice(ptr) @@ -320,16 +192,6 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte } b = encodeComma(b) code = code.next - case opBytesIndent: - 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 case opInterface: ptr := load(ctxptr, code.idx) if ptr == 0 { @@ -373,12 +235,6 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte if err != nil { return nil, err } - if e.enabledIndent { - c = toIndent(c) - } - if e.enabledHTMLEscape { - c = toEscaped(c) - } beforeLastCode := c.beforeLastCode() lastCode := beforeLastCode.next lastCode.idx = beforeLastCode.idx + uintptrSize @@ -404,92 +260,7 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte code = c recursiveLevel++ - case opInterfaceIndent: - 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 - } - if e.enabledIndent { - c = toIndent(c) - } - if e.enabledHTMLEscape { - 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 - lastCode.op = opInterfaceEnd - lastCode.next = code.next - - code = c - recursiveLevel++ - case opInterfaceEnd, opInterfaceEndIndent: + case opInterfaceEnd: recursiveLevel-- // restore ctxptr offset := load(ctxptr, code.idx) @@ -515,31 +286,6 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte } b = append(append(b, buf.Bytes()...), ',') code = code.next - case opMarshalJSONIndent: - 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 case opMarshalText: ptr := load(ctxptr, code.idx) isPtr := code.typ.Kind() == reflect.Ptr @@ -563,35 +309,6 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte b = encodeComma(b) } code = code.next - case opMarshalTextIndent: - 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) - } - if e.enabledHTMLEscape { - b = encodeEscapedString(b, *(*string)(unsafe.Pointer(&bytes))) - } else { - b = encodeNoEscapedString(b, *(*string)(unsafe.Pointer(&bytes))) - } - b = encodeIndentComma(b) - } - code = code.next case opSliceHead: p := load(ctxptr, code.idx) slice := e.ptrToSlice(p) @@ -628,86 +345,6 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte b = encodeComma(b) code = code.end.next } - case opSliceHeadIndent: - 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 - } - } - case opRootSliceHeadIndent: - 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 - } - } - case opSliceElemIndent: - 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 - } - case opRootSliceElemIndent: - 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 - } case opArrayHead: p := load(ctxptr, code.idx) if p == 0 { @@ -740,43 +377,6 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte b = encodeComma(b) code = code.end.next } - case opArrayHeadIndent: - 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 - } - } - case opArrayElemIndent: - 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 - } case opMapHead: ptr := load(ctxptr, code.idx) if ptr == 0 { @@ -935,189 +535,12 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte b = b[:pos[0]] b = append(b, buf...) code = code.next - case opMapHeadIndent: - 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 - } - } - case opMapHeadLoadIndent: - 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 - } - } - case opMapKeyIndent: - 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 - } - } - case opMapValueIndent: - 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 - case opMapEndIndent: - // 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 - case opStructFieldPtrAnonymousHeadRecursive, opStructEscapedFieldPtrAnonymousHeadRecursive: + case opStructFieldPtrAnonymousHeadRecursive: store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) fallthrough - case opStructFieldAnonymousHeadRecursive, opStructEscapedFieldAnonymousHeadRecursive: + case opStructFieldAnonymousHeadRecursive: fallthrough - case opStructFieldRecursive, opStructEscapedFieldRecursive: + case opStructFieldRecursive: ptr := load(ctxptr, code.idx) if ptr != 0 { if recursiveLevel > startDetectingCyclesAfter { @@ -1205,40 +628,7 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte p := ptr + code.offset code = code.next store(ctxptr, code.idx, p) - case opStructEscapedFieldPtrHead: - p := load(ctxptr, code.idx) - if p == 0 { - b = encodeNull(b) - code = code.end.next - break - } - store(ctxptr, code.idx, e.ptrToPtr(p)) - fallthrough - case opStructEscapedFieldHead: - ptr := load(ctxptr, code.idx) - if ptr == 0 { - b = encodeNull(b) - b = encodeComma(b) - code = code.end.next - } else { - b = append(b, '{') - if !code.anonymousKey { - b = append(b, code.escapedKey...) - } - p := ptr + code.offset - code = code.next - store(ctxptr, code.idx, p) - } - case opStructEscapedFieldHeadOnly: - ptr := load(ctxptr, code.idx) - b = append(b, '{') - if !code.anonymousKey { - b = append(b, code.escapedKey...) - } - p := ptr + code.offset - code = code.next - store(ctxptr, code.idx, p) - case opStructFieldAnonymousHead, opStructEscapedFieldAnonymousHead: + case opStructFieldAnonymousHead: ptr := load(ctxptr, code.idx) if ptr == 0 { code = code.end.next @@ -1269,29 +659,6 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte b = appendInt(b, int64(e.ptrToInt(p))) b = encodeComma(b) code = code.next - case opStructEscapedFieldPtrHeadInt: - store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) - fallthrough - case opStructEscapedFieldHeadInt: - ptr := load(ctxptr, code.idx) - if ptr == 0 { - b = encodeNull(b) - b = encodeComma(b) - code = code.end.next - } else { - b = append(b, '{') - b = append(b, code.escapedKey...) - b = appendInt(b, int64(e.ptrToInt(ptr+code.offset))) - b = encodeComma(b) - code = code.next - } - case opStructEscapedFieldPtrHeadIntOnly, opStructEscapedFieldHeadIntOnly: - p := load(ctxptr, code.idx) - b = append(b, '{') - b = append(b, code.escapedKey...) - b = appendInt(b, int64(e.ptrToInt(p))) - b = encodeComma(b) - code = code.next case opStructFieldPtrHeadIntPtr: store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) fallthrough @@ -1335,49 +702,6 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte } b = encodeComma(b) code = code.next - case opStructEscapedFieldPtrHeadIntPtr: - store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) - fallthrough - case opStructEscapedFieldHeadIntPtr: - p := load(ctxptr, code.idx) - if p == 0 { - b = encodeNull(b) - b = encodeComma(b) - code = code.end.next - break - } else { - b = append(b, '{') - b = append(b, code.escapedKey...) - p = e.ptrToPtr(p) - if p == 0 { - b = encodeNull(b) - } else { - b = appendInt(b, int64(e.ptrToInt(p+code.offset))) - } - } - b = encodeComma(b) - code = code.next - case opStructEscapedFieldPtrHeadIntPtrOnly: - p := load(ctxptr, code.idx) - if p == 0 { - b = encodeNull(b) - b = encodeComma(b) - code = code.end.next - break - } - store(ctxptr, code.idx, e.ptrToPtr(p)) - fallthrough - case opStructEscapedFieldHeadIntPtrOnly: - p := load(ctxptr, code.idx) - b = append(b, '{') - b = append(b, code.escapedKey...) - if p == 0 { - b = encodeNull(b) - } else { - b = appendInt(b, int64(e.ptrToInt(p+code.offset))) - } - b = encodeComma(b) - code = code.next case opStructFieldHeadIntNPtr: p := load(ctxptr, code.idx) if p == 0 { @@ -1399,27 +723,6 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte } b = encodeComma(b) code = code.next - case opStructEscapedFieldHeadIntNPtr: - p := load(ctxptr, code.idx) - if p == 0 { - b = encodeNull(b) - } else { - b = append(b, '{') - b = append(b, code.escapedKey...) - 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 = encodeComma(b) - code = code.next case opStructFieldPtrAnonymousHeadInt: store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) fallthrough @@ -1433,19 +736,6 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte b = encodeComma(b) code = code.next } - case opStructEscapedFieldPtrAnonymousHeadInt: - store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) - fallthrough - case opStructEscapedFieldAnonymousHeadInt: - ptr := load(ctxptr, code.idx) - if ptr == 0 { - code = code.end.next - } else { - b = append(b, code.escapedKey...) - b = appendInt(b, int64(e.ptrToInt(ptr+code.offset))) - b = encodeComma(b) - code = code.next - } case opStructFieldPtrAnonymousHeadIntOnly, opStructFieldAnonymousHeadIntOnly: ptr := load(ctxptr, code.idx) if ptr == 0 { @@ -1456,16 +746,6 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte b = encodeComma(b) code = code.next } - case opStructEscapedFieldPtrAnonymousHeadIntOnly, opStructEscapedFieldAnonymousHeadIntOnly: - ptr := load(ctxptr, code.idx) - if ptr == 0 { - code = code.end.next - } else { - b = append(b, code.escapedKey...) - b = appendInt(b, int64(e.ptrToInt(ptr+code.offset))) - b = encodeComma(b) - code = code.next - } case opStructFieldPtrAnonymousHeadIntPtr: store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) fallthrough @@ -1484,24 +764,6 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte } b = encodeComma(b) code = code.next - case opStructEscapedFieldPtrAnonymousHeadIntPtr: - store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) - fallthrough - case opStructEscapedFieldAnonymousHeadIntPtr: - p := load(ctxptr, code.idx) - if p == 0 { - code = code.end.next - break - } - b = append(b, code.escapedKey...) - p = e.ptrToPtr(p) - if p == 0 { - b = encodeNull(b) - } else { - b = appendInt(b, int64(e.ptrToInt(p+code.offset))) - } - b = encodeComma(b) - code = code.next case opStructFieldPtrAnonymousHeadIntPtrOnly: p := load(ctxptr, code.idx) if p == 0 { @@ -1520,24 +782,6 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte } b = encodeComma(b) code = code.next - case opStructEscapedFieldPtrAnonymousHeadIntPtrOnly: - p := load(ctxptr, code.idx) - if p == 0 { - code = code.end.next - break - } - store(ctxptr, code.idx, e.ptrToPtr(p)) - fallthrough - case opStructEscapedFieldAnonymousHeadIntPtrOnly: - p := load(ctxptr, code.idx) - b = append(b, code.escapedKey...) - if p == 0 { - b = encodeNull(b) - } else { - b = appendInt(b, int64(e.ptrToInt(p+code.offset))) - } - b = encodeComma(b) - code = code.next case opStructFieldPtrHeadInt8: store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) fallthrough @@ -1561,29 +805,6 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte b = appendInt(b, int64(e.ptrToInt8(p))) b = encodeComma(b) code = code.next - case opStructEscapedFieldPtrHeadInt8: - store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) - fallthrough - case opStructEscapedFieldHeadInt8: - ptr := load(ctxptr, code.idx) - if ptr == 0 { - b = encodeNull(b) - b = encodeComma(b) - code = code.end.next - } else { - b = append(b, '{') - b = append(b, code.escapedKey...) - b = appendInt(b, int64(e.ptrToInt8(ptr+code.offset))) - b = encodeComma(b) - code = code.next - } - case opStructEscapedFieldPtrHeadInt8Only, opStructEscapedFieldHeadInt8Only: - p := load(ctxptr, code.idx) - b = append(b, '{') - b = append(b, code.escapedKey...) - b = appendInt(b, int64(e.ptrToInt8(p))) - b = encodeComma(b) - code = code.next case opStructFieldPtrHeadInt8Ptr: store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) fallthrough @@ -1627,49 +848,6 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte } b = encodeComma(b) code = code.next - case opStructEscapedFieldPtrHeadInt8Ptr: - store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) - fallthrough - case opStructEscapedFieldHeadInt8Ptr: - p := load(ctxptr, code.idx) - if p == 0 { - b = encodeNull(b) - b = encodeComma(b) - code = code.end.next - break - } else { - b = append(b, '{') - b = append(b, code.escapedKey...) - p = e.ptrToPtr(p) - if p == 0 { - b = encodeNull(b) - } else { - b = appendInt(b, int64(e.ptrToInt8(p+code.offset))) - } - } - b = encodeComma(b) - code = code.next - case opStructEscapedFieldPtrHeadInt8PtrOnly: - p := load(ctxptr, code.idx) - if p == 0 { - b = encodeNull(b) - b = encodeComma(b) - code = code.end.next - break - } - store(ctxptr, code.idx, e.ptrToPtr(p)) - fallthrough - case opStructEscapedFieldHeadInt8PtrOnly: - p := load(ctxptr, code.idx) - b = append(b, '{') - b = append(b, code.escapedKey...) - if p == 0 { - b = encodeNull(b) - } else { - b = appendInt(b, int64(e.ptrToInt8(p+code.offset))) - } - b = encodeComma(b) - code = code.next case opStructFieldPtrAnonymousHeadInt8: store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) fallthrough @@ -1683,19 +861,6 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte b = encodeComma(b) code = code.next } - case opStructEscapedFieldPtrAnonymousHeadInt8: - store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) - fallthrough - case opStructEscapedFieldAnonymousHeadInt8: - ptr := load(ctxptr, code.idx) - if ptr == 0 { - code = code.end.next - } else { - b = append(b, code.escapedKey...) - b = appendInt(b, int64(e.ptrToInt8(ptr+code.offset))) - b = encodeComma(b) - code = code.next - } case opStructFieldPtrAnonymousHeadInt8Only, opStructFieldAnonymousHeadInt8Only: ptr := load(ctxptr, code.idx) if ptr == 0 { @@ -1706,16 +871,6 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte b = encodeComma(b) code = code.next } - case opStructEscapedFieldPtrAnonymousHeadInt8Only, opStructEscapedFieldAnonymousHeadInt8Only: - ptr := load(ctxptr, code.idx) - if ptr == 0 { - code = code.end.next - } else { - b = append(b, code.escapedKey...) - b = appendInt(b, int64(e.ptrToInt8(ptr+code.offset))) - b = encodeComma(b) - code = code.next - } case opStructFieldPtrAnonymousHeadInt8Ptr: store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) fallthrough @@ -1734,24 +889,6 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte } b = encodeComma(b) code = code.next - case opStructEscapedFieldPtrAnonymousHeadInt8Ptr: - store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) - fallthrough - case opStructEscapedFieldAnonymousHeadInt8Ptr: - p := load(ctxptr, code.idx) - if p == 0 { - code = code.end.next - break - } - b = append(b, code.escapedKey...) - p = e.ptrToPtr(p) - if p == 0 { - b = encodeNull(b) - } else { - b = appendInt(b, int64(e.ptrToInt8(p+code.offset))) - } - b = encodeComma(b) - code = code.next case opStructFieldPtrAnonymousHeadInt8PtrOnly: p := load(ctxptr, code.idx) if p == 0 { @@ -1770,24 +907,6 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte } b = encodeComma(b) code = code.next - case opStructEscapedFieldPtrAnonymousHeadInt8PtrOnly: - p := load(ctxptr, code.idx) - if p == 0 { - code = code.end.next - break - } - store(ctxptr, code.idx, e.ptrToPtr(p)) - fallthrough - case opStructEscapedFieldAnonymousHeadInt8PtrOnly: - p := load(ctxptr, code.idx) - b = append(b, code.escapedKey...) - if p == 0 { - b = encodeNull(b) - } else { - b = appendInt(b, int64(e.ptrToInt8(p+code.offset))) - } - b = encodeComma(b) - code = code.next case opStructFieldPtrHeadInt16: store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) fallthrough @@ -1811,29 +930,6 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte b = appendInt(b, int64(e.ptrToInt16(p))) b = encodeComma(b) code = code.next - case opStructEscapedFieldPtrHeadInt16: - store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) - fallthrough - case opStructEscapedFieldHeadInt16: - ptr := load(ctxptr, code.idx) - if ptr == 0 { - b = encodeNull(b) - b = encodeComma(b) - code = code.end.next - } else { - b = append(b, '{') - b = append(b, code.escapedKey...) - b = appendInt(b, int64(e.ptrToInt16(ptr+code.offset))) - b = encodeComma(b) - code = code.next - } - case opStructEscapedFieldPtrHeadInt16Only, opStructEscapedFieldHeadInt16Only: - p := load(ctxptr, code.idx) - b = append(b, '{') - b = append(b, code.escapedKey...) - b = appendInt(b, int64(e.ptrToInt16(p))) - b = encodeComma(b) - code = code.next case opStructFieldPtrHeadInt16Ptr: store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) fallthrough @@ -1877,49 +973,6 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte } b = encodeComma(b) code = code.next - case opStructEscapedFieldPtrHeadInt16Ptr: - store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) - fallthrough - case opStructEscapedFieldHeadInt16Ptr: - p := load(ctxptr, code.idx) - if p == 0 { - b = encodeNull(b) - b = encodeComma(b) - code = code.end.next - break - } else { - b = append(b, '{') - b = append(b, code.escapedKey...) - p = e.ptrToPtr(p) - if p == 0 { - b = encodeNull(b) - } else { - b = appendInt(b, int64(e.ptrToInt16(p+code.offset))) - } - } - b = encodeComma(b) - code = code.next - case opStructEscapedFieldPtrHeadInt16PtrOnly: - p := load(ctxptr, code.idx) - if p == 0 { - b = encodeNull(b) - b = encodeComma(b) - code = code.end.next - break - } - store(ctxptr, code.idx, e.ptrToPtr(p)) - fallthrough - case opStructEscapedFieldHeadInt16PtrOnly: - p := load(ctxptr, code.idx) - b = append(b, '{') - b = append(b, code.escapedKey...) - if p == 0 { - b = encodeNull(b) - } else { - b = appendInt(b, int64(e.ptrToInt16(p+code.offset))) - } - b = encodeComma(b) - code = code.next case opStructFieldPtrAnonymousHeadInt16: store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) fallthrough @@ -1933,19 +986,6 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte b = encodeComma(b) code = code.next } - case opStructEscapedFieldPtrAnonymousHeadInt16: - store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) - fallthrough - case opStructEscapedFieldAnonymousHeadInt16: - ptr := load(ctxptr, code.idx) - if ptr == 0 { - code = code.end.next - } else { - b = append(b, code.escapedKey...) - b = appendInt(b, int64(e.ptrToInt16(ptr+code.offset))) - b = encodeComma(b) - code = code.next - } case opStructFieldPtrAnonymousHeadInt16Only, opStructFieldAnonymousHeadInt16Only: ptr := load(ctxptr, code.idx) if ptr == 0 { @@ -1956,16 +996,6 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte b = encodeComma(b) code = code.next } - case opStructEscapedFieldPtrAnonymousHeadInt16Only, opStructEscapedFieldAnonymousHeadInt16Only: - ptr := load(ctxptr, code.idx) - if ptr == 0 { - code = code.end.next - } else { - b = append(b, code.escapedKey...) - b = appendInt(b, int64(e.ptrToInt16(ptr+code.offset))) - b = encodeComma(b) - code = code.next - } case opStructFieldPtrAnonymousHeadInt16Ptr: store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) fallthrough @@ -1984,24 +1014,6 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte } b = encodeComma(b) code = code.next - case opStructEscapedFieldPtrAnonymousHeadInt16Ptr: - store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) - fallthrough - case opStructEscapedFieldAnonymousHeadInt16Ptr: - p := load(ctxptr, code.idx) - if p == 0 { - code = code.end.next - break - } - b = append(b, code.escapedKey...) - p = e.ptrToPtr(p) - if p == 0 { - b = encodeNull(b) - } else { - b = appendInt(b, int64(e.ptrToInt16(p+code.offset))) - } - b = encodeComma(b) - code = code.next case opStructFieldPtrAnonymousHeadInt16PtrOnly: p := load(ctxptr, code.idx) if p == 0 { @@ -2020,24 +1032,6 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte } b = encodeComma(b) code = code.next - case opStructEscapedFieldPtrAnonymousHeadInt16PtrOnly: - p := load(ctxptr, code.idx) - if p == 0 { - code = code.end.next - break - } - store(ctxptr, code.idx, e.ptrToPtr(p)) - fallthrough - case opStructEscapedFieldAnonymousHeadInt16PtrOnly: - p := load(ctxptr, code.idx) - b = append(b, code.escapedKey...) - if p == 0 { - b = encodeNull(b) - } else { - b = appendInt(b, int64(e.ptrToInt16(p+code.offset))) - } - b = encodeComma(b) - code = code.next case opStructFieldPtrHeadInt32: store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) fallthrough @@ -2061,29 +1055,6 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte b = appendInt(b, int64(e.ptrToInt32(p))) b = encodeComma(b) code = code.next - case opStructEscapedFieldPtrHeadInt32: - store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) - fallthrough - case opStructEscapedFieldHeadInt32: - ptr := load(ctxptr, code.idx) - if ptr == 0 { - b = encodeNull(b) - b = encodeComma(b) - code = code.end.next - } else { - b = append(b, '{') - b = append(b, code.escapedKey...) - b = appendInt(b, int64(e.ptrToInt32(ptr+code.offset))) - b = encodeComma(b) - code = code.next - } - case opStructEscapedFieldPtrHeadInt32Only, opStructEscapedFieldHeadInt32Only: - p := load(ctxptr, code.idx) - b = append(b, '{') - b = append(b, code.escapedKey...) - b = appendInt(b, int64(e.ptrToInt32(p))) - b = encodeComma(b) - code = code.next case opStructFieldPtrHeadInt32Ptr: store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) fallthrough @@ -2127,49 +1098,6 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte } b = encodeComma(b) code = code.next - case opStructEscapedFieldPtrHeadInt32Ptr: - store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) - fallthrough - case opStructEscapedFieldHeadInt32Ptr: - p := load(ctxptr, code.idx) - if p == 0 { - b = encodeNull(b) - b = encodeComma(b) - code = code.end.next - break - } else { - b = append(b, '{') - b = append(b, code.escapedKey...) - p = e.ptrToPtr(p) - if p == 0 { - b = encodeNull(b) - } else { - b = appendInt(b, int64(e.ptrToInt32(p+code.offset))) - } - } - b = encodeComma(b) - code = code.next - case opStructEscapedFieldPtrHeadInt32PtrOnly: - p := load(ctxptr, code.idx) - if p == 0 { - b = encodeNull(b) - b = encodeComma(b) - code = code.end.next - break - } - store(ctxptr, code.idx, e.ptrToPtr(p)) - fallthrough - case opStructEscapedFieldHeadInt32PtrOnly: - p := load(ctxptr, code.idx) - b = append(b, '{') - b = append(b, code.escapedKey...) - if p == 0 { - b = encodeNull(b) - } else { - b = appendInt(b, int64(e.ptrToInt32(p+code.offset))) - } - b = encodeComma(b) - code = code.next case opStructFieldPtrAnonymousHeadInt32: store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) fallthrough @@ -2183,19 +1111,6 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte b = encodeComma(b) code = code.next } - case opStructEscapedFieldPtrAnonymousHeadInt32: - store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) - fallthrough - case opStructEscapedFieldAnonymousHeadInt32: - ptr := load(ctxptr, code.idx) - if ptr == 0 { - code = code.end.next - } else { - b = append(b, code.escapedKey...) - b = appendInt(b, int64(e.ptrToInt32(ptr+code.offset))) - b = encodeComma(b) - code = code.next - } case opStructFieldPtrAnonymousHeadInt32Only, opStructFieldAnonymousHeadInt32Only: ptr := load(ctxptr, code.idx) if ptr == 0 { @@ -2206,16 +1121,6 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte b = encodeComma(b) code = code.next } - case opStructEscapedFieldPtrAnonymousHeadInt32Only, opStructEscapedFieldAnonymousHeadInt32Only: - ptr := load(ctxptr, code.idx) - if ptr == 0 { - code = code.end.next - } else { - b = append(b, code.escapedKey...) - b = appendInt(b, int64(e.ptrToInt32(ptr+code.offset))) - b = encodeComma(b) - code = code.next - } case opStructFieldPtrAnonymousHeadInt32Ptr: store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) fallthrough @@ -2234,24 +1139,6 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte } b = encodeComma(b) code = code.next - case opStructEscapedFieldPtrAnonymousHeadInt32Ptr: - store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) - fallthrough - case opStructEscapedFieldAnonymousHeadInt32Ptr: - p := load(ctxptr, code.idx) - if p == 0 { - code = code.end.next - break - } - b = append(b, code.escapedKey...) - p = e.ptrToPtr(p) - if p == 0 { - b = encodeNull(b) - } else { - b = appendInt(b, int64(e.ptrToInt32(p+code.offset))) - } - b = encodeComma(b) - code = code.next case opStructFieldPtrAnonymousHeadInt32PtrOnly: p := load(ctxptr, code.idx) if p == 0 { @@ -2270,24 +1157,6 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte } b = encodeComma(b) code = code.next - case opStructEscapedFieldPtrAnonymousHeadInt32PtrOnly: - p := load(ctxptr, code.idx) - if p == 0 { - code = code.end.next - break - } - store(ctxptr, code.idx, e.ptrToPtr(p)) - fallthrough - case opStructEscapedFieldAnonymousHeadInt32PtrOnly: - p := load(ctxptr, code.idx) - b = append(b, code.escapedKey...) - if p == 0 { - b = encodeNull(b) - } else { - b = appendInt(b, int64(e.ptrToInt32(p+code.offset))) - } - b = encodeComma(b) - code = code.next case opStructFieldPtrHeadInt64: store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) fallthrough @@ -2311,29 +1180,6 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte b = appendInt(b, e.ptrToInt64(p)) b = encodeComma(b) code = code.next - case opStructEscapedFieldPtrHeadInt64: - store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) - fallthrough - case opStructEscapedFieldHeadInt64: - ptr := load(ctxptr, code.idx) - if ptr == 0 { - b = encodeNull(b) - b = encodeComma(b) - code = code.end.next - } else { - b = append(b, '{') - b = append(b, code.escapedKey...) - b = appendInt(b, e.ptrToInt64(ptr+code.offset)) - b = encodeComma(b) - code = code.next - } - case opStructEscapedFieldPtrHeadInt64Only, opStructEscapedFieldHeadInt64Only: - p := load(ctxptr, code.idx) - b = append(b, '{') - b = append(b, code.escapedKey...) - b = appendInt(b, e.ptrToInt64(p)) - b = encodeComma(b) - code = code.next case opStructFieldPtrHeadInt64Ptr: store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) fallthrough @@ -2377,49 +1223,6 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte } b = encodeComma(b) code = code.next - case opStructEscapedFieldPtrHeadInt64Ptr: - store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) - fallthrough - case opStructEscapedFieldHeadInt64Ptr: - p := load(ctxptr, code.idx) - if p == 0 { - b = encodeNull(b) - b = encodeComma(b) - code = code.end.next - break - } else { - b = append(b, '{') - b = append(b, code.escapedKey...) - p = e.ptrToPtr(p) - if p == 0 { - b = encodeNull(b) - } else { - b = appendInt(b, e.ptrToInt64(p+code.offset)) - } - } - b = encodeComma(b) - code = code.next - case opStructEscapedFieldPtrHeadInt64PtrOnly: - p := load(ctxptr, code.idx) - if p == 0 { - b = encodeNull(b) - b = encodeComma(b) - code = code.end.next - break - } - store(ctxptr, code.idx, e.ptrToPtr(p)) - fallthrough - case opStructEscapedFieldHeadInt64PtrOnly: - p := load(ctxptr, code.idx) - b = append(b, '{') - b = append(b, code.escapedKey...) - if p == 0 { - b = encodeNull(b) - } else { - b = appendInt(b, e.ptrToInt64(p+code.offset)) - } - b = encodeComma(b) - code = code.next case opStructFieldPtrAnonymousHeadInt64: store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) fallthrough @@ -2433,19 +1236,6 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte b = encodeComma(b) code = code.next } - case opStructEscapedFieldPtrAnonymousHeadInt64: - store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) - fallthrough - case opStructEscapedFieldAnonymousHeadInt64: - ptr := load(ctxptr, code.idx) - if ptr == 0 { - code = code.end.next - } else { - b = append(b, code.escapedKey...) - b = appendInt(b, e.ptrToInt64(ptr+code.offset)) - b = encodeComma(b) - code = code.next - } case opStructFieldPtrAnonymousHeadInt64Only, opStructFieldAnonymousHeadInt64Only: ptr := load(ctxptr, code.idx) if ptr == 0 { @@ -2456,16 +1246,6 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte b = encodeComma(b) code = code.next } - case opStructEscapedFieldPtrAnonymousHeadInt64Only, opStructEscapedFieldAnonymousHeadInt64Only: - ptr := load(ctxptr, code.idx) - if ptr == 0 { - code = code.end.next - } else { - b = append(b, code.escapedKey...) - b = appendInt(b, e.ptrToInt64(ptr+code.offset)) - b = encodeComma(b) - code = code.next - } case opStructFieldPtrAnonymousHeadInt64Ptr: store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) fallthrough @@ -2484,24 +1264,6 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte } b = encodeComma(b) code = code.next - case opStructEscapedFieldPtrAnonymousHeadInt64Ptr: - store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) - fallthrough - case opStructEscapedFieldAnonymousHeadInt64Ptr: - p := load(ctxptr, code.idx) - if p == 0 { - code = code.end.next - break - } - b = append(b, code.escapedKey...) - p = e.ptrToPtr(p) - if p == 0 { - b = encodeNull(b) - } else { - b = appendInt(b, e.ptrToInt64(p+code.offset)) - } - b = encodeComma(b) - code = code.next case opStructFieldPtrAnonymousHeadInt64PtrOnly: p := load(ctxptr, code.idx) if p == 0 { @@ -2520,24 +1282,6 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte } b = encodeComma(b) code = code.next - case opStructEscapedFieldPtrAnonymousHeadInt64PtrOnly: - p := load(ctxptr, code.idx) - if p == 0 { - code = code.end.next - break - } - store(ctxptr, code.idx, e.ptrToPtr(p)) - fallthrough - case opStructEscapedFieldAnonymousHeadInt64PtrOnly: - p := load(ctxptr, code.idx) - b = append(b, code.escapedKey...) - if p == 0 { - b = encodeNull(b) - } else { - b = appendInt(b, e.ptrToInt64(p+code.offset)) - } - b = encodeComma(b) - code = code.next case opStructFieldPtrHeadUint: store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) fallthrough @@ -2561,29 +1305,6 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte b = appendUint(b, uint64(e.ptrToUint(p))) b = encodeComma(b) code = code.next - case opStructEscapedFieldPtrHeadUint: - store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) - fallthrough - case opStructEscapedFieldHeadUint: - ptr := load(ctxptr, code.idx) - if ptr == 0 { - b = encodeNull(b) - b = encodeComma(b) - code = code.end.next - } else { - b = append(b, '{') - b = append(b, code.escapedKey...) - b = appendUint(b, uint64(e.ptrToUint(ptr+code.offset))) - b = encodeComma(b) - code = code.next - } - case opStructEscapedFieldPtrHeadUintOnly, opStructEscapedFieldHeadUintOnly: - p := load(ctxptr, code.idx) - b = append(b, '{') - b = append(b, code.escapedKey...) - b = appendUint(b, uint64(e.ptrToUint(p))) - b = encodeComma(b) - code = code.next case opStructFieldPtrHeadUintPtr: store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) fallthrough @@ -2627,49 +1348,6 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte } b = encodeComma(b) code = code.next - case opStructEscapedFieldPtrHeadUintPtr: - store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) - fallthrough - case opStructEscapedFieldHeadUintPtr: - p := load(ctxptr, code.idx) - if p == 0 { - b = encodeNull(b) - b = encodeComma(b) - code = code.end.next - break - } else { - b = append(b, '{') - b = append(b, code.escapedKey...) - p = e.ptrToPtr(p) - if p == 0 { - b = encodeNull(b) - } else { - b = appendUint(b, uint64(e.ptrToUint(p+code.offset))) - } - } - b = encodeComma(b) - code = code.next - case opStructEscapedFieldPtrHeadUintPtrOnly: - p := load(ctxptr, code.idx) - if p == 0 { - b = encodeNull(b) - b = encodeComma(b) - code = code.end.next - break - } - store(ctxptr, code.idx, e.ptrToPtr(p)) - fallthrough - case opStructEscapedFieldHeadUintPtrOnly: - p := load(ctxptr, code.idx) - b = append(b, '{') - b = append(b, code.escapedKey...) - if p == 0 { - b = encodeNull(b) - } else { - b = appendUint(b, uint64(e.ptrToUint(p+code.offset))) - } - b = encodeComma(b) - code = code.next case opStructFieldHeadUintNPtr: p := load(ctxptr, code.idx) if p == 0 { @@ -2691,27 +1369,6 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte } b = encodeComma(b) code = code.next - case opStructEscapedFieldHeadUintNPtr: - p := load(ctxptr, code.idx) - if p == 0 { - b = encodeNull(b) - } else { - b = append(b, '{') - b = append(b, code.escapedKey...) - 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 = encodeComma(b) - code = code.next case opStructFieldPtrAnonymousHeadUint: store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) fallthrough @@ -2725,19 +1382,6 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte b = encodeComma(b) code = code.next } - case opStructEscapedFieldPtrAnonymousHeadUint: - store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) - fallthrough - case opStructEscapedFieldAnonymousHeadUint: - ptr := load(ctxptr, code.idx) - if ptr == 0 { - code = code.end.next - } else { - b = append(b, code.escapedKey...) - b = appendUint(b, uint64(e.ptrToUint(ptr+code.offset))) - b = encodeComma(b) - code = code.next - } case opStructFieldPtrAnonymousHeadUintOnly, opStructFieldAnonymousHeadUintOnly: ptr := load(ctxptr, code.idx) if ptr == 0 { @@ -2748,16 +1392,6 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte b = encodeComma(b) code = code.next } - case opStructEscapedFieldPtrAnonymousHeadUintOnly, opStructEscapedFieldAnonymousHeadUintOnly: - ptr := load(ctxptr, code.idx) - if ptr == 0 { - code = code.end.next - } else { - b = append(b, code.escapedKey...) - b = appendUint(b, uint64(e.ptrToUint(ptr+code.offset))) - b = encodeComma(b) - code = code.next - } case opStructFieldPtrAnonymousHeadUintPtr: store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) fallthrough @@ -2776,24 +1410,6 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte } b = encodeComma(b) code = code.next - case opStructEscapedFieldPtrAnonymousHeadUintPtr: - store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) - fallthrough - case opStructEscapedFieldAnonymousHeadUintPtr: - p := load(ctxptr, code.idx) - if p == 0 { - code = code.end.next - break - } - b = append(b, code.escapedKey...) - p = e.ptrToPtr(p) - if p == 0 { - b = encodeNull(b) - } else { - b = appendUint(b, uint64(e.ptrToUint(p+code.offset))) - } - b = encodeComma(b) - code = code.next case opStructFieldPtrAnonymousHeadUintPtrOnly: p := load(ctxptr, code.idx) if p == 0 { @@ -2812,24 +1428,6 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte } b = encodeComma(b) code = code.next - case opStructEscapedFieldPtrAnonymousHeadUintPtrOnly: - p := load(ctxptr, code.idx) - if p == 0 { - code = code.end.next - break - } - store(ctxptr, code.idx, e.ptrToPtr(p)) - fallthrough - case opStructEscapedFieldAnonymousHeadUintPtrOnly: - p := load(ctxptr, code.idx) - b = append(b, code.escapedKey...) - if p == 0 { - b = encodeNull(b) - } else { - b = appendUint(b, uint64(e.ptrToUint(p+code.offset))) - } - b = encodeComma(b) - code = code.next case opStructFieldPtrHeadUint8: store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) fallthrough @@ -2853,29 +1451,6 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte b = appendUint(b, uint64(e.ptrToUint8(p))) b = encodeComma(b) code = code.next - case opStructEscapedFieldPtrHeadUint8: - store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) - fallthrough - case opStructEscapedFieldHeadUint8: - ptr := load(ctxptr, code.idx) - if ptr == 0 { - b = encodeNull(b) - b = encodeComma(b) - code = code.end.next - } else { - b = append(b, '{') - b = append(b, code.escapedKey...) - b = appendUint(b, uint64(e.ptrToUint8(ptr+code.offset))) - b = encodeComma(b) - code = code.next - } - case opStructEscapedFieldPtrHeadUint8Only, opStructEscapedFieldHeadUint8Only: - p := load(ctxptr, code.idx) - b = append(b, '{') - b = append(b, code.escapedKey...) - b = appendUint(b, uint64(e.ptrToUint8(p))) - b = encodeComma(b) - code = code.next case opStructFieldPtrHeadUint8Ptr: store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) fallthrough @@ -2919,49 +1494,6 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte } b = encodeComma(b) code = code.next - case opStructEscapedFieldPtrHeadUint8Ptr: - store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) - fallthrough - case opStructEscapedFieldHeadUint8Ptr: - p := load(ctxptr, code.idx) - if p == 0 { - b = encodeNull(b) - b = encodeComma(b) - code = code.end.next - break - } else { - b = append(b, '{') - b = append(b, code.escapedKey...) - p = e.ptrToPtr(p) - if p == 0 { - b = encodeNull(b) - } else { - b = appendUint(b, uint64(e.ptrToUint8(p+code.offset))) - } - } - b = encodeComma(b) - code = code.next - case opStructEscapedFieldPtrHeadUint8PtrOnly: - p := load(ctxptr, code.idx) - if p == 0 { - b = encodeNull(b) - b = encodeComma(b) - code = code.end.next - break - } - store(ctxptr, code.idx, e.ptrToPtr(p)) - fallthrough - case opStructEscapedFieldHeadUint8PtrOnly: - p := load(ctxptr, code.idx) - b = append(b, '{') - b = append(b, code.escapedKey...) - if p == 0 { - b = encodeNull(b) - } else { - b = appendUint(b, uint64(e.ptrToUint8(p+code.offset))) - } - b = encodeComma(b) - code = code.next case opStructFieldPtrAnonymousHeadUint8: store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) fallthrough @@ -2975,19 +1507,6 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte b = encodeComma(b) code = code.next } - case opStructEscapedFieldPtrAnonymousHeadUint8: - store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) - fallthrough - case opStructEscapedFieldAnonymousHeadUint8: - ptr := load(ctxptr, code.idx) - if ptr == 0 { - code = code.end.next - } else { - b = append(b, code.escapedKey...) - b = appendUint(b, uint64(e.ptrToUint8(ptr+code.offset))) - b = encodeComma(b) - code = code.next - } case opStructFieldPtrAnonymousHeadUint8Only, opStructFieldAnonymousHeadUint8Only: ptr := load(ctxptr, code.idx) if ptr == 0 { @@ -2998,16 +1517,6 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte b = encodeComma(b) code = code.next } - case opStructEscapedFieldPtrAnonymousHeadUint8Only, opStructEscapedFieldAnonymousHeadUint8Only: - ptr := load(ctxptr, code.idx) - if ptr == 0 { - code = code.end.next - } else { - b = append(b, code.escapedKey...) - b = appendUint(b, uint64(e.ptrToUint8(ptr+code.offset))) - b = encodeComma(b) - code = code.next - } case opStructFieldPtrAnonymousHeadUint8Ptr: store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) fallthrough @@ -3026,24 +1535,6 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte } b = encodeComma(b) code = code.next - case opStructEscapedFieldPtrAnonymousHeadUint8Ptr: - store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) - fallthrough - case opStructEscapedFieldAnonymousHeadUint8Ptr: - p := load(ctxptr, code.idx) - if p == 0 { - code = code.end.next - break - } - b = append(b, code.escapedKey...) - p = e.ptrToPtr(p) - if p == 0 { - b = encodeNull(b) - } else { - b = appendUint(b, uint64(e.ptrToUint8(p+code.offset))) - } - b = encodeComma(b) - code = code.next case opStructFieldPtrAnonymousHeadUint8PtrOnly: p := load(ctxptr, code.idx) if p == 0 { @@ -3062,24 +1553,6 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte } b = encodeComma(b) code = code.next - case opStructEscapedFieldPtrAnonymousHeadUint8PtrOnly: - p := load(ctxptr, code.idx) - if p == 0 { - code = code.end.next - break - } - store(ctxptr, code.idx, e.ptrToPtr(p)) - fallthrough - case opStructEscapedFieldAnonymousHeadUint8PtrOnly: - p := load(ctxptr, code.idx) - b = append(b, code.escapedKey...) - if p == 0 { - b = encodeNull(b) - } else { - b = appendUint(b, uint64(e.ptrToUint8(p+code.offset))) - } - b = encodeComma(b) - code = code.next case opStructFieldPtrHeadUint16: store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) fallthrough @@ -3103,29 +1576,6 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte b = appendUint(b, uint64(e.ptrToUint16(p))) b = encodeComma(b) code = code.next - case opStructEscapedFieldPtrHeadUint16: - store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) - fallthrough - case opStructEscapedFieldHeadUint16: - ptr := load(ctxptr, code.idx) - if ptr == 0 { - b = encodeNull(b) - b = encodeComma(b) - code = code.end.next - } else { - b = append(b, '{') - b = append(b, code.escapedKey...) - b = appendUint(b, uint64(e.ptrToUint16(ptr+code.offset))) - b = encodeComma(b) - code = code.next - } - case opStructEscapedFieldPtrHeadUint16Only, opStructEscapedFieldHeadUint16Only: - p := load(ctxptr, code.idx) - b = append(b, '{') - b = append(b, code.escapedKey...) - b = appendUint(b, uint64(e.ptrToUint16(p))) - b = encodeComma(b) - code = code.next case opStructFieldPtrHeadUint16Ptr: store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) fallthrough @@ -3169,49 +1619,6 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte } b = encodeComma(b) code = code.next - case opStructEscapedFieldPtrHeadUint16Ptr: - store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) - fallthrough - case opStructEscapedFieldHeadUint16Ptr: - p := load(ctxptr, code.idx) - if p == 0 { - b = encodeNull(b) - b = encodeComma(b) - code = code.end.next - break - } else { - b = append(b, '{') - b = append(b, code.escapedKey...) - p = e.ptrToPtr(p) - if p == 0 { - b = encodeNull(b) - } else { - b = appendUint(b, uint64(e.ptrToUint16(p+code.offset))) - } - } - b = encodeComma(b) - code = code.next - case opStructEscapedFieldPtrHeadUint16PtrOnly: - p := load(ctxptr, code.idx) - if p == 0 { - b = encodeNull(b) - b = encodeComma(b) - code = code.end.next - break - } - store(ctxptr, code.idx, e.ptrToPtr(p)) - fallthrough - case opStructEscapedFieldHeadUint16PtrOnly: - p := load(ctxptr, code.idx) - b = append(b, '{') - b = append(b, code.escapedKey...) - if p == 0 { - b = encodeNull(b) - } else { - b = appendUint(b, uint64(e.ptrToUint16(p+code.offset))) - } - b = encodeComma(b) - code = code.next case opStructFieldPtrAnonymousHeadUint16: store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) fallthrough @@ -3225,19 +1632,6 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte b = encodeComma(b) code = code.next } - case opStructEscapedFieldPtrAnonymousHeadUint16: - store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) - fallthrough - case opStructEscapedFieldAnonymousHeadUint16: - ptr := load(ctxptr, code.idx) - if ptr == 0 { - code = code.end.next - } else { - b = append(b, code.escapedKey...) - b = appendUint(b, uint64(e.ptrToUint16(ptr+code.offset))) - b = encodeComma(b) - code = code.next - } case opStructFieldPtrAnonymousHeadUint16Only, opStructFieldAnonymousHeadUint16Only: ptr := load(ctxptr, code.idx) if ptr == 0 { @@ -3248,16 +1642,6 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte b = encodeComma(b) code = code.next } - case opStructEscapedFieldPtrAnonymousHeadUint16Only, opStructEscapedFieldAnonymousHeadUint16Only: - ptr := load(ctxptr, code.idx) - if ptr == 0 { - code = code.end.next - } else { - b = append(b, code.escapedKey...) - b = appendUint(b, uint64(e.ptrToUint16(ptr+code.offset))) - b = encodeComma(b) - code = code.next - } case opStructFieldPtrAnonymousHeadUint16Ptr: store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) fallthrough @@ -3276,24 +1660,6 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte } b = encodeComma(b) code = code.next - case opStructEscapedFieldPtrAnonymousHeadUint16Ptr: - store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) - fallthrough - case opStructEscapedFieldAnonymousHeadUint16Ptr: - p := load(ctxptr, code.idx) - if p == 0 { - code = code.end.next - break - } - b = append(b, code.escapedKey...) - p = e.ptrToPtr(p) - if p == 0 { - b = encodeNull(b) - } else { - b = appendUint(b, uint64(e.ptrToUint16(p+code.offset))) - } - b = encodeComma(b) - code = code.next case opStructFieldPtrAnonymousHeadUint16PtrOnly: p := load(ctxptr, code.idx) if p == 0 { @@ -3312,24 +1678,6 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte } b = encodeComma(b) code = code.next - case opStructEscapedFieldPtrAnonymousHeadUint16PtrOnly: - p := load(ctxptr, code.idx) - if p == 0 { - code = code.end.next - break - } - store(ctxptr, code.idx, e.ptrToPtr(p)) - fallthrough - case opStructEscapedFieldAnonymousHeadUint16PtrOnly: - p := load(ctxptr, code.idx) - b = append(b, code.escapedKey...) - if p == 0 { - b = encodeNull(b) - } else { - b = appendUint(b, uint64(e.ptrToUint16(p+code.offset))) - } - b = encodeComma(b) - code = code.next case opStructFieldPtrHeadUint32: store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) fallthrough @@ -3353,29 +1701,6 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte b = appendUint(b, uint64(e.ptrToUint32(p))) b = encodeComma(b) code = code.next - case opStructEscapedFieldPtrHeadUint32: - store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) - fallthrough - case opStructEscapedFieldHeadUint32: - ptr := load(ctxptr, code.idx) - if ptr == 0 { - b = encodeNull(b) - b = encodeComma(b) - code = code.end.next - } else { - b = append(b, '{') - b = append(b, code.escapedKey...) - b = appendUint(b, uint64(e.ptrToUint32(ptr+code.offset))) - b = encodeComma(b) - code = code.next - } - case opStructEscapedFieldPtrHeadUint32Only, opStructEscapedFieldHeadUint32Only: - p := load(ctxptr, code.idx) - b = append(b, '{') - b = append(b, code.escapedKey...) - b = appendUint(b, uint64(e.ptrToUint32(p))) - b = encodeComma(b) - code = code.next case opStructFieldPtrHeadUint32Ptr: store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) fallthrough @@ -3419,49 +1744,6 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte } b = encodeComma(b) code = code.next - case opStructEscapedFieldPtrHeadUint32Ptr: - store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) - fallthrough - case opStructEscapedFieldHeadUint32Ptr: - p := load(ctxptr, code.idx) - if p == 0 { - b = encodeNull(b) - b = encodeComma(b) - code = code.end.next - break - } else { - b = append(b, '{') - b = append(b, code.escapedKey...) - p = e.ptrToPtr(p) - if p == 0 { - b = encodeNull(b) - } else { - b = appendUint(b, uint64(e.ptrToUint32(p+code.offset))) - } - } - b = encodeComma(b) - code = code.next - case opStructEscapedFieldPtrHeadUint32PtrOnly: - p := load(ctxptr, code.idx) - if p == 0 { - b = encodeNull(b) - b = encodeComma(b) - code = code.end.next - break - } - store(ctxptr, code.idx, e.ptrToPtr(p)) - fallthrough - case opStructEscapedFieldHeadUint32PtrOnly: - p := load(ctxptr, code.idx) - b = append(b, '{') - b = append(b, code.escapedKey...) - if p == 0 { - b = encodeNull(b) - } else { - b = appendUint(b, uint64(e.ptrToUint32(p+code.offset))) - } - b = encodeComma(b) - code = code.next case opStructFieldPtrAnonymousHeadUint32: store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) fallthrough @@ -3475,19 +1757,6 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte b = encodeComma(b) code = code.next } - case opStructEscapedFieldPtrAnonymousHeadUint32: - store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) - fallthrough - case opStructEscapedFieldAnonymousHeadUint32: - ptr := load(ctxptr, code.idx) - if ptr == 0 { - code = code.end.next - } else { - b = append(b, code.escapedKey...) - b = appendUint(b, uint64(e.ptrToUint32(ptr+code.offset))) - b = encodeComma(b) - code = code.next - } case opStructFieldPtrAnonymousHeadUint32Only, opStructFieldAnonymousHeadUint32Only: ptr := load(ctxptr, code.idx) if ptr == 0 { @@ -3498,16 +1767,6 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte b = encodeComma(b) code = code.next } - case opStructEscapedFieldPtrAnonymousHeadUint32Only, opStructEscapedFieldAnonymousHeadUint32Only: - ptr := load(ctxptr, code.idx) - if ptr == 0 { - code = code.end.next - } else { - b = append(b, code.escapedKey...) - b = appendUint(b, uint64(e.ptrToUint32(ptr+code.offset))) - b = encodeComma(b) - code = code.next - } case opStructFieldPtrAnonymousHeadUint32Ptr: store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) fallthrough @@ -3526,24 +1785,6 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte } b = encodeComma(b) code = code.next - case opStructEscapedFieldPtrAnonymousHeadUint32Ptr: - store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) - fallthrough - case opStructEscapedFieldAnonymousHeadUint32Ptr: - p := load(ctxptr, code.idx) - if p == 0 { - code = code.end.next - break - } - b = append(b, code.escapedKey...) - p = e.ptrToPtr(p) - if p == 0 { - b = encodeNull(b) - } else { - b = appendUint(b, uint64(e.ptrToUint32(p+code.offset))) - } - b = encodeComma(b) - code = code.next case opStructFieldPtrAnonymousHeadUint32PtrOnly: p := load(ctxptr, code.idx) if p == 0 { @@ -3562,24 +1803,6 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte } b = encodeComma(b) code = code.next - case opStructEscapedFieldPtrAnonymousHeadUint32PtrOnly: - p := load(ctxptr, code.idx) - if p == 0 { - code = code.end.next - break - } - store(ctxptr, code.idx, e.ptrToPtr(p)) - fallthrough - case opStructEscapedFieldAnonymousHeadUint32PtrOnly: - p := load(ctxptr, code.idx) - b = append(b, code.escapedKey...) - if p == 0 { - b = encodeNull(b) - } else { - b = appendUint(b, uint64(e.ptrToUint32(p+code.offset))) - } - b = encodeComma(b) - code = code.next case opStructFieldPtrHeadUint64: store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) fallthrough @@ -3603,29 +1826,6 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte b = appendUint(b, e.ptrToUint64(p)) b = encodeComma(b) code = code.next - case opStructEscapedFieldPtrHeadUint64: - store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) - fallthrough - case opStructEscapedFieldHeadUint64: - ptr := load(ctxptr, code.idx) - if ptr == 0 { - b = encodeNull(b) - b = encodeComma(b) - code = code.end.next - } else { - b = append(b, '{') - b = append(b, code.escapedKey...) - b = appendUint(b, e.ptrToUint64(ptr+code.offset)) - b = encodeComma(b) - code = code.next - } - case opStructEscapedFieldPtrHeadUint64Only, opStructEscapedFieldHeadUint64Only: - p := load(ctxptr, code.idx) - b = append(b, '{') - b = append(b, code.escapedKey...) - b = appendUint(b, e.ptrToUint64(p)) - b = encodeComma(b) - code = code.next case opStructFieldPtrHeadUint64Ptr: store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) fallthrough @@ -3669,49 +1869,6 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte } b = encodeComma(b) code = code.next - case opStructEscapedFieldPtrHeadUint64Ptr: - store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) - fallthrough - case opStructEscapedFieldHeadUint64Ptr: - p := load(ctxptr, code.idx) - if p == 0 { - b = encodeNull(b) - b = encodeComma(b) - code = code.end.next - break - } else { - b = append(b, '{') - b = append(b, code.escapedKey...) - p = e.ptrToPtr(p) - if p == 0 { - b = encodeNull(b) - } else { - b = appendUint(b, e.ptrToUint64(p+code.offset)) - } - } - b = encodeComma(b) - code = code.next - case opStructEscapedFieldPtrHeadUint64PtrOnly: - p := load(ctxptr, code.idx) - if p == 0 { - b = encodeNull(b) - b = encodeComma(b) - code = code.end.next - break - } - store(ctxptr, code.idx, e.ptrToPtr(p)) - fallthrough - case opStructEscapedFieldHeadUint64PtrOnly: - p := load(ctxptr, code.idx) - b = append(b, '{') - b = append(b, code.escapedKey...) - if p == 0 { - b = encodeNull(b) - } else { - b = appendUint(b, e.ptrToUint64(p+code.offset)) - } - b = encodeComma(b) - code = code.next case opStructFieldPtrAnonymousHeadUint64: store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) fallthrough @@ -3725,19 +1882,6 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte b = encodeComma(b) code = code.next } - case opStructEscapedFieldPtrAnonymousHeadUint64: - store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) - fallthrough - case opStructEscapedFieldAnonymousHeadUint64: - ptr := load(ctxptr, code.idx) - if ptr == 0 { - code = code.end.next - } else { - b = append(b, code.escapedKey...) - b = appendUint(b, e.ptrToUint64(ptr+code.offset)) - b = encodeComma(b) - code = code.next - } case opStructFieldPtrAnonymousHeadUint64Only, opStructFieldAnonymousHeadUint64Only: ptr := load(ctxptr, code.idx) if ptr == 0 { @@ -3748,16 +1892,6 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte b = encodeComma(b) code = code.next } - case opStructEscapedFieldPtrAnonymousHeadUint64Only, opStructEscapedFieldAnonymousHeadUint64Only: - ptr := load(ctxptr, code.idx) - if ptr == 0 { - code = code.end.next - } else { - b = append(b, code.escapedKey...) - b = appendUint(b, e.ptrToUint64(ptr+code.offset)) - b = encodeComma(b) - code = code.next - } case opStructFieldPtrAnonymousHeadUint64Ptr: store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) fallthrough @@ -3776,24 +1910,6 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte } b = encodeComma(b) code = code.next - case opStructEscapedFieldPtrAnonymousHeadUint64Ptr: - store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) - fallthrough - case opStructEscapedFieldAnonymousHeadUint64Ptr: - p := load(ctxptr, code.idx) - if p == 0 { - code = code.end.next - break - } - b = append(b, code.escapedKey...) - p = e.ptrToPtr(p) - if p == 0 { - b = encodeNull(b) - } else { - b = appendUint(b, e.ptrToUint64(p+code.offset)) - } - b = encodeComma(b) - code = code.next case opStructFieldPtrAnonymousHeadUint64PtrOnly: p := load(ctxptr, code.idx) if p == 0 { @@ -3812,24 +1928,6 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte } b = encodeComma(b) code = code.next - case opStructEscapedFieldPtrAnonymousHeadUint64PtrOnly: - p := load(ctxptr, code.idx) - if p == 0 { - code = code.end.next - break - } - store(ctxptr, code.idx, e.ptrToPtr(p)) - fallthrough - case opStructEscapedFieldAnonymousHeadUint64PtrOnly: - p := load(ctxptr, code.idx) - b = append(b, code.escapedKey...) - if p == 0 { - b = encodeNull(b) - } else { - b = appendUint(b, e.ptrToUint64(p+code.offset)) - } - b = encodeComma(b) - code = code.next case opStructFieldPtrHeadFloat32: store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) fallthrough @@ -3853,29 +1951,6 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte b = encodeFloat32(b, e.ptrToFloat32(p)) b = encodeComma(b) code = code.next - case opStructEscapedFieldPtrHeadFloat32: - store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) - fallthrough - case opStructEscapedFieldHeadFloat32: - ptr := load(ctxptr, code.idx) - if ptr == 0 { - b = encodeNull(b) - b = encodeComma(b) - code = code.end.next - } else { - b = append(b, '{') - b = append(b, code.escapedKey...) - b = encodeFloat32(b, e.ptrToFloat32(ptr+code.offset)) - b = encodeComma(b) - code = code.next - } - case opStructEscapedFieldPtrHeadFloat32Only, opStructEscapedFieldHeadFloat32Only: - p := load(ctxptr, code.idx) - b = append(b, '{') - b = append(b, code.escapedKey...) - b = encodeFloat32(b, e.ptrToFloat32(p)) - b = encodeComma(b) - code = code.next case opStructFieldPtrHeadFloat32Ptr: store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) fallthrough @@ -3919,49 +1994,6 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte } b = encodeComma(b) code = code.next - case opStructEscapedFieldPtrHeadFloat32Ptr: - store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) - fallthrough - case opStructEscapedFieldHeadFloat32Ptr: - p := load(ctxptr, code.idx) - if p == 0 { - b = encodeNull(b) - b = encodeComma(b) - code = code.end.next - break - } else { - b = append(b, '{') - b = append(b, code.escapedKey...) - p = e.ptrToPtr(p) - if p == 0 { - b = encodeNull(b) - } else { - b = encodeFloat32(b, e.ptrToFloat32(p+code.offset)) - } - } - b = encodeComma(b) - code = code.next - case opStructEscapedFieldPtrHeadFloat32PtrOnly: - p := load(ctxptr, code.idx) - if p == 0 { - b = encodeNull(b) - b = encodeComma(b) - code = code.end.next - break - } - store(ctxptr, code.idx, e.ptrToPtr(p)) - fallthrough - case opStructEscapedFieldHeadFloat32PtrOnly: - p := load(ctxptr, code.idx) - b = append(b, '{') - b = append(b, code.escapedKey...) - if p == 0 { - b = encodeNull(b) - } else { - b = encodeFloat32(b, e.ptrToFloat32(p+code.offset)) - } - b = encodeComma(b) - code = code.next case opStructFieldPtrAnonymousHeadFloat32: store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) fallthrough @@ -3975,19 +2007,6 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte b = encodeComma(b) code = code.next } - case opStructEscapedFieldPtrAnonymousHeadFloat32: - store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) - fallthrough - case opStructEscapedFieldAnonymousHeadFloat32: - ptr := load(ctxptr, code.idx) - if ptr == 0 { - code = code.end.next - } else { - b = append(b, code.escapedKey...) - b = encodeFloat32(b, e.ptrToFloat32(ptr+code.offset)) - b = encodeComma(b) - code = code.next - } case opStructFieldPtrAnonymousHeadFloat32Only, opStructFieldAnonymousHeadFloat32Only: ptr := load(ctxptr, code.idx) if ptr == 0 { @@ -3998,16 +2017,6 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte b = encodeComma(b) code = code.next } - case opStructEscapedFieldPtrAnonymousHeadFloat32Only, opStructEscapedFieldAnonymousHeadFloat32Only: - ptr := load(ctxptr, code.idx) - if ptr == 0 { - code = code.end.next - } else { - b = append(b, code.escapedKey...) - b = encodeFloat32(b, e.ptrToFloat32(ptr+code.offset)) - b = encodeComma(b) - code = code.next - } case opStructFieldPtrAnonymousHeadFloat32Ptr: store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) fallthrough @@ -4026,24 +2035,6 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte } b = encodeComma(b) code = code.next - case opStructEscapedFieldPtrAnonymousHeadFloat32Ptr: - store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) - fallthrough - case opStructEscapedFieldAnonymousHeadFloat32Ptr: - p := load(ctxptr, code.idx) - if p == 0 { - code = code.end.next - break - } - b = append(b, code.escapedKey...) - p = e.ptrToPtr(p) - if p == 0 { - b = encodeNull(b) - } else { - b = encodeFloat32(b, e.ptrToFloat32(p+code.offset)) - } - b = encodeComma(b) - code = code.next case opStructFieldPtrAnonymousHeadFloat32PtrOnly: p := load(ctxptr, code.idx) if p == 0 { @@ -4062,24 +2053,6 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte } b = encodeComma(b) code = code.next - case opStructEscapedFieldPtrAnonymousHeadFloat32PtrOnly: - p := load(ctxptr, code.idx) - if p == 0 { - code = code.end.next - break - } - store(ctxptr, code.idx, e.ptrToPtr(p)) - fallthrough - case opStructEscapedFieldAnonymousHeadFloat32PtrOnly: - p := load(ctxptr, code.idx) - b = append(b, code.escapedKey...) - if p == 0 { - b = encodeNull(b) - } else { - b = encodeFloat32(b, e.ptrToFloat32(p+code.offset)) - } - b = encodeComma(b) - code = code.next case opStructFieldPtrHeadFloat64: store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) fallthrough @@ -4111,37 +2084,6 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte b = encodeFloat64(b, v) b = encodeComma(b) code = code.next - case opStructEscapedFieldPtrHeadFloat64: - store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) - fallthrough - case opStructEscapedFieldHeadFloat64: - ptr := load(ctxptr, code.idx) - if ptr == 0 { - b = encodeNull(b) - b = encodeComma(b) - code = code.end.next - } else { - v := e.ptrToFloat64(ptr + code.offset) - if math.IsInf(v, 0) || math.IsNaN(v) { - return nil, errUnsupportedFloat(v) - } - b = append(b, '{') - b = append(b, code.escapedKey...) - b = encodeFloat64(b, v) - b = encodeComma(b) - code = code.next - } - case opStructEscapedFieldPtrHeadFloat64Only, opStructEscapedFieldHeadFloat64Only: - p := load(ctxptr, code.idx) - b = append(b, '{') - b = append(b, code.escapedKey...) - v := e.ptrToFloat64(p) - if math.IsInf(v, 0) || math.IsNaN(v) { - return nil, errUnsupportedFloat(v) - } - b = encodeFloat64(b, v) - b = encodeComma(b) - code = code.next case opStructFieldPtrHeadFloat64Ptr: store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) fallthrough @@ -4193,57 +2135,6 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte } b = encodeComma(b) code = code.next - case opStructEscapedFieldPtrHeadFloat64Ptr: - store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) - fallthrough - case opStructEscapedFieldHeadFloat64Ptr: - p := load(ctxptr, code.idx) - if p == 0 { - b = encodeNull(b) - b = encodeComma(b) - code = code.end.next - break - } else { - b = append(b, '{') - b = append(b, code.escapedKey...) - p = e.ptrToPtr(p) - if p == 0 { - b = encodeNull(b) - } else { - v := e.ptrToFloat64(p + code.offset) - if math.IsInf(v, 0) || math.IsNaN(v) { - return nil, errUnsupportedFloat(v) - } - b = encodeFloat64(b, v) - } - } - b = encodeComma(b) - code = code.next - case opStructEscapedFieldPtrHeadFloat64PtrOnly: - p := load(ctxptr, code.idx) - if p == 0 { - b = encodeNull(b) - b = encodeComma(b) - code = code.end.next - break - } - store(ctxptr, code.idx, e.ptrToPtr(p)) - fallthrough - case opStructEscapedFieldHeadFloat64PtrOnly: - p := load(ctxptr, code.idx) - b = append(b, '{') - b = append(b, code.escapedKey...) - if p == 0 { - b = encodeNull(b) - } else { - v := e.ptrToFloat64(p + code.offset) - if math.IsInf(v, 0) || math.IsNaN(v) { - return nil, errUnsupportedFloat(v) - } - b = encodeFloat64(b, v) - } - b = encodeComma(b) - code = code.next case opStructFieldPtrAnonymousHeadFloat64: store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) fallthrough @@ -4261,23 +2152,6 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte b = encodeComma(b) code = code.next } - case opStructEscapedFieldPtrAnonymousHeadFloat64: - store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) - fallthrough - case opStructEscapedFieldAnonymousHeadFloat64: - ptr := load(ctxptr, code.idx) - if ptr == 0 { - code = code.end.next - } else { - v := e.ptrToFloat64(ptr + code.offset) - if math.IsInf(v, 0) || math.IsNaN(v) { - return nil, errUnsupportedFloat(v) - } - b = append(b, code.escapedKey...) - b = encodeFloat64(b, v) - b = encodeComma(b) - code = code.next - } case opStructFieldPtrAnonymousHeadFloat64Only, opStructFieldAnonymousHeadFloat64Only: ptr := load(ctxptr, code.idx) if ptr == 0 { @@ -4292,20 +2166,6 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte b = encodeComma(b) code = code.next } - case opStructEscapedFieldPtrAnonymousHeadFloat64Only, opStructEscapedFieldAnonymousHeadFloat64Only: - ptr := load(ctxptr, code.idx) - if ptr == 0 { - code = code.end.next - } else { - b = append(b, code.escapedKey...) - v := e.ptrToFloat64(ptr + code.offset) - if math.IsInf(v, 0) || math.IsNaN(v) { - return nil, errUnsupportedFloat(v) - } - b = encodeFloat64(b, v) - b = encodeComma(b) - code = code.next - } case opStructFieldPtrAnonymousHeadFloat64Ptr: store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) fallthrough @@ -4328,28 +2188,6 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte } b = encodeComma(b) code = code.next - case opStructEscapedFieldPtrAnonymousHeadFloat64Ptr: - store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) - fallthrough - case opStructEscapedFieldAnonymousHeadFloat64Ptr: - p := load(ctxptr, code.idx) - if p == 0 { - code = code.end.next - break - } - b = append(b, code.escapedKey...) - p = e.ptrToPtr(p) - if p == 0 { - b = encodeNull(b) - } else { - v := e.ptrToFloat64(p + code.offset) - if math.IsInf(v, 0) || math.IsNaN(v) { - return nil, errUnsupportedFloat(v) - } - b = encodeFloat64(b, v) - } - b = encodeComma(b) - code = code.next case opStructFieldPtrAnonymousHeadFloat64PtrOnly: p := load(ctxptr, code.idx) if p == 0 { @@ -4372,28 +2210,6 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte } b = encodeComma(b) code = code.next - case opStructEscapedFieldPtrAnonymousHeadFloat64PtrOnly: - p := load(ctxptr, code.idx) - if p == 0 { - code = code.end.next - break - } - store(ctxptr, code.idx, e.ptrToPtr(p)) - fallthrough - case opStructEscapedFieldAnonymousHeadFloat64PtrOnly: - p := load(ctxptr, code.idx) - b = append(b, code.escapedKey...) - if p == 0 { - b = encodeNull(b) - } else { - v := e.ptrToFloat64(p + code.offset) - if math.IsInf(v, 0) || math.IsNaN(v) { - return nil, errUnsupportedFloat(v) - } - b = encodeFloat64(b, v) - } - b = encodeComma(b) - code = code.next case opStructFieldPtrHeadString: store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) fallthrough @@ -4417,36 +2233,6 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte b = encodeNoEscapedString(b, e.ptrToString(p)) b = encodeComma(b) code = code.next - case opStructEscapedFieldPtrHeadEscapedString: - p := load(ctxptr, code.idx) - if p == 0 { - b = encodeNull(b) - b = encodeComma(b) - code = code.end.next - break - } - store(ctxptr, code.idx, e.ptrToPtr(p)) - fallthrough - case opStructEscapedFieldHeadEscapedString: - ptr := load(ctxptr, code.idx) - if ptr == 0 { - b = encodeNull(b) - b = encodeComma(b) - code = code.end.next - } else { - b = append(b, '{') - b = append(b, code.escapedKey...) - b = encodeEscapedString(b, e.ptrToString(ptr+code.offset)) - b = encodeComma(b) - code = code.next - } - case opStructEscapedFieldPtrHeadEscapedStringOnly, opStructEscapedFieldHeadEscapedStringOnly: - p := load(ctxptr, code.idx) - b = append(b, '{') - b = append(b, code.escapedKey...) - b = encodeEscapedString(b, e.ptrToString(p+code.offset)) - b = encodeComma(b) - code = code.next case opStructFieldPtrHeadStringPtr: store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) fallthrough @@ -4490,49 +2276,6 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte } b = encodeComma(b) code = code.next - case opStructEscapedFieldPtrHeadEscapedStringPtr: - store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) - fallthrough - case opStructEscapedFieldHeadEscapedStringPtr: - p := load(ctxptr, code.idx) - if p == 0 { - b = encodeNull(b) - b = encodeComma(b) - code = code.end.next - break - } else { - b = append(b, '{') - b = append(b, code.escapedKey...) - p = e.ptrToPtr(p) - if p == 0 { - b = encodeNull(b) - } else { - b = encodeEscapedString(b, e.ptrToString(p+code.offset)) - } - } - b = encodeComma(b) - code = code.next - case opStructEscapedFieldPtrHeadEscapedStringPtrOnly: - p := load(ctxptr, code.idx) - if p == 0 { - b = encodeNull(b) - b = encodeComma(b) - code = code.end.next - break - } - store(ctxptr, code.idx, e.ptrToPtr(p)) - fallthrough - case opStructEscapedFieldHeadEscapedStringPtrOnly: - p := load(ctxptr, code.idx) - b = append(b, '{') - b = append(b, code.escapedKey...) - if p == 0 { - b = encodeNull(b) - } else { - b = encodeEscapedString(b, e.ptrToString(p+code.offset)) - } - b = encodeComma(b) - code = code.next case opStructFieldPtrAnonymousHeadString: store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) fallthrough @@ -4546,19 +2289,6 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte b = encodeComma(b) code = code.next } - case opStructEscapedFieldPtrAnonymousHeadEscapedString: - store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) - fallthrough - case opStructEscapedFieldAnonymousHeadEscapedString: - ptr := load(ctxptr, code.idx) - if ptr == 0 { - code = code.end.next - } else { - b = append(b, code.escapedKey...) - b = encodeEscapedString(b, e.ptrToString(ptr+code.offset)) - b = encodeComma(b) - code = code.next - } case opStructFieldPtrAnonymousHeadStringOnly, opStructFieldAnonymousHeadStringOnly: ptr := load(ctxptr, code.idx) if ptr == 0 { @@ -4569,16 +2299,6 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte b = encodeComma(b) code = code.next } - case opStructEscapedFieldPtrAnonymousHeadEscapedStringOnly, opStructEscapedFieldAnonymousHeadEscapedStringOnly: - ptr := load(ctxptr, code.idx) - if ptr == 0 { - code = code.end.next - } else { - b = append(b, code.escapedKey...) - b = encodeEscapedString(b, e.ptrToString(ptr+code.offset)) - b = encodeComma(b) - code = code.next - } case opStructFieldPtrAnonymousHeadStringPtr: store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) fallthrough @@ -4597,24 +2317,6 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte } b = encodeComma(b) code = code.next - case opStructEscapedFieldPtrAnonymousHeadEscapedStringPtr: - store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) - fallthrough - case opStructEscapedFieldAnonymousHeadEscapedStringPtr: - p := load(ctxptr, code.idx) - if p == 0 { - code = code.end.next - break - } - b = append(b, code.escapedKey...) - p = e.ptrToPtr(p) - if p == 0 { - b = encodeNull(b) - } else { - b = encodeEscapedString(b, e.ptrToString(p+code.offset)) - } - b = encodeComma(b) - code = code.next case opStructFieldPtrAnonymousHeadStringPtrOnly: p := load(ctxptr, code.idx) if p == 0 { @@ -4633,24 +2335,6 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte } b = encodeComma(b) code = code.next - case opStructEscapedFieldPtrAnonymousHeadEscapedStringPtrOnly: - p := load(ctxptr, code.idx) - if p == 0 { - code = code.end.next - break - } - store(ctxptr, code.idx, e.ptrToPtr(p)) - fallthrough - case opStructEscapedFieldAnonymousHeadEscapedStringPtrOnly: - p := load(ctxptr, code.idx) - b = append(b, code.escapedKey...) - if p == 0 { - b = encodeNull(b) - } else { - b = encodeEscapedString(b, e.ptrToString(p+code.offset)) - } - b = encodeComma(b) - code = code.next case opStructFieldPtrHeadBool: p := load(ctxptr, code.idx) if p == 0 { @@ -4694,49 +2378,6 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte b = encodeBool(b, e.ptrToBool(ptr+code.offset)) b = encodeComma(b) code = code.next - case opStructEscapedFieldPtrHeadBool: - p := load(ctxptr, code.idx) - if p == 0 { - b = encodeNull(b) - b = encodeComma(b) - code = code.end.next - break - } - store(ctxptr, code.idx, e.ptrToPtr(p)) - fallthrough - case opStructEscapedFieldHeadBool: - ptr := load(ctxptr, code.idx) - if ptr == 0 { - if code.op == opStructEscapedFieldPtrHeadBool { - b = encodeNull(b) - b = encodeComma(b) - } else { - b = append(b, '{', '}', ',') - } - code = code.end.next - } else { - b = append(b, '{') - b = append(b, code.escapedKey...) - b = encodeBool(b, e.ptrToBool(ptr+code.offset)) - b = encodeComma(b) - code = code.next - } - case opStructEscapedFieldPtrHeadBoolOnly: - p := load(ctxptr, code.idx) - if p == 0 { - b = encodeNull(b) - b = encodeComma(b) - code = code.end.next - break - } - fallthrough - case opStructEscapedFieldHeadBoolOnly: - ptr := load(ctxptr, code.idx) - b = append(b, '{') - b = append(b, code.key...) - b = encodeBool(b, e.ptrToBool(ptr+code.offset)) - b = encodeComma(b) - code = code.next case opStructFieldPtrAnonymousHeadBool: store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) fallthrough @@ -4750,19 +2391,6 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte b = encodeComma(b) code = code.next } - case opStructEscapedFieldPtrAnonymousHeadBool: - store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) - fallthrough - case opStructEscapedFieldAnonymousHeadBool: - ptr := load(ctxptr, code.idx) - if ptr == 0 { - code = code.end.next - } else { - b = append(b, code.escapedKey...) - b = encodeBool(b, e.ptrToBool(ptr+code.offset)) - b = encodeComma(b) - code = code.next - } case opStructFieldPtrHeadBytes: p := load(ctxptr, code.idx) if p == 0 { @@ -4790,33 +2418,6 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte b = encodeComma(b) code = code.next } - case opStructEscapedFieldPtrHeadBytes: - p := load(ctxptr, code.idx) - if p == 0 { - b = encodeNull(b) - b = encodeComma(b) - code = code.end.next - break - } - store(ctxptr, code.idx, e.ptrToPtr(p)) - fallthrough - case opStructEscapedFieldHeadBytes: - ptr := load(ctxptr, code.idx) - if ptr == 0 { - if code.op == opStructEscapedFieldPtrHeadBytes { - b = encodeNull(b) - b = encodeComma(b) - } else { - b = append(b, '{', '}', ',') - } - code = code.end.next - } else { - b = append(b, '{') - b = append(b, code.escapedKey...) - b = encodeByteSlice(b, e.ptrToBytes(ptr+code.offset)) - b = encodeComma(b) - code = code.next - } case opStructFieldPtrAnonymousHeadBytes: store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) fallthrough @@ -4830,19 +2431,6 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte b = encodeComma(b) code = code.next } - case opStructEscapedFieldPtrAnonymousHeadBytes: - store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) - fallthrough - case opStructEscapedFieldAnonymousHeadBytes: - ptr := load(ctxptr, code.idx) - if ptr == 0 { - code = code.end.next - } else { - b = append(b, code.escapedKey...) - b = encodeByteSlice(b, e.ptrToBytes(ptr+code.offset)) - b = encodeComma(b) - code = code.next - } case opStructFieldPtrHeadArray: p := load(ctxptr, code.idx) if p == 0 { @@ -4871,34 +2459,6 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte code = code.next store(ctxptr, code.idx, ptr) } - case opStructEscapedFieldPtrHeadArray: - p := load(ctxptr, code.idx) - if p == 0 { - b = encodeNull(b) - b = encodeComma(b) - code = code.end.next - break - } - store(ctxptr, code.idx, e.ptrToPtr(p)) - fallthrough - case opStructEscapedFieldHeadArray: - ptr := load(ctxptr, code.idx) + code.offset - if ptr == 0 { - if code.op == opStructEscapedFieldPtrHeadArray { - b = encodeNull(b) - b = encodeComma(b) - } else { - b = append(b, '[', ']', ',') - } - code = code.end.next - } else { - b = append(b, '{') - if !code.anonymousKey { - b = append(b, code.escapedKey...) - } - code = code.next - store(ctxptr, code.idx, ptr) - } case opStructFieldPtrAnonymousHeadArray: store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) fallthrough @@ -4911,18 +2471,6 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte store(ctxptr, code.idx, ptr) code = code.next } - case opStructEscapedFieldPtrAnonymousHeadArray: - store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) - fallthrough - case opStructEscapedFieldAnonymousHeadArray: - ptr := load(ctxptr, code.idx) + code.offset - if ptr == 0 { - code = code.end.next - } else { - b = append(b, code.escapedKey...) - store(ctxptr, code.idx, ptr) - code = code.next - } case opStructFieldPtrHeadSlice: p := load(ctxptr, code.idx) if p == 0 { @@ -4952,35 +2500,6 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte code = code.next store(ctxptr, code.idx, p) } - case opStructEscapedFieldPtrHeadSlice: - p := load(ctxptr, code.idx) - if p == 0 { - b = encodeNull(b) - b = encodeComma(b) - code = code.end.next - break - } - store(ctxptr, code.idx, e.ptrToPtr(p)) - fallthrough - case opStructEscapedFieldHeadSlice: - ptr := load(ctxptr, code.idx) - p := ptr + code.offset - if p == 0 { - if code.op == opStructEscapedFieldPtrHeadSlice { - b = encodeNull(b) - b = encodeComma(b) - } else { - b = append(b, '[', ']', ',') - } - code = code.end.next - } else { - b = append(b, '{') - if !code.anonymousKey { - b = append(b, code.escapedKey...) - } - code = code.next - store(ctxptr, code.idx, p) - } case opStructFieldPtrAnonymousHeadSlice: store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) fallthrough @@ -4994,19 +2513,6 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte store(ctxptr, code.idx, p) code = code.next } - case opStructEscapedFieldPtrAnonymousHeadSlice: - store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) - fallthrough - case opStructEscapedFieldAnonymousHeadSlice: - ptr := load(ctxptr, code.idx) - p := ptr + code.offset - if p == 0 { - code = code.end.next - } else { - b = append(b, code.escapedKey...) - store(ctxptr, code.idx, p) - code = code.next - } case opStructFieldPtrHeadMarshalJSON: p := load(ctxptr, code.idx) if p == 0 { @@ -5052,51 +2558,6 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte b = encodeComma(b) code = code.next } - case opStructEscapedFieldPtrHeadMarshalJSON: - p := load(ctxptr, code.idx) - if p == 0 { - b = encodeNull(b) - b = encodeComma(b) - code = code.end.next - break - } - store(ctxptr, code.idx, e.ptrToPtr(p)) - fallthrough - case opStructEscapedFieldHeadMarshalJSON: - ptr := load(ctxptr, code.idx) - if ptr == 0 { - b = encodeNull(b) - b = encodeComma(b) - code = code.end.next - } else { - b = append(b, '{') - b = append(b, code.escapedKey...) - ptr += code.offset - v := e.ptrToInterface(code, ptr) - rv := reflect.ValueOf(v) - if rv.Type().Kind() == reflect.Interface && rv.IsNil() { - b = encodeNull(b) - code = code.end - break - } - bb, err := rv.Interface().(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 := compact(&buf, bb, e.enabledHTMLEscape); err != nil { - return nil, err - } - b = append(b, buf.Bytes()...) - b = encodeComma(b) - code = code.next - } case opStructFieldPtrAnonymousHeadMarshalJSON: store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) fallthrough @@ -5132,41 +2593,6 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte b = encodeComma(b) code = code.next } - case opStructEscapedFieldPtrAnonymousHeadMarshalJSON: - store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) - fallthrough - case opStructEscapedFieldAnonymousHeadMarshalJSON: - ptr := load(ctxptr, code.idx) - if ptr == 0 { - code = code.end.next - } else { - b = append(b, code.escapedKey...) - ptr += code.offset - v := e.ptrToInterface(code, ptr) - rv := reflect.ValueOf(v) - if rv.Type().Kind() == reflect.Interface && rv.IsNil() { - b = encodeNull(b) - code = code.end.next - break - } - bb, err := rv.Interface().(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 := compact(&buf, bb, e.enabledHTMLEscape); err != nil { - return nil, err - } - b = append(b, buf.Bytes()...) - b = encodeComma(b) - code = code.next - } case opStructFieldPtrHeadMarshalText: p := load(ctxptr, code.idx) if p == 0 { @@ -5203,42 +2629,6 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte b = encodeComma(b) code = code.next } - case opStructEscapedFieldPtrHeadMarshalText: - p := load(ctxptr, code.idx) - if p == 0 { - b = encodeNull(b) - b = encodeComma(b) - code = code.end.next - break - } - store(ctxptr, code.idx, e.ptrToPtr(p)) - fallthrough - case opStructEscapedFieldHeadMarshalText: - ptr := load(ctxptr, code.idx) - if ptr == 0 { - b = encodeNull(b) - b = encodeComma(b) - code = code.end.next - } else { - b = append(b, '{') - b = append(b, code.escapedKey...) - ptr += code.offset - v := e.ptrToInterface(code, ptr) - rv := reflect.ValueOf(v) - if rv.Type().Kind() == reflect.Interface && rv.IsNil() { - b = encodeNull(b) - b = encodeComma(b) - code = code.end - break - } - bytes, err := rv.Interface().(encoding.TextMarshaler).MarshalText() - if err != nil { - return nil, errMarshaler(code, err) - } - b = encodeEscapedString(b, *(*string)(unsafe.Pointer(&bytes))) - b = encodeComma(b) - code = code.next - } case opStructFieldPtrAnonymousHeadMarshalText: store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) fallthrough @@ -5265,4249 +2655,6 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte b = encodeComma(b) code = code.next } - case opStructEscapedFieldPtrAnonymousHeadMarshalText: - store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) - fallthrough - case opStructEscapedFieldAnonymousHeadMarshalText: - ptr := load(ctxptr, code.idx) - if ptr == 0 { - code = code.end.next - } else { - b = append(b, code.escapedKey...) - ptr += code.offset - v := e.ptrToInterface(code, ptr) - rv := reflect.ValueOf(v) - if rv.Type().Kind() == reflect.Interface && rv.IsNil() { - b = encodeNull(b) - b = encodeComma(b) - code = code.end.next - break - } - bytes, err := rv.Interface().(encoding.TextMarshaler).MarshalText() - if err != nil { - return nil, errMarshaler(code, err) - } - b = encodeEscapedString(b, *(*string)(unsafe.Pointer(&bytes))) - b = encodeComma(b) - code = code.next - } - case opStructFieldPtrHeadIndent: - p := load(ctxptr, code.idx) - if p == 0 { - b = encodeNull(b) - code = code.end.next - break - } - store(ctxptr, code.idx, e.ptrToPtr(p)) - fallthrough - case opStructFieldHeadIndent: - 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.key...) - b = append(b, ' ') - } - p := ptr + code.offset - code = code.next - store(ctxptr, code.idx, p) - } - case opStructFieldHeadOnlyIndent: - ptr := load(ctxptr, code.idx) - b = append(b, '{', '\n') - if !code.anonymousKey { - b = e.encodeIndent(b, code.indent+1) - b = append(b, code.key...) - b = append(b, ' ') - } - p := ptr + code.offset - code = code.next - store(ctxptr, code.idx, p) - case opStructEscapedFieldPtrHeadIndent: - p := load(ctxptr, code.idx) - if p == 0 { - b = encodeNull(b) - code = code.end.next - break - } - store(ctxptr, code.idx, e.ptrToPtr(p)) - fallthrough - case opStructEscapedFieldHeadIndent: - 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) - } - case opStructEscapedFieldHeadOnlyIndent: - 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) - case opStructFieldPtrHeadIntIndent: - store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) - fallthrough - case opStructFieldHeadIntIndent: - 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.key...) - b = append(b, ' ') - b = appendInt(b, int64(e.ptrToInt(ptr+code.offset))) - b = encodeIndentComma(b) - code = code.next - } - case opStructFieldPtrHeadIntOnlyIndent, opStructFieldHeadIntOnlyIndent: - p := load(ctxptr, code.idx) - b = append(b, '{', '\n') - b = e.encodeIndent(b, code.indent+1) - b = append(b, code.key...) - b = append(b, ' ') - b = appendInt(b, int64(e.ptrToInt(p))) - b = encodeIndentComma(b) - code = code.next - case opStructEscapedFieldPtrHeadIntIndent: - store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) - fallthrough - case opStructEscapedFieldHeadIntIndent: - 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 - } - case opStructEscapedFieldPtrHeadIntOnlyIndent, opStructEscapedFieldHeadIntOnlyIndent: - 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 - case opStructFieldPtrHeadIntPtrIndent: - store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) - fallthrough - case opStructFieldHeadIntPtrIndent: - 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.key...) - 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 - case opStructFieldPtrHeadIntPtrOnlyIndent: - 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 - case opStructFieldHeadIntPtrOnlyIndent: - p := load(ctxptr, code.idx) - b = append(b, '{', '\n') - b = e.encodeIndent(b, code.indent+1) - b = append(b, code.key...) - 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 - case opStructEscapedFieldPtrHeadIntPtrIndent: - store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) - fallthrough - case opStructEscapedFieldHeadIntPtrIndent: - 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 - case opStructEscapedFieldPtrHeadIntPtrOnlyIndent: - 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 - case opStructEscapedFieldHeadIntPtrOnlyIndent: - 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 - case opStructFieldHeadIntNPtrIndent: - 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.key...) - 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 - case opStructEscapedFieldHeadIntNPtrIndent: - 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 - case opStructFieldPtrAnonymousHeadIntIndent: - store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) - fallthrough - case opStructFieldAnonymousHeadIntIndent: - ptr := load(ctxptr, code.idx) - if ptr == 0 { - code = code.end.next - } else { - b = e.encodeIndent(b, code.indent) - b = append(b, code.key...) - b = append(b, ' ') - b = appendInt(b, int64(e.ptrToInt(ptr+code.offset))) - b = encodeIndentComma(b) - code = code.next - } - case opStructEscapedFieldPtrAnonymousHeadIntIndent: - store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) - fallthrough - case opStructEscapedFieldAnonymousHeadIntIndent: - 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 - } - case opStructFieldPtrAnonymousHeadIntOnlyIndent, opStructFieldAnonymousHeadIntOnlyIndent: - ptr := load(ctxptr, code.idx) - if ptr == 0 { - code = code.end.next - } else { - b = e.encodeIndent(b, code.indent) - b = append(b, code.key...) - b = append(b, ' ') - b = appendInt(b, int64(e.ptrToInt(ptr+code.offset))) - b = encodeIndentComma(b) - code = code.next - } - case opStructEscapedFieldPtrAnonymousHeadIntOnlyIndent, opStructEscapedFieldAnonymousHeadIntOnlyIndent: - 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 - } - case opStructFieldPtrAnonymousHeadIntPtrIndent: - store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) - fallthrough - case opStructFieldAnonymousHeadIntPtrIndent: - p := load(ctxptr, code.idx) - if p == 0 { - code = code.end.next - break - } - b = e.encodeIndent(b, code.indent) - b = append(b, code.key...) - 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 - case opStructEscapedFieldPtrAnonymousHeadIntPtrIndent: - store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) - fallthrough - case opStructEscapedFieldAnonymousHeadIntPtrIndent: - 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 - case opStructFieldPtrAnonymousHeadIntPtrOnlyIndent: - p := load(ctxptr, code.idx) - if p == 0 { - code = code.end.next - break - } - store(ctxptr, code.idx, e.ptrToPtr(p)) - fallthrough - case opStructFieldAnonymousHeadIntPtrOnlyIndent: - p := load(ctxptr, code.idx) - b = e.encodeIndent(b, code.indent) - b = append(b, code.key...) - 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 - case opStructEscapedFieldPtrAnonymousHeadIntPtrOnlyIndent: - p := load(ctxptr, code.idx) - if p == 0 { - code = code.end.next - break - } - store(ctxptr, code.idx, e.ptrToPtr(p)) - fallthrough - case opStructEscapedFieldAnonymousHeadIntPtrOnlyIndent: - 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 - case opStructFieldPtrHeadInt8Indent: - store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) - fallthrough - case opStructFieldHeadInt8Indent: - 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.key...) - b = append(b, ' ') - b = appendInt(b, int64(e.ptrToInt8(ptr))) - b = encodeIndentComma(b) - code = code.next - } - case opStructFieldPtrHeadInt8OnlyIndent, opStructFieldHeadInt8OnlyIndent: - p := load(ctxptr, code.idx) - b = append(b, '{', '\n') - b = e.encodeIndent(b, code.indent+1) - b = append(b, code.key...) - b = append(b, ' ') - b = appendInt(b, int64(e.ptrToInt8(p))) - b = encodeIndentComma(b) - code = code.next - case opStructEscapedFieldPtrHeadInt8Indent: - store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) - fallthrough - case opStructEscapedFieldHeadInt8Indent: - 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 - } - case opStructEscapedFieldPtrHeadInt8OnlyIndent, opStructEscapedFieldHeadInt8OnlyIndent: - 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 - case opStructFieldPtrHeadInt8PtrIndent: - store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) - fallthrough - case opStructFieldHeadInt8PtrIndent: - 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.key...) - 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 - case opStructFieldPtrHeadInt8PtrOnlyIndent: - 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 - case opStructFieldHeadInt8PtrOnlyIndent: - p := load(ctxptr, code.idx) - b = append(b, '{', '\n') - b = e.encodeIndent(b, code.indent+1) - b = append(b, code.key...) - 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 - case opStructEscapedFieldPtrHeadInt8PtrIndent: - store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) - fallthrough - case opStructEscapedFieldHeadInt8PtrIndent: - 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 - case opStructEscapedFieldPtrHeadInt8PtrOnlyIndent: - 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 - case opStructEscapedFieldHeadInt8PtrOnlyIndent: - 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 - case opStructFieldHeadInt8NPtrIndent: - 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.key...) - 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 - case opStructEscapedFieldHeadInt8NPtrIndent: - 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 - case opStructFieldPtrAnonymousHeadInt8Indent: - store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) - fallthrough - case opStructFieldAnonymousHeadInt8Indent: - ptr := load(ctxptr, code.idx) - if ptr == 0 { - code = code.end.next - } else { - b = e.encodeIndent(b, code.indent) - b = append(b, code.key...) - b = append(b, ' ') - b = appendInt(b, int64(e.ptrToInt8(ptr+code.offset))) - b = encodeIndentComma(b) - code = code.next - } - case opStructEscapedFieldPtrAnonymousHeadInt8Indent: - store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) - fallthrough - case opStructEscapedFieldAnonymousHeadInt8Indent: - 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 - } - case opStructFieldPtrAnonymousHeadInt8OnlyIndent, opStructFieldAnonymousHeadInt8OnlyIndent: - ptr := load(ctxptr, code.idx) - if ptr == 0 { - code = code.end.next - } else { - b = e.encodeIndent(b, code.indent) - b = append(b, code.key...) - b = append(b, ' ') - b = appendInt(b, int64(e.ptrToInt8(ptr+code.offset))) - b = encodeIndentComma(b) - code = code.next - } - case opStructEscapedFieldPtrAnonymousHeadInt8OnlyIndent, opStructEscapedFieldAnonymousHeadInt8OnlyIndent: - 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 - } - case opStructFieldPtrAnonymousHeadInt8PtrIndent: - store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) - fallthrough - case opStructFieldAnonymousHeadInt8PtrIndent: - p := load(ctxptr, code.idx) - if p == 0 { - code = code.end.next - break - } - b = e.encodeIndent(b, code.indent) - b = append(b, code.key...) - 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 - case opStructEscapedFieldPtrAnonymousHeadInt8PtrIndent: - store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) - fallthrough - case opStructEscapedFieldAnonymousHeadInt8PtrIndent: - 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 - case opStructFieldPtrAnonymousHeadInt8PtrOnlyIndent: - p := load(ctxptr, code.idx) - if p == 0 { - code = code.end.next - break - } - store(ctxptr, code.idx, e.ptrToPtr(p)) - fallthrough - case opStructFieldAnonymousHeadInt8PtrOnlyIndent: - p := load(ctxptr, code.idx) - b = e.encodeIndent(b, code.indent) - b = append(b, code.key...) - 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 - case opStructEscapedFieldPtrAnonymousHeadInt8PtrOnlyIndent: - p := load(ctxptr, code.idx) - if p == 0 { - code = code.end.next - break - } - store(ctxptr, code.idx, e.ptrToPtr(p)) - fallthrough - case opStructEscapedFieldAnonymousHeadInt8PtrOnlyIndent: - 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 - case opStructFieldPtrHeadInt16Indent: - store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) - fallthrough - case opStructFieldHeadInt16Indent: - 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.key...) - b = append(b, ' ') - b = appendInt(b, int64(e.ptrToInt16(ptr))) - b = encodeIndentComma(b) - code = code.next - } - case opStructFieldPtrHeadInt16OnlyIndent, opStructFieldHeadInt16OnlyIndent: - p := load(ctxptr, code.idx) - b = append(b, '{', '\n') - b = e.encodeIndent(b, code.indent+1) - b = append(b, code.key...) - b = append(b, ' ') - b = appendInt(b, int64(e.ptrToInt16(p))) - b = encodeIndentComma(b) - code = code.next - case opStructEscapedFieldPtrHeadInt16Indent: - store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) - fallthrough - case opStructEscapedFieldHeadInt16Indent: - 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 - } - case opStructEscapedFieldPtrHeadInt16OnlyIndent, opStructEscapedFieldHeadInt16OnlyIndent: - 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 - case opStructFieldPtrHeadInt16PtrIndent: - store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) - fallthrough - case opStructFieldHeadInt16PtrIndent: - 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.key...) - 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 - case opStructFieldPtrHeadInt16PtrOnlyIndent: - 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 - case opStructFieldHeadInt16PtrOnlyIndent: - p := load(ctxptr, code.idx) - b = append(b, '{', '\n') - b = e.encodeIndent(b, code.indent+1) - b = append(b, code.key...) - 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 - case opStructEscapedFieldPtrHeadInt16PtrIndent: - store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) - fallthrough - case opStructEscapedFieldHeadInt16PtrIndent: - 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 - case opStructEscapedFieldPtrHeadInt16PtrOnlyIndent: - 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 - case opStructEscapedFieldHeadInt16PtrOnlyIndent: - 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 - case opStructFieldHeadInt16NPtrIndent: - 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.key...) - 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 - case opStructEscapedFieldHeadInt16NPtrIndent: - 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 - case opStructFieldPtrAnonymousHeadInt16Indent: - store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) - fallthrough - case opStructFieldAnonymousHeadInt16Indent: - ptr := load(ctxptr, code.idx) - if ptr == 0 { - code = code.end.next - } else { - b = e.encodeIndent(b, code.indent) - b = append(b, code.key...) - b = append(b, ' ') - b = appendInt(b, int64(e.ptrToInt16(ptr+code.offset))) - b = encodeIndentComma(b) - code = code.next - } - case opStructEscapedFieldPtrAnonymousHeadInt16Indent: - store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) - fallthrough - case opStructEscapedFieldAnonymousHeadInt16Indent: - 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 - } - case opStructFieldPtrAnonymousHeadInt16OnlyIndent, opStructFieldAnonymousHeadInt16OnlyIndent: - ptr := load(ctxptr, code.idx) - if ptr == 0 { - code = code.end.next - } else { - b = e.encodeIndent(b, code.indent) - b = append(b, code.key...) - b = append(b, ' ') - b = appendInt(b, int64(e.ptrToInt16(ptr+code.offset))) - b = encodeIndentComma(b) - code = code.next - } - case opStructEscapedFieldPtrAnonymousHeadInt16OnlyIndent, opStructEscapedFieldAnonymousHeadInt16OnlyIndent: - 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 - } - case opStructFieldPtrAnonymousHeadInt16PtrIndent: - store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) - fallthrough - case opStructFieldAnonymousHeadInt16PtrIndent: - p := load(ctxptr, code.idx) - if p == 0 { - code = code.end.next - break - } - b = e.encodeIndent(b, code.indent) - b = append(b, code.key...) - 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 - case opStructEscapedFieldPtrAnonymousHeadInt16PtrIndent: - store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) - fallthrough - case opStructEscapedFieldAnonymousHeadInt16PtrIndent: - 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 - case opStructFieldPtrAnonymousHeadInt16PtrOnlyIndent: - p := load(ctxptr, code.idx) - if p == 0 { - code = code.end.next - break - } - store(ctxptr, code.idx, e.ptrToPtr(p)) - fallthrough - case opStructFieldAnonymousHeadInt16PtrOnlyIndent: - p := load(ctxptr, code.idx) - b = e.encodeIndent(b, code.indent) - b = append(b, code.key...) - 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 - case opStructEscapedFieldPtrAnonymousHeadInt16PtrOnlyIndent: - p := load(ctxptr, code.idx) - if p == 0 { - code = code.end.next - break - } - store(ctxptr, code.idx, e.ptrToPtr(p)) - fallthrough - case opStructEscapedFieldAnonymousHeadInt16PtrOnlyIndent: - 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 - case opStructFieldPtrHeadInt32Indent: - store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) - fallthrough - case opStructFieldHeadInt32Indent: - 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.key...) - b = append(b, ' ') - b = appendInt(b, int64(e.ptrToInt32(ptr))) - b = encodeIndentComma(b) - code = code.next - } - case opStructFieldPtrHeadInt32OnlyIndent, opStructFieldHeadInt32OnlyIndent: - p := load(ctxptr, code.idx) - b = append(b, '{', '\n') - b = e.encodeIndent(b, code.indent+1) - b = append(b, code.key...) - b = append(b, ' ') - b = appendInt(b, int64(e.ptrToInt32(p))) - b = encodeIndentComma(b) - code = code.next - case opStructEscapedFieldPtrHeadInt32Indent: - store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) - fallthrough - case opStructEscapedFieldHeadInt32Indent: - 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 - } - case opStructEscapedFieldPtrHeadInt32OnlyIndent, opStructEscapedFieldHeadInt32OnlyIndent: - 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 - case opStructFieldPtrHeadInt32PtrIndent: - store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) - fallthrough - case opStructFieldHeadInt32PtrIndent: - 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.key...) - 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 - case opStructFieldPtrHeadInt32PtrOnlyIndent: - 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 - case opStructFieldHeadInt32PtrOnlyIndent: - p := load(ctxptr, code.idx) - b = append(b, '{', '\n') - b = e.encodeIndent(b, code.indent+1) - b = append(b, code.key...) - 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 - case opStructEscapedFieldPtrHeadInt32PtrIndent: - store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) - fallthrough - case opStructEscapedFieldHeadInt32PtrIndent: - 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 - case opStructEscapedFieldPtrHeadInt32PtrOnlyIndent: - 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 - case opStructEscapedFieldHeadInt32PtrOnlyIndent: - 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 - case opStructFieldHeadInt32NPtrIndent: - 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.key...) - 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 - case opStructEscapedFieldHeadInt32NPtrIndent: - 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 - case opStructFieldPtrAnonymousHeadInt32Indent: - store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) - fallthrough - case opStructFieldAnonymousHeadInt32Indent: - ptr := load(ctxptr, code.idx) - if ptr == 0 { - code = code.end.next - } else { - b = e.encodeIndent(b, code.indent) - b = append(b, code.key...) - b = append(b, ' ') - b = appendInt(b, int64(e.ptrToInt32(ptr+code.offset))) - b = encodeIndentComma(b) - code = code.next - } - case opStructEscapedFieldPtrAnonymousHeadInt32Indent: - store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) - fallthrough - case opStructEscapedFieldAnonymousHeadInt32Indent: - 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 - } - case opStructFieldPtrAnonymousHeadInt32OnlyIndent, opStructFieldAnonymousHeadInt32OnlyIndent: - ptr := load(ctxptr, code.idx) - if ptr == 0 { - code = code.end.next - } else { - b = e.encodeIndent(b, code.indent) - b = append(b, code.key...) - b = append(b, ' ') - b = appendInt(b, int64(e.ptrToInt32(ptr+code.offset))) - b = encodeIndentComma(b) - code = code.next - } - case opStructEscapedFieldPtrAnonymousHeadInt32OnlyIndent, opStructEscapedFieldAnonymousHeadInt32OnlyIndent: - 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 - } - case opStructFieldPtrAnonymousHeadInt32PtrIndent: - store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) - fallthrough - case opStructFieldAnonymousHeadInt32PtrIndent: - p := load(ctxptr, code.idx) - if p == 0 { - code = code.end.next - break - } - b = e.encodeIndent(b, code.indent) - b = append(b, code.key...) - 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 - case opStructEscapedFieldPtrAnonymousHeadInt32PtrIndent: - store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) - fallthrough - case opStructEscapedFieldAnonymousHeadInt32PtrIndent: - 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 - case opStructFieldPtrAnonymousHeadInt32PtrOnlyIndent: - p := load(ctxptr, code.idx) - if p == 0 { - code = code.end.next - break - } - store(ctxptr, code.idx, e.ptrToPtr(p)) - fallthrough - case opStructFieldAnonymousHeadInt32PtrOnlyIndent: - p := load(ctxptr, code.idx) - b = e.encodeIndent(b, code.indent) - b = append(b, code.key...) - 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 - case opStructEscapedFieldPtrAnonymousHeadInt32PtrOnlyIndent: - p := load(ctxptr, code.idx) - if p == 0 { - code = code.end.next - break - } - store(ctxptr, code.idx, e.ptrToPtr(p)) - fallthrough - case opStructEscapedFieldAnonymousHeadInt32PtrOnlyIndent: - 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 - case opStructFieldPtrHeadInt64Indent: - store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) - fallthrough - case opStructFieldHeadInt64Indent: - 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.key...) - b = append(b, ' ') - b = appendInt(b, e.ptrToInt64(ptr)) - b = encodeIndentComma(b) - code = code.next - } - case opStructFieldPtrHeadInt64OnlyIndent, opStructFieldHeadInt64OnlyIndent: - p := load(ctxptr, code.idx) - b = append(b, '{', '\n') - b = e.encodeIndent(b, code.indent+1) - b = append(b, code.key...) - b = append(b, ' ') - b = appendInt(b, e.ptrToInt64(p)) - b = encodeIndentComma(b) - code = code.next - case opStructEscapedFieldPtrHeadInt64Indent: - store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) - fallthrough - case opStructEscapedFieldHeadInt64Indent: - 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 - } - case opStructEscapedFieldPtrHeadInt64OnlyIndent, opStructEscapedFieldHeadInt64OnlyIndent: - 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 - case opStructFieldPtrHeadInt64PtrIndent: - store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) - fallthrough - case opStructFieldHeadInt64PtrIndent: - 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.key...) - 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 - case opStructFieldPtrHeadInt64PtrOnlyIndent: - 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 - case opStructFieldHeadInt64PtrOnlyIndent: - p := load(ctxptr, code.idx) - b = append(b, '{', '\n') - b = e.encodeIndent(b, code.indent+1) - b = append(b, code.key...) - b = append(b, ' ') - if p == 0 { - b = encodeNull(b) - } else { - b = appendInt(b, e.ptrToInt64(p+code.offset)) - } - b = encodeIndentComma(b) - code = code.next - case opStructEscapedFieldPtrHeadInt64PtrIndent: - store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) - fallthrough - case opStructEscapedFieldHeadInt64PtrIndent: - 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 - case opStructEscapedFieldPtrHeadInt64PtrOnlyIndent: - 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 - case opStructEscapedFieldHeadInt64PtrOnlyIndent: - 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 - case opStructFieldHeadInt64NPtrIndent: - 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.key...) - 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 - case opStructEscapedFieldHeadInt64NPtrIndent: - 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 - case opStructFieldPtrAnonymousHeadInt64Indent: - store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) - fallthrough - case opStructFieldAnonymousHeadInt64Indent: - ptr := load(ctxptr, code.idx) - if ptr == 0 { - code = code.end.next - } else { - b = e.encodeIndent(b, code.indent) - b = append(b, code.key...) - b = append(b, ' ') - b = appendInt(b, e.ptrToInt64(ptr+code.offset)) - b = encodeIndentComma(b) - code = code.next - } - case opStructEscapedFieldPtrAnonymousHeadInt64Indent: - store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) - fallthrough - case opStructEscapedFieldAnonymousHeadInt64Indent: - 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 - } - case opStructFieldPtrAnonymousHeadInt64OnlyIndent, opStructFieldAnonymousHeadInt64OnlyIndent: - ptr := load(ctxptr, code.idx) - if ptr == 0 { - code = code.end.next - } else { - b = e.encodeIndent(b, code.indent) - b = append(b, code.key...) - b = append(b, ' ') - b = appendInt(b, e.ptrToInt64(ptr+code.offset)) - b = encodeIndentComma(b) - code = code.next - } - case opStructEscapedFieldPtrAnonymousHeadInt64OnlyIndent, opStructEscapedFieldAnonymousHeadInt64OnlyIndent: - 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 - } - case opStructFieldPtrAnonymousHeadInt64PtrIndent: - store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) - fallthrough - case opStructFieldAnonymousHeadInt64PtrIndent: - p := load(ctxptr, code.idx) - if p == 0 { - code = code.end.next - break - } - b = e.encodeIndent(b, code.indent) - b = append(b, code.key...) - 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 - case opStructEscapedFieldPtrAnonymousHeadInt64PtrIndent: - store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) - fallthrough - case opStructEscapedFieldAnonymousHeadInt64PtrIndent: - 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 - case opStructFieldPtrAnonymousHeadInt64PtrOnlyIndent: - p := load(ctxptr, code.idx) - if p == 0 { - code = code.end.next - break - } - store(ctxptr, code.idx, e.ptrToPtr(p)) - fallthrough - case opStructFieldAnonymousHeadInt64PtrOnlyIndent: - p := load(ctxptr, code.idx) - b = e.encodeIndent(b, code.indent) - b = append(b, code.key...) - b = append(b, ' ') - if p == 0 { - b = encodeNull(b) - } else { - b = appendInt(b, e.ptrToInt64(p+code.offset)) - } - b = encodeIndentComma(b) - code = code.next - case opStructEscapedFieldPtrAnonymousHeadInt64PtrOnlyIndent: - p := load(ctxptr, code.idx) - if p == 0 { - code = code.end.next - break - } - store(ctxptr, code.idx, e.ptrToPtr(p)) - fallthrough - case opStructEscapedFieldAnonymousHeadInt64PtrOnlyIndent: - 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 - - case opStructFieldPtrHeadUintIndent: - store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) - fallthrough - case opStructFieldHeadUintIndent: - 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.key...) - b = append(b, ' ') - b = appendUint(b, uint64(e.ptrToUint(ptr+code.offset))) - b = encodeIndentComma(b) - code = code.next - } - case opStructFieldPtrHeadUintOnlyIndent, opStructFieldHeadUintOnlyIndent: - p := load(ctxptr, code.idx) - b = append(b, '{', '\n') - b = e.encodeIndent(b, code.indent+1) - b = append(b, code.key...) - b = append(b, ' ') - b = appendUint(b, uint64(e.ptrToUint(p))) - b = encodeIndentComma(b) - code = code.next - case opStructEscapedFieldPtrHeadUintIndent: - store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) - fallthrough - case opStructEscapedFieldHeadUintIndent: - 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 - } - case opStructEscapedFieldPtrHeadUintOnlyIndent, opStructEscapedFieldHeadUintOnlyIndent: - 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 - case opStructFieldPtrHeadUintPtrIndent: - store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) - fallthrough - case opStructFieldHeadUintPtrIndent: - 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.key...) - 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 - case opStructFieldPtrHeadUintPtrOnlyIndent: - 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 - case opStructFieldHeadUintPtrOnlyIndent: - p := load(ctxptr, code.idx) - b = append(b, '{', '\n') - b = e.encodeIndent(b, code.indent+1) - b = append(b, code.key...) - 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 - case opStructEscapedFieldPtrHeadUintPtrIndent: - store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) - fallthrough - case opStructEscapedFieldHeadUintPtrIndent: - 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 - case opStructEscapedFieldPtrHeadUintPtrOnlyIndent: - 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 - case opStructEscapedFieldHeadUintPtrOnlyIndent: - 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 - case opStructFieldHeadUintNPtrIndent: - 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.key...) - 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 - case opStructEscapedFieldHeadUintNPtrIndent: - 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 - case opStructFieldPtrAnonymousHeadUintIndent: - store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) - fallthrough - case opStructFieldAnonymousHeadUintIndent: - ptr := load(ctxptr, code.idx) - if ptr == 0 { - code = code.end.next - } else { - b = e.encodeIndent(b, code.indent) - b = append(b, code.key...) - b = append(b, ' ') - b = appendUint(b, uint64(e.ptrToUint(ptr+code.offset))) - b = encodeIndentComma(b) - code = code.next - } - case opStructEscapedFieldPtrAnonymousHeadUintIndent: - store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) - fallthrough - case opStructEscapedFieldAnonymousHeadUintIndent: - 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 - } - case opStructFieldPtrAnonymousHeadUintOnlyIndent, opStructFieldAnonymousHeadUintOnlyIndent: - ptr := load(ctxptr, code.idx) - if ptr == 0 { - code = code.end.next - } else { - b = e.encodeIndent(b, code.indent) - b = append(b, code.key...) - b = append(b, ' ') - b = appendUint(b, uint64(e.ptrToUint(ptr+code.offset))) - b = encodeIndentComma(b) - code = code.next - } - case opStructEscapedFieldPtrAnonymousHeadUintOnlyIndent, opStructEscapedFieldAnonymousHeadUintOnlyIndent: - 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 - } - case opStructFieldPtrAnonymousHeadUintPtrIndent: - store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) - fallthrough - case opStructFieldAnonymousHeadUintPtrIndent: - p := load(ctxptr, code.idx) - if p == 0 { - code = code.end.next - break - } - b = e.encodeIndent(b, code.indent) - b = append(b, code.key...) - 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 - case opStructEscapedFieldPtrAnonymousHeadUintPtrIndent: - store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) - fallthrough - case opStructEscapedFieldAnonymousHeadUintPtrIndent: - 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 - case opStructFieldPtrAnonymousHeadUintPtrOnlyIndent: - p := load(ctxptr, code.idx) - if p == 0 { - code = code.end.next - break - } - store(ctxptr, code.idx, e.ptrToPtr(p)) - fallthrough - case opStructFieldAnonymousHeadUintPtrOnlyIndent: - p := load(ctxptr, code.idx) - b = e.encodeIndent(b, code.indent) - b = append(b, code.key...) - 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 - case opStructEscapedFieldPtrAnonymousHeadUintPtrOnlyIndent: - p := load(ctxptr, code.idx) - if p == 0 { - code = code.end.next - break - } - store(ctxptr, code.idx, e.ptrToPtr(p)) - fallthrough - case opStructEscapedFieldAnonymousHeadUintPtrOnlyIndent: - 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 - case opStructFieldPtrHeadUint8Indent: - store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) - fallthrough - case opStructFieldHeadUint8Indent: - 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.key...) - b = append(b, ' ') - b = appendUint(b, uint64(e.ptrToUint8(ptr))) - b = encodeIndentComma(b) - code = code.next - } - case opStructFieldPtrHeadUint8OnlyIndent, opStructFieldHeadUint8OnlyIndent: - p := load(ctxptr, code.idx) - b = append(b, '{', '\n') - b = e.encodeIndent(b, code.indent+1) - b = append(b, code.key...) - b = append(b, ' ') - b = appendUint(b, uint64(e.ptrToUint8(p))) - b = encodeIndentComma(b) - code = code.next - case opStructEscapedFieldPtrHeadUint8Indent: - store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) - fallthrough - case opStructEscapedFieldHeadUint8Indent: - 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 - } - case opStructEscapedFieldPtrHeadUint8OnlyIndent, opStructEscapedFieldHeadUint8OnlyIndent: - 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 - case opStructFieldPtrHeadUint8PtrIndent: - store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) - fallthrough - case opStructFieldHeadUint8PtrIndent: - 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.key...) - 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 - case opStructFieldPtrHeadUint8PtrOnlyIndent: - 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 - case opStructFieldHeadUint8PtrOnlyIndent: - p := load(ctxptr, code.idx) - b = append(b, '{', '\n') - b = e.encodeIndent(b, code.indent+1) - b = append(b, code.key...) - 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 - case opStructEscapedFieldPtrHeadUint8PtrIndent: - store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) - fallthrough - case opStructEscapedFieldHeadUint8PtrIndent: - 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 - case opStructEscapedFieldPtrHeadUint8PtrOnlyIndent: - 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 - case opStructEscapedFieldHeadUint8PtrOnlyIndent: - 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 - case opStructFieldHeadUint8NPtrIndent: - 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.key...) - 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 - case opStructEscapedFieldHeadUint8NPtrIndent: - 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 - case opStructFieldPtrAnonymousHeadUint8Indent: - store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) - fallthrough - case opStructFieldAnonymousHeadUint8Indent: - ptr := load(ctxptr, code.idx) - if ptr == 0 { - code = code.end.next - } else { - b = e.encodeIndent(b, code.indent) - b = append(b, code.key...) - b = append(b, ' ') - b = appendUint(b, uint64(e.ptrToUint8(ptr+code.offset))) - b = encodeIndentComma(b) - code = code.next - } - case opStructEscapedFieldPtrAnonymousHeadUint8Indent: - store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) - fallthrough - case opStructEscapedFieldAnonymousHeadUint8Indent: - 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 - } - case opStructFieldPtrAnonymousHeadUint8OnlyIndent, opStructFieldAnonymousHeadUint8OnlyIndent: - ptr := load(ctxptr, code.idx) - if ptr == 0 { - code = code.end.next - } else { - b = e.encodeIndent(b, code.indent) - b = append(b, code.key...) - b = append(b, ' ') - b = appendUint(b, uint64(e.ptrToUint8(ptr+code.offset))) - b = encodeIndentComma(b) - code = code.next - } - case opStructEscapedFieldPtrAnonymousHeadUint8OnlyIndent, opStructEscapedFieldAnonymousHeadUint8OnlyIndent: - 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 - } - case opStructFieldPtrAnonymousHeadUint8PtrIndent: - store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) - fallthrough - case opStructFieldAnonymousHeadUint8PtrIndent: - p := load(ctxptr, code.idx) - if p == 0 { - code = code.end.next - break - } - b = e.encodeIndent(b, code.indent) - b = append(b, code.key...) - 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 - case opStructEscapedFieldPtrAnonymousHeadUint8PtrIndent: - store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) - fallthrough - case opStructEscapedFieldAnonymousHeadUint8PtrIndent: - 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 - case opStructFieldPtrAnonymousHeadUint8PtrOnlyIndent: - p := load(ctxptr, code.idx) - if p == 0 { - code = code.end.next - break - } - store(ctxptr, code.idx, e.ptrToPtr(p)) - fallthrough - case opStructFieldAnonymousHeadUint8PtrOnlyIndent: - p := load(ctxptr, code.idx) - b = e.encodeIndent(b, code.indent) - b = append(b, code.key...) - 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 - case opStructEscapedFieldPtrAnonymousHeadUint8PtrOnlyIndent: - p := load(ctxptr, code.idx) - if p == 0 { - code = code.end.next - break - } - store(ctxptr, code.idx, e.ptrToPtr(p)) - fallthrough - case opStructEscapedFieldAnonymousHeadUint8PtrOnlyIndent: - 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 - case opStructFieldPtrHeadUint16Indent: - store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) - fallthrough - case opStructFieldHeadUint16Indent: - 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.key...) - b = append(b, ' ') - b = appendUint(b, uint64(e.ptrToUint16(ptr))) - b = encodeIndentComma(b) - code = code.next - } - case opStructFieldPtrHeadUint16OnlyIndent, opStructFieldHeadUint16OnlyIndent: - p := load(ctxptr, code.idx) - b = append(b, '{', '\n') - b = e.encodeIndent(b, code.indent+1) - b = append(b, code.key...) - b = append(b, ' ') - b = appendUint(b, uint64(e.ptrToUint16(p))) - b = encodeIndentComma(b) - code = code.next - case opStructEscapedFieldPtrHeadUint16Indent: - store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) - fallthrough - case opStructEscapedFieldHeadUint16Indent: - 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 - } - case opStructEscapedFieldPtrHeadUint16OnlyIndent, opStructEscapedFieldHeadUint16OnlyIndent: - 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 - case opStructFieldPtrHeadUint16PtrIndent: - store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) - fallthrough - case opStructFieldHeadUint16PtrIndent: - 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.key...) - 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 - case opStructFieldPtrHeadUint16PtrOnlyIndent: - 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 - case opStructFieldHeadUint16PtrOnlyIndent: - p := load(ctxptr, code.idx) - b = append(b, '{', '\n') - b = e.encodeIndent(b, code.indent+1) - b = append(b, code.key...) - 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 - case opStructEscapedFieldPtrHeadUint16PtrIndent: - store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) - fallthrough - case opStructEscapedFieldHeadUint16PtrIndent: - 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 - case opStructEscapedFieldPtrHeadUint16PtrOnlyIndent: - 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 - case opStructEscapedFieldHeadUint16PtrOnlyIndent: - 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 - case opStructFieldHeadUint16NPtrIndent: - 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.key...) - 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 - case opStructEscapedFieldHeadUint16NPtrIndent: - 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 - case opStructFieldPtrAnonymousHeadUint16Indent: - store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) - fallthrough - case opStructFieldAnonymousHeadUint16Indent: - ptr := load(ctxptr, code.idx) - if ptr == 0 { - code = code.end.next - } else { - b = e.encodeIndent(b, code.indent) - b = append(b, code.key...) - b = append(b, ' ') - b = appendUint(b, uint64(e.ptrToUint16(ptr+code.offset))) - b = encodeIndentComma(b) - code = code.next - } - case opStructEscapedFieldPtrAnonymousHeadUint16Indent: - store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) - fallthrough - case opStructEscapedFieldAnonymousHeadUint16Indent: - 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 - } - case opStructFieldPtrAnonymousHeadUint16OnlyIndent, opStructFieldAnonymousHeadUint16OnlyIndent: - ptr := load(ctxptr, code.idx) - if ptr == 0 { - code = code.end.next - } else { - b = e.encodeIndent(b, code.indent) - b = append(b, code.key...) - b = append(b, ' ') - b = appendUint(b, uint64(e.ptrToUint16(ptr+code.offset))) - b = encodeIndentComma(b) - code = code.next - } - case opStructEscapedFieldPtrAnonymousHeadUint16OnlyIndent, opStructEscapedFieldAnonymousHeadUint16OnlyIndent: - 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 - } - case opStructFieldPtrAnonymousHeadUint16PtrIndent: - store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) - fallthrough - case opStructFieldAnonymousHeadUint16PtrIndent: - p := load(ctxptr, code.idx) - if p == 0 { - code = code.end.next - break - } - b = e.encodeIndent(b, code.indent) - b = append(b, code.key...) - 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 - case opStructEscapedFieldPtrAnonymousHeadUint16PtrIndent: - store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) - fallthrough - case opStructEscapedFieldAnonymousHeadUint16PtrIndent: - 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 - case opStructFieldPtrAnonymousHeadUint16PtrOnlyIndent: - p := load(ctxptr, code.idx) - if p == 0 { - code = code.end.next - break - } - store(ctxptr, code.idx, e.ptrToPtr(p)) - fallthrough - case opStructFieldAnonymousHeadUint16PtrOnlyIndent: - p := load(ctxptr, code.idx) - b = e.encodeIndent(b, code.indent) - b = append(b, code.key...) - 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 - case opStructEscapedFieldPtrAnonymousHeadUint16PtrOnlyIndent: - p := load(ctxptr, code.idx) - if p == 0 { - code = code.end.next - break - } - store(ctxptr, code.idx, e.ptrToPtr(p)) - fallthrough - case opStructEscapedFieldAnonymousHeadUint16PtrOnlyIndent: - 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 - case opStructFieldPtrHeadUint32Indent: - store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) - fallthrough - case opStructFieldHeadUint32Indent: - 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.key...) - b = append(b, ' ') - b = appendUint(b, uint64(e.ptrToUint32(ptr))) - b = encodeIndentComma(b) - code = code.next - } - case opStructFieldPtrHeadUint32OnlyIndent, opStructFieldHeadUint32OnlyIndent: - p := load(ctxptr, code.idx) - b = append(b, '{', '\n') - b = e.encodeIndent(b, code.indent+1) - b = append(b, code.key...) - b = append(b, ' ') - b = appendUint(b, uint64(e.ptrToUint32(p))) - b = encodeIndentComma(b) - code = code.next - case opStructEscapedFieldPtrHeadUint32Indent: - store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) - fallthrough - case opStructEscapedFieldHeadUint32Indent: - 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 - } - case opStructEscapedFieldPtrHeadUint32OnlyIndent, opStructEscapedFieldHeadUint32OnlyIndent: - 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 - case opStructFieldPtrHeadUint32PtrIndent: - store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) - fallthrough - case opStructFieldHeadUint32PtrIndent: - 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.key...) - 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 - case opStructFieldPtrHeadUint32PtrOnlyIndent: - 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 - case opStructFieldHeadUint32PtrOnlyIndent: - p := load(ctxptr, code.idx) - b = append(b, '{', '\n') - b = e.encodeIndent(b, code.indent+1) - b = append(b, code.key...) - 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 - case opStructEscapedFieldPtrHeadUint32PtrIndent: - store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) - fallthrough - case opStructEscapedFieldHeadUint32PtrIndent: - 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 - case opStructEscapedFieldPtrHeadUint32PtrOnlyIndent: - 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 - case opStructEscapedFieldHeadUint32PtrOnlyIndent: - 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 - case opStructFieldHeadUint32NPtrIndent: - 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.key...) - 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 - case opStructEscapedFieldHeadUint32NPtrIndent: - 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 - case opStructFieldPtrAnonymousHeadUint32Indent: - store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) - fallthrough - case opStructFieldAnonymousHeadUint32Indent: - ptr := load(ctxptr, code.idx) - if ptr == 0 { - code = code.end.next - } else { - b = e.encodeIndent(b, code.indent) - b = append(b, code.key...) - b = append(b, ' ') - b = appendUint(b, uint64(e.ptrToUint32(ptr+code.offset))) - b = encodeIndentComma(b) - code = code.next - } - case opStructEscapedFieldPtrAnonymousHeadUint32Indent: - store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) - fallthrough - case opStructEscapedFieldAnonymousHeadUint32Indent: - 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 - } - case opStructFieldPtrAnonymousHeadUint32OnlyIndent, opStructFieldAnonymousHeadUint32OnlyIndent: - ptr := load(ctxptr, code.idx) - if ptr == 0 { - code = code.end.next - } else { - b = e.encodeIndent(b, code.indent) - b = append(b, code.key...) - b = append(b, ' ') - b = appendUint(b, uint64(e.ptrToUint32(ptr+code.offset))) - b = encodeIndentComma(b) - code = code.next - } - case opStructEscapedFieldPtrAnonymousHeadUint32OnlyIndent, opStructEscapedFieldAnonymousHeadUint32OnlyIndent: - 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 - } - case opStructFieldPtrAnonymousHeadUint32PtrIndent: - store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) - fallthrough - case opStructFieldAnonymousHeadUint32PtrIndent: - p := load(ctxptr, code.idx) - if p == 0 { - code = code.end.next - break - } - b = e.encodeIndent(b, code.indent) - b = append(b, code.key...) - 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 - case opStructEscapedFieldPtrAnonymousHeadUint32PtrIndent: - store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) - fallthrough - case opStructEscapedFieldAnonymousHeadUint32PtrIndent: - 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 - case opStructFieldPtrAnonymousHeadUint32PtrOnlyIndent: - p := load(ctxptr, code.idx) - if p == 0 { - code = code.end.next - break - } - store(ctxptr, code.idx, e.ptrToPtr(p)) - fallthrough - case opStructFieldAnonymousHeadUint32PtrOnlyIndent: - p := load(ctxptr, code.idx) - b = e.encodeIndent(b, code.indent) - b = append(b, code.key...) - 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 - case opStructEscapedFieldPtrAnonymousHeadUint32PtrOnlyIndent: - p := load(ctxptr, code.idx) - if p == 0 { - code = code.end.next - break - } - store(ctxptr, code.idx, e.ptrToPtr(p)) - fallthrough - case opStructEscapedFieldAnonymousHeadUint32PtrOnlyIndent: - 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 - case opStructFieldPtrHeadUint64Indent: - store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) - fallthrough - case opStructFieldHeadUint64Indent: - 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.key...) - b = append(b, ' ') - b = appendUint(b, e.ptrToUint64(ptr)) - b = encodeIndentComma(b) - code = code.next - } - case opStructFieldPtrHeadUint64OnlyIndent, opStructFieldHeadUint64OnlyIndent: - p := load(ctxptr, code.idx) - b = append(b, '{', '\n') - b = e.encodeIndent(b, code.indent+1) - b = append(b, code.key...) - b = append(b, ' ') - b = appendUint(b, e.ptrToUint64(p)) - b = encodeIndentComma(b) - code = code.next - case opStructEscapedFieldPtrHeadUint64Indent: - store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) - fallthrough - case opStructEscapedFieldHeadUint64Indent: - 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 - } - case opStructEscapedFieldPtrHeadUint64OnlyIndent, opStructEscapedFieldHeadUint64OnlyIndent: - 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 - case opStructFieldPtrHeadUint64PtrIndent: - store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) - fallthrough - case opStructFieldHeadUint64PtrIndent: - 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.key...) - 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 - case opStructFieldPtrHeadUint64PtrOnlyIndent: - 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 - case opStructFieldHeadUint64PtrOnlyIndent: - p := load(ctxptr, code.idx) - b = append(b, '{', '\n') - b = e.encodeIndent(b, code.indent+1) - b = append(b, code.key...) - b = append(b, ' ') - if p == 0 { - b = encodeNull(b) - } else { - b = appendUint(b, e.ptrToUint64(p+code.offset)) - } - b = encodeIndentComma(b) - code = code.next - case opStructEscapedFieldPtrHeadUint64PtrIndent: - store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) - fallthrough - case opStructEscapedFieldHeadUint64PtrIndent: - 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 - case opStructEscapedFieldPtrHeadUint64PtrOnlyIndent: - 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 - case opStructEscapedFieldHeadUint64PtrOnlyIndent: - 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 - case opStructFieldHeadUint64NPtrIndent: - 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.key...) - 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 - case opStructEscapedFieldHeadUint64NPtrIndent: - 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 - case opStructFieldPtrAnonymousHeadUint64Indent: - store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) - fallthrough - case opStructFieldAnonymousHeadUint64Indent: - ptr := load(ctxptr, code.idx) - if ptr == 0 { - code = code.end.next - } else { - b = e.encodeIndent(b, code.indent) - b = append(b, code.key...) - b = append(b, ' ') - b = appendUint(b, e.ptrToUint64(ptr+code.offset)) - b = encodeIndentComma(b) - code = code.next - } - case opStructEscapedFieldPtrAnonymousHeadUint64Indent: - store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) - fallthrough - case opStructEscapedFieldAnonymousHeadUint64Indent: - 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 - } - case opStructFieldPtrAnonymousHeadUint64OnlyIndent, opStructFieldAnonymousHeadUint64OnlyIndent: - ptr := load(ctxptr, code.idx) - if ptr == 0 { - code = code.end.next - } else { - b = e.encodeIndent(b, code.indent) - b = append(b, code.key...) - b = append(b, ' ') - b = appendUint(b, e.ptrToUint64(ptr+code.offset)) - b = encodeIndentComma(b) - code = code.next - } - case opStructEscapedFieldPtrAnonymousHeadUint64OnlyIndent, opStructEscapedFieldAnonymousHeadUint64OnlyIndent: - 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 - } - case opStructFieldPtrAnonymousHeadUint64PtrIndent: - store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) - fallthrough - case opStructFieldAnonymousHeadUint64PtrIndent: - p := load(ctxptr, code.idx) - if p == 0 { - code = code.end.next - break - } - b = e.encodeIndent(b, code.indent) - b = append(b, code.key...) - 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 - case opStructEscapedFieldPtrAnonymousHeadUint64PtrIndent: - store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) - fallthrough - case opStructEscapedFieldAnonymousHeadUint64PtrIndent: - 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 - case opStructFieldPtrAnonymousHeadUint64PtrOnlyIndent: - p := load(ctxptr, code.idx) - if p == 0 { - code = code.end.next - break - } - store(ctxptr, code.idx, e.ptrToPtr(p)) - fallthrough - case opStructFieldAnonymousHeadUint64PtrOnlyIndent: - p := load(ctxptr, code.idx) - b = e.encodeIndent(b, code.indent) - b = append(b, code.key...) - b = append(b, ' ') - if p == 0 { - b = encodeNull(b) - } else { - b = appendUint(b, e.ptrToUint64(p+code.offset)) - } - b = encodeIndentComma(b) - code = code.next - case opStructEscapedFieldPtrAnonymousHeadUint64PtrOnlyIndent: - p := load(ctxptr, code.idx) - if p == 0 { - code = code.end.next - break - } - store(ctxptr, code.idx, e.ptrToPtr(p)) - fallthrough - case opStructEscapedFieldAnonymousHeadUint64PtrOnlyIndent: - 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 - case opStructFieldPtrHeadFloat32Indent: - store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) - fallthrough - case opStructFieldHeadFloat32Indent: - 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.key...) - b = append(b, ' ') - b = encodeFloat32(b, e.ptrToFloat32(ptr)) - b = encodeIndentComma(b) - code = code.next - } - case opStructFieldPtrHeadFloat32OnlyIndent, opStructFieldHeadFloat32OnlyIndent: - p := load(ctxptr, code.idx) - b = append(b, '{', '\n') - b = e.encodeIndent(b, code.indent+1) - b = append(b, code.key...) - b = append(b, ' ') - b = encodeFloat32(b, e.ptrToFloat32(p)) - b = encodeIndentComma(b) - code = code.next - case opStructEscapedFieldPtrHeadFloat32Indent: - store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) - fallthrough - case opStructEscapedFieldHeadFloat32Indent: - 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 - } - case opStructEscapedFieldPtrHeadFloat32OnlyIndent, opStructEscapedFieldHeadFloat32OnlyIndent: - 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 - case opStructFieldPtrHeadFloat32PtrIndent: - store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) - fallthrough - case opStructFieldHeadFloat32PtrIndent: - 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.key...) - 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 - case opStructFieldPtrHeadFloat32PtrOnlyIndent: - 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 - case opStructFieldHeadFloat32PtrOnlyIndent: - p := load(ctxptr, code.idx) - b = append(b, '{', '\n') - b = e.encodeIndent(b, code.indent+1) - b = append(b, code.key...) - b = append(b, ' ') - if p == 0 { - b = encodeNull(b) - } else { - b = encodeFloat32(b, e.ptrToFloat32(p)) - } - b = encodeIndentComma(b) - code = code.next - case opStructEscapedFieldPtrHeadFloat32PtrIndent: - store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) - fallthrough - case opStructEscapedFieldHeadFloat32PtrIndent: - 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 - case opStructEscapedFieldPtrHeadFloat32PtrOnlyIndent: - 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 - case opStructEscapedFieldHeadFloat32PtrOnlyIndent: - 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 - case opStructFieldHeadFloat32NPtrIndent: - 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.key...) - 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 - case opStructEscapedFieldHeadFloat32NPtrIndent: - 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 - case opStructFieldPtrAnonymousHeadFloat32Indent: - store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) - fallthrough - case opStructFieldAnonymousHeadFloat32Indent: - ptr := load(ctxptr, code.idx) - if ptr == 0 { - code = code.end.next - } else { - b = e.encodeIndent(b, code.indent) - b = append(b, code.key...) - b = append(b, ' ') - b = encodeFloat32(b, e.ptrToFloat32(ptr)) - b = encodeIndentComma(b) - code = code.next - } - case opStructEscapedFieldPtrAnonymousHeadFloat32Indent: - store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) - fallthrough - case opStructEscapedFieldAnonymousHeadFloat32Indent: - 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 - } - case opStructFieldPtrAnonymousHeadFloat32OnlyIndent, opStructFieldAnonymousHeadFloat32OnlyIndent: - ptr := load(ctxptr, code.idx) - if ptr == 0 { - code = code.end.next - } else { - b = e.encodeIndent(b, code.indent) - b = append(b, code.key...) - b = append(b, ' ') - b = encodeFloat32(b, e.ptrToFloat32(ptr)) - b = encodeIndentComma(b) - code = code.next - } - case opStructEscapedFieldPtrAnonymousHeadFloat32OnlyIndent, opStructEscapedFieldAnonymousHeadFloat32OnlyIndent: - 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 - } - case opStructFieldPtrAnonymousHeadFloat32PtrIndent: - store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) - fallthrough - case opStructFieldAnonymousHeadFloat32PtrIndent: - p := load(ctxptr, code.idx) - if p == 0 { - code = code.end.next - break - } - b = e.encodeIndent(b, code.indent) - b = append(b, code.key...) - 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 - case opStructEscapedFieldPtrAnonymousHeadFloat32PtrIndent: - store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) - fallthrough - case opStructEscapedFieldAnonymousHeadFloat32PtrIndent: - 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 - case opStructFieldPtrAnonymousHeadFloat32PtrOnlyIndent: - p := load(ctxptr, code.idx) - if p == 0 { - code = code.end.next - break - } - store(ctxptr, code.idx, e.ptrToPtr(p)) - fallthrough - case opStructFieldAnonymousHeadFloat32PtrOnlyIndent: - p := load(ctxptr, code.idx) - b = e.encodeIndent(b, code.indent) - b = append(b, code.key...) - b = append(b, ' ') - if p == 0 { - b = encodeNull(b) - } else { - b = encodeFloat32(b, e.ptrToFloat32(p)) - } - b = encodeIndentComma(b) - code = code.next - case opStructEscapedFieldPtrAnonymousHeadFloat32PtrOnlyIndent: - p := load(ctxptr, code.idx) - if p == 0 { - code = code.end.next - break - } - store(ctxptr, code.idx, e.ptrToPtr(p)) - fallthrough - case opStructEscapedFieldAnonymousHeadFloat32PtrOnlyIndent: - 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 - case opStructFieldPtrHeadFloat64Indent: - store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) - fallthrough - case opStructFieldHeadFloat64Indent: - 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.key...) - b = append(b, ' ') - b = encodeFloat64(b, v) - b = encodeIndentComma(b) - code = code.next - } - case opStructFieldPtrHeadFloat64OnlyIndent, opStructFieldHeadFloat64OnlyIndent: - p := load(ctxptr, code.idx) - b = append(b, '{', '\n') - b = e.encodeIndent(b, code.indent+1) - b = append(b, code.key...) - 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 - case opStructEscapedFieldPtrHeadFloat64Indent: - store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) - fallthrough - case opStructEscapedFieldHeadFloat64Indent: - 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 - } - case opStructEscapedFieldPtrHeadFloat64OnlyIndent, opStructEscapedFieldHeadFloat64OnlyIndent: - 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 - case opStructFieldPtrHeadFloat64PtrIndent: - store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) - fallthrough - case opStructFieldHeadFloat64PtrIndent: - 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.key...) - 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 - case opStructFieldPtrHeadFloat64PtrOnlyIndent: - 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 - case opStructFieldHeadFloat64PtrOnlyIndent: - p := load(ctxptr, code.idx) - b = append(b, '{', '\n') - b = e.encodeIndent(b, code.indent+1) - b = append(b, code.key...) - 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 - case opStructEscapedFieldPtrHeadFloat64PtrIndent: - store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) - fallthrough - case opStructEscapedFieldHeadFloat64PtrIndent: - 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 - case opStructEscapedFieldPtrHeadFloat64PtrOnlyIndent: - 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 - case opStructEscapedFieldHeadFloat64PtrOnlyIndent: - 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 - case opStructFieldHeadFloat64NPtrIndent: - 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.key...) - 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 - case opStructEscapedFieldHeadFloat64NPtrIndent: - 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 - case opStructFieldPtrAnonymousHeadFloat64Indent: - store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) - fallthrough - case opStructFieldAnonymousHeadFloat64Indent: - ptr := load(ctxptr, code.idx) - if ptr == 0 { - code = code.end.next - } else { - b = e.encodeIndent(b, code.indent) - b = append(b, code.key...) - 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 - } - case opStructEscapedFieldPtrAnonymousHeadFloat64Indent: - store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) - fallthrough - case opStructEscapedFieldAnonymousHeadFloat64Indent: - 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 - } - case opStructFieldPtrAnonymousHeadFloat64OnlyIndent, opStructFieldAnonymousHeadFloat64OnlyIndent: - ptr := load(ctxptr, code.idx) - if ptr == 0 { - code = code.end.next - } else { - b = e.encodeIndent(b, code.indent) - b = append(b, code.key...) - 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 - } - case opStructEscapedFieldPtrAnonymousHeadFloat64OnlyIndent, opStructEscapedFieldAnonymousHeadFloat64OnlyIndent: - 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 - } - case opStructFieldPtrAnonymousHeadFloat64PtrIndent: - store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) - fallthrough - case opStructFieldAnonymousHeadFloat64PtrIndent: - p := load(ctxptr, code.idx) - if p == 0 { - code = code.end.next - break - } - b = e.encodeIndent(b, code.indent) - b = append(b, code.key...) - 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 - case opStructEscapedFieldPtrAnonymousHeadFloat64PtrIndent: - store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) - fallthrough - case opStructEscapedFieldAnonymousHeadFloat64PtrIndent: - 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 - case opStructFieldPtrAnonymousHeadFloat64PtrOnlyIndent: - p := load(ctxptr, code.idx) - if p == 0 { - code = code.end.next - break - } - store(ctxptr, code.idx, e.ptrToPtr(p)) - fallthrough - case opStructFieldAnonymousHeadFloat64PtrOnlyIndent: - p := load(ctxptr, code.idx) - b = e.encodeIndent(b, code.indent) - b = append(b, code.key...) - 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 - case opStructEscapedFieldPtrAnonymousHeadFloat64PtrOnlyIndent: - p := load(ctxptr, code.idx) - if p == 0 { - code = code.end.next - break - } - store(ctxptr, code.idx, e.ptrToPtr(p)) - fallthrough - case opStructEscapedFieldAnonymousHeadFloat64PtrOnlyIndent: - 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 - case opStructFieldPtrHeadStringIndent: - store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) - fallthrough - case opStructFieldHeadStringIndent: - 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.key...) - b = append(b, ' ') - b = encodeNoEscapedString(b, e.ptrToString(ptr)) - b = encodeIndentComma(b) - code = code.next - } - case opStructEscapedFieldPtrHeadEscapedStringIndent: - store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) - fallthrough - case opStructEscapedFieldHeadEscapedStringIndent: - 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 - } - case opStructFieldPtrHeadBoolIndent: - store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) - fallthrough - case opStructFieldHeadBoolIndent: - 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.key...) - b = append(b, ' ') - b = encodeBool(b, e.ptrToBool(ptr)) - b = encodeIndentComma(b) - code = code.next - } - case opStructEscapedFieldPtrHeadBoolIndent: - store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) - fallthrough - case opStructEscapedFieldHeadBoolIndent: - 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 - } - case opStructFieldPtrHeadBytesIndent: - store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) - fallthrough - case opStructFieldHeadBytesIndent: - 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.key...) - b = append(b, ' ') - b = encodeByteSlice(b, e.ptrToBytes(ptr)) - b = encodeIndentComma(b) - code = code.next - } - case opStructEscapedFieldPtrHeadBytesIndent: - store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) - fallthrough - case opStructEscapedFieldHeadBytesIndent: - 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 - } case opStructFieldPtrHeadOmitEmpty: ptr := load(ctxptr, code.idx) if ptr != 0 { @@ -9531,29 +2678,6 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte store(ctxptr, code.idx, p) } } - case opStructEscapedFieldPtrHeadOmitEmpty: - ptr := load(ctxptr, code.idx) - if ptr != 0 { - store(ctxptr, code.idx, e.ptrToPtr(ptr)) - } - fallthrough - case opStructEscapedFieldHeadOmitEmpty: - ptr := load(ctxptr, code.idx) - if ptr == 0 { - b = encodeNull(b) - b = encodeComma(b) - code = code.end.next - } else { - b = append(b, '{') - p := ptr + code.offset - if p == 0 || *(*uintptr)(*(*unsafe.Pointer)(unsafe.Pointer(&p))) == 0 { - code = code.nextField - } else { - b = append(b, code.escapedKey...) - code = code.next - store(ctxptr, code.idx, p) - } - } case opStructFieldPtrAnonymousHeadOmitEmpty: ptr := load(ctxptr, code.idx) if ptr != 0 { @@ -9574,26 +2698,6 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte store(ctxptr, code.idx, p) } } - case opStructEscapedFieldPtrAnonymousHeadOmitEmpty: - ptr := load(ctxptr, code.idx) - if ptr != 0 { - store(ctxptr, code.idx, e.ptrToPtr(ptr)) - } - fallthrough - case opStructEscapedFieldAnonymousHeadOmitEmpty: - ptr := load(ctxptr, code.idx) - if ptr == 0 { - code = code.end.next - } else { - p := ptr + code.offset - if p == 0 || *(*uintptr)(*(*unsafe.Pointer)(unsafe.Pointer(&p))) == 0 { - code = code.nextField - } else { - b = append(b, code.escapedKey...) - code = code.next - store(ctxptr, code.idx, p) - } - } case opStructFieldPtrHeadOmitEmptyInt: ptr := load(ctxptr, code.idx) if ptr != 0 { @@ -9618,51 +2722,6 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte code = code.next } } - case opStructEscapedFieldPtrHeadOmitEmptyInt: - ptr := load(ctxptr, code.idx) - if ptr != 0 { - store(ctxptr, code.idx, e.ptrToPtr(ptr)) - } - fallthrough - case opStructEscapedFieldHeadOmitEmptyInt: - ptr := load(ctxptr, code.idx) - if ptr == 0 { - b = encodeNull(b) - b = encodeComma(b) - code = code.end.next - } else { - b = append(b, '{') - v := e.ptrToInt(ptr + code.offset) - if v == 0 { - code = code.nextField - } else { - b = append(b, code.escapedKey...) - b = appendInt(b, int64(v)) - b = encodeComma(b) - code = code.next - } - } - case opStructEscapedFieldPtrHeadOmitEmptyIntOnly: - p := load(ctxptr, code.idx) - if p == 0 { - b = encodeNull(b) - b = encodeComma(b) - code = code.end.next - break - } - fallthrough - case opStructEscapedFieldHeadOmitEmptyIntOnly: - ptr := load(ctxptr, code.idx) - b = append(b, '{') - v := e.ptrToInt(ptr + code.offset) - if v == 0 { - code = code.nextField - } else { - b = append(b, code.escapedKey...) - b = appendInt(b, int64(v)) - b = encodeComma(b) - code = code.next - } case opStructFieldPtrAnonymousHeadOmitEmptyInt: ptr := load(ctxptr, code.idx) if ptr != 0 { @@ -9684,27 +2743,6 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte code = code.next } } - case opStructEscapedFieldPtrAnonymousHeadOmitEmptyInt: - ptr := load(ctxptr, code.idx) - if ptr != 0 { - store(ctxptr, code.idx, e.ptrToPtr(ptr)) - } - fallthrough - case opStructEscapedFieldAnonymousHeadOmitEmptyInt: - ptr := load(ctxptr, code.idx) - if ptr == 0 { - code = code.end.next - } else { - v := e.ptrToInt(ptr + code.offset) - if v == 0 { - code = code.nextField - } else { - b = append(b, code.escapedKey...) - b = appendInt(b, int64(v)) - b = encodeComma(b) - code = code.next - } - } case opStructFieldPtrHeadOmitEmptyInt8: ptr := load(ctxptr, code.idx) if ptr != 0 { @@ -9729,30 +2767,6 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte code = code.next } } - case opStructEscapedFieldPtrHeadOmitEmptyInt8: - ptr := load(ctxptr, code.idx) - if ptr != 0 { - store(ctxptr, code.idx, e.ptrToPtr(ptr)) - } - fallthrough - case opStructEscapedFieldHeadOmitEmptyInt8: - ptr := load(ctxptr, code.idx) - if ptr == 0 { - b = encodeNull(b) - b = encodeComma(b) - code = code.end.next - } else { - b = append(b, '{') - v := e.ptrToInt8(ptr + code.offset) - if v == 0 { - code = code.nextField - } else { - b = append(b, code.escapedKey...) - b = appendInt(b, int64(v)) - b = encodeComma(b) - code = code.next - } - } case opStructFieldPtrAnonymousHeadOmitEmptyInt8: ptr := load(ctxptr, code.idx) if ptr != 0 { @@ -9774,27 +2788,6 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte code = code.next } } - case opStructEscapedFieldPtrAnonymousHeadOmitEmptyInt8: - ptr := load(ctxptr, code.idx) - if ptr != 0 { - store(ctxptr, code.idx, e.ptrToPtr(ptr)) - } - fallthrough - case opStructEscapedFieldAnonymousHeadOmitEmptyInt8: - ptr := load(ctxptr, code.idx) - if ptr == 0 { - code = code.end.next - } else { - v := e.ptrToInt8(ptr + code.offset) - if v == 0 { - code = code.nextField - } else { - b = append(b, code.escapedKey...) - b = appendInt(b, int64(v)) - b = encodeComma(b) - code = code.next - } - } case opStructFieldPtrHeadOmitEmptyInt16: ptr := load(ctxptr, code.idx) if ptr != 0 { @@ -9819,30 +2812,6 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte code = code.next } } - case opStructEscapedFieldPtrHeadOmitEmptyInt16: - ptr := load(ctxptr, code.idx) - if ptr != 0 { - store(ctxptr, code.idx, e.ptrToPtr(ptr)) - } - fallthrough - case opStructEscapedFieldHeadOmitEmptyInt16: - ptr := load(ctxptr, code.idx) - if ptr == 0 { - b = encodeNull(b) - b = encodeComma(b) - code = code.end.next - } else { - b = append(b, '{') - v := e.ptrToInt16(ptr + code.offset) - if v == 0 { - code = code.nextField - } else { - b = append(b, code.escapedKey...) - b = appendInt(b, int64(v)) - b = encodeComma(b) - code = code.next - } - } case opStructFieldPtrAnonymousHeadOmitEmptyInt16: ptr := load(ctxptr, code.idx) if ptr != 0 { @@ -9864,27 +2833,6 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte code = code.next } } - case opStructEscapedFieldPtrAnonymousHeadOmitEmptyInt16: - ptr := load(ctxptr, code.idx) - if ptr != 0 { - store(ctxptr, code.idx, e.ptrToPtr(ptr)) - } - fallthrough - case opStructEscapedFieldAnonymousHeadOmitEmptyInt16: - ptr := load(ctxptr, code.idx) - if ptr == 0 { - code = code.end.next - } else { - v := e.ptrToInt16(ptr + code.offset) - if v == 0 { - code = code.nextField - } else { - b = append(b, code.escapedKey...) - b = appendInt(b, int64(v)) - b = encodeComma(b) - code = code.next - } - } case opStructFieldPtrHeadOmitEmptyInt32: ptr := load(ctxptr, code.idx) if ptr != 0 { @@ -9909,30 +2857,6 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte code = code.next } } - case opStructEscapedFieldPtrHeadOmitEmptyInt32: - ptr := load(ctxptr, code.idx) - if ptr != 0 { - store(ctxptr, code.idx, e.ptrToPtr(ptr)) - } - fallthrough - case opStructEscapedFieldHeadOmitEmptyInt32: - ptr := load(ctxptr, code.idx) - if ptr == 0 { - b = encodeNull(b) - b = encodeComma(b) - code = code.end.next - } else { - b = append(b, '{') - v := e.ptrToInt32(ptr + code.offset) - if v == 0 { - code = code.nextField - } else { - b = append(b, code.escapedKey...) - b = appendInt(b, int64(v)) - b = encodeComma(b) - code = code.next - } - } case opStructFieldPtrAnonymousHeadOmitEmptyInt32: ptr := load(ctxptr, code.idx) if ptr != 0 { @@ -9954,27 +2878,6 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte code = code.next } } - case opStructEscapedFieldPtrAnonymousHeadOmitEmptyInt32: - ptr := load(ctxptr, code.idx) - if ptr != 0 { - store(ctxptr, code.idx, e.ptrToPtr(ptr)) - } - fallthrough - case opStructEscapedFieldAnonymousHeadOmitEmptyInt32: - ptr := load(ctxptr, code.idx) - if ptr == 0 { - code = code.end.next - } else { - v := e.ptrToInt32(ptr + code.offset) - if v == 0 { - code = code.nextField - } else { - b = append(b, code.escapedKey...) - b = appendInt(b, int64(v)) - b = encodeComma(b) - code = code.next - } - } case opStructFieldPtrHeadOmitEmptyInt64: ptr := load(ctxptr, code.idx) if ptr != 0 { @@ -9999,30 +2902,6 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte code = code.next } } - case opStructEscapedFieldPtrHeadOmitEmptyInt64: - ptr := load(ctxptr, code.idx) - if ptr != 0 { - store(ctxptr, code.idx, e.ptrToPtr(ptr)) - } - fallthrough - case opStructEscapedFieldHeadOmitEmptyInt64: - ptr := load(ctxptr, code.idx) - if ptr == 0 { - b = encodeNull(b) - b = encodeComma(b) - code = code.end.next - } else { - b = append(b, '{') - v := e.ptrToInt64(ptr + code.offset) - if v == 0 { - code = code.nextField - } else { - b = append(b, code.escapedKey...) - b = appendInt(b, v) - b = encodeComma(b) - code = code.next - } - } case opStructFieldPtrAnonymousHeadOmitEmptyInt64: ptr := load(ctxptr, code.idx) if ptr != 0 { @@ -10044,27 +2923,6 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte code = code.next } } - case opStructEscapedFieldPtrAnonymousHeadOmitEmptyInt64: - ptr := load(ctxptr, code.idx) - if ptr != 0 { - store(ctxptr, code.idx, e.ptrToPtr(ptr)) - } - fallthrough - case opStructEscapedFieldAnonymousHeadOmitEmptyInt64: - ptr := load(ctxptr, code.idx) - if ptr == 0 { - code = code.end.next - } else { - v := e.ptrToInt64(ptr + code.offset) - if v == 0 { - code = code.nextField - } else { - b = append(b, code.escapedKey...) - b = appendInt(b, v) - b = encodeComma(b) - code = code.next - } - } case opStructFieldPtrHeadOmitEmptyUint: ptr := load(ctxptr, code.idx) if ptr != 0 { @@ -10089,30 +2947,6 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte code = code.next } } - case opStructEscapedFieldPtrHeadOmitEmptyUint: - ptr := load(ctxptr, code.idx) - if ptr != 0 { - store(ctxptr, code.idx, e.ptrToPtr(ptr)) - } - fallthrough - case opStructEscapedFieldHeadOmitEmptyUint: - ptr := load(ctxptr, code.idx) - if ptr == 0 { - b = encodeNull(b) - b = encodeComma(b) - code = code.end.next - } else { - b = append(b, '{') - v := e.ptrToUint(ptr + code.offset) - if v == 0 { - code = code.nextField - } else { - b = append(b, code.escapedKey...) - b = appendUint(b, uint64(v)) - b = encodeComma(b) - code = code.next - } - } case opStructFieldPtrAnonymousHeadOmitEmptyUint: ptr := load(ctxptr, code.idx) if ptr != 0 { @@ -10134,27 +2968,6 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte code = code.next } } - case opStructEscapedFieldPtrAnonymousHeadOmitEmptyUint: - ptr := load(ctxptr, code.idx) - if ptr != 0 { - store(ctxptr, code.idx, e.ptrToPtr(ptr)) - } - fallthrough - case opStructEscapedFieldAnonymousHeadOmitEmptyUint: - ptr := load(ctxptr, code.idx) - if ptr == 0 { - code = code.end.next - } else { - v := e.ptrToUint(ptr + code.offset) - if v == 0 { - code = code.nextField - } else { - b = append(b, code.escapedKey...) - b = appendUint(b, uint64(v)) - b = encodeComma(b) - code = code.next - } - } case opStructFieldPtrHeadOmitEmptyUint8: ptr := load(ctxptr, code.idx) if ptr != 0 { @@ -10179,30 +2992,6 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte code = code.next } } - case opStructEscapedFieldPtrHeadOmitEmptyUint8: - ptr := load(ctxptr, code.idx) - if ptr != 0 { - store(ctxptr, code.idx, e.ptrToPtr(ptr)) - } - fallthrough - case opStructEscapedFieldHeadOmitEmptyUint8: - ptr := load(ctxptr, code.idx) - if ptr == 0 { - b = encodeNull(b) - b = encodeComma(b) - code = code.end.next - } else { - b = append(b, '{') - v := e.ptrToUint8(ptr + code.offset) - if v == 0 { - code = code.nextField - } else { - b = append(b, code.escapedKey...) - b = appendUint(b, uint64(v)) - b = encodeComma(b) - code = code.next - } - } case opStructFieldPtrAnonymousHeadOmitEmptyUint8: ptr := load(ctxptr, code.idx) if ptr != 0 { @@ -10224,27 +3013,6 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte code = code.next } } - case opStructEscapedFieldPtrAnonymousHeadOmitEmptyUint8: - ptr := load(ctxptr, code.idx) - if ptr != 0 { - store(ctxptr, code.idx, e.ptrToPtr(ptr)) - } - fallthrough - case opStructEscapedFieldAnonymousHeadOmitEmptyUint8: - ptr := load(ctxptr, code.idx) - if ptr == 0 { - code = code.end.next - } else { - v := e.ptrToUint8(ptr + code.offset) - if v == 0 { - code = code.nextField - } else { - b = append(b, code.escapedKey...) - b = appendUint(b, uint64(v)) - b = encodeComma(b) - code = code.next - } - } case opStructFieldPtrHeadOmitEmptyUint16: ptr := load(ctxptr, code.idx) if ptr != 0 { @@ -10269,30 +3037,6 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte code = code.next } } - case opStructEscapedFieldPtrHeadOmitEmptyUint16: - ptr := load(ctxptr, code.idx) - if ptr != 0 { - store(ctxptr, code.idx, e.ptrToPtr(ptr)) - } - fallthrough - case opStructEscapedFieldHeadOmitEmptyUint16: - ptr := load(ctxptr, code.idx) - if ptr == 0 { - b = encodeNull(b) - b = encodeComma(b) - code = code.end.next - } else { - b = append(b, '{') - v := e.ptrToUint16(ptr + code.offset) - if v == 0 { - code = code.nextField - } else { - b = append(b, code.escapedKey...) - b = appendUint(b, uint64(v)) - b = encodeComma(b) - code = code.next - } - } case opStructFieldPtrAnonymousHeadOmitEmptyUint16: ptr := load(ctxptr, code.idx) if ptr != 0 { @@ -10314,27 +3058,6 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte code = code.next } } - case opStructEscapedFieldPtrAnonymousHeadOmitEmptyUint16: - ptr := load(ctxptr, code.idx) - if ptr != 0 { - store(ctxptr, code.idx, e.ptrToPtr(ptr)) - } - fallthrough - case opStructEscapedFieldAnonymousHeadOmitEmptyUint16: - ptr := load(ctxptr, code.idx) - if ptr == 0 { - code = code.end.next - } else { - v := e.ptrToUint16(ptr + code.offset) - if v == 0 { - code = code.nextField - } else { - b = append(b, code.escapedKey...) - b = appendUint(b, uint64(v)) - b = encodeComma(b) - code = code.next - } - } case opStructFieldPtrHeadOmitEmptyUint32: ptr := load(ctxptr, code.idx) if ptr != 0 { @@ -10359,30 +3082,6 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte code = code.next } } - case opStructEscapedFieldPtrHeadOmitEmptyUint32: - ptr := load(ctxptr, code.idx) - if ptr != 0 { - store(ctxptr, code.idx, e.ptrToPtr(ptr)) - } - fallthrough - case opStructEscapedFieldHeadOmitEmptyUint32: - ptr := load(ctxptr, code.idx) - if ptr == 0 { - b = encodeNull(b) - b = encodeComma(b) - code = code.end.next - } else { - b = append(b, '{') - v := e.ptrToUint32(ptr + code.offset) - if v == 0 { - code = code.nextField - } else { - b = append(b, code.escapedKey...) - b = appendUint(b, uint64(v)) - b = encodeComma(b) - code = code.next - } - } case opStructFieldPtrAnonymousHeadOmitEmptyUint32: ptr := load(ctxptr, code.idx) if ptr != 0 { @@ -10404,27 +3103,6 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte code = code.next } } - case opStructEscapedFieldPtrAnonymousHeadOmitEmptyUint32: - ptr := load(ctxptr, code.idx) - if ptr != 0 { - store(ctxptr, code.idx, e.ptrToPtr(ptr)) - } - fallthrough - case opStructEscapedFieldAnonymousHeadOmitEmptyUint32: - ptr := load(ctxptr, code.idx) - if ptr == 0 { - code = code.end.next - } else { - v := e.ptrToUint32(ptr + code.offset) - if v == 0 { - code = code.nextField - } else { - b = append(b, code.escapedKey...) - b = appendUint(b, uint64(v)) - b = encodeComma(b) - code = code.next - } - } case opStructFieldPtrHeadOmitEmptyUint64: ptr := load(ctxptr, code.idx) if ptr != 0 { @@ -10449,30 +3127,6 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte code = code.next } } - case opStructEscapedFieldPtrHeadOmitEmptyUint64: - ptr := load(ctxptr, code.idx) - if ptr != 0 { - store(ctxptr, code.idx, e.ptrToPtr(ptr)) - } - fallthrough - case opStructEscapedFieldHeadOmitEmptyUint64: - ptr := load(ctxptr, code.idx) - if ptr == 0 { - b = encodeNull(b) - b = encodeComma(b) - code = code.end.next - } else { - b = append(b, '{') - v := e.ptrToUint64(ptr + code.offset) - if v == 0 { - code = code.nextField - } else { - b = append(b, code.escapedKey...) - b = appendUint(b, v) - b = encodeComma(b) - code = code.next - } - } case opStructFieldPtrAnonymousHeadOmitEmptyUint64: ptr := load(ctxptr, code.idx) if ptr != 0 { @@ -10494,27 +3148,6 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte code = code.next } } - case opStructEscapedFieldPtrAnonymousHeadOmitEmptyUint64: - ptr := load(ctxptr, code.idx) - if ptr != 0 { - store(ctxptr, code.idx, e.ptrToPtr(ptr)) - } - fallthrough - case opStructEscapedFieldAnonymousHeadOmitEmptyUint64: - ptr := load(ctxptr, code.idx) - if ptr == 0 { - code = code.end.next - } else { - v := e.ptrToUint64(ptr + code.offset) - if v == 0 { - code = code.nextField - } else { - b = append(b, code.escapedKey...) - b = appendUint(b, v) - b = encodeComma(b) - code = code.next - } - } case opStructFieldPtrHeadOmitEmptyFloat32: ptr := load(ctxptr, code.idx) if ptr != 0 { @@ -10539,30 +3172,6 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte code = code.next } } - case opStructEscapedFieldPtrHeadOmitEmptyFloat32: - ptr := load(ctxptr, code.idx) - if ptr != 0 { - store(ctxptr, code.idx, e.ptrToPtr(ptr)) - } - fallthrough - case opStructEscapedFieldHeadOmitEmptyFloat32: - ptr := load(ctxptr, code.idx) - if ptr == 0 { - b = encodeNull(b) - b = encodeComma(b) - code = code.end.next - } else { - b = append(b, '{') - v := e.ptrToFloat32(ptr + code.offset) - if v == 0 { - code = code.nextField - } else { - b = append(b, code.escapedKey...) - b = encodeFloat32(b, v) - b = encodeComma(b) - code = code.next - } - } case opStructFieldPtrAnonymousHeadOmitEmptyFloat32: ptr := load(ctxptr, code.idx) if ptr != 0 { @@ -10584,27 +3193,6 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte code = code.next } } - case opStructEscapedFieldPtrAnonymousHeadOmitEmptyFloat32: - ptr := load(ctxptr, code.idx) - if ptr != 0 { - store(ctxptr, code.idx, e.ptrToPtr(ptr)) - } - fallthrough - case opStructEscapedFieldAnonymousHeadOmitEmptyFloat32: - ptr := load(ctxptr, code.idx) - if ptr == 0 { - code = code.end.next - } else { - v := e.ptrToFloat32(ptr + code.offset) - if v == 0 { - code = code.nextField - } else { - b = append(b, code.escapedKey...) - b = encodeFloat32(b, v) - b = encodeComma(b) - code = code.next - } - } case opStructFieldPtrHeadOmitEmptyFloat64: ptr := load(ctxptr, code.idx) if ptr != 0 { @@ -10632,33 +3220,6 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte code = code.next } } - case opStructEscapedFieldPtrHeadOmitEmptyFloat64: - ptr := load(ctxptr, code.idx) - if ptr != 0 { - store(ctxptr, code.idx, e.ptrToPtr(ptr)) - } - fallthrough - case opStructEscapedFieldHeadOmitEmptyFloat64: - ptr := load(ctxptr, code.idx) - if ptr == 0 { - b = encodeNull(b) - b = encodeComma(b) - code = code.end.next - } else { - b = append(b, '{') - 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 = append(b, code.escapedKey...) - b = encodeFloat64(b, v) - b = encodeComma(b) - code = code.next - } - } case opStructFieldPtrAnonymousHeadOmitEmptyFloat64: ptr := load(ctxptr, code.idx) if ptr != 0 { @@ -10683,30 +3244,6 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte code = code.next } } - case opStructEscapedFieldPtrAnonymousHeadOmitEmptyFloat64: - ptr := load(ctxptr, code.idx) - if ptr != 0 { - store(ctxptr, code.idx, e.ptrToPtr(ptr)) - } - fallthrough - case opStructEscapedFieldAnonymousHeadOmitEmptyFloat64: - ptr := load(ctxptr, code.idx) - if ptr == 0 { - code = code.end.next - } else { - 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 = append(b, code.escapedKey...) - b = encodeFloat64(b, v) - b = encodeComma(b) - code = code.next - } - } case opStructFieldPtrHeadOmitEmptyString: ptr := load(ctxptr, code.idx) if ptr != 0 { @@ -10731,30 +3268,6 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte code = code.next } } - case opStructEscapedFieldPtrHeadOmitEmptyEscapedString: - ptr := load(ctxptr, code.idx) - if ptr != 0 { - store(ctxptr, code.idx, e.ptrToPtr(ptr)) - } - fallthrough - case opStructEscapedFieldHeadOmitEmptyEscapedString: - ptr := load(ctxptr, code.idx) - if ptr == 0 { - b = encodeNull(b) - b = encodeComma(b) - code = code.end.next - } else { - b = append(b, '{') - v := e.ptrToString(ptr + code.offset) - if v == "" { - code = code.nextField - } else { - b = append(b, code.escapedKey...) - b = encodeEscapedString(b, v) - b = encodeComma(b) - code = code.next - } - } case opStructFieldPtrAnonymousHeadOmitEmptyString: ptr := load(ctxptr, code.idx) if ptr != 0 { @@ -10776,27 +3289,6 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte code = code.next } } - case opStructEscapedFieldPtrAnonymousHeadOmitEmptyEscapedString: - ptr := load(ctxptr, code.idx) - if ptr != 0 { - store(ctxptr, code.idx, e.ptrToPtr(ptr)) - } - fallthrough - case opStructEscapedFieldAnonymousHeadOmitEmptyEscapedString: - ptr := load(ctxptr, code.idx) - if ptr == 0 { - code = code.end.next - } else { - v := e.ptrToString(ptr + code.offset) - if v == "" { - code = code.nextField - } else { - b = append(b, code.escapedKey...) - b = encodeEscapedString(b, v) - b = encodeComma(b) - code = code.next - } - } case opStructFieldPtrHeadOmitEmptyBool: ptr := load(ctxptr, code.idx) if ptr != 0 { @@ -10821,30 +3313,6 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte code = code.next } } - case opStructEscapedFieldPtrHeadOmitEmptyBool: - ptr := load(ctxptr, code.idx) - if ptr != 0 { - store(ctxptr, code.idx, e.ptrToPtr(ptr)) - } - fallthrough - case opStructEscapedFieldHeadOmitEmptyBool: - ptr := load(ctxptr, code.idx) - if ptr == 0 { - b = encodeNull(b) - b = encodeComma(b) - code = code.end.next - } else { - b = append(b, '{') - v := e.ptrToBool(ptr + code.offset) - if !v { - code = code.nextField - } else { - b = append(b, code.escapedKey...) - b = encodeBool(b, v) - b = encodeComma(b) - code = code.next - } - } case opStructFieldPtrAnonymousHeadOmitEmptyBool: ptr := load(ctxptr, code.idx) if ptr != 0 { @@ -10866,27 +3334,6 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte code = code.next } } - case opStructEscapedFieldPtrAnonymousHeadOmitEmptyBool: - ptr := load(ctxptr, code.idx) - if ptr != 0 { - store(ctxptr, code.idx, e.ptrToPtr(ptr)) - } - fallthrough - case opStructEscapedFieldAnonymousHeadOmitEmptyBool: - ptr := load(ctxptr, code.idx) - if ptr == 0 { - code = code.end.next - } else { - v := e.ptrToBool(ptr + code.offset) - if !v { - code = code.nextField - } else { - b = append(b, code.escapedKey...) - b = encodeBool(b, v) - b = encodeComma(b) - code = code.next - } - } case opStructFieldPtrHeadOmitEmptyBytes: ptr := load(ctxptr, code.idx) if ptr != 0 { @@ -10911,30 +3358,6 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte code = code.next } } - case opStructEscapedFieldPtrHeadOmitEmptyBytes: - ptr := load(ctxptr, code.idx) - if ptr != 0 { - store(ctxptr, code.idx, e.ptrToPtr(ptr)) - } - fallthrough - case opStructEscapedFieldHeadOmitEmptyBytes: - ptr := load(ctxptr, code.idx) - if ptr == 0 { - b = encodeNull(b) - b = encodeComma(b) - code = code.end.next - } else { - b = append(b, '{') - v := e.ptrToBytes(ptr + code.offset) - if len(v) == 0 { - code = code.nextField - } else { - b = append(b, code.escapedKey...) - b = encodeByteSlice(b, v) - b = encodeComma(b) - code = code.next - } - } case opStructFieldPtrAnonymousHeadOmitEmptyBytes: ptr := load(ctxptr, code.idx) if ptr != 0 { @@ -10956,27 +3379,6 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte code = code.next } } - case opStructEscapedFieldPtrAnonymousHeadOmitEmptyBytes: - ptr := load(ctxptr, code.idx) - if ptr != 0 { - store(ctxptr, code.idx, e.ptrToPtr(ptr)) - } - fallthrough - case opStructEscapedFieldAnonymousHeadOmitEmptyBytes: - ptr := load(ctxptr, code.idx) - if ptr == 0 { - code = code.end.next - } else { - v := e.ptrToBytes(ptr + code.offset) - if len(v) == 0 { - code = code.nextField - } else { - b = append(b, code.escapedKey...) - b = encodeByteSlice(b, v) - b = encodeComma(b) - code = code.next - } - } case opStructFieldPtrHeadOmitEmptyMarshalJSON: ptr := load(ctxptr, code.idx) if ptr != 0 { @@ -11025,54 +3427,6 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte } } } - case opStructEscapedFieldPtrHeadOmitEmptyMarshalJSON: - ptr := load(ctxptr, code.idx) - if ptr != 0 { - store(ctxptr, code.idx, e.ptrToPtr(ptr)) - } - fallthrough - case opStructEscapedFieldHeadOmitEmptyMarshalJSON: - ptr := load(ctxptr, code.idx) - if ptr == 0 { - b = encodeNull(b) - b = encodeComma(b) - code = code.end.next - } else { - b = append(b, '{') - ptr += code.offset - p := e.ptrToUnsafePtr(ptr) - isPtr := code.typ.Kind() == reflect.Ptr - if p == nil || (!isPtr && *(*unsafe.Pointer)(p) == nil) { - code = code.nextField - } else { - v := *(*interface{})(unsafe.Pointer(&interfaceHeader{typ: code.typ, ptr: p})) - bb, err := v.(Marshaler).MarshalJSON() - if err != nil { - return nil, &MarshalerError{ - Type: rtype2type(code.typ), - Err: err, - } - } - if len(bb) == 0 { - if isPtr { - return nil, errUnexpectedEndOfJSON( - fmt.Sprintf("error calling MarshalJSON for type %s", code.typ), - 0, - ) - } - code = code.nextField - } else { - var buf bytes.Buffer - if err := compact(&buf, bb, e.enabledHTMLEscape); err != nil { - return nil, err - } - b = append(b, code.escapedKey...) - b = append(b, buf.Bytes()...) - b = encodeComma(b) - code = code.next - } - } - } case opStructFieldPtrAnonymousHeadOmitEmptyMarshalJSON: ptr := load(ctxptr, code.idx) if ptr != 0 { @@ -11118,51 +3472,6 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte } } } - case opStructEscapedFieldPtrAnonymousHeadOmitEmptyMarshalJSON: - ptr := load(ctxptr, code.idx) - if ptr != 0 { - store(ctxptr, code.idx, e.ptrToPtr(ptr)) - } - fallthrough - case opStructEscapedFieldAnonymousHeadOmitEmptyMarshalJSON: - ptr := load(ctxptr, code.idx) - if ptr == 0 { - code = code.end.next - } else { - ptr += code.offset - p := e.ptrToUnsafePtr(ptr) - isPtr := code.typ.Kind() == reflect.Ptr - if p == nil || (!isPtr && *(*unsafe.Pointer)(p) == nil) { - code = code.nextField - } else { - v := *(*interface{})(unsafe.Pointer(&interfaceHeader{typ: code.typ, ptr: p})) - bb, err := v.(Marshaler).MarshalJSON() - if err != nil { - return nil, &MarshalerError{ - Type: rtype2type(code.typ), - Err: err, - } - } - if len(bb) == 0 { - if isPtr { - return nil, errUnexpectedEndOfJSON( - fmt.Sprintf("error calling MarshalJSON for type %s", code.typ), - 0, - ) - } - code = code.nextField - } else { - var buf bytes.Buffer - if err := compact(&buf, bb, e.enabledHTMLEscape); err != nil { - return nil, err - } - b = append(b, code.escapedKey...) - b = append(b, buf.Bytes()...) - b = encodeComma(b) - code = code.next - } - } - } case opStructFieldPtrHeadOmitEmptyMarshalText: ptr := load(ctxptr, code.idx) if ptr != 0 { @@ -11197,40 +3506,6 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte code = code.next } } - case opStructEscapedFieldPtrHeadOmitEmptyMarshalText: - ptr := load(ctxptr, code.idx) - if ptr != 0 { - store(ctxptr, code.idx, e.ptrToPtr(ptr)) - } - fallthrough - case opStructEscapedFieldHeadOmitEmptyMarshalText: - ptr := load(ctxptr, code.idx) - if ptr == 0 { - b = encodeNull(b) - b = encodeComma(b) - code = code.end.next - } else { - b = append(b, '{') - ptr += code.offset - p := e.ptrToUnsafePtr(ptr) - isPtr := code.typ.Kind() == reflect.Ptr - if p == nil || (!isPtr && *(*unsafe.Pointer)(p) == nil) { - code = code.nextField - } else { - v := *(*interface{})(unsafe.Pointer(&interfaceHeader{typ: code.typ, ptr: p})) - bytes, err := v.(encoding.TextMarshaler).MarshalText() - if err != nil { - return nil, &MarshalerError{ - Type: rtype2type(code.typ), - Err: err, - } - } - b = append(b, code.escapedKey...) - b = encodeEscapedString(b, *(*string)(unsafe.Pointer(&bytes))) - b = encodeComma(b) - code = code.next - } - } case opStructFieldPtrAnonymousHeadOmitEmptyMarshalText: ptr := load(ctxptr, code.idx) if ptr != 0 { @@ -11262,937 +3537,6 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte code = code.next } } - case opStructEscapedFieldPtrAnonymousHeadOmitEmptyMarshalText: - ptr := load(ctxptr, code.idx) - if ptr != 0 { - store(ctxptr, code.idx, e.ptrToPtr(ptr)) - } - fallthrough - case opStructEscapedFieldAnonymousHeadOmitEmptyMarshalText: - ptr := load(ctxptr, code.idx) - if ptr == 0 { - code = code.end.next - } else { - ptr += code.offset - p := e.ptrToUnsafePtr(ptr) - isPtr := code.typ.Kind() == reflect.Ptr - if p == nil || (!isPtr && *(*unsafe.Pointer)(p) == nil) { - code = code.nextField - } else { - v := *(*interface{})(unsafe.Pointer(&interfaceHeader{typ: code.typ, ptr: p})) - bytes, err := v.(encoding.TextMarshaler).MarshalText() - if err != nil { - return nil, &MarshalerError{ - Type: rtype2type(code.typ), - Err: err, - } - } - b = append(b, code.escapedKey...) - b = encodeEscapedString(b, *(*string)(unsafe.Pointer(&bytes))) - b = encodeComma(b) - code = code.next - } - } - case opStructFieldPtrHeadOmitEmptyIndent: - ptr := load(ctxptr, code.idx) - if ptr != 0 { - store(ctxptr, code.idx, e.ptrToPtr(ptr)) - } - fallthrough - case opStructFieldHeadOmitEmptyIndent: - 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.key...) - b = append(b, ' ') - code = code.next - store(ctxptr, code.idx, p) - } - } - case opStructEscapedFieldPtrHeadOmitEmptyIndent: - ptr := load(ctxptr, code.idx) - if ptr != 0 { - store(ctxptr, code.idx, e.ptrToPtr(ptr)) - } - fallthrough - case opStructEscapedFieldHeadOmitEmptyIndent: - 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) - } - } - case opStructFieldPtrHeadOmitEmptyIntIndent: - ptr := load(ctxptr, code.idx) - if ptr != 0 { - store(ctxptr, code.idx, e.ptrToPtr(ptr)) - } - fallthrough - case opStructFieldHeadOmitEmptyIntIndent: - 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.key...) - b = append(b, ' ') - b = appendInt(b, int64(v)) - b = encodeIndentComma(b) - code = code.next - } - } - case opStructEscapedFieldPtrHeadOmitEmptyIntIndent: - ptr := load(ctxptr, code.idx) - if ptr != 0 { - store(ctxptr, code.idx, e.ptrToPtr(ptr)) - } - fallthrough - case opStructEscapedFieldHeadOmitEmptyIntIndent: - 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 - } - } - case opStructFieldPtrHeadOmitEmptyInt8Indent: - ptr := load(ctxptr, code.idx) - if ptr != 0 { - store(ctxptr, code.idx, e.ptrToPtr(ptr)) - } - fallthrough - case opStructFieldHeadOmitEmptyInt8Indent: - 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.key...) - b = append(b, ' ') - b = appendInt(b, int64(v)) - b = encodeIndentComma(b) - code = code.next - } - } - case opStructEscapedFieldPtrHeadOmitEmptyInt8Indent: - ptr := load(ctxptr, code.idx) - if ptr != 0 { - store(ctxptr, code.idx, e.ptrToPtr(ptr)) - } - fallthrough - case opStructEscapedFieldHeadOmitEmptyInt8Indent: - 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 - } - } - case opStructFieldPtrHeadOmitEmptyInt16Indent: - ptr := load(ctxptr, code.idx) - if ptr != 0 { - store(ctxptr, code.idx, e.ptrToPtr(ptr)) - } - fallthrough - case opStructFieldHeadOmitEmptyInt16Indent: - 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.key...) - b = append(b, ' ') - b = appendInt(b, int64(v)) - b = encodeIndentComma(b) - code = code.next - } - } - case opStructEscapedFieldPtrHeadOmitEmptyInt16Indent: - ptr := load(ctxptr, code.idx) - if ptr != 0 { - store(ctxptr, code.idx, e.ptrToPtr(ptr)) - } - fallthrough - case opStructEscapedFieldHeadOmitEmptyInt16Indent: - 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 - } - } - case opStructFieldPtrHeadOmitEmptyInt32Indent: - ptr := load(ctxptr, code.idx) - if ptr != 0 { - store(ctxptr, code.idx, e.ptrToPtr(ptr)) - } - fallthrough - case opStructFieldHeadOmitEmptyInt32Indent: - 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.key...) - b = append(b, ' ') - b = appendInt(b, int64(v)) - b = encodeIndentComma(b) - code = code.next - } - } - case opStructEscapedFieldPtrHeadOmitEmptyInt32Indent: - ptr := load(ctxptr, code.idx) - if ptr != 0 { - store(ctxptr, code.idx, e.ptrToPtr(ptr)) - } - fallthrough - case opStructEscapedFieldHeadOmitEmptyInt32Indent: - 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 - } - } - case opStructFieldPtrHeadOmitEmptyInt64Indent: - ptr := load(ctxptr, code.idx) - if ptr != 0 { - store(ctxptr, code.idx, e.ptrToPtr(ptr)) - } - fallthrough - case opStructFieldHeadOmitEmptyInt64Indent: - 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.key...) - b = append(b, ' ') - b = appendInt(b, v) - b = encodeIndentComma(b) - code = code.next - } - } - case opStructEscapedFieldPtrHeadOmitEmptyInt64Indent: - ptr := load(ctxptr, code.idx) - if ptr != 0 { - store(ctxptr, code.idx, e.ptrToPtr(ptr)) - } - fallthrough - case opStructEscapedFieldHeadOmitEmptyInt64Indent: - 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 - } - } - case opStructFieldPtrHeadOmitEmptyUintIndent: - ptr := load(ctxptr, code.idx) - if ptr != 0 { - store(ctxptr, code.idx, e.ptrToPtr(ptr)) - } - fallthrough - case opStructFieldHeadOmitEmptyUintIndent: - 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.key...) - b = append(b, ' ') - b = appendUint(b, uint64(v)) - b = encodeIndentComma(b) - code = code.next - } - } - case opStructEscapedFieldPtrHeadOmitEmptyUintIndent: - ptr := load(ctxptr, code.idx) - if ptr != 0 { - store(ctxptr, code.idx, e.ptrToPtr(ptr)) - } - fallthrough - case opStructEscapedFieldHeadOmitEmptyUintIndent: - 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 - } - } - case opStructFieldPtrHeadOmitEmptyUint8Indent: - ptr := load(ctxptr, code.idx) - if ptr != 0 { - store(ctxptr, code.idx, e.ptrToPtr(ptr)) - } - fallthrough - case opStructFieldHeadOmitEmptyUint8Indent: - 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.key...) - b = append(b, ' ') - b = appendUint(b, uint64(v)) - b = encodeIndentComma(b) - code = code.next - } - } - case opStructEscapedFieldPtrHeadOmitEmptyUint8Indent: - ptr := load(ctxptr, code.idx) - if ptr != 0 { - store(ctxptr, code.idx, e.ptrToPtr(ptr)) - } - fallthrough - case opStructEscapedFieldHeadOmitEmptyUint8Indent: - 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 - } - } - case opStructFieldPtrHeadOmitEmptyUint16Indent: - ptr := load(ctxptr, code.idx) - if ptr != 0 { - store(ctxptr, code.idx, e.ptrToPtr(ptr)) - } - fallthrough - case opStructFieldHeadOmitEmptyUint16Indent: - 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.key...) - b = append(b, ' ') - b = appendUint(b, uint64(v)) - b = encodeIndentComma(b) - code = code.next - } - } - case opStructEscapedFieldPtrHeadOmitEmptyUint16Indent: - ptr := load(ctxptr, code.idx) - if ptr != 0 { - store(ctxptr, code.idx, e.ptrToPtr(ptr)) - } - fallthrough - case opStructEscapedFieldHeadOmitEmptyUint16Indent: - 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 - } - } - case opStructFieldPtrHeadOmitEmptyUint32Indent: - ptr := load(ctxptr, code.idx) - if ptr != 0 { - store(ctxptr, code.idx, e.ptrToPtr(ptr)) - } - fallthrough - case opStructFieldHeadOmitEmptyUint32Indent: - 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.key...) - b = append(b, ' ') - b = appendUint(b, uint64(v)) - b = encodeIndentComma(b) - code = code.next - } - } - case opStructEscapedFieldPtrHeadOmitEmptyUint32Indent: - ptr := load(ctxptr, code.idx) - if ptr != 0 { - store(ctxptr, code.idx, e.ptrToPtr(ptr)) - } - fallthrough - case opStructEscapedFieldHeadOmitEmptyUint32Indent: - 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 - } - } - case opStructFieldPtrHeadOmitEmptyUint64Indent: - ptr := load(ctxptr, code.idx) - if ptr != 0 { - store(ctxptr, code.idx, e.ptrToPtr(ptr)) - } - fallthrough - case opStructFieldHeadOmitEmptyUint64Indent: - 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.key...) - b = append(b, ' ') - b = appendUint(b, v) - b = encodeIndentComma(b) - code = code.next - } - } - case opStructEscapedFieldPtrHeadOmitEmptyUint64Indent: - ptr := load(ctxptr, code.idx) - if ptr != 0 { - store(ctxptr, code.idx, e.ptrToPtr(ptr)) - } - fallthrough - case opStructEscapedFieldHeadOmitEmptyUint64Indent: - 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 - } - } - case opStructFieldPtrHeadOmitEmptyFloat32Indent: - ptr := load(ctxptr, code.idx) - if ptr != 0 { - store(ctxptr, code.idx, e.ptrToPtr(ptr)) - } - fallthrough - case opStructFieldHeadOmitEmptyFloat32Indent: - 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.key...) - b = append(b, ' ') - b = encodeFloat32(b, v) - b = encodeIndentComma(b) - code = code.next - } - } - case opStructEscapedFieldPtrHeadOmitEmptyFloat32Indent: - ptr := load(ctxptr, code.idx) - if ptr != 0 { - store(ctxptr, code.idx, e.ptrToPtr(ptr)) - } - fallthrough - case opStructEscapedFieldHeadOmitEmptyFloat32Indent: - 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 - } - } - case opStructFieldPtrHeadOmitEmptyFloat64Indent: - ptr := load(ctxptr, code.idx) - if ptr != 0 { - store(ctxptr, code.idx, e.ptrToPtr(ptr)) - } - fallthrough - case opStructFieldHeadOmitEmptyFloat64Indent: - 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.key...) - b = append(b, ' ') - b = encodeFloat64(b, v) - b = encodeIndentComma(b) - code = code.next - } - } - case opStructEscapedFieldPtrHeadOmitEmptyFloat64Indent: - ptr := load(ctxptr, code.idx) - if ptr != 0 { - store(ctxptr, code.idx, e.ptrToPtr(ptr)) - } - fallthrough - case opStructEscapedFieldHeadOmitEmptyFloat64Indent: - 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 - } - } - case opStructFieldPtrHeadOmitEmptyStringIndent: - ptr := load(ctxptr, code.idx) - if ptr != 0 { - store(ctxptr, code.idx, e.ptrToPtr(ptr)) - } - fallthrough - case opStructFieldHeadOmitEmptyStringIndent: - 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.key...) - b = append(b, ' ') - b = encodeNoEscapedString(b, v) - b = encodeIndentComma(b) - code = code.next - } - } - case opStructEscapedFieldPtrHeadOmitEmptyEscapedStringIndent: - ptr := load(ctxptr, code.idx) - if ptr != 0 { - store(ctxptr, code.idx, e.ptrToPtr(ptr)) - } - fallthrough - case opStructEscapedFieldHeadOmitEmptyEscapedStringIndent: - 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 - } - } - case opStructFieldPtrHeadOmitEmptyBoolIndent: - ptr := load(ctxptr, code.idx) - if ptr != 0 { - store(ctxptr, code.idx, e.ptrToPtr(ptr)) - } - fallthrough - case opStructFieldHeadOmitEmptyBoolIndent: - 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.key...) - b = append(b, ' ') - b = encodeBool(b, v) - b = encodeIndentComma(b) - code = code.next - } - } - case opStructEscapedFieldPtrHeadOmitEmptyBoolIndent: - ptr := load(ctxptr, code.idx) - if ptr != 0 { - store(ctxptr, code.idx, e.ptrToPtr(ptr)) - } - fallthrough - case opStructEscapedFieldHeadOmitEmptyBoolIndent: - 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 - } - } - case opStructFieldPtrHeadOmitEmptyBytesIndent: - ptr := load(ctxptr, code.idx) - if ptr != 0 { - store(ctxptr, code.idx, e.ptrToPtr(ptr)) - } - fallthrough - case opStructFieldHeadOmitEmptyBytesIndent: - 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.key...) - b = append(b, ' ') - b = encodeByteSlice(b, v) - b = encodeIndentComma(b) - code = code.next - } - } - case opStructEscapedFieldPtrHeadOmitEmptyBytesIndent: - ptr := load(ctxptr, code.idx) - if ptr != 0 { - store(ctxptr, code.idx, e.ptrToPtr(ptr)) - } - fallthrough - case opStructEscapedFieldHeadOmitEmptyBytesIndent: - 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 - } - } case opStructFieldPtrHeadStringTag: ptr := load(ctxptr, code.idx) if ptr != 0 { @@ -12212,25 +3556,6 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte code = code.next store(ctxptr, code.idx, p) } - case opStructEscapedFieldPtrHeadStringTag: - ptr := load(ctxptr, code.idx) - if ptr != 0 { - store(ctxptr, code.idx, e.ptrToPtr(ptr)) - } - fallthrough - case opStructEscapedFieldHeadStringTag: - ptr := load(ctxptr, code.idx) - if ptr == 0 { - b = encodeNull(b) - b = encodeComma(b) - code = code.end.next - } else { - b = append(b, '{') - p := ptr + code.offset - b = append(b, code.escapedKey...) - code = code.next - store(ctxptr, code.idx, p) - } case opStructFieldPtrAnonymousHeadStringTag: ptr := load(ctxptr, code.idx) if ptr != 0 { @@ -12246,21 +3571,6 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte code = code.next store(ctxptr, code.idx, ptr+code.offset) } - case opStructEscapedFieldPtrAnonymousHeadStringTag: - ptr := load(ctxptr, code.idx) - if ptr != 0 { - store(ctxptr, code.idx, e.ptrToPtr(ptr)) - } - fallthrough - case opStructEscapedFieldAnonymousHeadStringTag: - ptr := load(ctxptr, code.idx) - if ptr == 0 { - code = code.end.next - } else { - b = append(b, code.escapedKey...) - code = code.next - store(ctxptr, code.idx, ptr+code.offset) - } case opStructFieldPtrHeadStringTagInt: ptr := load(ctxptr, code.idx) if ptr != 0 { @@ -12282,27 +3592,6 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte b = encodeComma(b) code = code.next } - case opStructEscapedFieldPtrHeadStringTagInt: - ptr := load(ctxptr, code.idx) - if ptr != 0 { - store(ctxptr, code.idx, e.ptrToPtr(ptr)) - } - fallthrough - case opStructEscapedFieldHeadStringTagInt: - ptr := load(ctxptr, code.idx) - if ptr == 0 { - b = encodeNull(b) - b = encodeComma(b) - code = code.end.next - } else { - b = append(b, '{') - b = append(b, code.escapedKey...) - b = append(b, '"') - b = appendInt(b, int64(e.ptrToInt(ptr+code.offset))) - b = append(b, '"') - b = encodeComma(b) - code = code.next - } case opStructFieldPtrAnonymousHeadStringTagInt: ptr := load(ctxptr, code.idx) if ptr != 0 { @@ -12321,24 +3610,6 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte b = encodeComma(b) code = code.next } - case opStructEscapedFieldPtrAnonymousHeadStringTagInt: - ptr := load(ctxptr, code.idx) - if ptr != 0 { - store(ctxptr, code.idx, e.ptrToPtr(ptr)) - } - fallthrough - case opStructEscapedFieldAnonymousHeadStringTagInt: - ptr := load(ctxptr, code.idx) - if ptr == 0 { - code = code.end.next - } else { - b = append(b, code.escapedKey...) - b = append(b, '"') - b = appendInt(b, int64(e.ptrToInt(ptr+code.offset))) - b = append(b, '"') - b = encodeComma(b) - code = code.next - } case opStructFieldPtrHeadStringTagInt8: ptr := load(ctxptr, code.idx) if ptr != 0 { @@ -12360,27 +3631,6 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte b = encodeComma(b) code = code.next } - case opStructEscapedFieldPtrHeadStringTagInt8: - ptr := load(ctxptr, code.idx) - if ptr != 0 { - store(ctxptr, code.idx, e.ptrToPtr(ptr)) - } - fallthrough - case opStructEscapedFieldHeadStringTagInt8: - ptr := load(ctxptr, code.idx) - if ptr == 0 { - b = encodeNull(b) - b = encodeComma(b) - code = code.end.next - } else { - b = append(b, '{') - b = append(b, code.escapedKey...) - b = append(b, '"') - b = appendInt(b, int64(e.ptrToInt8(ptr+code.offset))) - b = append(b, '"') - b = encodeComma(b) - code = code.next - } case opStructFieldPtrAnonymousHeadStringTagInt8: ptr := load(ctxptr, code.idx) if ptr != 0 { @@ -12399,24 +3649,6 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte b = encodeComma(b) code = code.next } - case opStructEscapedFieldPtrAnonymousHeadStringTagInt8: - ptr := load(ctxptr, code.idx) - if ptr != 0 { - store(ctxptr, code.idx, e.ptrToPtr(ptr)) - } - fallthrough - case opStructEscapedFieldAnonymousHeadStringTagInt8: - ptr := load(ctxptr, code.idx) - if ptr == 0 { - code = code.end.next - } else { - b = append(b, code.escapedKey...) - b = append(b, '"') - b = appendInt(b, int64(e.ptrToInt8(ptr+code.offset))) - b = append(b, '"') - b = encodeComma(b) - code = code.next - } case opStructFieldPtrHeadStringTagInt16: ptr := load(ctxptr, code.idx) if ptr != 0 { @@ -12438,27 +3670,6 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte b = encodeComma(b) code = code.next } - case opStructEscapedFieldPtrHeadStringTagInt16: - ptr := load(ctxptr, code.idx) - if ptr != 0 { - store(ctxptr, code.idx, e.ptrToPtr(ptr)) - } - fallthrough - case opStructEscapedFieldHeadStringTagInt16: - ptr := load(ctxptr, code.idx) - if ptr == 0 { - b = encodeNull(b) - b = encodeComma(b) - code = code.end.next - } else { - b = append(b, '{') - b = append(b, code.escapedKey...) - b = append(b, '"') - b = appendInt(b, int64(e.ptrToInt16(ptr+code.offset))) - b = append(b, '"') - b = encodeComma(b) - code = code.next - } case opStructFieldPtrAnonymousHeadStringTagInt16: ptr := load(ctxptr, code.idx) if ptr != 0 { @@ -12477,24 +3688,6 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte b = encodeComma(b) code = code.next } - case opStructEscapedFieldPtrAnonymousHeadStringTagInt16: - ptr := load(ctxptr, code.idx) - if ptr != 0 { - store(ctxptr, code.idx, e.ptrToPtr(ptr)) - } - fallthrough - case opStructEscapedFieldAnonymousHeadStringTagInt16: - ptr := load(ctxptr, code.idx) - if ptr == 0 { - code = code.end.next - } else { - b = append(b, code.escapedKey...) - b = append(b, '"') - b = appendInt(b, int64(e.ptrToInt16(ptr+code.offset))) - b = append(b, '"') - b = encodeComma(b) - code = code.next - } case opStructFieldPtrHeadStringTagInt32: ptr := load(ctxptr, code.idx) if ptr != 0 { @@ -12516,27 +3709,6 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte b = encodeComma(b) code = code.next } - case opStructEscapedFieldPtrHeadStringTagInt32: - ptr := load(ctxptr, code.idx) - if ptr != 0 { - store(ctxptr, code.idx, e.ptrToPtr(ptr)) - } - fallthrough - case opStructEscapedFieldHeadStringTagInt32: - ptr := load(ctxptr, code.idx) - if ptr == 0 { - b = encodeNull(b) - b = encodeComma(b) - code = code.end.next - } else { - b = append(b, '{') - b = append(b, code.escapedKey...) - b = append(b, '"') - b = appendInt(b, int64(e.ptrToInt32(ptr+code.offset))) - b = append(b, '"') - b = encodeComma(b) - code = code.next - } case opStructFieldPtrAnonymousHeadStringTagInt32: ptr := load(ctxptr, code.idx) if ptr != 0 { @@ -12555,24 +3727,6 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte b = encodeComma(b) code = code.next } - case opStructEscapedFieldPtrAnonymousHeadStringTagInt32: - ptr := load(ctxptr, code.idx) - if ptr != 0 { - store(ctxptr, code.idx, e.ptrToPtr(ptr)) - } - fallthrough - case opStructEscapedFieldAnonymousHeadStringTagInt32: - ptr := load(ctxptr, code.idx) - if ptr == 0 { - code = code.end.next - } else { - b = append(b, code.escapedKey...) - b = append(b, '"') - b = appendInt(b, int64(e.ptrToInt32(ptr+code.offset))) - b = append(b, '"') - b = encodeComma(b) - code = code.next - } case opStructFieldPtrHeadStringTagInt64: ptr := load(ctxptr, code.idx) if ptr != 0 { @@ -12594,68 +3748,6 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte b = encodeComma(b) code = code.next } - case opStructEscapedFieldPtrHeadStringTagInt64: - ptr := load(ctxptr, code.idx) - if ptr != 0 { - store(ctxptr, code.idx, e.ptrToPtr(ptr)) - } - fallthrough - case opStructEscapedFieldHeadStringTagInt64: - ptr := load(ctxptr, code.idx) - if ptr == 0 { - b = encodeNull(b) - b = encodeComma(b) - code = code.end.next - } else { - b = append(b, '{') - b = append(b, code.escapedKey...) - b = append(b, '"') - b = appendInt(b, e.ptrToInt64(ptr+code.offset)) - b = append(b, '"') - b = encodeComma(b) - code = code.next - } - case opStructEscapedFieldPtrHeadStringTagInt64Only: - p := load(ctxptr, code.idx) - if p == 0 { - b = encodeNull(b) - b = encodeComma(b) - code = code.end.next - break - } - fallthrough - case opStructEscapedFieldHeadStringTagInt64Only: - p := load(ctxptr, code.idx) - b = append(b, '{') - b = append(b, code.escapedKey...) - b = append(b, '"') - b = appendInt(b, e.ptrToInt64(p+code.offset)) - b = append(b, '"') - b = encodeComma(b) - code = code.next - case opStructEscapedFieldPtrHeadStringTagInt64PtrOnly: - p := load(ctxptr, code.idx) - if p == 0 { - b = encodeNull(b) - b = encodeComma(b) - code = code.end.next - break - } - fallthrough - case opStructEscapedFieldHeadStringTagInt64PtrOnly: - p := load(ctxptr, code.idx) - b = append(b, '{') - b = append(b, code.escapedKey...) - if p == 0 { - b = encodeNull(b) - } else { - b = append(b, '"') - b = appendInt(b, e.ptrToInt64(p+code.offset)) - b = append(b, '"') - } - b = encodeComma(b) - code = code.next - case opStructFieldPtrAnonymousHeadStringTagInt64: ptr := load(ctxptr, code.idx) if ptr != 0 { @@ -12674,24 +3766,6 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte b = encodeComma(b) code = code.next } - case opStructEscapedFieldPtrAnonymousHeadStringTagInt64: - ptr := load(ctxptr, code.idx) - if ptr != 0 { - store(ctxptr, code.idx, e.ptrToPtr(ptr)) - } - fallthrough - case opStructEscapedFieldAnonymousHeadStringTagInt64: - ptr := load(ctxptr, code.idx) - if ptr == 0 { - code = code.end.next - } else { - b = append(b, code.escapedKey...) - b = append(b, '"') - b = appendInt(b, e.ptrToInt64(ptr+code.offset)) - b = append(b, '"') - b = encodeComma(b) - code = code.next - } case opStructFieldPtrHeadStringTagUint: ptr := load(ctxptr, code.idx) if ptr != 0 { @@ -12713,27 +3787,6 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte b = encodeComma(b) code = code.next } - case opStructEscapedFieldPtrHeadStringTagUint: - ptr := load(ctxptr, code.idx) - if ptr != 0 { - store(ctxptr, code.idx, e.ptrToPtr(ptr)) - } - fallthrough - case opStructEscapedFieldHeadStringTagUint: - ptr := load(ctxptr, code.idx) - if ptr == 0 { - b = encodeNull(b) - b = encodeComma(b) - code = code.end.next - } else { - b = append(b, '{') - b = append(b, code.escapedKey...) - b = append(b, '"') - b = appendUint(b, uint64(e.ptrToUint(ptr+code.offset))) - b = append(b, '"') - b = encodeComma(b) - code = code.next - } case opStructFieldPtrAnonymousHeadStringTagUint: ptr := load(ctxptr, code.idx) if ptr != 0 { @@ -12752,24 +3805,6 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte b = encodeComma(b) code = code.next } - case opStructEscapedFieldPtrAnonymousHeadStringTagUint: - ptr := load(ctxptr, code.idx) - if ptr != 0 { - store(ctxptr, code.idx, e.ptrToPtr(ptr)) - } - fallthrough - case opStructEscapedFieldAnonymousHeadStringTagUint: - ptr := load(ctxptr, code.idx) - if ptr == 0 { - code = code.end.next - } else { - b = append(b, code.escapedKey...) - b = append(b, '"') - b = appendUint(b, uint64(e.ptrToUint(ptr+code.offset))) - b = append(b, '"') - b = encodeComma(b) - code = code.next - } case opStructFieldPtrHeadStringTagUint8: ptr := load(ctxptr, code.idx) if ptr != 0 { @@ -12791,27 +3826,6 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte b = encodeComma(b) code = code.next } - case opStructEscapedFieldPtrHeadStringTagUint8: - ptr := load(ctxptr, code.idx) - if ptr != 0 { - store(ctxptr, code.idx, e.ptrToPtr(ptr)) - } - fallthrough - case opStructEscapedFieldHeadStringTagUint8: - ptr := load(ctxptr, code.idx) - if ptr == 0 { - b = encodeNull(b) - b = encodeComma(b) - code = code.end.next - } else { - b = append(b, '{') - b = append(b, code.escapedKey...) - b = append(b, '"') - b = appendUint(b, uint64(e.ptrToUint8(ptr+code.offset))) - b = append(b, '"') - b = encodeComma(b) - code = code.next - } case opStructFieldPtrAnonymousHeadStringTagUint8: ptr := load(ctxptr, code.idx) if ptr != 0 { @@ -12830,24 +3844,6 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte b = encodeComma(b) code = code.next } - case opStructEscapedFieldPtrAnonymousHeadStringTagUint8: - ptr := load(ctxptr, code.idx) - if ptr != 0 { - store(ctxptr, code.idx, e.ptrToPtr(ptr)) - } - fallthrough - case opStructEscapedFieldAnonymousHeadStringTagUint8: - ptr := load(ctxptr, code.idx) - if ptr == 0 { - code = code.end.next - } else { - b = append(b, code.escapedKey...) - b = append(b, '"') - b = appendUint(b, uint64(e.ptrToUint8(ptr+code.offset))) - b = append(b, '"') - b = encodeComma(b) - code = code.next - } case opStructFieldPtrHeadStringTagUint16: ptr := load(ctxptr, code.idx) if ptr != 0 { @@ -12869,27 +3865,6 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte b = encodeComma(b) code = code.next } - case opStructEscapedFieldPtrHeadStringTagUint16: - ptr := load(ctxptr, code.idx) - if ptr != 0 { - store(ctxptr, code.idx, e.ptrToPtr(ptr)) - } - fallthrough - case opStructEscapedFieldHeadStringTagUint16: - ptr := load(ctxptr, code.idx) - if ptr == 0 { - b = encodeNull(b) - b = encodeComma(b) - code = code.end.next - } else { - b = append(b, '{') - b = append(b, code.escapedKey...) - b = append(b, '"') - b = appendUint(b, uint64(e.ptrToUint16(ptr+code.offset))) - b = append(b, '"') - b = encodeComma(b) - code = code.next - } case opStructFieldPtrAnonymousHeadStringTagUint16: ptr := load(ctxptr, code.idx) if ptr != 0 { @@ -12908,24 +3883,6 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte b = encodeComma(b) code = code.next } - case opStructEscapedFieldPtrAnonymousHeadStringTagUint16: - ptr := load(ctxptr, code.idx) - if ptr != 0 { - store(ctxptr, code.idx, e.ptrToPtr(ptr)) - } - fallthrough - case opStructEscapedFieldAnonymousHeadStringTagUint16: - ptr := load(ctxptr, code.idx) - if ptr == 0 { - code = code.end.next - } else { - b = append(b, code.escapedKey...) - b = append(b, '"') - b = appendUint(b, uint64(e.ptrToUint16(ptr+code.offset))) - b = append(b, '"') - b = encodeComma(b) - code = code.next - } case opStructFieldPtrHeadStringTagUint32: ptr := load(ctxptr, code.idx) if ptr != 0 { @@ -12947,27 +3904,6 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte b = encodeComma(b) code = code.next } - case opStructEscapedFieldPtrHeadStringTagUint32: - ptr := load(ctxptr, code.idx) - if ptr != 0 { - store(ctxptr, code.idx, e.ptrToPtr(ptr)) - } - fallthrough - case opStructEscapedFieldHeadStringTagUint32: - ptr := load(ctxptr, code.idx) - if ptr == 0 { - b = encodeNull(b) - b = encodeComma(b) - code = code.end.next - } else { - b = append(b, '{') - b = append(b, code.escapedKey...) - b = append(b, '"') - b = appendUint(b, uint64(e.ptrToUint32(ptr+code.offset))) - b = append(b, '"') - b = encodeComma(b) - code = code.next - } case opStructFieldPtrAnonymousHeadStringTagUint32: ptr := load(ctxptr, code.idx) if ptr != 0 { @@ -12986,24 +3922,6 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte b = encodeComma(b) code = code.next } - case opStructEscapedFieldPtrAnonymousHeadStringTagUint32: - ptr := load(ctxptr, code.idx) - if ptr != 0 { - store(ctxptr, code.idx, e.ptrToPtr(ptr)) - } - fallthrough - case opStructEscapedFieldAnonymousHeadStringTagUint32: - ptr := load(ctxptr, code.idx) - if ptr == 0 { - code = code.end.next - } else { - b = append(b, code.escapedKey...) - b = append(b, '"') - b = appendUint(b, uint64(e.ptrToUint32(ptr+code.offset))) - b = append(b, '"') - b = encodeComma(b) - code = code.next - } case opStructFieldPtrHeadStringTagUint64: ptr := load(ctxptr, code.idx) if ptr != 0 { @@ -13025,27 +3943,6 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte b = encodeComma(b) code = code.next } - case opStructEscapedFieldPtrHeadStringTagUint64: - ptr := load(ctxptr, code.idx) - if ptr != 0 { - store(ctxptr, code.idx, e.ptrToPtr(ptr)) - } - fallthrough - case opStructEscapedFieldHeadStringTagUint64: - ptr := load(ctxptr, code.idx) - if ptr == 0 { - b = encodeNull(b) - b = encodeComma(b) - code = code.end.next - } else { - b = append(b, '{') - b = append(b, code.escapedKey...) - b = append(b, '"') - b = appendUint(b, e.ptrToUint64(ptr+code.offset)) - b = append(b, '"') - b = encodeComma(b) - code = code.next - } case opStructFieldPtrAnonymousHeadStringTagUint64: ptr := load(ctxptr, code.idx) if ptr != 0 { @@ -13064,24 +3961,6 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte b = encodeComma(b) code = code.next } - case opStructEscapedFieldPtrAnonymousHeadStringTagUint64: - ptr := load(ctxptr, code.idx) - if ptr != 0 { - store(ctxptr, code.idx, e.ptrToPtr(ptr)) - } - fallthrough - case opStructEscapedFieldAnonymousHeadStringTagUint64: - ptr := load(ctxptr, code.idx) - if ptr == 0 { - code = code.end.next - } else { - b = append(b, code.escapedKey...) - b = append(b, '"') - b = appendUint(b, e.ptrToUint64(ptr+code.offset)) - b = append(b, '"') - b = encodeComma(b) - code = code.next - } case opStructFieldPtrHeadStringTagFloat32: ptr := load(ctxptr, code.idx) if ptr != 0 { @@ -13103,27 +3982,6 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte b = encodeComma(b) code = code.next } - case opStructEscapedFieldPtrHeadStringTagFloat32: - ptr := load(ctxptr, code.idx) - if ptr != 0 { - store(ctxptr, code.idx, e.ptrToPtr(ptr)) - } - fallthrough - case opStructEscapedFieldHeadStringTagFloat32: - ptr := load(ctxptr, code.idx) - if ptr == 0 { - b = encodeNull(b) - b = encodeComma(b) - code = code.end.next - } else { - b = append(b, '{') - b = append(b, code.escapedKey...) - b = append(b, '"') - b = encodeFloat32(b, e.ptrToFloat32(ptr+code.offset)) - b = append(b, '"') - b = encodeComma(b) - code = code.next - } case opStructFieldPtrAnonymousHeadStringTagFloat32: ptr := load(ctxptr, code.idx) if ptr != 0 { @@ -13142,24 +4000,6 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte b = encodeComma(b) code = code.next } - case opStructEscapedFieldPtrAnonymousHeadStringTagFloat32: - ptr := load(ctxptr, code.idx) - if ptr != 0 { - store(ctxptr, code.idx, e.ptrToPtr(ptr)) - } - fallthrough - case opStructEscapedFieldAnonymousHeadStringTagFloat32: - ptr := load(ctxptr, code.idx) - if ptr == 0 { - code = code.end.next - } else { - b = append(b, code.escapedKey...) - b = append(b, '"') - b = encodeFloat32(b, e.ptrToFloat32(ptr+code.offset)) - b = append(b, '"') - b = encodeComma(b) - code = code.next - } case opStructFieldPtrHeadStringTagFloat64: ptr := load(ctxptr, code.idx) if ptr != 0 { @@ -13185,31 +4025,6 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte b = encodeComma(b) code = code.next } - case opStructEscapedFieldPtrHeadStringTagFloat64: - ptr := load(ctxptr, code.idx) - if ptr != 0 { - store(ctxptr, code.idx, e.ptrToPtr(ptr)) - } - fallthrough - case opStructEscapedFieldHeadStringTagFloat64: - ptr := load(ctxptr, code.idx) - if ptr == 0 { - b = encodeNull(b) - b = encodeComma(b) - code = code.end.next - } else { - b = append(b, '{') - v := e.ptrToFloat64(ptr + code.offset) - if math.IsInf(v, 0) || math.IsNaN(v) { - return nil, errUnsupportedFloat(v) - } - b = append(b, code.escapedKey...) - b = append(b, '"') - b = encodeFloat64(b, v) - b = append(b, '"') - b = encodeComma(b) - code = code.next - } case opStructFieldPtrAnonymousHeadStringTagFloat64: ptr := load(ctxptr, code.idx) if ptr != 0 { @@ -13232,28 +4047,6 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte b = encodeComma(b) code = code.next } - case opStructEscapedFieldPtrAnonymousHeadStringTagFloat64: - ptr := load(ctxptr, code.idx) - if ptr != 0 { - store(ctxptr, code.idx, e.ptrToPtr(ptr)) - } - fallthrough - case opStructEscapedFieldAnonymousHeadStringTagFloat64: - ptr := load(ctxptr, code.idx) - if ptr == 0 { - code = code.end.next - } else { - v := e.ptrToFloat64(ptr + code.offset) - if math.IsInf(v, 0) || math.IsNaN(v) { - return nil, errUnsupportedFloat(v) - } - b = append(b, code.escapedKey...) - b = append(b, '"') - b = encodeFloat64(b, v) - b = append(b, '"') - b = encodeComma(b) - code = code.next - } case opStructFieldPtrHeadStringTagString: ptr := load(ctxptr, code.idx) if ptr != 0 { @@ -13274,26 +4067,6 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte b = encodeComma(b) code = code.next } - case opStructEscapedFieldPtrHeadStringTagEscapedString: - ptr := load(ctxptr, code.idx) - if ptr != 0 { - store(ctxptr, code.idx, e.ptrToPtr(ptr)) - } - fallthrough - case opStructEscapedFieldHeadStringTagEscapedString: - ptr := load(ctxptr, code.idx) - if ptr == 0 { - b = encodeNull(b) - b = encodeComma(b) - code = code.end.next - } else { - b = append(b, '{') - b = append(b, code.escapedKey...) - s := e.ptrToString(ptr + code.offset) - b = encodeEscapedString(b, string(encodeEscapedString([]byte{}, s))) - b = encodeComma(b) - code = code.next - } case opStructFieldPtrAnonymousHeadStringTagString: ptr := load(ctxptr, code.idx) if ptr != 0 { @@ -13311,23 +4084,6 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte b = encodeComma(b) code = code.next } - case opStructEscapedFieldPtrAnonymousHeadStringTagEscapedString: - ptr := load(ctxptr, code.idx) - if ptr != 0 { - store(ctxptr, code.idx, e.ptrToPtr(ptr)) - } - fallthrough - case opStructEscapedFieldAnonymousHeadStringTagEscapedString: - ptr := load(ctxptr, code.idx) - if ptr == 0 { - code = code.end.next - } else { - b = append(b, code.escapedKey...) - s := string(encodeEscapedString([]byte{}, e.ptrToString(ptr+code.offset))) - b = encodeEscapedString(b, s) - b = encodeComma(b) - code = code.next - } case opStructFieldPtrHeadStringTagBool: ptr := load(ctxptr, code.idx) if ptr != 0 { @@ -13349,45 +4105,6 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte b = encodeComma(b) code = code.next } - case opStructEscapedFieldPtrHeadStringTagBool: - ptr := load(ctxptr, code.idx) - if ptr != 0 { - store(ctxptr, code.idx, e.ptrToPtr(ptr)) - } - fallthrough - case opStructEscapedFieldHeadStringTagBool: - ptr := load(ctxptr, code.idx) - if ptr == 0 { - b = encodeNull(b) - b = encodeComma(b) - code = code.end.next - } else { - b = append(b, '{') - b = append(b, code.escapedKey...) - b = append(b, '"') - b = encodeBool(b, e.ptrToBool(ptr+code.offset)) - b = append(b, '"') - b = encodeComma(b) - code = code.next - } - case opStructEscapedFieldPtrHeadStringTagBoolOnly: - p := load(ctxptr, code.idx) - if p == 0 { - b = encodeNull(b) - b = encodeComma(b) - code = code.end.next - break - } - fallthrough - case opStructEscapedFieldHeadStringTagBoolOnly: - ptr := load(ctxptr, code.idx) - b = append(b, '{') - b = append(b, code.escapedKey...) - b = append(b, '"') - b = encodeBool(b, e.ptrToBool(ptr+code.offset)) - b = append(b, '"') - b = encodeComma(b) - code = code.next case opStructFieldPtrAnonymousHeadStringTagBool: ptr := load(ctxptr, code.idx) if ptr != 0 { @@ -13406,24 +4123,6 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte b = encodeComma(b) code = code.next } - case opStructEscapedFieldPtrAnonymousHeadStringTagBool: - ptr := load(ctxptr, code.idx) - if ptr != 0 { - store(ctxptr, code.idx, e.ptrToPtr(ptr)) - } - fallthrough - case opStructEscapedFieldAnonymousHeadStringTagBool: - ptr := load(ctxptr, code.idx) - if ptr == 0 { - code = code.end.next - } else { - b = append(b, code.escapedKey...) - b = append(b, '"') - b = encodeBool(b, e.ptrToBool(ptr+code.offset)) - b = append(b, '"') - b = encodeComma(b) - code = code.next - } case opStructFieldPtrHeadStringTagBytes: ptr := load(ctxptr, code.idx) if ptr != 0 { @@ -13443,25 +4142,6 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte b = encodeComma(b) code = code.next } - case opStructEscapedFieldPtrHeadStringTagBytes: - ptr := load(ctxptr, code.idx) - if ptr != 0 { - store(ctxptr, code.idx, e.ptrToPtr(ptr)) - } - fallthrough - case opStructEscapedFieldHeadStringTagBytes: - ptr := load(ctxptr, code.idx) - if ptr == 0 { - b = encodeNull(b) - b = encodeComma(b) - code = code.end.next - } else { - b = append(b, '{') - b = append(b, code.escapedKey...) - b = encodeByteSlice(b, e.ptrToBytes(ptr+code.offset)) - b = encodeComma(b) - code = code.next - } case opStructFieldPtrAnonymousHeadStringTagBytes: ptr := load(ctxptr, code.idx) if ptr != 0 { @@ -13478,22 +4158,6 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte b = encodeComma(b) code = code.next } - case opStructEscapedFieldPtrAnonymousHeadStringTagBytes: - ptr := load(ctxptr, code.idx) - if ptr != 0 { - store(ctxptr, code.idx, e.ptrToPtr(ptr)) - } - fallthrough - case opStructEscapedFieldAnonymousHeadStringTagBytes: - ptr := load(ctxptr, code.idx) - if ptr == 0 { - code = code.end.next - } else { - b = append(b, code.escapedKey...) - b = encodeByteSlice(b, e.ptrToBytes(ptr+code.offset)) - b = encodeComma(b) - code = code.next - } case opStructFieldPtrHeadStringTagMarshalJSON: ptr := load(ctxptr, code.idx) if ptr != 0 { @@ -13540,53 +4204,6 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte code = code.next } } - case opStructEscapedFieldPtrHeadStringTagMarshalJSON: - ptr := load(ctxptr, code.idx) - if ptr != 0 { - store(ctxptr, code.idx, e.ptrToPtr(ptr)) - } - fallthrough - case opStructEscapedFieldHeadStringTagMarshalJSON: - ptr := load(ctxptr, code.idx) - if ptr == 0 { - b = encodeNull(b) - b = encodeComma(b) - code = code.end.next - } else { - b = append(b, '{') - ptr += code.offset - p := e.ptrToUnsafePtr(ptr) - isPtr := code.typ.Kind() == reflect.Ptr - v := *(*interface{})(unsafe.Pointer(&interfaceHeader{typ: code.typ, ptr: p})) - bb, err := v.(Marshaler).MarshalJSON() - if err != nil { - return nil, &MarshalerError{ - Type: rtype2type(code.typ), - Err: err, - } - } - if len(bb) == 0 { - if isPtr { - return nil, errUnexpectedEndOfJSON( - fmt.Sprintf("error calling MarshalJSON for type %s", code.typ), - 0, - ) - } - b = append(b, code.escapedKey...) - b = append(b, '"', '"') - b = encodeComma(b) - code = code.nextField - } else { - var buf bytes.Buffer - if err := compact(&buf, bb, e.enabledHTMLEscape); err != nil { - return nil, err - } - b = append(b, code.escapedKey...) - b = encodeEscapedString(b, buf.String()) - b = encodeComma(b) - code = code.next - } - } case opStructFieldPtrAnonymousHeadStringTagMarshalJSON: ptr := load(ctxptr, code.idx) if ptr != 0 { @@ -13631,50 +4248,6 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte code = code.next } } - case opStructEscapedFieldPtrAnonymousHeadStringTagMarshalJSON: - ptr := load(ctxptr, code.idx) - if ptr != 0 { - store(ctxptr, code.idx, e.ptrToPtr(ptr)) - } - fallthrough - case opStructEscapedFieldAnonymousHeadStringTagMarshalJSON: - ptr := load(ctxptr, code.idx) - if ptr == 0 { - code = code.end.next - } else { - ptr += code.offset - p := e.ptrToUnsafePtr(ptr) - isPtr := code.typ.Kind() == reflect.Ptr - v := *(*interface{})(unsafe.Pointer(&interfaceHeader{typ: code.typ, ptr: p})) - bb, err := v.(Marshaler).MarshalJSON() - if err != nil { - return nil, &MarshalerError{ - Type: rtype2type(code.typ), - Err: err, - } - } - if len(bb) == 0 { - if isPtr { - return nil, errUnexpectedEndOfJSON( - fmt.Sprintf("error calling MarshalJSON for type %s", code.typ), - 0, - ) - } - b = append(b, code.escapedKey...) - b = append(b, '"', '"') - b = encodeComma(b) - code = code.nextField - } else { - var buf bytes.Buffer - if err := compact(&buf, bb, e.enabledHTMLEscape); err != nil { - return nil, err - } - b = append(b, code.escapedKey...) - b = encodeEscapedString(b, buf.String()) - b = encodeComma(b) - code = code.next - } - } case opStructFieldPtrHeadStringTagMarshalText: ptr := load(ctxptr, code.idx) if ptr != 0 { @@ -13704,35 +4277,6 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte b = encodeComma(b) code = code.next } - case opStructEscapedFieldPtrHeadStringTagMarshalText: - ptr := load(ctxptr, code.idx) - if ptr != 0 { - store(ctxptr, code.idx, e.ptrToPtr(ptr)) - } - fallthrough - case opStructEscapedFieldHeadStringTagMarshalText: - ptr := load(ctxptr, code.idx) - if ptr == 0 { - b = encodeNull(b) - b = encodeComma(b) - code = code.end.next - } else { - b = append(b, '{') - ptr += code.offset - p := e.ptrToUnsafePtr(ptr) - v := *(*interface{})(unsafe.Pointer(&interfaceHeader{typ: code.typ, ptr: p})) - bytes, err := v.(encoding.TextMarshaler).MarshalText() - if err != nil { - return nil, &MarshalerError{ - Type: rtype2type(code.typ), - Err: err, - } - } - b = append(b, code.escapedKey...) - b = encodeEscapedString(b, *(*string)(unsafe.Pointer(&bytes))) - b = encodeComma(b) - code = code.next - } case opStructFieldPtrAnonymousHeadStringTagMarshalText: ptr := load(ctxptr, code.idx) if ptr != 0 { @@ -13756,769 +4300,6 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte b = encodeComma(b) code = code.next } - case opStructEscapedFieldPtrAnonymousHeadStringTagMarshalText: - ptr := load(ctxptr, code.idx) - if ptr != 0 { - store(ctxptr, code.idx, e.ptrToPtr(ptr)) - } - fallthrough - case opStructEscapedFieldAnonymousHeadStringTagMarshalText: - ptr := load(ctxptr, code.idx) - if ptr == 0 { - code = code.end.next - } else { - ptr += code.offset - p := e.ptrToUnsafePtr(ptr) - 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 = append(b, code.escapedKey...) - b = encodeEscapedString(b, *(*string)(unsafe.Pointer(&bytes))) - b = encodeComma(b) - code = code.next - } - case opStructFieldPtrHeadStringTagIndent: - ptr := load(ctxptr, code.idx) - if ptr != 0 { - store(ctxptr, code.idx, e.ptrToPtr(ptr)) - } - fallthrough - case opStructFieldHeadStringTagIndent: - 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.key...) - b = append(b, ' ') - code = code.next - store(ctxptr, code.idx, p) - } - case opStructEscapedFieldPtrHeadStringTagIndent: - ptr := load(ctxptr, code.idx) - if ptr != 0 { - store(ctxptr, code.idx, e.ptrToPtr(ptr)) - } - fallthrough - case opStructEscapedFieldHeadStringTagIndent: - 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) - } - case opStructFieldPtrHeadStringTagIntIndent: - ptr := load(ctxptr, code.idx) - if ptr != 0 { - store(ctxptr, code.idx, e.ptrToPtr(ptr)) - } - fallthrough - case opStructFieldHeadStringTagIntIndent: - 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.key...) - b = append(b, ' ', '"') - b = appendInt(b, int64(e.ptrToInt(ptr+code.offset))) - b = append(b, '"') - b = encodeIndentComma(b) - code = code.next - } - case opStructEscapedFieldPtrHeadStringTagIntIndent: - ptr := load(ctxptr, code.idx) - if ptr != 0 { - store(ctxptr, code.idx, e.ptrToPtr(ptr)) - } - fallthrough - case opStructEscapedFieldHeadStringTagIntIndent: - 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 - } - case opStructFieldPtrHeadStringTagInt8Indent: - ptr := load(ctxptr, code.idx) - if ptr != 0 { - store(ctxptr, code.idx, e.ptrToPtr(ptr)) - } - fallthrough - case opStructFieldHeadStringTagInt8Indent: - 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.key...) - b = append(b, ' ', '"') - b = appendInt(b, int64(e.ptrToInt8(ptr+code.offset))) - b = append(b, '"') - b = encodeIndentComma(b) - code = code.next - } - case opStructEscapedFieldPtrHeadStringTagInt8Indent: - ptr := load(ctxptr, code.idx) - if ptr != 0 { - store(ctxptr, code.idx, e.ptrToPtr(ptr)) - } - fallthrough - case opStructEscapedFieldHeadStringTagInt8Indent: - 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 - } - case opStructFieldPtrHeadStringTagInt16Indent: - ptr := load(ctxptr, code.idx) - if ptr != 0 { - store(ctxptr, code.idx, e.ptrToPtr(ptr)) - } - fallthrough - case opStructFieldHeadStringTagInt16Indent: - 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.key...) - b = append(b, ' ', '"') - b = appendInt(b, int64(e.ptrToInt16(ptr+code.offset))) - b = append(b, '"') - b = encodeIndentComma(b) - code = code.next - } - case opStructEscapedFieldPtrHeadStringTagInt16Indent: - ptr := load(ctxptr, code.idx) - if ptr != 0 { - store(ctxptr, code.idx, e.ptrToPtr(ptr)) - } - fallthrough - case opStructEscapedFieldHeadStringTagInt16Indent: - 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 - } - case opStructFieldPtrHeadStringTagInt32Indent: - ptr := load(ctxptr, code.idx) - if ptr != 0 { - store(ctxptr, code.idx, e.ptrToPtr(ptr)) - } - fallthrough - case opStructFieldHeadStringTagInt32Indent: - 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.key...) - b = append(b, ' ', '"') - b = appendInt(b, int64(e.ptrToInt32(ptr+code.offset))) - b = append(b, '"') - b = encodeIndentComma(b) - code = code.next - } - case opStructEscapedFieldPtrHeadStringTagInt32Indent: - ptr := load(ctxptr, code.idx) - if ptr != 0 { - store(ctxptr, code.idx, e.ptrToPtr(ptr)) - } - fallthrough - case opStructEscapedFieldHeadStringTagInt32Indent: - 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 - } - case opStructFieldPtrHeadStringTagInt64Indent: - ptr := load(ctxptr, code.idx) - if ptr != 0 { - store(ctxptr, code.idx, e.ptrToPtr(ptr)) - } - fallthrough - case opStructFieldHeadStringTagInt64Indent: - 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.key...) - b = append(b, ' ', '"') - b = appendInt(b, e.ptrToInt64(ptr+code.offset)) - b = append(b, '"') - b = encodeIndentComma(b) - code = code.next - } - case opStructEscapedFieldPtrHeadStringTagInt64Indent: - ptr := load(ctxptr, code.idx) - if ptr != 0 { - store(ctxptr, code.idx, e.ptrToPtr(ptr)) - } - fallthrough - case opStructEscapedFieldHeadStringTagInt64Indent: - 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 - } - case opStructFieldPtrHeadStringTagUintIndent: - ptr := load(ctxptr, code.idx) - if ptr != 0 { - store(ctxptr, code.idx, e.ptrToPtr(ptr)) - } - fallthrough - case opStructFieldHeadStringTagUintIndent: - 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.key...) - b = append(b, ' ', '"') - b = appendUint(b, uint64(e.ptrToUint(ptr+code.offset))) - b = append(b, '"') - b = encodeIndentComma(b) - code = code.next - } - case opStructEscapedFieldPtrHeadStringTagUintIndent: - ptr := load(ctxptr, code.idx) - if ptr != 0 { - store(ctxptr, code.idx, e.ptrToPtr(ptr)) - } - fallthrough - case opStructEscapedFieldHeadStringTagUintIndent: - 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 - } - case opStructFieldPtrHeadStringTagUint8Indent: - ptr := load(ctxptr, code.idx) - if ptr != 0 { - store(ctxptr, code.idx, e.ptrToPtr(ptr)) - } - fallthrough - case opStructFieldHeadStringTagUint8Indent: - 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.key...) - b = append(b, ' ', '"') - b = appendUint(b, uint64(e.ptrToUint8(ptr+code.offset))) - b = append(b, '"') - b = encodeIndentComma(b) - code = code.next - } - case opStructEscapedFieldPtrHeadStringTagUint8Indent: - ptr := load(ctxptr, code.idx) - if ptr != 0 { - store(ctxptr, code.idx, e.ptrToPtr(ptr)) - } - fallthrough - case opStructEscapedFieldHeadStringTagUint8Indent: - 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 - } - case opStructFieldPtrHeadStringTagUint16Indent: - ptr := load(ctxptr, code.idx) - if ptr != 0 { - store(ctxptr, code.idx, e.ptrToPtr(ptr)) - } - fallthrough - case opStructFieldHeadStringTagUint16Indent: - 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.key...) - b = append(b, ' ', '"') - b = appendUint(b, uint64(e.ptrToUint16(ptr+code.offset))) - b = append(b, '"') - b = encodeIndentComma(b) - code = code.next - } - case opStructEscapedFieldPtrHeadStringTagUint16Indent: - ptr := load(ctxptr, code.idx) - if ptr != 0 { - store(ctxptr, code.idx, e.ptrToPtr(ptr)) - } - fallthrough - case opStructEscapedFieldHeadStringTagUint16Indent: - 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 - } - case opStructFieldPtrHeadStringTagUint32Indent: - ptr := load(ctxptr, code.idx) - if ptr != 0 { - store(ctxptr, code.idx, e.ptrToPtr(ptr)) - } - fallthrough - case opStructFieldHeadStringTagUint32Indent: - 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.key...) - b = append(b, ' ', '"') - b = appendUint(b, uint64(e.ptrToUint32(ptr+code.offset))) - b = append(b, '"') - b = encodeIndentComma(b) - code = code.next - } - case opStructEscapedFieldPtrHeadStringTagUint32Indent: - ptr := load(ctxptr, code.idx) - if ptr != 0 { - store(ctxptr, code.idx, e.ptrToPtr(ptr)) - } - fallthrough - case opStructEscapedFieldHeadStringTagUint32Indent: - 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 - } - case opStructFieldPtrHeadStringTagUint64Indent: - ptr := load(ctxptr, code.idx) - if ptr != 0 { - store(ctxptr, code.idx, e.ptrToPtr(ptr)) - } - fallthrough - case opStructFieldHeadStringTagUint64Indent: - 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.key...) - b = append(b, ' ', '"') - b = appendUint(b, e.ptrToUint64(ptr+code.offset)) - b = append(b, '"') - b = encodeIndentComma(b) - code = code.next - } - case opStructEscapedFieldPtrHeadStringTagUint64Indent: - ptr := load(ctxptr, code.idx) - if ptr != 0 { - store(ctxptr, code.idx, e.ptrToPtr(ptr)) - } - fallthrough - case opStructEscapedFieldHeadStringTagUint64Indent: - 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 - } - case opStructFieldPtrHeadStringTagFloat32Indent: - ptr := load(ctxptr, code.idx) - if ptr != 0 { - store(ctxptr, code.idx, e.ptrToPtr(ptr)) - } - fallthrough - case opStructFieldHeadStringTagFloat32Indent: - 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.key...) - b = append(b, ' ', '"') - b = encodeFloat32(b, e.ptrToFloat32(ptr+code.offset)) - b = append(b, '"') - b = encodeIndentComma(b) - code = code.next - } - case opStructEscapedFieldPtrHeadStringTagFloat32Indent: - ptr := load(ctxptr, code.idx) - if ptr != 0 { - store(ctxptr, code.idx, e.ptrToPtr(ptr)) - } - fallthrough - case opStructEscapedFieldHeadStringTagFloat32Indent: - 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 - } - case opStructFieldPtrHeadStringTagFloat64Indent: - ptr := load(ctxptr, code.idx) - if ptr != 0 { - store(ctxptr, code.idx, e.ptrToPtr(ptr)) - } - fallthrough - case opStructFieldHeadStringTagFloat64Indent: - 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.key...) - b = append(b, ' ', '"') - b = encodeFloat64(b, v) - b = append(b, '"') - b = encodeIndentComma(b) - code = code.next - } - case opStructEscapedFieldPtrHeadStringTagFloat64Indent: - ptr := load(ctxptr, code.idx) - if ptr != 0 { - store(ctxptr, code.idx, e.ptrToPtr(ptr)) - } - fallthrough - case opStructEscapedFieldHeadStringTagFloat64Indent: - 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 - } - case opStructFieldPtrHeadStringTagStringIndent: - ptr := load(ctxptr, code.idx) - if ptr != 0 { - store(ctxptr, code.idx, e.ptrToPtr(ptr)) - } - fallthrough - case opStructFieldHeadStringTagStringIndent: - 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.key...) - b = append(b, ' ') - s := e.ptrToString(ptr + code.offset) - b = encodeNoEscapedString(b, string(encodeNoEscapedString([]byte{}, s))) - b = encodeIndentComma(b) - code = code.next - } - case opStructEscapedFieldPtrHeadStringTagEscapedStringIndent: - ptr := load(ctxptr, code.idx) - if ptr != 0 { - store(ctxptr, code.idx, e.ptrToPtr(ptr)) - } - fallthrough - case opStructEscapedFieldHeadStringTagEscapedStringIndent: - 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 - } - case opStructFieldPtrHeadStringTagBoolIndent: - ptr := load(ctxptr, code.idx) - if ptr != 0 { - store(ctxptr, code.idx, e.ptrToPtr(ptr)) - } - fallthrough - case opStructFieldHeadStringTagBoolIndent: - 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.key...) - b = append(b, ' ', '"') - b = encodeBool(b, e.ptrToBool(ptr+code.offset)) - b = append(b, '"') - b = encodeIndentComma(b) - code = code.next - } - case opStructEscapedFieldPtrHeadStringTagBoolIndent: - ptr := load(ctxptr, code.idx) - if ptr != 0 { - store(ctxptr, code.idx, e.ptrToPtr(ptr)) - } - fallthrough - case opStructEscapedFieldHeadStringTagBoolIndent: - 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 - } - case opStructFieldPtrHeadStringTagBytesIndent: - ptr := load(ctxptr, code.idx) - if ptr != 0 { - store(ctxptr, code.idx, e.ptrToPtr(ptr)) - } - fallthrough - case opStructFieldHeadStringTagBytesIndent: - 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.key...) - b = append(b, ' ') - b = encodeByteSlice(b, e.ptrToBytes(ptr+code.offset)) - b = encodeIndentComma(b) - code = code.next - } - case opStructEscapedFieldPtrHeadStringTagBytesIndent: - ptr := load(ctxptr, code.idx) - if ptr != 0 { - store(ctxptr, code.idx, e.ptrToPtr(ptr)) - } - fallthrough - case opStructEscapedFieldHeadStringTagBytesIndent: - 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 - } case opStructField: if !code.anonymousKey { b = append(b, code.key...) @@ -14526,13 +4307,6 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte ptr := load(ctxptr, code.headIdx) + code.offset code = code.next store(ctxptr, code.idx, ptr) - case opStructEscapedField: - if !code.anonymousKey { - b = append(b, code.escapedKey...) - } - ptr := load(ctxptr, code.headIdx) + code.offset - code = code.next - store(ctxptr, code.idx, ptr) case opStructFieldIntPtr: b = append(b, code.key...) ptr := load(ctxptr, code.headIdx) @@ -14544,17 +4318,6 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte } b = encodeComma(b) code = code.next - case opStructEscapedFieldIntPtr: - b = append(b, code.escapedKey...) - 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 = encodeComma(b) - code = code.next case opStructFieldIntNPtr: b = append(b, code.key...) ptr := load(ctxptr, code.headIdx) @@ -14572,35 +4335,12 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte } b = encodeComma(b) code = code.next - case opStructEscapedFieldIntNPtr: - b = append(b, code.escapedKey...) - ptr := load(ctxptr, code.headIdx) - p := e.ptrToPtr(ptr + code.offset) - for i := 0; i < code.ptrNum-1; i++ { - if p == 0 { - break - } - p = e.ptrToPtr(p) - } - if p == 0 { - b = encodeNull(b) - } else { - b = appendInt(b, int64(e.ptrToInt(p))) - } - b = encodeComma(b) - code = code.next case opStructFieldInt: ptr := load(ctxptr, code.headIdx) b = append(b, code.key...) b = appendInt(b, int64(e.ptrToInt(ptr+code.offset))) b = encodeComma(b) code = code.next - case opStructEscapedFieldInt: - ptr := load(ctxptr, code.headIdx) - b = append(b, code.escapedKey...) - b = appendInt(b, int64(e.ptrToInt(ptr+code.offset))) - b = encodeComma(b) - code = code.next case opStructFieldInt8Ptr: b = append(b, code.key...) ptr := load(ctxptr, code.headIdx) @@ -14612,29 +4352,12 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte } b = encodeComma(b) code = code.next - case opStructEscapedFieldInt8Ptr: - b = append(b, code.escapedKey...) - 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 = encodeComma(b) - code = code.next case opStructFieldInt8: ptr := load(ctxptr, code.headIdx) b = append(b, code.key...) b = appendInt(b, int64(e.ptrToInt8(ptr+code.offset))) b = encodeComma(b) code = code.next - case opStructEscapedFieldInt8: - ptr := load(ctxptr, code.headIdx) - b = append(b, code.escapedKey...) - b = appendInt(b, int64(e.ptrToInt8(ptr+code.offset))) - b = encodeComma(b) - code = code.next case opStructFieldInt16Ptr: b = append(b, code.key...) ptr := load(ctxptr, code.headIdx) @@ -14646,29 +4369,12 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte } b = encodeComma(b) code = code.next - case opStructEscapedFieldInt16Ptr: - b = append(b, code.escapedKey...) - 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 = encodeComma(b) - code = code.next case opStructFieldInt16: ptr := load(ctxptr, code.headIdx) b = append(b, code.key...) b = appendInt(b, int64(e.ptrToInt16(ptr+code.offset))) b = encodeComma(b) code = code.next - case opStructEscapedFieldInt16: - ptr := load(ctxptr, code.headIdx) - b = append(b, code.escapedKey...) - b = appendInt(b, int64(e.ptrToInt16(ptr+code.offset))) - b = encodeComma(b) - code = code.next case opStructFieldInt32Ptr: b = append(b, code.key...) ptr := load(ctxptr, code.headIdx) @@ -14680,29 +4386,12 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte } b = encodeComma(b) code = code.next - case opStructEscapedFieldInt32Ptr: - b = append(b, code.escapedKey...) - 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 = encodeComma(b) - code = code.next case opStructFieldInt32: ptr := load(ctxptr, code.headIdx) b = append(b, code.key...) b = appendInt(b, int64(e.ptrToInt32(ptr+code.offset))) b = encodeComma(b) code = code.next - case opStructEscapedFieldInt32: - ptr := load(ctxptr, code.headIdx) - b = append(b, code.escapedKey...) - b = appendInt(b, int64(e.ptrToInt32(ptr+code.offset))) - b = encodeComma(b) - code = code.next case opStructFieldInt64Ptr: b = append(b, code.key...) ptr := load(ctxptr, code.headIdx) @@ -14714,29 +4403,12 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte } b = encodeComma(b) code = code.next - case opStructEscapedFieldInt64Ptr: - b = append(b, code.escapedKey...) - 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 = encodeComma(b) - code = code.next case opStructFieldInt64: ptr := load(ctxptr, code.headIdx) b = append(b, code.key...) b = appendInt(b, e.ptrToInt64(ptr+code.offset)) b = encodeComma(b) code = code.next - case opStructEscapedFieldInt64: - ptr := load(ctxptr, code.headIdx) - b = append(b, code.escapedKey...) - b = appendInt(b, e.ptrToInt64(ptr+code.offset)) - b = encodeComma(b) - code = code.next case opStructFieldUintPtr: b = append(b, code.key...) ptr := load(ctxptr, code.headIdx) @@ -14748,29 +4420,12 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte } b = encodeComma(b) code = code.next - case opStructEscapedFieldUintPtr: - b = append(b, code.escapedKey...) - 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 = encodeComma(b) - code = code.next case opStructFieldUint: ptr := load(ctxptr, code.headIdx) b = append(b, code.key...) b = appendUint(b, uint64(e.ptrToUint(ptr+code.offset))) b = encodeComma(b) code = code.next - case opStructEscapedFieldUint: - ptr := load(ctxptr, code.headIdx) - b = append(b, code.escapedKey...) - b = appendUint(b, uint64(e.ptrToUint(ptr+code.offset))) - b = encodeComma(b) - code = code.next case opStructFieldUint8Ptr: b = append(b, code.key...) ptr := load(ctxptr, code.headIdx) @@ -14782,29 +4437,12 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte } b = encodeComma(b) code = code.next - case opStructEscapedFieldUint8Ptr: - b = append(b, code.escapedKey...) - 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 = encodeComma(b) - code = code.next case opStructFieldUint8: ptr := load(ctxptr, code.headIdx) b = append(b, code.key...) b = appendUint(b, uint64(e.ptrToUint8(ptr+code.offset))) b = encodeComma(b) code = code.next - case opStructEscapedFieldUint8: - ptr := load(ctxptr, code.headIdx) - b = append(b, code.escapedKey...) - b = appendUint(b, uint64(e.ptrToUint8(ptr+code.offset))) - b = encodeComma(b) - code = code.next case opStructFieldUint16Ptr: b = append(b, code.key...) ptr := load(ctxptr, code.headIdx) @@ -14816,29 +4454,12 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte } b = encodeComma(b) code = code.next - case opStructEscapedFieldUint16Ptr: - b = append(b, code.escapedKey...) - 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 = encodeComma(b) - code = code.next case opStructFieldUint16: ptr := load(ctxptr, code.headIdx) b = append(b, code.key...) b = appendUint(b, uint64(e.ptrToUint16(ptr+code.offset))) b = encodeComma(b) code = code.next - case opStructEscapedFieldUint16: - ptr := load(ctxptr, code.headIdx) - b = append(b, code.escapedKey...) - b = appendUint(b, uint64(e.ptrToUint16(ptr+code.offset))) - b = encodeComma(b) - code = code.next case opStructFieldUint32Ptr: b = append(b, code.key...) ptr := load(ctxptr, code.headIdx) @@ -14850,29 +4471,12 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte } b = encodeComma(b) code = code.next - case opStructEscapedFieldUint32Ptr: - b = append(b, code.escapedKey...) - 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 = encodeComma(b) - code = code.next case opStructFieldUint32: ptr := load(ctxptr, code.headIdx) b = append(b, code.key...) b = appendUint(b, uint64(e.ptrToUint32(ptr+code.offset))) b = encodeComma(b) code = code.next - case opStructEscapedFieldUint32: - ptr := load(ctxptr, code.headIdx) - b = append(b, code.escapedKey...) - b = appendUint(b, uint64(e.ptrToUint32(ptr+code.offset))) - b = encodeComma(b) - code = code.next case opStructFieldUint64Ptr: b = append(b, code.key...) ptr := load(ctxptr, code.headIdx) @@ -14884,29 +4488,12 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte } b = encodeComma(b) code = code.next - case opStructEscapedFieldUint64Ptr: - b = append(b, code.escapedKey...) - 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 = encodeComma(b) - code = code.next case opStructFieldUint64: ptr := load(ctxptr, code.headIdx) b = append(b, code.key...) b = appendUint(b, e.ptrToUint64(ptr+code.offset)) b = encodeComma(b) code = code.next - case opStructEscapedFieldUint64: - ptr := load(ctxptr, code.headIdx) - b = append(b, code.escapedKey...) - b = appendUint(b, e.ptrToUint64(ptr+code.offset)) - b = encodeComma(b) - code = code.next case opStructFieldFloat32Ptr: b = append(b, code.key...) ptr := load(ctxptr, code.headIdx) @@ -14918,29 +4505,12 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte } b = encodeComma(b) code = code.next - case opStructEscapedFieldFloat32Ptr: - b = append(b, code.escapedKey...) - 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 = encodeComma(b) - code = code.next case opStructFieldFloat32: ptr := load(ctxptr, code.headIdx) b = append(b, code.key...) b = encodeFloat32(b, e.ptrToFloat32(ptr+code.offset)) b = encodeComma(b) code = code.next - case opStructEscapedFieldFloat32: - ptr := load(ctxptr, code.headIdx) - b = append(b, code.escapedKey...) - b = encodeFloat32(b, e.ptrToFloat32(ptr+code.offset)) - b = encodeComma(b) - code = code.next case opStructFieldFloat64Ptr: b = append(b, code.key...) ptr := load(ctxptr, code.headIdx) @@ -14958,23 +4528,6 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte b = encodeFloat64(b, v) b = encodeComma(b) code = code.next - case opStructEscapedFieldFloat64Ptr: - b = append(b, code.escapedKey...) - ptr := load(ctxptr, code.headIdx) - p := e.ptrToPtr(ptr + code.offset) - if p == 0 { - b = encodeNull(b) - b = encodeComma(b) - code = code.next - break - } - v := e.ptrToFloat64(p) - if math.IsInf(v, 0) || math.IsNaN(v) { - return nil, errUnsupportedFloat(v) - } - b = encodeFloat64(b, v) - b = encodeComma(b) - code = code.next case opStructFieldFloat64: ptr := load(ctxptr, code.headIdx) b = append(b, code.key...) @@ -14985,16 +4538,6 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte b = encodeFloat64(b, v) b = encodeComma(b) code = code.next - case opStructEscapedFieldFloat64: - ptr := load(ctxptr, code.headIdx) - b = append(b, code.escapedKey...) - v := e.ptrToFloat64(ptr + code.offset) - if math.IsInf(v, 0) || math.IsNaN(v) { - return nil, errUnsupportedFloat(v) - } - b = encodeFloat64(b, v) - b = encodeComma(b) - code = code.next case opStructFieldStringPtr: b = append(b, code.key...) ptr := load(ctxptr, code.headIdx) @@ -15006,29 +4549,12 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte } b = encodeComma(b) code = code.next - case opStructEscapedFieldEscapedStringPtr: - b = append(b, code.escapedKey...) - ptr := load(ctxptr, code.headIdx) - p := e.ptrToPtr(ptr + code.offset) - if p == 0 { - b = encodeNull(b) - } else { - b = encodeEscapedString(b, e.ptrToString(p)) - } - b = encodeComma(b) - code = code.next case opStructFieldString: ptr := load(ctxptr, code.headIdx) b = append(b, code.key...) b = encodeNoEscapedString(b, e.ptrToString(ptr+code.offset)) b = encodeComma(b) code = code.next - case opStructEscapedFieldEscapedString: - ptr := load(ctxptr, code.headIdx) - b = append(b, code.escapedKey...) - b = encodeEscapedString(b, e.ptrToString(ptr+code.offset)) - b = encodeComma(b) - code = code.next case opStructFieldBoolPtr: b = append(b, code.key...) ptr := load(ctxptr, code.headIdx) @@ -15040,41 +4566,18 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte } b = encodeComma(b) code = code.next - case opStructEscapedFieldBoolPtr: - b = append(b, code.escapedKey...) - ptr := load(ctxptr, code.headIdx) - p := e.ptrToPtr(ptr + code.offset) - if p == 0 { - b = encodeNull(b) - } else { - b = encodeBool(b, e.ptrToBool(p)) - } - b = encodeComma(b) - code = code.next case opStructFieldBool: ptr := load(ctxptr, code.headIdx) b = append(b, code.key...) b = encodeBool(b, e.ptrToBool(ptr+code.offset)) b = encodeComma(b) code = code.next - case opStructEscapedFieldBool: - ptr := load(ctxptr, code.headIdx) - b = append(b, code.escapedKey...) - b = encodeBool(b, e.ptrToBool(ptr+code.offset)) - b = encodeComma(b) - code = code.next case opStructFieldBytes: ptr := load(ctxptr, code.headIdx) b = append(b, code.key...) b = encodeByteSlice(b, e.ptrToBytes(ptr+code.offset)) b = encodeComma(b) code = code.next - case opStructEscapedFieldBytes: - ptr := load(ctxptr, code.headIdx) - b = append(b, code.escapedKey...) - b = encodeByteSlice(b, e.ptrToBytes(ptr+code.offset)) - b = encodeComma(b) - code = code.next case opStructFieldMarshalJSON: ptr := load(ctxptr, code.headIdx) b = append(b, code.key...) @@ -15091,22 +4594,6 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte b = append(b, buf.Bytes()...) b = encodeComma(b) code = code.next - case opStructEscapedFieldMarshalJSON: - ptr := load(ctxptr, code.headIdx) - b = append(b, code.escapedKey...) - 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 = encodeComma(b) - code = code.next case opStructFieldMarshalText: ptr := load(ctxptr, code.headIdx) b = append(b, code.key...) @@ -15119,552 +4606,36 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte b = encodeNoEscapedString(b, *(*string)(unsafe.Pointer(&bytes))) b = encodeComma(b) code = code.next - case opStructEscapedFieldMarshalText: - ptr := load(ctxptr, code.headIdx) - b = append(b, code.escapedKey...) - 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 = encodeComma(b) - code = code.next case opStructFieldArray: b = append(b, code.key...) ptr := load(ctxptr, code.headIdx) p := ptr + code.offset code = code.next store(ctxptr, code.idx, p) - case opStructEscapedFieldArray: - b = append(b, code.escapedKey...) - ptr := load(ctxptr, code.headIdx) - p := ptr + code.offset - code = code.next - store(ctxptr, code.idx, p) case opStructFieldSlice: b = append(b, code.key...) ptr := load(ctxptr, code.headIdx) p := ptr + code.offset code = code.next store(ctxptr, code.idx, p) - case opStructEscapedFieldSlice: - b = append(b, code.escapedKey...) - ptr := load(ctxptr, code.headIdx) - p := ptr + code.offset - code = code.next - store(ctxptr, code.idx, p) case opStructFieldMap: b = append(b, code.key...) ptr := load(ctxptr, code.headIdx) p := ptr + code.offset code = code.next store(ctxptr, code.idx, p) - case opStructEscapedFieldMap: - b = append(b, code.escapedKey...) - ptr := load(ctxptr, code.headIdx) - p := ptr + code.offset - code = code.next - store(ctxptr, code.idx, p) case opStructFieldMapLoad: b = append(b, code.key...) ptr := load(ctxptr, code.headIdx) p := ptr + code.offset code = code.next store(ctxptr, code.idx, p) - case opStructEscapedFieldMapLoad: - b = append(b, code.escapedKey...) - ptr := load(ctxptr, code.headIdx) - p := ptr + code.offset - code = code.next - store(ctxptr, code.idx, p) case opStructFieldStruct: b = append(b, code.key...) ptr := load(ctxptr, code.headIdx) p := ptr + code.offset code = code.next store(ctxptr, code.idx, p) - case opStructEscapedFieldStruct: - b = append(b, code.escapedKey...) - ptr := load(ctxptr, code.headIdx) - p := ptr + code.offset - code = code.next - store(ctxptr, code.idx, p) - case opStructFieldIndent: - b = e.encodeIndent(b, code.indent) - b = append(b, code.key...) - b = append(b, ' ') - ptr := load(ctxptr, code.headIdx) - p := ptr + code.offset - code = code.next - store(ctxptr, code.idx, p) - case opStructEscapedFieldIndent: - 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) - case opStructFieldIntIndent: - b = e.encodeIndent(b, code.indent) - b = append(b, code.key...) - b = append(b, ' ') - ptr := load(ctxptr, code.headIdx) - b = appendInt(b, int64(e.ptrToInt(ptr+code.offset))) - b = encodeIndentComma(b) - code = code.next - case opStructEscapedFieldIntIndent: - 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 - case opStructFieldInt8Indent: - b = e.encodeIndent(b, code.indent) - b = append(b, code.key...) - b = append(b, ' ') - ptr := load(ctxptr, code.headIdx) - b = appendInt(b, int64(e.ptrToInt8(ptr+code.offset))) - b = encodeIndentComma(b) - code = code.next - case opStructEscapedFieldInt8Indent: - 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 - case opStructFieldInt16Indent: - b = e.encodeIndent(b, code.indent) - b = append(b, code.key...) - b = append(b, ' ') - ptr := load(ctxptr, code.headIdx) - b = appendInt(b, int64(e.ptrToInt16(ptr+code.offset))) - b = encodeIndentComma(b) - code = code.next - case opStructEscapedFieldInt16Indent: - 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 - case opStructFieldInt32Indent: - b = e.encodeIndent(b, code.indent) - b = append(b, code.key...) - b = append(b, ' ') - ptr := load(ctxptr, code.headIdx) - b = appendInt(b, int64(e.ptrToInt32(ptr+code.offset))) - b = encodeIndentComma(b) - code = code.next - case opStructEscapedFieldInt32Indent: - 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 - case opStructFieldInt64Indent: - b = e.encodeIndent(b, code.indent) - b = append(b, code.key...) - b = append(b, ' ') - ptr := load(ctxptr, code.headIdx) - b = appendInt(b, e.ptrToInt64(ptr+code.offset)) - b = encodeIndentComma(b) - code = code.next - case opStructEscapedFieldInt64Indent: - 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 - case opStructFieldUintIndent: - b = e.encodeIndent(b, code.indent) - b = append(b, code.key...) - b = append(b, ' ') - ptr := load(ctxptr, code.headIdx) - b = appendUint(b, uint64(e.ptrToUint(ptr+code.offset))) - b = encodeIndentComma(b) - code = code.next - case opStructEscapedFieldUintIndent: - 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 - case opStructFieldUint8Indent: - b = e.encodeIndent(b, code.indent) - b = append(b, code.key...) - b = append(b, ' ') - ptr := load(ctxptr, code.headIdx) - b = appendUint(b, uint64(e.ptrToUint8(ptr+code.offset))) - b = encodeIndentComma(b) - code = code.next - case opStructEscapedFieldUint8Indent: - 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 - case opStructFieldUint16Indent: - b = e.encodeIndent(b, code.indent) - b = append(b, code.key...) - b = append(b, ' ') - ptr := load(ctxptr, code.headIdx) - b = appendUint(b, uint64(e.ptrToUint16(ptr+code.offset))) - b = encodeIndentComma(b) - code = code.next - case opStructEscapedFieldUint16Indent: - 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 - case opStructFieldUint32Indent: - b = e.encodeIndent(b, code.indent) - b = append(b, code.key...) - b = append(b, ' ') - ptr := load(ctxptr, code.headIdx) - b = appendUint(b, uint64(e.ptrToUint32(ptr+code.offset))) - b = encodeIndentComma(b) - code = code.next - case opStructEscapedFieldUint32Indent: - 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 - case opStructFieldUint64Indent: - b = e.encodeIndent(b, code.indent) - b = append(b, code.key...) - b = append(b, ' ') - ptr := load(ctxptr, code.headIdx) - b = appendUint(b, e.ptrToUint64(ptr+code.offset)) - b = encodeIndentComma(b) - code = code.next - case opStructEscapedFieldUint64Indent: - 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 - case opStructFieldFloat32Indent: - b = e.encodeIndent(b, code.indent) - b = append(b, code.key...) - b = append(b, ' ') - ptr := load(ctxptr, code.headIdx) - b = encodeFloat32(b, e.ptrToFloat32(ptr+code.offset)) - b = encodeIndentComma(b) - code = code.next - case opStructEscapedFieldFloat32Indent: - 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 - case opStructFieldFloat64Indent: - b = e.encodeIndent(b, code.indent) - b = append(b, code.key...) - 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 - case opStructEscapedFieldFloat64Indent: - 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 - case opStructFieldStringIndent: - b = e.encodeIndent(b, code.indent) - b = append(b, code.key...) - b = append(b, ' ') - ptr := load(ctxptr, code.headIdx) - b = encodeNoEscapedString(b, e.ptrToString(ptr+code.offset)) - b = encodeIndentComma(b) - code = code.next - case opStructEscapedFieldEscapedStringIndent: - 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 - case opStructFieldBoolIndent: - b = e.encodeIndent(b, code.indent) - b = append(b, code.key...) - b = append(b, ' ') - ptr := load(ctxptr, code.headIdx) - b = encodeBool(b, e.ptrToBool(ptr+code.offset)) - b = encodeIndentComma(b) - code = code.next - case opStructEscapedFieldBoolIndent: - 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 - case opStructFieldBytesIndent: - b = e.encodeIndent(b, code.indent) - b = append(b, code.key...) - b = append(b, ' ') - ptr := load(ctxptr, code.headIdx) - b = encodeByteSlice(b, e.ptrToBytes(ptr+code.offset)) - b = encodeIndentComma(b) - code = code.next - case opStructEscapedFieldBytesIndent: - 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 - case opStructFieldMarshalJSONIndent: - b = e.encodeIndent(b, code.indent) - b = append(b, code.key...) - 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 - case opStructEscapedFieldMarshalJSONIndent: - 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 - case opStructFieldArrayIndent: - b = e.encodeIndent(b, code.indent) - b = append(b, code.key...) - 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 - } - case opStructEscapedFieldArrayIndent: - 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 - } - case opStructFieldSliceIndent: - b = e.encodeIndent(b, code.indent) - b = append(b, code.key...) - 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 - } - case opStructEscapedFieldSliceIndent: - 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 - } - case opStructFieldMapIndent: - b = e.encodeIndent(b, code.indent) - b = append(b, code.key...) - 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 - } - } - case opStructEscapedFieldMapIndent: - 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 - } - } - case opStructFieldMapLoadIndent: - b = e.encodeIndent(b, code.indent) - b = append(b, code.key...) - 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 - } - } - case opStructEscapedFieldMapLoadIndent: - 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 - } - } - case opStructFieldStructIndent: - ptr := load(ctxptr, code.headIdx) - p := ptr + code.offset - b = e.encodeIndent(b, code.indent) - b = append(b, code.key...) - 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) - } - } - case opStructEscapedFieldStructIndent: - 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) - } - } case opStructFieldOmitEmpty: ptr := load(ctxptr, code.headIdx) p := ptr + code.offset @@ -15675,16 +4646,6 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte code = code.next store(ctxptr, code.idx, p) } - case opStructEscapedFieldOmitEmpty: - ptr := load(ctxptr, code.headIdx) - p := ptr + code.offset - if p == 0 || **(**uintptr)(unsafe.Pointer(&p)) == 0 { - code = code.nextField - } else { - b = append(b, code.escapedKey...) - code = code.next - store(ctxptr, code.idx, p) - } case opStructFieldOmitEmptyInt: ptr := load(ctxptr, code.headIdx) v := e.ptrToInt(ptr + code.offset) @@ -15694,15 +4655,6 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte b = encodeComma(b) } code = code.next - case opStructEscapedFieldOmitEmptyInt: - ptr := load(ctxptr, code.headIdx) - v := e.ptrToInt(ptr + code.offset) - if v != 0 { - b = append(b, code.escapedKey...) - b = appendInt(b, int64(v)) - b = encodeComma(b) - } - code = code.next case opStructFieldOmitEmptyInt8: ptr := load(ctxptr, code.headIdx) v := e.ptrToInt8(ptr + code.offset) @@ -15712,15 +4664,6 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte b = encodeComma(b) } code = code.next - case opStructEscapedFieldOmitEmptyInt8: - ptr := load(ctxptr, code.headIdx) - v := e.ptrToInt8(ptr + code.offset) - if v != 0 { - b = append(b, code.escapedKey...) - b = appendInt(b, int64(v)) - b = encodeComma(b) - } - code = code.next case opStructFieldOmitEmptyInt16: ptr := load(ctxptr, code.headIdx) v := e.ptrToInt16(ptr + code.offset) @@ -15730,15 +4673,6 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte b = encodeComma(b) } code = code.next - case opStructEscapedFieldOmitEmptyInt16: - ptr := load(ctxptr, code.headIdx) - v := e.ptrToInt16(ptr + code.offset) - if v != 0 { - b = append(b, code.escapedKey...) - b = appendInt(b, int64(v)) - b = encodeComma(b) - } - code = code.next case opStructFieldOmitEmptyInt32: ptr := load(ctxptr, code.headIdx) v := e.ptrToInt32(ptr + code.offset) @@ -15748,15 +4682,6 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte b = encodeComma(b) } code = code.next - case opStructEscapedFieldOmitEmptyInt32: - ptr := load(ctxptr, code.headIdx) - v := e.ptrToInt32(ptr + code.offset) - if v != 0 { - b = append(b, code.escapedKey...) - b = appendInt(b, int64(v)) - b = encodeComma(b) - } - code = code.next case opStructFieldOmitEmptyInt64: ptr := load(ctxptr, code.headIdx) v := e.ptrToInt64(ptr + code.offset) @@ -15766,15 +4691,6 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte b = encodeComma(b) } code = code.next - case opStructEscapedFieldOmitEmptyInt64: - ptr := load(ctxptr, code.headIdx) - v := e.ptrToInt64(ptr + code.offset) - if v != 0 { - b = append(b, code.escapedKey...) - b = appendInt(b, v) - b = encodeComma(b) - } - code = code.next case opStructFieldOmitEmptyUint: ptr := load(ctxptr, code.headIdx) v := e.ptrToUint(ptr + code.offset) @@ -15784,15 +4700,6 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte b = encodeComma(b) } code = code.next - case opStructEscapedFieldOmitEmptyUint: - ptr := load(ctxptr, code.headIdx) - v := e.ptrToUint(ptr + code.offset) - if v != 0 { - b = append(b, code.escapedKey...) - b = appendUint(b, uint64(v)) - b = encodeComma(b) - } - code = code.next case opStructFieldOmitEmptyUint8: ptr := load(ctxptr, code.headIdx) v := e.ptrToUint8(ptr + code.offset) @@ -15802,15 +4709,6 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte b = encodeComma(b) } code = code.next - case opStructEscapedFieldOmitEmptyUint8: - ptr := load(ctxptr, code.headIdx) - v := e.ptrToUint8(ptr + code.offset) - if v != 0 { - b = append(b, code.escapedKey...) - b = appendUint(b, uint64(v)) - b = encodeComma(b) - } - code = code.next case opStructFieldOmitEmptyUint16: ptr := load(ctxptr, code.headIdx) v := e.ptrToUint16(ptr + code.offset) @@ -15820,15 +4718,6 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte b = encodeComma(b) } code = code.next - case opStructEscapedFieldOmitEmptyUint16: - ptr := load(ctxptr, code.headIdx) - v := e.ptrToUint16(ptr + code.offset) - if v != 0 { - b = append(b, code.escapedKey...) - b = appendUint(b, uint64(v)) - b = encodeComma(b) - } - code = code.next case opStructFieldOmitEmptyUint32: ptr := load(ctxptr, code.headIdx) v := e.ptrToUint32(ptr + code.offset) @@ -15838,15 +4727,6 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte b = encodeComma(b) } code = code.next - case opStructEscapedFieldOmitEmptyUint32: - ptr := load(ctxptr, code.headIdx) - v := e.ptrToUint32(ptr + code.offset) - if v != 0 { - b = append(b, code.escapedKey...) - b = appendUint(b, uint64(v)) - b = encodeComma(b) - } - code = code.next case opStructFieldOmitEmptyUint64: ptr := load(ctxptr, code.headIdx) v := e.ptrToUint64(ptr + code.offset) @@ -15856,15 +4736,6 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte b = encodeComma(b) } code = code.next - case opStructEscapedFieldOmitEmptyUint64: - ptr := load(ctxptr, code.headIdx) - v := e.ptrToUint64(ptr + code.offset) - if v != 0 { - b = append(b, code.escapedKey...) - b = appendUint(b, v) - b = encodeComma(b) - } - code = code.next case opStructFieldOmitEmptyFloat32: ptr := load(ctxptr, code.headIdx) v := e.ptrToFloat32(ptr + code.offset) @@ -15874,15 +4745,6 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte b = encodeComma(b) } code = code.next - case opStructEscapedFieldOmitEmptyFloat32: - ptr := load(ctxptr, code.headIdx) - v := e.ptrToFloat32(ptr + code.offset) - if v != 0 { - b = append(b, code.escapedKey...) - b = encodeFloat32(b, v) - b = encodeComma(b) - } - code = code.next case opStructFieldOmitEmptyFloat64: ptr := load(ctxptr, code.headIdx) v := e.ptrToFloat64(ptr + code.offset) @@ -15895,18 +4757,6 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte b = encodeComma(b) } code = code.next - case opStructEscapedFieldOmitEmptyFloat64: - 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 = append(b, code.escapedKey...) - b = encodeFloat64(b, v) - b = encodeComma(b) - } - code = code.next case opStructFieldOmitEmptyString: ptr := load(ctxptr, code.headIdx) v := e.ptrToString(ptr + code.offset) @@ -15916,15 +4766,6 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte b = encodeComma(b) } code = code.next - case opStructEscapedFieldOmitEmptyEscapedString: - ptr := load(ctxptr, code.headIdx) - v := e.ptrToString(ptr + code.offset) - if v != "" { - b = append(b, code.escapedKey...) - b = encodeEscapedString(b, v) - b = encodeComma(b) - } - code = code.next case opStructFieldOmitEmptyBool: ptr := load(ctxptr, code.headIdx) v := e.ptrToBool(ptr + code.offset) @@ -15934,15 +4775,6 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte b = encodeComma(b) } code = code.next - case opStructEscapedFieldOmitEmptyBool: - ptr := load(ctxptr, code.headIdx) - v := e.ptrToBool(ptr + code.offset) - if v { - b = append(b, code.escapedKey...) - b = encodeBool(b, v) - b = encodeComma(b) - } - code = code.next case opStructFieldOmitEmptyBytes: ptr := load(ctxptr, code.headIdx) v := e.ptrToBytes(ptr + code.offset) @@ -15952,15 +4784,6 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte b = encodeComma(b) } code = code.next - case opStructEscapedFieldOmitEmptyBytes: - ptr := load(ctxptr, code.headIdx) - v := e.ptrToBytes(ptr + code.offset) - if len(v) > 0 { - b = append(b, code.escapedKey...) - b = encodeByteSlice(b, v) - b = encodeComma(b) - } - code = code.next case opStructFieldOmitEmptyMarshalJSON: ptr := load(ctxptr, code.headIdx) p := ptr + code.offset @@ -15979,24 +4802,6 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte b = encodeComma(b) } code = code.next - case opStructEscapedFieldOmitEmptyMarshalJSON: - ptr := load(ctxptr, code.headIdx) - p := ptr + code.offset - v := e.ptrToInterface(code, p) - if v != nil { - 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, code.escapedKey...) - b = append(b, buf.Bytes()...) - b = encodeComma(b) - } - code = code.next case opStructFieldOmitEmptyMarshalText: ptr := load(ctxptr, code.headIdx) p := ptr + code.offset @@ -16011,21 +4816,7 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte b = encodeComma(b) } code = code.next - case opStructEscapedFieldOmitEmptyMarshalText: - ptr := load(ctxptr, code.headIdx) - p := ptr + code.offset - v := e.ptrToInterface(code, p) - if v != nil { - bytes, err := v.(encoding.TextMarshaler).MarshalText() - if err != nil { - return nil, errMarshaler(code, err) - } - b = append(b, code.escapedKey...) - b = encodeEscapedString(b, *(*string)(unsafe.Pointer(&bytes))) - b = encodeComma(b) - } - code = code.next - case opStructFieldOmitEmptyArray, opStructEscapedFieldOmitEmptyArray: + case opStructFieldOmitEmptyArray: ptr := load(ctxptr, code.headIdx) p := ptr + code.offset array := e.ptrToSlice(p) @@ -16034,7 +4825,7 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte } else { code = code.next } - case opStructFieldOmitEmptySlice, opStructEscapedFieldOmitEmptySlice: + case opStructFieldOmitEmptySlice: ptr := load(ctxptr, code.headIdx) p := ptr + code.offset slice := e.ptrToSlice(p) @@ -16043,7 +4834,7 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte } else { code = code.next } - case opStructFieldOmitEmptyMap, opStructEscapedFieldOmitEmptyMap: + case opStructFieldOmitEmptyMap: ptr := load(ctxptr, code.headIdx) p := ptr + code.offset if p == 0 { @@ -16056,7 +4847,7 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte code = code.next } } - case opStructFieldOmitEmptyMapLoad, opStructEscapedFieldOmitEmptyMapLoad: + case opStructFieldOmitEmptyMapLoad: ptr := load(ctxptr, code.headIdx) p := ptr + code.offset if p == 0 { @@ -16069,528 +4860,12 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte code = code.next } } - case opStructFieldOmitEmptyIndent: - 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.key...) - b = append(b, ' ') - code = code.next - store(ctxptr, code.idx, p) - } - case opStructEscapedFieldOmitEmptyIndent: - 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) - } - case opStructFieldOmitEmptyIntIndent: - ptr := load(ctxptr, code.headIdx) - v := e.ptrToInt(ptr + code.offset) - if v != 0 { - b = e.encodeIndent(b, code.indent) - b = append(b, code.key...) - b = append(b, ' ') - b = appendInt(b, int64(v)) - b = encodeIndentComma(b) - } - code = code.next - case opStructEscapedFieldOmitEmptyIntIndent: - 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 - case opStructFieldOmitEmptyInt8Indent: - ptr := load(ctxptr, code.headIdx) - v := e.ptrToInt8(ptr + code.offset) - if v != 0 { - b = e.encodeIndent(b, code.indent) - b = append(b, code.key...) - b = append(b, ' ') - b = appendInt(b, int64(v)) - b = encodeIndentComma(b) - } - code = code.next - case opStructEscapedFieldOmitEmptyInt8Indent: - 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 - case opStructFieldOmitEmptyInt16Indent: - ptr := load(ctxptr, code.headIdx) - v := e.ptrToInt16(ptr + code.offset) - if v != 0 { - b = e.encodeIndent(b, code.indent) - b = append(b, code.key...) - b = append(b, ' ') - b = appendInt(b, int64(v)) - b = encodeIndentComma(b) - } - code = code.next - case opStructEscapedFieldOmitEmptyInt16Indent: - 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 - case opStructFieldOmitEmptyInt32Indent: - ptr := load(ctxptr, code.headIdx) - v := e.ptrToInt32(ptr + code.offset) - if v != 0 { - b = e.encodeIndent(b, code.indent) - b = append(b, code.key...) - b = append(b, ' ') - b = appendInt(b, int64(v)) - b = encodeIndentComma(b) - } - code = code.next - case opStructEscapedFieldOmitEmptyInt32Indent: - 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 - case opStructFieldOmitEmptyInt64Indent: - ptr := load(ctxptr, code.headIdx) - v := e.ptrToInt64(ptr + code.offset) - if v != 0 { - b = e.encodeIndent(b, code.indent) - b = append(b, code.key...) - b = append(b, ' ') - b = appendInt(b, v) - b = encodeIndentComma(b) - } - code = code.next - case opStructEscapedFieldOmitEmptyInt64Indent: - 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 - case opStructFieldOmitEmptyUintIndent: - ptr := load(ctxptr, code.headIdx) - v := e.ptrToUint(ptr + code.offset) - if v != 0 { - b = e.encodeIndent(b, code.indent) - b = append(b, code.key...) - b = append(b, ' ') - b = appendUint(b, uint64(v)) - b = encodeIndentComma(b) - } - code = code.next - case opStructEscapedFieldOmitEmptyUintIndent: - 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 - case opStructFieldOmitEmptyUint8Indent: - ptr := load(ctxptr, code.headIdx) - v := e.ptrToUint8(ptr + code.offset) - if v != 0 { - b = e.encodeIndent(b, code.indent) - b = append(b, code.key...) - b = append(b, ' ') - b = appendUint(b, uint64(v)) - b = encodeIndentComma(b) - } - code = code.next - case opStructEscapedFieldOmitEmptyUint8Indent: - 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 - case opStructFieldOmitEmptyUint16Indent: - ptr := load(ctxptr, code.headIdx) - v := e.ptrToUint16(ptr + code.offset) - if v != 0 { - b = e.encodeIndent(b, code.indent) - b = append(b, code.key...) - b = append(b, ' ') - b = appendUint(b, uint64(v)) - b = encodeIndentComma(b) - } - code = code.next - case opStructEscapedFieldOmitEmptyUint16Indent: - 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 - case opStructFieldOmitEmptyUint32Indent: - ptr := load(ctxptr, code.headIdx) - v := e.ptrToUint32(ptr + code.offset) - if v != 0 { - b = e.encodeIndent(b, code.indent) - b = append(b, code.key...) - b = append(b, ' ') - b = appendUint(b, uint64(v)) - b = encodeIndentComma(b) - } - code = code.next - case opStructEscapedFieldOmitEmptyUint32Indent: - 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 - case opStructFieldOmitEmptyUint64Indent: - ptr := load(ctxptr, code.headIdx) - v := e.ptrToUint64(ptr + code.offset) - if v != 0 { - b = e.encodeIndent(b, code.indent) - b = append(b, code.key...) - b = append(b, ' ') - b = appendUint(b, v) - b = encodeIndentComma(b) - } - code = code.next - case opStructEscapedFieldOmitEmptyUint64Indent: - 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 - case opStructFieldOmitEmptyFloat32Indent: - ptr := load(ctxptr, code.headIdx) - v := e.ptrToFloat32(ptr + code.offset) - if v != 0 { - b = e.encodeIndent(b, code.indent) - b = append(b, code.key...) - b = append(b, ' ') - b = encodeFloat32(b, v) - b = encodeIndentComma(b) - } - code = code.next - case opStructEscapedFieldOmitEmptyFloat32Indent: - 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 - case opStructFieldOmitEmptyFloat64Indent: - 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.key...) - b = append(b, ' ') - b = encodeFloat64(b, v) - b = encodeIndentComma(b) - } - code = code.next - case opStructEscapedFieldOmitEmptyFloat64Indent: - 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 - case opStructFieldOmitEmptyStringIndent: - ptr := load(ctxptr, code.headIdx) - v := e.ptrToString(ptr + code.offset) - if v != "" { - b = e.encodeIndent(b, code.indent) - b = append(b, code.key...) - b = append(b, ' ') - b = encodeNoEscapedString(b, v) - b = encodeIndentComma(b) - } - code = code.next - case opStructEscapedFieldOmitEmptyEscapedStringIndent: - 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 - case opStructFieldOmitEmptyBoolIndent: - ptr := load(ctxptr, code.headIdx) - v := e.ptrToBool(ptr + code.offset) - if v { - b = e.encodeIndent(b, code.indent) - b = append(b, code.key...) - b = append(b, ' ') - b = encodeBool(b, v) - b = encodeIndentComma(b) - } - code = code.next - case opStructEscapedFieldOmitEmptyBoolIndent: - 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 - case opStructFieldOmitEmptyBytesIndent: - 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.key...) - b = append(b, ' ') - b = encodeByteSlice(b, v) - b = encodeIndentComma(b) - } - code = code.next - case opStructEscapedFieldOmitEmptyBytesIndent: - 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 - case opStructFieldOmitEmptyArrayIndent: - 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.key...) - b = append(b, ' ') - code = code.next - } - case opStructEscapedFieldOmitEmptyArrayIndent: - 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 - } - case opStructFieldOmitEmptySliceIndent: - 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.key...) - b = append(b, ' ') - code = code.next - } - case opStructEscapedFieldOmitEmptySliceIndent: - 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 - } - case opStructFieldOmitEmptyMapIndent: - 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.key...) - b = append(b, ' ') - code = code.next - } - } - case opStructEscapedFieldOmitEmptyMapIndent: - 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 - } - } - case opStructFieldOmitEmptyMapLoadIndent: - 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.key...) - b = append(b, ' ') - code = code.next - } - } - case opStructEscapedFieldOmitEmptyMapLoadIndent: - 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 - } - } - case opStructFieldOmitEmptyStructIndent: - 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.key...) - 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) - } - } - case opStructEscapedFieldOmitEmptyStructIndent: - 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) - } - } case opStructFieldStringTag: ptr := load(ctxptr, code.headIdx) p := ptr + code.offset b = append(b, code.key...) code = code.next store(ctxptr, code.idx, p) - case opStructEscapedFieldStringTag: - ptr := load(ctxptr, code.headIdx) - p := ptr + code.offset - b = append(b, code.escapedKey...) - code = code.next - store(ctxptr, code.idx, p) case opStructFieldStringTagInt: ptr := load(ctxptr, code.headIdx) b = append(b, code.key...) @@ -16599,14 +4874,6 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte b = append(b, '"') b = encodeComma(b) code = code.next - case opStructEscapedFieldStringTagInt: - ptr := load(ctxptr, code.headIdx) - b = append(b, code.escapedKey...) - b = append(b, '"') - b = appendInt(b, int64(e.ptrToInt(ptr+code.offset))) - b = append(b, '"') - b = encodeComma(b) - code = code.next case opStructFieldStringTagInt8: ptr := load(ctxptr, code.headIdx) b = append(b, code.key...) @@ -16615,14 +4882,6 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte b = append(b, '"') b = encodeComma(b) code = code.next - case opStructEscapedFieldStringTagInt8: - ptr := load(ctxptr, code.headIdx) - b = append(b, code.escapedKey...) - b = append(b, '"') - b = appendInt(b, int64(e.ptrToInt8(ptr+code.offset))) - b = append(b, '"') - b = encodeComma(b) - code = code.next case opStructFieldStringTagInt16: ptr := load(ctxptr, code.headIdx) b = append(b, code.key...) @@ -16631,14 +4890,6 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte b = append(b, '"') b = encodeComma(b) code = code.next - case opStructEscapedFieldStringTagInt16: - ptr := load(ctxptr, code.headIdx) - b = append(b, code.escapedKey...) - b = append(b, '"') - b = appendInt(b, int64(e.ptrToInt16(ptr+code.offset))) - b = append(b, '"') - b = encodeComma(b) - code = code.next case opStructFieldStringTagInt32: ptr := load(ctxptr, code.headIdx) b = append(b, code.key...) @@ -16647,14 +4898,6 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte b = append(b, '"') b = encodeComma(b) code = code.next - case opStructEscapedFieldStringTagInt32: - ptr := load(ctxptr, code.headIdx) - b = append(b, code.escapedKey...) - b = append(b, '"') - b = appendInt(b, int64(e.ptrToInt32(ptr+code.offset))) - b = append(b, '"') - b = encodeComma(b) - code = code.next case opStructFieldStringTagInt64: ptr := load(ctxptr, code.headIdx) b = append(b, code.key...) @@ -16663,14 +4906,6 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte b = append(b, '"') b = encodeComma(b) code = code.next - case opStructEscapedFieldStringTagInt64: - ptr := load(ctxptr, code.headIdx) - b = append(b, code.escapedKey...) - b = append(b, '"') - b = appendInt(b, e.ptrToInt64(ptr+code.offset)) - b = append(b, '"') - b = encodeComma(b) - code = code.next case opStructFieldStringTagUint: ptr := load(ctxptr, code.headIdx) b = append(b, code.key...) @@ -16679,14 +4914,6 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte b = append(b, '"') b = encodeComma(b) code = code.next - case opStructEscapedFieldStringTagUint: - ptr := load(ctxptr, code.headIdx) - b = append(b, code.escapedKey...) - b = append(b, '"') - b = appendUint(b, uint64(e.ptrToUint(ptr+code.offset))) - b = append(b, '"') - b = encodeComma(b) - code = code.next case opStructFieldStringTagUint8: ptr := load(ctxptr, code.headIdx) b = append(b, code.key...) @@ -16695,14 +4922,6 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte b = append(b, '"') b = encodeComma(b) code = code.next - case opStructEscapedFieldStringTagUint8: - ptr := load(ctxptr, code.headIdx) - b = append(b, code.escapedKey...) - b = append(b, '"') - b = appendUint(b, uint64(e.ptrToUint8(ptr+code.offset))) - b = append(b, '"') - b = encodeComma(b) - code = code.next case opStructFieldStringTagUint16: ptr := load(ctxptr, code.headIdx) b = append(b, code.key...) @@ -16711,14 +4930,6 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte b = append(b, '"') b = encodeComma(b) code = code.next - case opStructEscapedFieldStringTagUint16: - ptr := load(ctxptr, code.headIdx) - b = append(b, code.escapedKey...) - b = append(b, '"') - b = appendUint(b, uint64(e.ptrToUint16(ptr+code.offset))) - b = append(b, '"') - b = encodeComma(b) - code = code.next case opStructFieldStringTagUint32: ptr := load(ctxptr, code.headIdx) b = append(b, code.key...) @@ -16727,14 +4938,6 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte b = append(b, '"') b = encodeComma(b) code = code.next - case opStructEscapedFieldStringTagUint32: - ptr := load(ctxptr, code.headIdx) - b = append(b, code.escapedKey...) - b = append(b, '"') - b = appendUint(b, uint64(e.ptrToUint32(ptr+code.offset))) - b = append(b, '"') - b = encodeComma(b) - code = code.next case opStructFieldStringTagUint64: ptr := load(ctxptr, code.headIdx) b = append(b, code.key...) @@ -16743,14 +4946,6 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte b = append(b, '"') b = encodeComma(b) code = code.next - case opStructEscapedFieldStringTagUint64: - ptr := load(ctxptr, code.headIdx) - b = append(b, code.escapedKey...) - b = append(b, '"') - b = appendUint(b, uint64(e.ptrToUint64(ptr+code.offset))) - b = append(b, '"') - b = encodeComma(b) - code = code.next case opStructFieldStringTagFloat32: ptr := load(ctxptr, code.headIdx) b = append(b, code.key...) @@ -16759,14 +4954,6 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte b = append(b, '"') b = encodeComma(b) code = code.next - case opStructEscapedFieldStringTagFloat32: - ptr := load(ctxptr, code.headIdx) - b = append(b, code.escapedKey...) - b = append(b, '"') - b = encodeFloat32(b, e.ptrToFloat32(ptr+code.offset)) - b = append(b, '"') - b = encodeComma(b) - code = code.next case opStructFieldStringTagFloat64: ptr := load(ctxptr, code.headIdx) v := e.ptrToFloat64(ptr + code.offset) @@ -16779,18 +4966,6 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte b = append(b, '"') b = encodeComma(b) code = code.next - case opStructEscapedFieldStringTagFloat64: - ptr := load(ctxptr, code.headIdx) - v := e.ptrToFloat64(ptr + code.offset) - if math.IsInf(v, 0) || math.IsNaN(v) { - return nil, errUnsupportedFloat(v) - } - b = append(b, code.escapedKey...) - b = append(b, '"') - b = encodeFloat64(b, v) - b = append(b, '"') - b = encodeComma(b) - code = code.next case opStructFieldStringTagString: ptr := load(ctxptr, code.headIdx) b = append(b, code.key...) @@ -16798,13 +4973,6 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte b = encodeNoEscapedString(b, string(encodeNoEscapedString([]byte{}, s))) b = encodeComma(b) code = code.next - case opStructEscapedFieldStringTagEscapedString: - ptr := load(ctxptr, code.headIdx) - b = append(b, code.escapedKey...) - s := e.ptrToString(ptr + code.offset) - b = encodeEscapedString(b, string(encodeEscapedString([]byte{}, s))) - b = encodeComma(b) - code = code.next case opStructFieldStringTagBool: ptr := load(ctxptr, code.headIdx) b = append(b, code.key...) @@ -16813,14 +4981,6 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte b = append(b, '"') b = encodeComma(b) code = code.next - case opStructEscapedFieldStringTagBool: - ptr := load(ctxptr, code.headIdx) - b = append(b, code.escapedKey...) - b = append(b, '"') - b = encodeBool(b, e.ptrToBool(ptr+code.offset)) - b = append(b, '"') - b = encodeComma(b) - code = code.next case opStructFieldStringTagBytes: ptr := load(ctxptr, code.headIdx) v := e.ptrToBytes(ptr + code.offset) @@ -16828,13 +4988,6 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte b = encodeByteSlice(b, v) b = encodeComma(b) code = code.next - case opStructEscapedFieldStringTagBytes: - ptr := load(ctxptr, code.headIdx) - v := e.ptrToBytes(ptr + code.offset) - b = append(b, code.escapedKey...) - b = encodeByteSlice(b, v) - b = encodeComma(b) - code = code.next case opStructFieldStringTagMarshalJSON: ptr := load(ctxptr, code.headIdx) p := ptr + code.offset @@ -16851,22 +5004,6 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte b = encodeNoEscapedString(b, buf.String()) b = encodeComma(b) code = code.next - case opStructEscapedFieldStringTagMarshalJSON: - 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, code.escapedKey...) - b = encodeEscapedString(b, buf.String()) - b = encodeComma(b) - code = code.next case opStructFieldStringTagMarshalText: ptr := load(ctxptr, code.headIdx) p := ptr + code.offset @@ -16879,375 +5016,7 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte b = encodeNoEscapedString(b, *(*string)(unsafe.Pointer(&bytes))) b = encodeComma(b) code = code.next - case opStructEscapedFieldStringTagMarshalText: - ptr := load(ctxptr, code.headIdx) - p := ptr + code.offset - v := e.ptrToInterface(code, p) - bytes, err := v.(encoding.TextMarshaler).MarshalText() - if err != nil { - return nil, errMarshaler(code, err) - } - b = append(b, code.escapedKey...) - b = encodeEscapedString(b, *(*string)(unsafe.Pointer(&bytes))) - b = encodeComma(b) - code = code.next - case opStructFieldStringTagIndent: - ptr := load(ctxptr, code.headIdx) - p := ptr + code.offset - b = e.encodeIndent(b, code.indent) - b = append(b, code.key...) - b = append(b, ' ') - code = code.next - store(ctxptr, code.idx, p) - case opStructEscapedFieldStringTagIndent: - 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) - case opStructFieldStringTagIntIndent: - ptr := load(ctxptr, code.headIdx) - b = e.encodeIndent(b, code.indent) - b = append(b, code.key...) - b = append(b, ' ', '"') - b = appendInt(b, int64(e.ptrToInt(ptr+code.offset))) - b = append(b, '"') - b = encodeIndentComma(b) - code = code.next - case opStructEscapedFieldStringTagIntIndent: - 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 - case opStructFieldStringTagInt8Indent: - ptr := load(ctxptr, code.headIdx) - b = e.encodeIndent(b, code.indent) - b = append(b, code.key...) - b = append(b, ' ', '"') - b = appendInt(b, int64(e.ptrToInt8(ptr+code.offset))) - b = append(b, '"') - b = encodeIndentComma(b) - code = code.next - case opStructEscapedFieldStringTagInt8Indent: - 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 - case opStructFieldStringTagInt16Indent: - ptr := load(ctxptr, code.headIdx) - b = e.encodeIndent(b, code.indent) - b = append(b, code.key...) - b = append(b, ' ', '"') - b = appendInt(b, int64(e.ptrToInt16(ptr+code.offset))) - b = append(b, '"') - b = encodeIndentComma(b) - code = code.next - case opStructEscapedFieldStringTagInt16Indent: - 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 - case opStructFieldStringTagInt32Indent: - ptr := load(ctxptr, code.headIdx) - b = e.encodeIndent(b, code.indent) - b = append(b, code.key...) - b = append(b, ' ', '"') - b = appendInt(b, int64(e.ptrToInt32(ptr+code.offset))) - b = append(b, '"') - b = encodeIndentComma(b) - code = code.next - case opStructEscapedFieldStringTagInt32Indent: - 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 - case opStructFieldStringTagInt64Indent: - ptr := load(ctxptr, code.headIdx) - b = e.encodeIndent(b, code.indent) - b = append(b, code.key...) - b = append(b, ' ', '"') - b = appendInt(b, e.ptrToInt64(ptr+code.offset)) - b = append(b, '"') - b = encodeIndentComma(b) - code = code.next - case opStructEscapedFieldStringTagInt64Indent: - 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 - case opStructFieldStringTagUintIndent: - ptr := load(ctxptr, code.headIdx) - b = e.encodeIndent(b, code.indent) - b = append(b, code.key...) - b = append(b, ' ', '"') - b = appendUint(b, uint64(e.ptrToUint(ptr+code.offset))) - b = append(b, '"') - b = encodeIndentComma(b) - code = code.next - case opStructEscapedFieldStringTagUintIndent: - 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 - case opStructFieldStringTagUint8Indent: - ptr := load(ctxptr, code.headIdx) - b = e.encodeIndent(b, code.indent) - b = append(b, code.key...) - b = append(b, ' ', '"') - b = appendUint(b, uint64(e.ptrToUint8(ptr+code.offset))) - b = append(b, '"') - b = encodeIndentComma(b) - code = code.next - case opStructEscapedFieldStringTagUint8Indent: - 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 - case opStructFieldStringTagUint16Indent: - ptr := load(ctxptr, code.headIdx) - b = e.encodeIndent(b, code.indent) - b = append(b, code.key...) - b = append(b, ' ', '"') - b = appendUint(b, uint64(e.ptrToUint16(ptr+code.offset))) - b = append(b, '"') - b = encodeIndentComma(b) - code = code.next - case opStructEscapedFieldStringTagUint16Indent: - 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 - case opStructFieldStringTagUint32Indent: - ptr := load(ctxptr, code.headIdx) - b = e.encodeIndent(b, code.indent) - b = append(b, code.key...) - b = append(b, ' ', '"') - b = appendUint(b, uint64(e.ptrToUint32(ptr+code.offset))) - b = append(b, '"') - b = encodeIndentComma(b) - code = code.next - case opStructEscapedFieldStringTagUint32Indent: - 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 - case opStructFieldStringTagUint64Indent: - ptr := load(ctxptr, code.headIdx) - b = e.encodeIndent(b, code.indent) - b = append(b, code.key...) - b = append(b, ' ', '"') - b = appendUint(b, e.ptrToUint64(ptr+code.offset)) - b = append(b, '"') - b = encodeIndentComma(b) - code = code.next - case opStructEscapedFieldStringTagUint64Indent: - 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 - case opStructFieldStringTagFloat32Indent: - ptr := load(ctxptr, code.headIdx) - b = e.encodeIndent(b, code.indent) - b = append(b, code.key...) - b = append(b, ' ', '"') - b = encodeFloat32(b, e.ptrToFloat32(ptr+code.offset)) - b = append(b, '"') - b = encodeIndentComma(b) - code = code.next - case opStructEscapedFieldStringTagFloat32Indent: - 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 - case opStructFieldStringTagFloat64Indent: - 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.key...) - b = append(b, ' ', '"') - b = encodeFloat64(b, v) - b = append(b, '"') - b = encodeIndentComma(b) - code = code.next - case opStructEscapedFieldStringTagFloat64Indent: - 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 - case opStructFieldStringTagStringIndent: - ptr := load(ctxptr, code.headIdx) - b = e.encodeIndent(b, code.indent) - b = append(b, code.key...) - b = append(b, ' ') - s := e.ptrToString(ptr + code.offset) - b = encodeNoEscapedString(b, string(encodeNoEscapedString([]byte{}, s))) - b = encodeIndentComma(b) - code = code.next - case opStructEscapedFieldStringTagEscapedStringIndent: - 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 - case opStructFieldStringTagBoolIndent: - ptr := load(ctxptr, code.headIdx) - b = e.encodeIndent(b, code.indent) - b = append(b, code.key...) - b = append(b, ' ', '"') - b = encodeBool(b, e.ptrToBool(ptr+code.offset)) - b = append(b, '"') - b = encodeIndentComma(b) - code = code.next - case opStructEscapedFieldStringTagBoolIndent: - 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 - case opStructFieldStringTagBytesIndent: - ptr := load(ctxptr, code.headIdx) - b = e.encodeIndent(b, code.indent) - b = append(b, code.key...) - b = append(b, ' ') - b = encodeByteSlice(b, e.ptrToBytes(ptr+code.offset)) - b = encodeIndentComma(b) - code = code.next - case opStructEscapedFieldStringTagBytesIndent: - 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 - case opStructFieldStringTagMarshalJSONIndent: - ptr := load(ctxptr, code.headIdx) - b = e.encodeIndent(b, code.indent) - b = append(b, code.key...) - 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 - case opStructEscapedFieldStringTagMarshalJSONIndent: - 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 - case opStructFieldStringTagMarshalTextIndent: - ptr := load(ctxptr, code.headIdx) - b = e.encodeIndent(b, code.indent) - b = append(b, code.key...) - 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 = encodeNoEscapedString(b, *(*string)(unsafe.Pointer(&bytes))) - b = encodeIndentComma(b) - code = code.next - case opStructEscapedFieldStringTagMarshalTextIndent: - 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 - case opStructEnd, opStructEscapedEnd: + case opStructEnd: last := len(b) - 1 if b[last] == ',' { b[last] = '}' @@ -17256,24 +5025,7 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte } b = encodeComma(b) code = code.next - case opStructAnonymousEnd, opStructAnonymousEndIndent: - code = code.next - case opStructEndIndent, opStructEscapedEndIndent: - 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) + case opStructAnonymousEnd: code = code.next case opStructEndIntPtr: b = append(b, code.key...) @@ -17286,17 +5038,6 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte } b = appendStructEnd(b) code = code.next - case opStructEscapedEndIntPtr: - b = append(b, code.escapedKey...) - 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 = appendStructEnd(b) - code = code.next case opStructEndIntNPtr: b = append(b, code.key...) ptr := load(ctxptr, code.headIdx) @@ -17314,35 +5055,12 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte } b = appendStructEnd(b) code = code.next - case opStructEscapedEndIntNPtr: - b = append(b, code.escapedKey...) - ptr := load(ctxptr, code.headIdx) - p := e.ptrToPtr(ptr + code.offset) - for i := 0; i < code.ptrNum-1; i++ { - if p == 0 { - break - } - p = e.ptrToPtr(p) - } - if p == 0 { - b = encodeNull(b) - } else { - b = appendInt(b, int64(e.ptrToInt(p))) - } - b = appendStructEnd(b) - code = code.next case opStructEndInt: ptr := load(ctxptr, code.headIdx) b = append(b, code.key...) b = appendInt(b, int64(e.ptrToInt(ptr+code.offset))) b = appendStructEnd(b) code = code.next - case opStructEscapedEndInt: - ptr := load(ctxptr, code.headIdx) - b = append(b, code.escapedKey...) - b = appendInt(b, int64(e.ptrToInt(ptr+code.offset))) - b = appendStructEnd(b) - code = code.next case opStructEndInt8Ptr: b = append(b, code.key...) ptr := load(ctxptr, code.headIdx) @@ -17354,29 +5072,12 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte } b = appendStructEnd(b) code = code.next - case opStructEscapedEndInt8Ptr: - b = append(b, code.escapedKey...) - 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 = appendStructEnd(b) - code = code.next case opStructEndInt8: ptr := load(ctxptr, code.headIdx) b = append(b, code.key...) b = appendInt(b, int64(e.ptrToInt8(ptr+code.offset))) b = appendStructEnd(b) code = code.next - case opStructEscapedEndInt8: - ptr := load(ctxptr, code.headIdx) - b = append(b, code.escapedKey...) - b = appendInt(b, int64(e.ptrToInt8(ptr+code.offset))) - b = appendStructEnd(b) - code = code.next case opStructEndInt16Ptr: b = append(b, code.key...) ptr := load(ctxptr, code.headIdx) @@ -17388,29 +5089,12 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte } b = appendStructEnd(b) code = code.next - case opStructEscapedEndInt16Ptr: - b = append(b, code.escapedKey...) - 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 = appendStructEnd(b) - code = code.next case opStructEndInt16: ptr := load(ctxptr, code.headIdx) b = append(b, code.key...) b = appendInt(b, int64(e.ptrToInt16(ptr+code.offset))) b = appendStructEnd(b) code = code.next - case opStructEscapedEndInt16: - ptr := load(ctxptr, code.headIdx) - b = append(b, code.escapedKey...) - b = appendInt(b, int64(e.ptrToInt16(ptr+code.offset))) - b = appendStructEnd(b) - code = code.next case opStructEndInt32Ptr: b = append(b, code.key...) ptr := load(ctxptr, code.headIdx) @@ -17422,29 +5106,12 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte } b = appendStructEnd(b) code = code.next - case opStructEscapedEndInt32Ptr: - b = append(b, code.escapedKey...) - 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 = appendStructEnd(b) - code = code.next case opStructEndInt32: ptr := load(ctxptr, code.headIdx) b = append(b, code.key...) b = appendInt(b, int64(e.ptrToInt32(ptr+code.offset))) b = appendStructEnd(b) code = code.next - case opStructEscapedEndInt32: - ptr := load(ctxptr, code.headIdx) - b = append(b, code.escapedKey...) - b = appendInt(b, int64(e.ptrToInt32(ptr+code.offset))) - b = appendStructEnd(b) - code = code.next case opStructEndInt64Ptr: b = append(b, code.key...) ptr := load(ctxptr, code.headIdx) @@ -17456,29 +5123,12 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte } b = appendStructEnd(b) code = code.next - case opStructEscapedEndInt64Ptr: - b = append(b, code.escapedKey...) - 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 = appendStructEnd(b) - code = code.next case opStructEndInt64: ptr := load(ctxptr, code.headIdx) b = append(b, code.key...) b = appendInt(b, e.ptrToInt64(ptr+code.offset)) b = appendStructEnd(b) code = code.next - case opStructEscapedEndInt64: - ptr := load(ctxptr, code.headIdx) - b = append(b, code.escapedKey...) - b = appendInt(b, e.ptrToInt64(ptr+code.offset)) - b = appendStructEnd(b) - code = code.next case opStructEndUintPtr: b = append(b, code.key...) ptr := load(ctxptr, code.headIdx) @@ -17490,29 +5140,12 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte } b = appendStructEnd(b) code = code.next - case opStructEscapedEndUintPtr: - b = append(b, code.escapedKey...) - 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 = appendStructEnd(b) - code = code.next case opStructEndUint: ptr := load(ctxptr, code.headIdx) b = append(b, code.key...) b = appendUint(b, uint64(e.ptrToUint(ptr+code.offset))) b = appendStructEnd(b) code = code.next - case opStructEscapedEndUint: - ptr := load(ctxptr, code.headIdx) - b = append(b, code.escapedKey...) - b = appendUint(b, uint64(e.ptrToUint(ptr+code.offset))) - b = appendStructEnd(b) - code = code.next case opStructEndUint8Ptr: b = append(b, code.key...) ptr := load(ctxptr, code.headIdx) @@ -17524,29 +5157,12 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte } b = appendStructEnd(b) code = code.next - case opStructEscapedEndUint8Ptr: - b = append(b, code.escapedKey...) - 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 = appendStructEnd(b) - code = code.next case opStructEndUint8: ptr := load(ctxptr, code.headIdx) b = append(b, code.key...) b = appendUint(b, uint64(e.ptrToUint8(ptr+code.offset))) b = appendStructEnd(b) code = code.next - case opStructEscapedEndUint8: - ptr := load(ctxptr, code.headIdx) - b = append(b, code.escapedKey...) - b = appendUint(b, uint64(e.ptrToUint8(ptr+code.offset))) - b = appendStructEnd(b) - code = code.next case opStructEndUint16Ptr: b = append(b, code.key...) ptr := load(ctxptr, code.headIdx) @@ -17558,29 +5174,12 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte } b = appendStructEnd(b) code = code.next - case opStructEscapedEndUint16Ptr: - b = append(b, code.escapedKey...) - 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 = appendStructEnd(b) - code = code.next case opStructEndUint16: ptr := load(ctxptr, code.headIdx) b = append(b, code.key...) b = appendUint(b, uint64(e.ptrToUint16(ptr+code.offset))) b = appendStructEnd(b) code = code.next - case opStructEscapedEndUint16: - ptr := load(ctxptr, code.headIdx) - b = append(b, code.escapedKey...) - b = appendUint(b, uint64(e.ptrToUint16(ptr+code.offset))) - b = appendStructEnd(b) - code = code.next case opStructEndUint32Ptr: b = append(b, code.key...) ptr := load(ctxptr, code.headIdx) @@ -17592,29 +5191,12 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte } b = appendStructEnd(b) code = code.next - case opStructEscapedEndUint32Ptr: - b = append(b, code.escapedKey...) - 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 = appendStructEnd(b) - code = code.next case opStructEndUint32: ptr := load(ctxptr, code.headIdx) b = append(b, code.key...) b = appendUint(b, uint64(e.ptrToUint32(ptr+code.offset))) b = appendStructEnd(b) code = code.next - case opStructEscapedEndUint32: - ptr := load(ctxptr, code.headIdx) - b = append(b, code.escapedKey...) - b = appendUint(b, uint64(e.ptrToUint32(ptr+code.offset))) - b = appendStructEnd(b) - code = code.next case opStructEndUint64Ptr: b = append(b, code.key...) ptr := load(ctxptr, code.headIdx) @@ -17626,29 +5208,12 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte } b = appendStructEnd(b) code = code.next - case opStructEscapedEndUint64Ptr: - b = append(b, code.escapedKey...) - 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 = appendStructEnd(b) - code = code.next case opStructEndUint64: ptr := load(ctxptr, code.headIdx) b = append(b, code.key...) b = appendUint(b, e.ptrToUint64(ptr+code.offset)) b = appendStructEnd(b) code = code.next - case opStructEscapedEndUint64: - ptr := load(ctxptr, code.headIdx) - b = append(b, code.escapedKey...) - b = appendUint(b, e.ptrToUint64(ptr+code.offset)) - b = appendStructEnd(b) - code = code.next case opStructEndFloat32Ptr: b = append(b, code.key...) ptr := load(ctxptr, code.headIdx) @@ -17660,29 +5225,12 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte } b = appendStructEnd(b) code = code.next - case opStructEscapedEndFloat32Ptr: - b = append(b, code.escapedKey...) - 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 = appendStructEnd(b) - code = code.next case opStructEndFloat32: ptr := load(ctxptr, code.headIdx) b = append(b, code.key...) b = encodeFloat32(b, e.ptrToFloat32(ptr+code.offset)) b = appendStructEnd(b) code = code.next - case opStructEscapedEndFloat32: - ptr := load(ctxptr, code.headIdx) - b = append(b, code.escapedKey...) - b = encodeFloat32(b, e.ptrToFloat32(ptr+code.offset)) - b = appendStructEnd(b) - code = code.next case opStructEndFloat64Ptr: b = append(b, code.key...) ptr := load(ctxptr, code.headIdx) @@ -17700,23 +5248,6 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte b = encodeFloat64(b, v) b = appendStructEnd(b) code = code.next - case opStructEscapedEndFloat64Ptr: - b = append(b, code.escapedKey...) - ptr := load(ctxptr, code.headIdx) - p := e.ptrToPtr(ptr + code.offset) - if p == 0 { - b = encodeNull(b) - b = appendStructEnd(b) - code = code.next - break - } - v := e.ptrToFloat64(p) - if math.IsInf(v, 0) || math.IsNaN(v) { - return nil, errUnsupportedFloat(v) - } - b = encodeFloat64(b, v) - b = appendStructEnd(b) - code = code.next case opStructEndFloat64: ptr := load(ctxptr, code.headIdx) b = append(b, code.key...) @@ -17727,16 +5258,6 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte b = encodeFloat64(b, v) b = appendStructEnd(b) code = code.next - case opStructEscapedEndFloat64: - ptr := load(ctxptr, code.headIdx) - b = append(b, code.escapedKey...) - v := e.ptrToFloat64(ptr + code.offset) - if math.IsInf(v, 0) || math.IsNaN(v) { - return nil, errUnsupportedFloat(v) - } - b = encodeFloat64(b, v) - b = appendStructEnd(b) - code = code.next case opStructEndStringPtr: b = append(b, code.key...) ptr := load(ctxptr, code.headIdx) @@ -17748,29 +5269,12 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte } b = appendStructEnd(b) code = code.next - case opStructEscapedEndEscapedStringPtr: - b = append(b, code.escapedKey...) - ptr := load(ctxptr, code.headIdx) - p := e.ptrToPtr(ptr + code.offset) - if p == 0 { - b = encodeNull(b) - } else { - b = encodeEscapedString(b, e.ptrToString(p)) - } - b = appendStructEnd(b) - code = code.next case opStructEndString: ptr := load(ctxptr, code.headIdx) b = append(b, code.key...) b = encodeNoEscapedString(b, e.ptrToString(ptr+code.offset)) b = appendStructEnd(b) code = code.next - case opStructEscapedEndEscapedString: - ptr := load(ctxptr, code.headIdx) - b = append(b, code.escapedKey...) - b = encodeEscapedString(b, e.ptrToString(ptr+code.offset)) - b = appendStructEnd(b) - code = code.next case opStructEndBoolPtr: b = append(b, code.key...) ptr := load(ctxptr, code.headIdx) @@ -17782,41 +5286,18 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte } b = appendStructEnd(b) code = code.next - case opStructEscapedEndBoolPtr: - b = append(b, code.escapedKey...) - ptr := load(ctxptr, code.headIdx) - p := e.ptrToPtr(ptr + code.offset) - if p == 0 { - b = encodeNull(b) - } else { - b = encodeBool(b, e.ptrToBool(p)) - } - b = appendStructEnd(b) - code = code.next case opStructEndBool: ptr := load(ctxptr, code.headIdx) b = append(b, code.key...) b = encodeBool(b, e.ptrToBool(ptr+code.offset)) b = appendStructEnd(b) code = code.next - case opStructEscapedEndBool: - ptr := load(ctxptr, code.headIdx) - b = append(b, code.escapedKey...) - b = encodeBool(b, e.ptrToBool(ptr+code.offset)) - b = appendStructEnd(b) - code = code.next case opStructEndBytes: ptr := load(ctxptr, code.headIdx) b = append(b, code.key...) b = encodeByteSlice(b, e.ptrToBytes(ptr+code.offset)) b = appendStructEnd(b) code = code.next - case opStructEscapedEndBytes: - ptr := load(ctxptr, code.headIdx) - b = append(b, code.escapedKey...) - b = encodeByteSlice(b, e.ptrToBytes(ptr+code.offset)) - b = appendStructEnd(b) - code = code.next case opStructEndMarshalJSON: ptr := load(ctxptr, code.headIdx) b = append(b, code.key...) @@ -17833,22 +5314,6 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte b = append(b, buf.Bytes()...) b = appendStructEnd(b) code = code.next - case opStructEscapedEndMarshalJSON: - ptr := load(ctxptr, code.headIdx) - b = append(b, code.escapedKey...) - 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 = appendStructEnd(b) - code = code.next case opStructEndMarshalText: ptr := load(ctxptr, code.headIdx) b = append(b, code.key...) @@ -17861,622 +5326,6 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte b = encodeNoEscapedString(b, *(*string)(unsafe.Pointer(&bytes))) b = appendStructEnd(b) code = code.next - case opStructEscapedEndMarshalText: - ptr := load(ctxptr, code.headIdx) - b = append(b, code.escapedKey...) - 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 = appendStructEnd(b) - code = code.next - case opStructEndIntIndent: - b = e.encodeIndent(b, code.indent) - b = append(b, code.key...) - 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 - case opStructEscapedEndIntIndent: - 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 - case opStructEndIntPtrIndent: - b = e.encodeIndent(b, code.indent) - b = append(b, code.key...) - 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 - case opStructEscapedEndIntPtrIndent: - 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 - case opStructEndInt8Indent: - b = e.encodeIndent(b, code.indent) - b = append(b, code.key...) - 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 - case opStructEscapedEndInt8Indent: - 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 - case opStructEndInt8PtrIndent: - b = e.encodeIndent(b, code.indent) - b = append(b, code.key...) - 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 - case opStructEscapedEndInt8PtrIndent: - 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 - case opStructEndInt16Indent: - b = e.encodeIndent(b, code.indent) - b = append(b, code.key...) - 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 - case opStructEscapedEndInt16Indent: - 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 - case opStructEndInt16PtrIndent: - b = e.encodeIndent(b, code.indent) - b = append(b, code.key...) - 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 - case opStructEscapedEndInt16PtrIndent: - 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 - case opStructEndInt32Indent: - b = e.encodeIndent(b, code.indent) - b = append(b, code.key...) - 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 - case opStructEscapedEndInt32Indent: - 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 - case opStructEndInt32PtrIndent: - b = e.encodeIndent(b, code.indent) - b = append(b, code.key...) - 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 - case opStructEscapedEndInt32PtrIndent: - 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 - case opStructEndInt64Indent: - b = e.encodeIndent(b, code.indent) - b = append(b, code.key...) - 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 - case opStructEscapedEndInt64Indent: - 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 - case opStructEndInt64PtrIndent: - b = e.encodeIndent(b, code.indent) - b = append(b, code.key...) - 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 - case opStructEscapedEndInt64PtrIndent: - 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 - case opStructEndUintIndent: - b = e.encodeIndent(b, code.indent) - b = append(b, code.key...) - 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 - case opStructEscapedEndUintIndent: - 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 - case opStructEndUintPtrIndent: - b = e.encodeIndent(b, code.indent) - b = append(b, code.key...) - 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 - case opStructEscapedEndUintPtrIndent: - 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 - case opStructEndUint8Indent: - b = e.encodeIndent(b, code.indent) - b = append(b, code.key...) - 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 - case opStructEscapedEndUint8Indent: - 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 - case opStructEndUint8PtrIndent: - b = e.encodeIndent(b, code.indent) - b = append(b, code.key...) - 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 - case opStructEscapedEndUint8PtrIndent: - 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 - case opStructEndUint16Indent: - b = e.encodeIndent(b, code.indent) - b = append(b, code.key...) - 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 - case opStructEscapedEndUint16Indent: - 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 - case opStructEndUint16PtrIndent: - b = e.encodeIndent(b, code.indent) - b = append(b, code.key...) - 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 - case opStructEscapedEndUint16PtrIndent: - 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 - case opStructEndUint32Indent: - b = e.encodeIndent(b, code.indent) - b = append(b, code.key...) - 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 - case opStructEscapedEndUint32Indent: - 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 - case opStructEndUint32PtrIndent: - b = e.encodeIndent(b, code.indent) - b = append(b, code.key...) - 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 - case opStructEscapedEndUint32PtrIndent: - 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 - case opStructEndUint64Indent: - b = e.encodeIndent(b, code.indent) - b = append(b, code.key...) - 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 - case opStructEscapedEndUint64Indent: - 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 - case opStructEndUint64PtrIndent: - b = e.encodeIndent(b, code.indent) - b = append(b, code.key...) - 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 - case opStructEscapedEndUint64PtrIndent: - 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 - case opStructEndFloat32Indent: - b = e.encodeIndent(b, code.indent) - b = append(b, code.key...) - 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 - case opStructEscapedEndFloat32Indent: - 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 - case opStructEndFloat32PtrIndent: - b = e.encodeIndent(b, code.indent) - b = append(b, code.key...) - 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 - case opStructEscapedEndFloat32PtrIndent: - 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 - case opStructEndFloat64Indent: - b = e.encodeIndent(b, code.indent) - b = append(b, code.key...) - 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 - case opStructEscapedEndFloat64Indent: - 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 - case opStructEndFloat64PtrIndent: - b = e.encodeIndent(b, code.indent) - b = append(b, code.key...) - 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 - case opStructEscapedEndFloat64PtrIndent: - 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 - case opStructEndStringIndent: - b = e.encodeIndent(b, code.indent) - b = append(b, code.key...) - b = append(b, ' ') - ptr := load(ctxptr, code.headIdx) - b = encodeNoEscapedString(b, e.ptrToString(ptr+code.offset)) - b = e.appendStructEndIndent(b, code.indent-1) - code = code.next - case opStructEscapedEndEscapedStringIndent: - 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 - case opStructEndBoolIndent: - b = e.encodeIndent(b, code.indent) - b = append(b, code.key...) - 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 - case opStructEscapedEndBoolIndent: - 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 - case opStructEndBytesIndent: - b = e.encodeIndent(b, code.indent) - b = append(b, code.key...) - 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 - case opStructEscapedEndBytesIndent: - 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 - case opStructEndMarshalJSONIndent: - b = e.encodeIndent(b, code.indent) - b = append(b, code.key...) - 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 - case opStructEscapedEndMarshalJSONIndent: - 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 case opStructEndOmitEmptyInt: ptr := load(ctxptr, code.headIdx) v := e.ptrToInt(ptr + code.offset) @@ -18486,15 +5335,6 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte } b = appendStructEnd(b) code = code.next - case opStructEscapedEndOmitEmptyInt: - ptr := load(ctxptr, code.headIdx) - v := e.ptrToInt(ptr + code.offset) - if v != 0 { - b = append(b, code.escapedKey...) - b = appendInt(b, int64(v)) - } - b = appendStructEnd(b) - code = code.next case opStructEndOmitEmptyInt8: ptr := load(ctxptr, code.headIdx) v := e.ptrToInt8(ptr + code.offset) @@ -18504,15 +5344,6 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte } b = appendStructEnd(b) code = code.next - case opStructEscapedEndOmitEmptyInt8: - ptr := load(ctxptr, code.headIdx) - v := e.ptrToInt8(ptr + code.offset) - if v != 0 { - b = append(b, code.escapedKey...) - b = appendInt(b, int64(v)) - } - b = appendStructEnd(b) - code = code.next case opStructEndOmitEmptyInt16: ptr := load(ctxptr, code.headIdx) v := e.ptrToInt16(ptr + code.offset) @@ -18522,15 +5353,6 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte } b = appendStructEnd(b) code = code.next - case opStructEscapedEndOmitEmptyInt16: - ptr := load(ctxptr, code.headIdx) - v := e.ptrToInt16(ptr + code.offset) - if v != 0 { - b = append(b, code.escapedKey...) - b = appendInt(b, int64(v)) - } - b = appendStructEnd(b) - code = code.next case opStructEndOmitEmptyInt32: ptr := load(ctxptr, code.headIdx) v := e.ptrToInt32(ptr + code.offset) @@ -18540,15 +5362,6 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte } b = appendStructEnd(b) code = code.next - case opStructEscapedEndOmitEmptyInt32: - ptr := load(ctxptr, code.headIdx) - v := e.ptrToInt32(ptr + code.offset) - if v != 0 { - b = append(b, code.escapedKey...) - b = appendInt(b, int64(v)) - } - b = appendStructEnd(b) - code = code.next case opStructEndOmitEmptyInt64: ptr := load(ctxptr, code.headIdx) v := e.ptrToInt64(ptr + code.offset) @@ -18558,15 +5371,6 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte } b = appendStructEnd(b) code = code.next - case opStructEscapedEndOmitEmptyInt64: - ptr := load(ctxptr, code.headIdx) - v := e.ptrToInt64(ptr + code.offset) - if v != 0 { - b = append(b, code.escapedKey...) - b = appendInt(b, v) - } - b = appendStructEnd(b) - code = code.next case opStructEndOmitEmptyUint: ptr := load(ctxptr, code.headIdx) v := e.ptrToUint(ptr + code.offset) @@ -18576,15 +5380,6 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte b = appendStructEnd(b) } code = code.next - case opStructEscapedEndOmitEmptyUint: - ptr := load(ctxptr, code.headIdx) - v := e.ptrToUint(ptr + code.offset) - if v != 0 { - b = append(b, code.escapedKey...) - b = appendUint(b, uint64(v)) - } - b = appendStructEnd(b) - code = code.next case opStructEndOmitEmptyUint8: ptr := load(ctxptr, code.headIdx) v := e.ptrToUint8(ptr + code.offset) @@ -18594,15 +5389,6 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte } b = appendStructEnd(b) code = code.next - case opStructEscapedEndOmitEmptyUint8: - ptr := load(ctxptr, code.headIdx) - v := e.ptrToUint8(ptr + code.offset) - if v != 0 { - b = append(b, code.escapedKey...) - b = appendUint(b, uint64(v)) - } - b = appendStructEnd(b) - code = code.next case opStructEndOmitEmptyUint16: ptr := load(ctxptr, code.headIdx) v := e.ptrToUint16(ptr + code.offset) @@ -18612,15 +5398,6 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte } b = appendStructEnd(b) code = code.next - case opStructEscapedEndOmitEmptyUint16: - ptr := load(ctxptr, code.headIdx) - v := e.ptrToUint16(ptr + code.offset) - if v != 0 { - b = append(b, code.escapedKey...) - b = appendUint(b, uint64(v)) - } - b = appendStructEnd(b) - code = code.next case opStructEndOmitEmptyUint32: ptr := load(ctxptr, code.headIdx) v := e.ptrToUint32(ptr + code.offset) @@ -18630,15 +5407,6 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte } b = appendStructEnd(b) code = code.next - case opStructEscapedEndOmitEmptyUint32: - ptr := load(ctxptr, code.headIdx) - v := e.ptrToUint32(ptr + code.offset) - if v != 0 { - b = append(b, code.escapedKey...) - b = appendUint(b, uint64(v)) - } - b = appendStructEnd(b) - code = code.next case opStructEndOmitEmptyUint64: ptr := load(ctxptr, code.headIdx) v := e.ptrToUint64(ptr + code.offset) @@ -18648,15 +5416,6 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte } b = appendStructEnd(b) code = code.next - case opStructEscapedEndOmitEmptyUint64: - ptr := load(ctxptr, code.headIdx) - v := e.ptrToUint64(ptr + code.offset) - if v != 0 { - b = append(b, code.escapedKey...) - b = appendUint(b, v) - } - b = appendStructEnd(b) - code = code.next case opStructEndOmitEmptyFloat32: ptr := load(ctxptr, code.headIdx) v := e.ptrToFloat32(ptr + code.offset) @@ -18666,15 +5425,6 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte } b = appendStructEnd(b) code = code.next - case opStructEscapedEndOmitEmptyFloat32: - ptr := load(ctxptr, code.headIdx) - v := e.ptrToFloat32(ptr + code.offset) - if v != 0 { - b = append(b, code.escapedKey...) - b = encodeFloat32(b, v) - } - b = appendStructEnd(b) - code = code.next case opStructEndOmitEmptyFloat64: ptr := load(ctxptr, code.headIdx) v := e.ptrToFloat64(ptr + code.offset) @@ -18687,18 +5437,6 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte } b = appendStructEnd(b) code = code.next - case opStructEscapedEndOmitEmptyFloat64: - 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 = append(b, code.escapedKey...) - b = encodeFloat64(b, v) - } - b = appendStructEnd(b) - code = code.next case opStructEndOmitEmptyString: ptr := load(ctxptr, code.headIdx) v := e.ptrToString(ptr + code.offset) @@ -18708,15 +5446,6 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte } b = appendStructEnd(b) code = code.next - case opStructEscapedEndOmitEmptyEscapedString: - ptr := load(ctxptr, code.headIdx) - v := e.ptrToString(ptr + code.offset) - if v != "" { - b = append(b, code.escapedKey...) - b = encodeEscapedString(b, v) - } - b = appendStructEnd(b) - code = code.next case opStructEndOmitEmptyBool: ptr := load(ctxptr, code.headIdx) v := e.ptrToBool(ptr + code.offset) @@ -18726,15 +5455,6 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte } b = appendStructEnd(b) code = code.next - case opStructEscapedEndOmitEmptyBool: - ptr := load(ctxptr, code.headIdx) - v := e.ptrToBool(ptr + code.offset) - if v { - b = append(b, code.escapedKey...) - b = encodeBool(b, v) - } - b = appendStructEnd(b) - code = code.next case opStructEndOmitEmptyBytes: ptr := load(ctxptr, code.headIdx) v := e.ptrToBytes(ptr + code.offset) @@ -18744,15 +5464,6 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte } b = appendStructEnd(b) code = code.next - case opStructEscapedEndOmitEmptyBytes: - ptr := load(ctxptr, code.headIdx) - v := e.ptrToBytes(ptr + code.offset) - if len(v) > 0 { - b = append(b, code.escapedKey...) - b = encodeByteSlice(b, v) - } - b = appendStructEnd(b) - code = code.next case opStructEndOmitEmptyMarshalJSON: ptr := load(ctxptr, code.headIdx) p := ptr + code.offset @@ -18771,24 +5482,6 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte } b = appendStructEnd(b) code = code.next - case opStructEscapedEndOmitEmptyMarshalJSON: - ptr := load(ctxptr, code.headIdx) - p := ptr + code.offset - v := e.ptrToInterface(code, p) - if v != nil { - 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, code.escapedKey...) - b = append(b, buf.Bytes()...) - } - b = appendStructEnd(b) - code = code.next case opStructEndOmitEmptyMarshalText: ptr := load(ctxptr, code.headIdx) p := ptr + code.offset @@ -18803,356 +5496,6 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte } b = appendStructEnd(b) code = code.next - case opStructEscapedEndOmitEmptyMarshalText: - ptr := load(ctxptr, code.headIdx) - p := ptr + code.offset - v := e.ptrToInterface(code, p) - if v != nil { - bytes, err := v.(encoding.TextMarshaler).MarshalText() - if err != nil { - return nil, errMarshaler(code, err) - } - b = append(b, code.escapedKey...) - b = encodeEscapedString(b, *(*string)(unsafe.Pointer(&bytes))) - } - b = appendStructEnd(b) - code = code.next - case opStructEndOmitEmptyIntIndent: - ptr := load(ctxptr, code.headIdx) - v := e.ptrToInt(ptr + code.offset) - if v != 0 { - b = e.encodeIndent(b, code.indent) - b = append(b, code.key...) - b = append(b, ' ') - b = appendInt(b, int64(v)) - } - b = e.appendStructEndIndent(b, code.indent-1) - code = code.next - case opStructEscapedEndOmitEmptyIntIndent: - 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 - case opStructEndOmitEmptyInt8Indent: - ptr := load(ctxptr, code.headIdx) - v := e.ptrToInt8(ptr + code.offset) - if v != 0 { - b = e.encodeIndent(b, code.indent) - b = append(b, code.key...) - b = append(b, ' ') - b = appendInt(b, int64(v)) - } - b = e.appendStructEndIndent(b, code.indent-1) - code = code.next - case opStructEscapedEndOmitEmptyInt8Indent: - 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 - case opStructEndOmitEmptyInt16Indent: - ptr := load(ctxptr, code.headIdx) - v := e.ptrToInt16(ptr + code.offset) - if v != 0 { - b = e.encodeIndent(b, code.indent) - b = append(b, code.key...) - b = append(b, ' ') - b = appendInt(b, int64(v)) - } - b = e.appendStructEndIndent(b, code.indent-1) - code = code.next - case opStructEscapedEndOmitEmptyInt16Indent: - 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 - case opStructEndOmitEmptyInt32Indent: - ptr := load(ctxptr, code.headIdx) - v := e.ptrToInt32(ptr + code.offset) - if v != 0 { - b = e.encodeIndent(b, code.indent) - b = append(b, code.key...) - b = append(b, ' ') - b = appendInt(b, int64(v)) - } - b = e.appendStructEndIndent(b, code.indent-1) - code = code.next - case opStructEscapedEndOmitEmptyInt32Indent: - 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 - case opStructEndOmitEmptyInt64Indent: - ptr := load(ctxptr, code.headIdx) - v := e.ptrToInt64(ptr + code.offset) - if v != 0 { - b = e.encodeIndent(b, code.indent) - b = append(b, code.key...) - b = append(b, ' ') - b = appendInt(b, v) - } - b = e.appendStructEndIndent(b, code.indent-1) - code = code.next - case opStructEscapedEndOmitEmptyInt64Indent: - 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 - case opStructEndOmitEmptyUintIndent: - ptr := load(ctxptr, code.headIdx) - v := e.ptrToUint(ptr + code.offset) - if v != 0 { - b = e.encodeIndent(b, code.indent) - b = append(b, code.key...) - b = append(b, ' ') - b = appendUint(b, uint64(v)) - } - b = e.appendStructEndIndent(b, code.indent-1) - code = code.next - case opStructEscapedEndOmitEmptyUintIndent: - 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 - case opStructEndOmitEmptyUint8Indent: - ptr := load(ctxptr, code.headIdx) - v := e.ptrToUint8(ptr + code.offset) - if v != 0 { - b = e.encodeIndent(b, code.indent) - b = append(b, code.key...) - b = append(b, ' ') - b = appendUint(b, uint64(v)) - } - b = e.appendStructEndIndent(b, code.indent-1) - code = code.next - case opStructEscapedEndOmitEmptyUint8Indent: - 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 - case opStructEndOmitEmptyUint16Indent: - ptr := load(ctxptr, code.headIdx) - v := e.ptrToUint16(ptr + code.offset) - if v != 0 { - b = e.encodeIndent(b, code.indent) - b = append(b, code.key...) - b = append(b, ' ') - b = appendUint(b, uint64(v)) - } - b = e.appendStructEndIndent(b, code.indent-1) - code = code.next - case opStructEscapedEndOmitEmptyUint16Indent: - 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 - case opStructEndOmitEmptyUint32Indent: - ptr := load(ctxptr, code.headIdx) - v := e.ptrToUint32(ptr + code.offset) - if v != 0 { - b = e.encodeIndent(b, code.indent) - b = append(b, code.key...) - b = append(b, ' ') - b = appendUint(b, uint64(v)) - } - b = e.appendStructEndIndent(b, code.indent-1) - code = code.next - case opStructEscapedEndOmitEmptyUint32Indent: - 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 - case opStructEndOmitEmptyUint64Indent: - ptr := load(ctxptr, code.headIdx) - v := e.ptrToUint64(ptr + code.offset) - if v != 0 { - b = e.encodeIndent(b, code.indent) - b = append(b, code.key...) - b = append(b, ' ') - b = appendUint(b, v) - } - b = e.appendStructEndIndent(b, code.indent-1) - code = code.next - case opStructEscapedEndOmitEmptyUint64Indent: - 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 - case opStructEndOmitEmptyFloat32Indent: - ptr := load(ctxptr, code.headIdx) - v := e.ptrToFloat32(ptr + code.offset) - if v != 0 { - b = e.encodeIndent(b, code.indent) - b = append(b, code.key...) - b = append(b, ' ') - b = encodeFloat32(b, v) - } - b = e.appendStructEndIndent(b, code.indent-1) - code = code.next - case opStructEscapedEndOmitEmptyFloat32Indent: - 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 - case opStructEndOmitEmptyFloat64Indent: - 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.key...) - b = append(b, ' ') - b = encodeFloat64(b, v) - } - b = e.appendStructEndIndent(b, code.indent-1) - code = code.next - case opStructEscapedEndOmitEmptyFloat64Indent: - 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 - case opStructEndOmitEmptyStringIndent: - ptr := load(ctxptr, code.headIdx) - v := e.ptrToString(ptr + code.offset) - if v != "" { - b = e.encodeIndent(b, code.indent) - b = append(b, code.key...) - b = append(b, ' ') - b = encodeNoEscapedString(b, v) - } - b = e.appendStructEndIndent(b, code.indent-1) - code = code.next - case opStructEscapedEndOmitEmptyEscapedStringIndent: - 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 - case opStructEndOmitEmptyBoolIndent: - ptr := load(ctxptr, code.headIdx) - v := e.ptrToBool(ptr + code.offset) - if v { - b = e.encodeIndent(b, code.indent) - b = append(b, code.key...) - b = append(b, ' ') - b = encodeBool(b, v) - } - b = e.appendStructEndIndent(b, code.indent-1) - code = code.next - case opStructEscapedEndOmitEmptyBoolIndent: - 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 - case opStructEndOmitEmptyBytesIndent: - 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.key...) - b = append(b, ' ') - b = encodeByteSlice(b, v) - } - b = e.appendStructEndIndent(b, code.indent-1) - code = code.next - case opStructEscapedEndOmitEmptyBytesIndent: - 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 case opStructEndStringTagInt: ptr := load(ctxptr, code.headIdx) b = append(b, code.key...) @@ -19161,14 +5504,6 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte b = append(b, '"') b = appendStructEnd(b) code = code.next - case opStructEscapedEndStringTagInt: - ptr := load(ctxptr, code.headIdx) - b = append(b, code.escapedKey...) - b = append(b, '"') - b = appendInt(b, int64(e.ptrToInt(ptr+code.offset))) - b = append(b, '"') - b = appendStructEnd(b) - code = code.next case opStructEndStringTagInt8: ptr := load(ctxptr, code.headIdx) b = append(b, code.key...) @@ -19177,14 +5512,6 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte b = append(b, '"') b = appendStructEnd(b) code = code.next - case opStructEscapedEndStringTagInt8: - ptr := load(ctxptr, code.headIdx) - b = append(b, code.escapedKey...) - b = append(b, '"') - b = appendInt(b, int64(e.ptrToInt8(ptr+code.offset))) - b = append(b, '"') - b = appendStructEnd(b) - code = code.next case opStructEndStringTagInt16: ptr := load(ctxptr, code.headIdx) b = append(b, code.key...) @@ -19193,14 +5520,6 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte b = append(b, '"') b = appendStructEnd(b) code = code.next - case opStructEscapedEndStringTagInt16: - ptr := load(ctxptr, code.headIdx) - b = append(b, code.escapedKey...) - b = append(b, '"') - b = appendInt(b, int64(e.ptrToInt16(ptr+code.offset))) - b = append(b, '"') - b = appendStructEnd(b) - code = code.next case opStructEndStringTagInt32: ptr := load(ctxptr, code.headIdx) b = append(b, code.key...) @@ -19209,14 +5528,6 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte b = append(b, '"') b = appendStructEnd(b) code = code.next - case opStructEscapedEndStringTagInt32: - ptr := load(ctxptr, code.headIdx) - b = append(b, code.escapedKey...) - b = append(b, '"') - b = appendInt(b, int64(e.ptrToInt32(ptr+code.offset))) - b = append(b, '"') - b = appendStructEnd(b) - code = code.next case opStructEndStringTagInt64: ptr := load(ctxptr, code.headIdx) b = append(b, code.key...) @@ -19225,14 +5536,6 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte b = append(b, '"') b = appendStructEnd(b) code = code.next - case opStructEscapedEndStringTagInt64: - ptr := load(ctxptr, code.headIdx) - b = append(b, code.escapedKey...) - b = append(b, '"') - b = appendInt(b, e.ptrToInt64(ptr+code.offset)) - b = append(b, '"') - b = appendStructEnd(b) - code = code.next case opStructEndStringTagUint: ptr := load(ctxptr, code.headIdx) b = append(b, code.key...) @@ -19241,14 +5544,6 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte b = append(b, '"') b = appendStructEnd(b) code = code.next - case opStructEscapedEndStringTagUint: - ptr := load(ctxptr, code.headIdx) - b = append(b, code.escapedKey...) - b = append(b, '"') - b = appendUint(b, uint64(e.ptrToUint(ptr+code.offset))) - b = append(b, '"') - b = appendStructEnd(b) - code = code.next case opStructEndStringTagUint8: ptr := load(ctxptr, code.headIdx) b = append(b, code.key...) @@ -19257,14 +5552,6 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte b = append(b, '"') b = appendStructEnd(b) code = code.next - case opStructEscapedEndStringTagUint8: - ptr := load(ctxptr, code.headIdx) - b = append(b, code.escapedKey...) - b = append(b, '"') - b = appendUint(b, uint64(e.ptrToUint8(ptr+code.offset))) - b = append(b, '"') - b = appendStructEnd(b) - code = code.next case opStructEndStringTagUint16: ptr := load(ctxptr, code.headIdx) b = append(b, code.key...) @@ -19273,14 +5560,6 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte b = append(b, '"') b = appendStructEnd(b) code = code.next - case opStructEscapedEndStringTagUint16: - ptr := load(ctxptr, code.headIdx) - b = append(b, code.escapedKey...) - b = append(b, '"') - b = appendUint(b, uint64(e.ptrToUint16(ptr+code.offset))) - b = append(b, '"') - b = appendStructEnd(b) - code = code.next case opStructEndStringTagUint32: ptr := load(ctxptr, code.headIdx) b = append(b, code.key...) @@ -19289,14 +5568,6 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte b = append(b, '"') b = appendStructEnd(b) code = code.next - case opStructEscapedEndStringTagUint32: - ptr := load(ctxptr, code.headIdx) - b = append(b, code.escapedKey...) - b = append(b, '"') - b = appendUint(b, uint64(e.ptrToUint32(ptr+code.offset))) - b = append(b, '"') - b = appendStructEnd(b) - code = code.next case opStructEndStringTagUint64: ptr := load(ctxptr, code.headIdx) b = append(b, code.key...) @@ -19305,14 +5576,6 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte b = append(b, '"') b = appendStructEnd(b) code = code.next - case opStructEscapedEndStringTagUint64: - ptr := load(ctxptr, code.headIdx) - b = append(b, code.escapedKey...) - b = append(b, '"') - b = appendUint(b, uint64(e.ptrToUint64(ptr+code.offset))) - b = append(b, '"') - b = appendStructEnd(b) - code = code.next case opStructEndStringTagFloat32: ptr := load(ctxptr, code.headIdx) b = append(b, code.key...) @@ -19321,14 +5584,6 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte b = append(b, '"') b = appendStructEnd(b) code = code.next - case opStructEscapedEndStringTagFloat32: - ptr := load(ctxptr, code.headIdx) - b = append(b, code.escapedKey...) - b = append(b, '"') - b = encodeFloat32(b, e.ptrToFloat32(ptr+code.offset)) - b = append(b, '"') - b = appendStructEnd(b) - code = code.next case opStructEndStringTagFloat64: ptr := load(ctxptr, code.headIdx) v := e.ptrToFloat64(ptr + code.offset) @@ -19341,18 +5596,6 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte b = append(b, '"') b = appendStructEnd(b) code = code.next - case opStructEscapedEndStringTagFloat64: - ptr := load(ctxptr, code.headIdx) - v := e.ptrToFloat64(ptr + code.offset) - if math.IsInf(v, 0) || math.IsNaN(v) { - return nil, errUnsupportedFloat(v) - } - b = append(b, code.escapedKey...) - b = append(b, '"') - b = encodeFloat64(b, v) - b = append(b, '"') - b = appendStructEnd(b) - code = code.next case opStructEndStringTagString: ptr := load(ctxptr, code.headIdx) b = append(b, code.key...) @@ -19360,13 +5603,6 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte b = encodeNoEscapedString(b, string(encodeNoEscapedString([]byte{}, s))) b = appendStructEnd(b) code = code.next - case opStructEscapedEndStringTagEscapedString: - ptr := load(ctxptr, code.headIdx) - b = append(b, code.escapedKey...) - s := e.ptrToString(ptr + code.offset) - b = encodeEscapedString(b, string(encodeEscapedString([]byte{}, s))) - b = appendStructEnd(b) - code = code.next case opStructEndStringTagBool: ptr := load(ctxptr, code.headIdx) b = append(b, code.key...) @@ -19375,14 +5611,6 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte b = append(b, '"') b = appendStructEnd(b) code = code.next - case opStructEscapedEndStringTagBool: - ptr := load(ctxptr, code.headIdx) - b = append(b, code.escapedKey...) - b = append(b, '"') - b = encodeBool(b, e.ptrToBool(ptr+code.offset)) - b = append(b, '"') - b = appendStructEnd(b) - code = code.next case opStructEndStringTagBytes: ptr := load(ctxptr, code.headIdx) v := e.ptrToBytes(ptr + code.offset) @@ -19390,13 +5618,6 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte b = encodeByteSlice(b, v) b = appendStructEnd(b) code = code.next - case opStructEscapedEndStringTagBytes: - ptr := load(ctxptr, code.headIdx) - v := e.ptrToBytes(ptr + code.offset) - b = append(b, code.escapedKey...) - b = encodeByteSlice(b, v) - b = appendStructEnd(b) - code = code.next case opStructEndStringTagMarshalJSON: ptr := load(ctxptr, code.headIdx) p := ptr + code.offset @@ -19413,22 +5634,6 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte b = encodeNoEscapedString(b, buf.String()) b = appendStructEnd(b) code = code.next - case opStructEscapedEndStringTagMarshalJSON: - 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, code.escapedKey...) - b = encodeEscapedString(b, buf.String()) - b = appendStructEnd(b) - code = code.next case opStructEndStringTagMarshalText: ptr := load(ctxptr, code.headIdx) p := ptr + code.offset @@ -19441,358 +5646,6 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte b = encodeNoEscapedString(b, *(*string)(unsafe.Pointer(&bytes))) b = appendStructEnd(b) code = code.next - case opStructEscapedEndStringTagMarshalText: - ptr := load(ctxptr, code.headIdx) - p := ptr + code.offset - v := e.ptrToInterface(code, p) - bytes, err := v.(encoding.TextMarshaler).MarshalText() - if err != nil { - return nil, errMarshaler(code, err) - } - b = append(b, code.escapedKey...) - b = encodeEscapedString(b, *(*string)(unsafe.Pointer(&bytes))) - b = appendStructEnd(b) - code = code.next - case opStructEndStringTagIntIndent: - ptr := load(ctxptr, code.headIdx) - b = e.encodeIndent(b, code.indent) - b = append(b, code.key...) - 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 - case opStructEscapedEndStringTagIntIndent: - 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 - case opStructEndStringTagInt8Indent: - ptr := load(ctxptr, code.headIdx) - b = e.encodeIndent(b, code.indent) - b = append(b, code.key...) - 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 - case opStructEscapedEndStringTagInt8Indent: - 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 - case opStructEndStringTagInt16Indent: - ptr := load(ctxptr, code.headIdx) - b = e.encodeIndent(b, code.indent) - b = append(b, code.key...) - 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 - case opStructEscapedEndStringTagInt16Indent: - 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 - case opStructEndStringTagInt32Indent: - ptr := load(ctxptr, code.headIdx) - b = e.encodeIndent(b, code.indent) - b = append(b, code.key...) - 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 - case opStructEscapedEndStringTagInt32Indent: - 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 - case opStructEndStringTagInt64Indent: - ptr := load(ctxptr, code.headIdx) - b = e.encodeIndent(b, code.indent) - b = append(b, code.key...) - b = append(b, ' ', '"') - b = appendInt(b, e.ptrToInt64(ptr+code.offset)) - b = append(b, '"') - b = e.appendStructEndIndent(b, code.indent-1) - code = code.next - case opStructEscapedEndStringTagInt64Indent: - 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 - case opStructEndStringTagUintIndent: - ptr := load(ctxptr, code.headIdx) - b = e.encodeIndent(b, code.indent) - b = append(b, code.key...) - 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 - case opStructEscapedEndStringTagUintIndent: - 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 - case opStructEndStringTagUint8Indent: - ptr := load(ctxptr, code.headIdx) - b = e.encodeIndent(b, code.indent) - b = append(b, code.key...) - 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 - case opStructEscapedEndStringTagUint8Indent: - 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 - case opStructEndStringTagUint16Indent: - ptr := load(ctxptr, code.headIdx) - b = e.encodeIndent(b, code.indent) - b = append(b, code.key...) - 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 - case opStructEscapedEndStringTagUint16Indent: - 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 - case opStructEndStringTagUint32Indent: - ptr := load(ctxptr, code.headIdx) - b = e.encodeIndent(b, code.indent) - b = append(b, code.key...) - 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 - case opStructEscapedEndStringTagUint32Indent: - 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 - case opStructEndStringTagUint64Indent: - ptr := load(ctxptr, code.headIdx) - b = e.encodeIndent(b, code.indent) - b = append(b, code.key...) - b = append(b, ' ', '"') - b = appendUint(b, e.ptrToUint64(ptr+code.offset)) - b = append(b, '"') - b = e.appendStructEndIndent(b, code.indent-1) - code = code.next - case opStructEscapedEndStringTagUint64Indent: - 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 - case opStructEndStringTagFloat32Indent: - ptr := load(ctxptr, code.headIdx) - b = e.encodeIndent(b, code.indent) - b = append(b, code.key...) - b = append(b, ' ', '"') - b = encodeFloat32(b, e.ptrToFloat32(ptr+code.offset)) - b = append(b, '"') - b = e.appendStructEndIndent(b, code.indent-1) - code = code.next - case opStructEscapedEndStringTagFloat32Indent: - 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 - case opStructEndStringTagFloat64Indent: - 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.key...) - b = append(b, ' ', '"') - b = encodeFloat64(b, v) - b = append(b, '"') - b = e.appendStructEndIndent(b, code.indent-1) - code = code.next - case opStructEscapedEndStringTagFloat64Indent: - 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 - case opStructEndStringTagStringIndent: - ptr := load(ctxptr, code.headIdx) - b = e.encodeIndent(b, code.indent) - b = append(b, code.key...) - b = append(b, ' ') - s := e.ptrToString(ptr + code.offset) - b = encodeNoEscapedString(b, string(encodeNoEscapedString([]byte{}, s))) - b = e.appendStructEndIndent(b, code.indent-1) - code = code.next - case opStructEscapedEndStringTagEscapedStringIndent: - 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 - case opStructEndStringTagBoolIndent: - ptr := load(ctxptr, code.headIdx) - b = e.encodeIndent(b, code.indent) - b = append(b, code.key...) - b = append(b, ' ', '"') - b = encodeBool(b, e.ptrToBool(ptr+code.offset)) - b = append(b, '"') - b = e.appendStructEndIndent(b, code.indent-1) - code = code.next - case opStructEscapedEndStringTagBoolIndent: - 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 - case opStructEndStringTagBytesIndent: - ptr := load(ctxptr, code.headIdx) - b = e.encodeIndent(b, code.indent) - b = append(b, code.key...) - b = append(b, ' ') - b = encodeByteSlice(b, e.ptrToBytes(ptr+code.offset)) - b = e.appendStructEndIndent(b, code.indent-1) - code = code.next - case opStructEscapedEndStringTagBytesIndent: - 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 - case opStructEndStringTagMarshalJSONIndent: - ptr := load(ctxptr, code.headIdx) - b = e.encodeIndent(b, code.indent) - b = append(b, code.key...) - 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 - case opStructEscapedEndStringTagMarshalJSONIndent: - 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 - case opStructEndStringTagMarshalTextIndent: - ptr := load(ctxptr, code.headIdx) - b = e.encodeIndent(b, code.indent) - b = append(b, code.key...) - 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 = encodeNoEscapedString(b, *(*string)(unsafe.Pointer(&bytes))) - b = e.appendStructEndIndent(b, code.indent-1) - code = code.next - case opStructEscapedEndStringTagMarshalTextIndent: - 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 } diff --git a/encode_vm_escaped.go b/encode_vm_escaped.go new file mode 100644 index 0000000..0a1edbd --- /dev/null +++ b/encode_vm_escaped.go @@ -0,0 +1,5709 @@ +package json + +import ( + "bytes" + "encoding" + "fmt" + "math" + "reflect" + "sort" + "unsafe" +) + +func (e *Encoder) runEscaped(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) + case opPtr: + ptr := load(ctxptr, code.idx) + code = code.next + store(ctxptr, code.idx, e.ptrToPtr(ptr)) + case opInt: + b = appendInt(b, int64(e.ptrToInt(load(ctxptr, code.idx)))) + b = encodeComma(b) + code = code.next + case opInt8: + b = appendInt(b, int64(e.ptrToInt8(load(ctxptr, code.idx)))) + b = encodeComma(b) + code = code.next + case opInt16: + b = appendInt(b, int64(e.ptrToInt16(load(ctxptr, code.idx)))) + b = encodeComma(b) + code = code.next + case opInt32: + b = appendInt(b, int64(e.ptrToInt32(load(ctxptr, code.idx)))) + b = encodeComma(b) + code = code.next + case opInt64: + b = appendInt(b, e.ptrToInt64(load(ctxptr, code.idx))) + b = encodeComma(b) + code = code.next + case opUint: + b = appendUint(b, uint64(e.ptrToUint(load(ctxptr, code.idx)))) + b = encodeComma(b) + code = code.next + case opUint8: + b = appendUint(b, uint64(e.ptrToUint8(load(ctxptr, code.idx)))) + b = encodeComma(b) + code = code.next + case opUint16: + b = appendUint(b, uint64(e.ptrToUint16(load(ctxptr, code.idx)))) + b = encodeComma(b) + code = code.next + case opUint32: + b = appendUint(b, uint64(e.ptrToUint32(load(ctxptr, code.idx)))) + b = encodeComma(b) + code = code.next + case opUint64: + b = appendUint(b, e.ptrToUint64(load(ctxptr, code.idx))) + b = encodeComma(b) + code = code.next + case opIntString: + b = append(b, '"') + b = appendInt(b, int64(e.ptrToInt(load(ctxptr, code.idx)))) + b = append(b, '"') + b = encodeComma(b) + code = code.next + case opInt8String: + b = append(b, '"') + b = appendInt(b, int64(e.ptrToInt8(load(ctxptr, code.idx)))) + b = append(b, '"') + b = encodeComma(b) + code = code.next + case opInt16String: + b = append(b, '"') + b = appendInt(b, int64(e.ptrToInt16(load(ctxptr, code.idx)))) + b = append(b, '"') + b = encodeComma(b) + code = code.next + case opInt32String: + b = append(b, '"') + b = appendInt(b, int64(e.ptrToInt32(load(ctxptr, code.idx)))) + b = append(b, '"') + b = encodeComma(b) + code = code.next + case opInt64String: + b = append(b, '"') + b = appendInt(b, e.ptrToInt64(load(ctxptr, code.idx))) + b = append(b, '"') + b = encodeComma(b) + code = code.next + case opUintString: + b = append(b, '"') + b = appendUint(b, uint64(e.ptrToUint(load(ctxptr, code.idx)))) + b = append(b, '"') + b = encodeComma(b) + code = code.next + case opUint8String: + b = append(b, '"') + b = appendUint(b, uint64(e.ptrToUint8(load(ctxptr, code.idx)))) + b = append(b, '"') + b = encodeComma(b) + code = code.next + case opUint16String: + b = append(b, '"') + b = appendUint(b, uint64(e.ptrToUint16(load(ctxptr, code.idx)))) + b = append(b, '"') + b = encodeComma(b) + code = code.next + case opUint32String: + b = append(b, '"') + b = appendUint(b, uint64(e.ptrToUint32(load(ctxptr, code.idx)))) + b = append(b, '"') + b = encodeComma(b) + code = code.next + case opUint64String: + b = append(b, '"') + b = appendUint(b, e.ptrToUint64(load(ctxptr, code.idx))) + b = append(b, '"') + b = encodeComma(b) + code = code.next + case opFloat32: + b = encodeFloat32(b, e.ptrToFloat32(load(ctxptr, code.idx))) + b = encodeComma(b) + code = code.next + case opFloat64: + v := e.ptrToFloat64(load(ctxptr, code.idx)) + if math.IsInf(v, 0) || math.IsNaN(v) { + return nil, errUnsupportedFloat(v) + } + b = encodeFloat64(b, v) + b = encodeComma(b) + code = code.next + case opString: + b = encodeNoEscapedString(b, e.ptrToString(load(ctxptr, code.idx))) + b = encodeComma(b) + code = code.next + case opEscapedString: + b = encodeEscapedString(b, e.ptrToString(load(ctxptr, code.idx))) + b = encodeComma(b) + code = code.next + case opBool: + b = encodeBool(b, e.ptrToBool(load(ctxptr, code.idx))) + b = encodeComma(b) + code = code.next + case opBytes: + 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 = encodeComma(b) + code = code.next + case opInterface: + ptr := load(ctxptr, code.idx) + if ptr == 0 { + b = encodeNull(b) + b = encodeComma(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 = encodeComma(b) + code = code.next + break + } + vv := rv.Interface() + header := (*interfaceHeader)(unsafe.Pointer(&vv)) + if header.typ.Kind() == reflect.Ptr { + if rv.Elem().IsNil() { + b = encodeNull(b) + b = encodeComma(b) + code = code.next + break + } + } + c, err := e.compileHead(&encodeCompileContext{ + typ: header.typ, + root: code.root, + indent: code.indent, + structTypeToCompiledCode: map[uintptr]*compiledCode{}, + }) + if err != nil { + return nil, err + } + 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 + lastCode.op = opInterfaceEnd + lastCode.next = code.next + + code = c + recursiveLevel++ + case opInterfaceEnd: + recursiveLevel-- + // restore ctxptr + offset := load(ctxptr, code.idx) + ctxptr = ctx.ptr() + offset + ptrOffset = offset + code = code.next + case opMarshalJSON: + 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 := compact(&buf, bb, e.enabledHTMLEscape); err != nil { + return nil, err + } + b = append(append(b, buf.Bytes()...), ',') + code = code.next + case opMarshalText: + ptr := load(ctxptr, code.idx) + isPtr := code.typ.Kind() == reflect.Ptr + p := e.ptrToUnsafePtr(ptr) + if p == nil || isPtr && *(*unsafe.Pointer)(p) == nil { + b = append(b, '"', '"', ',') + } else { + v := *(*interface{})(unsafe.Pointer(&interfaceHeader{ + typ: code.typ, + ptr: p, + })) + bytes, err := v.(encoding.TextMarshaler).MarshalText() + if err != nil { + return nil, errMarshaler(code, err) + } + if e.enabledHTMLEscape { + b = encodeEscapedString(b, *(*string)(unsafe.Pointer(&bytes))) + } else { + b = encodeNoEscapedString(b, *(*string)(unsafe.Pointer(&bytes))) + } + b = encodeComma(b) + } + code = code.next + case opSliceHead: + p := load(ctxptr, code.idx) + slice := e.ptrToSlice(p) + if p == 0 || uintptr(slice.data) == 0 { + b = encodeNull(b) + b = encodeComma(b) + code = code.end.next + } else { + 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, '[') + code = code.next + store(ctxptr, code.idx, uintptr(slice.data)) + } else { + b = append(b, '[', ']', ',') + code = code.end.next + } + } + case opSliceElem: + idx := load(ctxptr, code.elemIdx) + length := load(ctxptr, code.length) + idx++ + if idx < length { + store(ctxptr, code.elemIdx, idx) + data := load(ctxptr, code.headIdx) + size := code.size + code = code.next + store(ctxptr, code.idx, data+idx*size) + } else { + last := len(b) - 1 + b[last] = ']' + b = encodeComma(b) + code = code.end.next + } + case opArrayHead: + p := load(ctxptr, code.idx) + if p == 0 { + b = encodeNull(b) + b = encodeComma(b) + code = code.end.next + } else { + if code.length > 0 { + b = append(b, '[') + store(ctxptr, code.elemIdx, 0) + code = code.next + store(ctxptr, code.idx, p) + } else { + b = append(b, '[', ']', ',') + code = code.end.next + } + } + case opArrayElem: + idx := load(ctxptr, code.elemIdx) + idx++ + if idx < code.length { + store(ctxptr, code.elemIdx, idx) + p := load(ctxptr, code.headIdx) + size := code.size + code = code.next + store(ctxptr, code.idx, p+idx*size) + } else { + last := len(b) - 1 + b[last] = ']' + b = encodeComma(b) + code = code.end.next + } + case opMapHead: + ptr := load(ctxptr, code.idx) + if ptr == 0 { + b = encodeNull(b) + b = encodeComma(b) + code = code.end.next + } else { + uptr := e.ptrToUnsafePtr(ptr) + mlen := maplen(uptr) + if mlen > 0 { + b = append(b, '{') + 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)) + } + key := mapiterkey(iter) + store(ctxptr, code.next.idx, uintptr(key)) + code = code.next + } else { + b = append(b, '{', '}', ',') + code = code.end.next + } + } + case opMapHeadLoad: + ptr := load(ctxptr, code.idx) + if ptr == 0 { + b = encodeNull(b) + b = encodeComma(b) + code = code.end.next + } else { + // load pointer + ptr = e.ptrToPtr(ptr) + uptr := e.ptrToUnsafePtr(ptr) + if ptr == 0 { + b = encodeNull(b) + b = encodeComma(b) + code = code.end.next + break + } + mlen := maplen(uptr) + if mlen > 0 { + b = append(b, '{') + 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)) + } + code = code.next + } else { + b = append(b, '{', '}', ',') + code = code.end.next + } + } + case opMapKey: + idx := load(ctxptr, code.elemIdx) + length := load(ctxptr, code.length) + idx++ + if e.unorderedMap { + 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 { + last := len(b) - 1 + b[last] = '}' + b = encodeComma(b) + 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 + } + } + case opMapValue: + if e.unorderedMap { + last := len(b) - 1 + b[last] = ':' + } 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 + case opMapEnd: + // 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) + posPtr := e.ptrToUnsafePtr(ptr) + pos := *(*[]int)(posPtr) + 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, []byte(kv.key)...) + buf[len(buf)-1] = ':' + buf = append(buf, []byte(kv.value)...) + } + buf[len(buf)-1] = '}' + buf = append(buf, ',') + b = b[:pos[0]] + b = append(b, buf...) + code = code.next + case opStructEscapedFieldPtrAnonymousHeadRecursive: + store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) + fallthrough + case opStructEscapedFieldAnonymousHeadRecursive: + fallthrough + case opStructEscapedFieldRecursive: + ptr := load(ctxptr, code.idx) + if ptr != 0 { + if recursiveLevel > startDetectingCyclesAfter { + if _, exists := seenPtr[ptr]; exists { + return nil, errUnsupportedValue(code, ptr) + } + } + } + if seenPtr == nil { + seenPtr = map[uintptr]struct{}{} + } + seenPtr[ptr] = struct{}{} + c := toEscaped(code.jmp.code) + c.end.next = newEndOp(&encodeCompileContext{}) + c.op = c.op.ptrHeadToHead() + + beforeLastCode := c.end + lastCode := beforeLastCode.next + + lastCode.idx = beforeLastCode.idx + uintptrSize + lastCode.elemIdx = lastCode.idx + uintptrSize + + // extend length to alloc slot for elemIdx + totalLength := uintptr(code.totalLength() + 1) + nextTotalLength := uintptr(c.totalLength() + 1) + + 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, c.idx, ptr) + store(ctxptr, lastCode.idx, oldOffset) + store(ctxptr, lastCode.elemIdx, uintptr(unsafe.Pointer(code.next))) + + // link lastCode ( opStructFieldRecursiveEnd ) => code.next + lastCode.op = opStructFieldRecursiveEnd + code = c + recursiveLevel++ + case opStructFieldRecursiveEnd: + recursiveLevel-- + + // restore ctxptr + offset := load(ctxptr, code.idx) + ptr := load(ctxptr, code.elemIdx) + code = (*opcode)(e.ptrToUnsafePtr(ptr)) + ctxptr = ctx.ptr() + offset + ptrOffset = offset + case opStructEscapedFieldPtrHead: + p := load(ctxptr, code.idx) + if p == 0 { + b = encodeNull(b) + code = code.end.next + break + } + store(ctxptr, code.idx, e.ptrToPtr(p)) + fallthrough + case opStructEscapedFieldHead: + ptr := load(ctxptr, code.idx) + if ptr == 0 { + b = encodeNull(b) + b = encodeComma(b) + code = code.end.next + } else { + b = append(b, '{') + if !code.anonymousKey { + b = append(b, code.escapedKey...) + } + p := ptr + code.offset + code = code.next + store(ctxptr, code.idx, p) + } + case opStructEscapedFieldHeadOnly: + ptr := load(ctxptr, code.idx) + b = append(b, '{') + if !code.anonymousKey { + b = append(b, code.escapedKey...) + } + p := ptr + code.offset + code = code.next + store(ctxptr, code.idx, p) + case opStructEscapedFieldAnonymousHead: + ptr := load(ctxptr, code.idx) + if ptr == 0 { + code = code.end.next + } else { + code = code.next + store(ctxptr, code.idx, ptr) + } + case opStructEscapedFieldPtrHeadInt: + store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) + fallthrough + case opStructEscapedFieldHeadInt: + ptr := load(ctxptr, code.idx) + if ptr == 0 { + b = encodeNull(b) + b = encodeComma(b) + code = code.end.next + } else { + b = append(b, '{') + b = append(b, code.escapedKey...) + b = appendInt(b, int64(e.ptrToInt(ptr+code.offset))) + b = encodeComma(b) + code = code.next + } + case opStructEscapedFieldPtrHeadIntOnly, opStructEscapedFieldHeadIntOnly: + p := load(ctxptr, code.idx) + b = append(b, '{') + b = append(b, code.escapedKey...) + b = appendInt(b, int64(e.ptrToInt(p))) + b = encodeComma(b) + code = code.next + case opStructEscapedFieldPtrHeadIntPtr: + store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) + fallthrough + case opStructEscapedFieldHeadIntPtr: + p := load(ctxptr, code.idx) + if p == 0 { + b = encodeNull(b) + b = encodeComma(b) + code = code.end.next + break + } else { + b = append(b, '{') + b = append(b, code.escapedKey...) + p = e.ptrToPtr(p) + if p == 0 { + b = encodeNull(b) + } else { + b = appendInt(b, int64(e.ptrToInt(p+code.offset))) + } + } + b = encodeComma(b) + code = code.next + case opStructEscapedFieldPtrHeadIntPtrOnly: + p := load(ctxptr, code.idx) + if p == 0 { + b = encodeNull(b) + b = encodeComma(b) + code = code.end.next + break + } + store(ctxptr, code.idx, e.ptrToPtr(p)) + fallthrough + case opStructEscapedFieldHeadIntPtrOnly: + p := load(ctxptr, code.idx) + b = append(b, '{') + b = append(b, code.escapedKey...) + if p == 0 { + b = encodeNull(b) + } else { + b = appendInt(b, int64(e.ptrToInt(p+code.offset))) + } + b = encodeComma(b) + code = code.next + case opStructEscapedFieldHeadIntNPtr: + p := load(ctxptr, code.idx) + if p == 0 { + b = encodeNull(b) + } else { + b = append(b, '{') + b = append(b, code.escapedKey...) + 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 = encodeComma(b) + code = code.next + case opStructEscapedFieldPtrAnonymousHeadInt: + store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) + fallthrough + case opStructEscapedFieldAnonymousHeadInt: + ptr := load(ctxptr, code.idx) + if ptr == 0 { + code = code.end.next + } else { + b = append(b, code.escapedKey...) + b = appendInt(b, int64(e.ptrToInt(ptr+code.offset))) + b = encodeComma(b) + code = code.next + } + case opStructEscapedFieldPtrAnonymousHeadIntOnly, opStructEscapedFieldAnonymousHeadIntOnly: + ptr := load(ctxptr, code.idx) + if ptr == 0 { + code = code.end.next + } else { + b = append(b, code.escapedKey...) + b = appendInt(b, int64(e.ptrToInt(ptr+code.offset))) + b = encodeComma(b) + code = code.next + } + case opStructEscapedFieldPtrAnonymousHeadIntPtr: + store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) + fallthrough + case opStructEscapedFieldAnonymousHeadIntPtr: + p := load(ctxptr, code.idx) + if p == 0 { + code = code.end.next + break + } + b = append(b, code.escapedKey...) + p = e.ptrToPtr(p) + if p == 0 { + b = encodeNull(b) + } else { + b = appendInt(b, int64(e.ptrToInt(p+code.offset))) + } + b = encodeComma(b) + code = code.next + case opStructEscapedFieldPtrAnonymousHeadIntPtrOnly: + p := load(ctxptr, code.idx) + if p == 0 { + code = code.end.next + break + } + store(ctxptr, code.idx, e.ptrToPtr(p)) + fallthrough + case opStructEscapedFieldAnonymousHeadIntPtrOnly: + p := load(ctxptr, code.idx) + b = append(b, code.escapedKey...) + if p == 0 { + b = encodeNull(b) + } else { + b = appendInt(b, int64(e.ptrToInt(p+code.offset))) + } + b = encodeComma(b) + code = code.next + case opStructEscapedFieldPtrHeadInt8: + store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) + fallthrough + case opStructEscapedFieldHeadInt8: + ptr := load(ctxptr, code.idx) + if ptr == 0 { + b = encodeNull(b) + b = encodeComma(b) + code = code.end.next + } else { + b = append(b, '{') + b = append(b, code.escapedKey...) + b = appendInt(b, int64(e.ptrToInt8(ptr+code.offset))) + b = encodeComma(b) + code = code.next + } + case opStructEscapedFieldPtrHeadInt8Only, opStructEscapedFieldHeadInt8Only: + p := load(ctxptr, code.idx) + b = append(b, '{') + b = append(b, code.escapedKey...) + b = appendInt(b, int64(e.ptrToInt8(p))) + b = encodeComma(b) + code = code.next + case opStructEscapedFieldPtrHeadInt8Ptr: + store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) + fallthrough + case opStructEscapedFieldHeadInt8Ptr: + p := load(ctxptr, code.idx) + if p == 0 { + b = encodeNull(b) + b = encodeComma(b) + code = code.end.next + break + } else { + b = append(b, '{') + b = append(b, code.escapedKey...) + p = e.ptrToPtr(p) + if p == 0 { + b = encodeNull(b) + } else { + b = appendInt(b, int64(e.ptrToInt8(p+code.offset))) + } + } + b = encodeComma(b) + code = code.next + case opStructEscapedFieldPtrHeadInt8PtrOnly: + p := load(ctxptr, code.idx) + if p == 0 { + b = encodeNull(b) + b = encodeComma(b) + code = code.end.next + break + } + store(ctxptr, code.idx, e.ptrToPtr(p)) + fallthrough + case opStructEscapedFieldHeadInt8PtrOnly: + p := load(ctxptr, code.idx) + b = append(b, '{') + b = append(b, code.escapedKey...) + if p == 0 { + b = encodeNull(b) + } else { + b = appendInt(b, int64(e.ptrToInt8(p+code.offset))) + } + b = encodeComma(b) + code = code.next + case opStructEscapedFieldPtrAnonymousHeadInt8: + store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) + fallthrough + case opStructEscapedFieldAnonymousHeadInt8: + ptr := load(ctxptr, code.idx) + if ptr == 0 { + code = code.end.next + } else { + b = append(b, code.escapedKey...) + b = appendInt(b, int64(e.ptrToInt8(ptr+code.offset))) + b = encodeComma(b) + code = code.next + } + case opStructEscapedFieldPtrAnonymousHeadInt8Only, opStructEscapedFieldAnonymousHeadInt8Only: + ptr := load(ctxptr, code.idx) + if ptr == 0 { + code = code.end.next + } else { + b = append(b, code.escapedKey...) + b = appendInt(b, int64(e.ptrToInt8(ptr+code.offset))) + b = encodeComma(b) + code = code.next + } + case opStructEscapedFieldPtrAnonymousHeadInt8Ptr: + store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) + fallthrough + case opStructEscapedFieldAnonymousHeadInt8Ptr: + p := load(ctxptr, code.idx) + if p == 0 { + code = code.end.next + break + } + b = append(b, code.escapedKey...) + p = e.ptrToPtr(p) + if p == 0 { + b = encodeNull(b) + } else { + b = appendInt(b, int64(e.ptrToInt8(p+code.offset))) + } + b = encodeComma(b) + code = code.next + case opStructEscapedFieldPtrAnonymousHeadInt8PtrOnly: + p := load(ctxptr, code.idx) + if p == 0 { + code = code.end.next + break + } + store(ctxptr, code.idx, e.ptrToPtr(p)) + fallthrough + case opStructEscapedFieldAnonymousHeadInt8PtrOnly: + p := load(ctxptr, code.idx) + b = append(b, code.escapedKey...) + if p == 0 { + b = encodeNull(b) + } else { + b = appendInt(b, int64(e.ptrToInt8(p+code.offset))) + } + b = encodeComma(b) + code = code.next + case opStructEscapedFieldPtrHeadInt16: + store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) + fallthrough + case opStructEscapedFieldHeadInt16: + ptr := load(ctxptr, code.idx) + if ptr == 0 { + b = encodeNull(b) + b = encodeComma(b) + code = code.end.next + } else { + b = append(b, '{') + b = append(b, code.escapedKey...) + b = appendInt(b, int64(e.ptrToInt16(ptr+code.offset))) + b = encodeComma(b) + code = code.next + } + case opStructEscapedFieldPtrHeadInt16Only, opStructEscapedFieldHeadInt16Only: + p := load(ctxptr, code.idx) + b = append(b, '{') + b = append(b, code.escapedKey...) + b = appendInt(b, int64(e.ptrToInt16(p))) + b = encodeComma(b) + code = code.next + case opStructEscapedFieldPtrHeadInt16Ptr: + store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) + fallthrough + case opStructEscapedFieldHeadInt16Ptr: + p := load(ctxptr, code.idx) + if p == 0 { + b = encodeNull(b) + b = encodeComma(b) + code = code.end.next + break + } else { + b = append(b, '{') + b = append(b, code.escapedKey...) + p = e.ptrToPtr(p) + if p == 0 { + b = encodeNull(b) + } else { + b = appendInt(b, int64(e.ptrToInt16(p+code.offset))) + } + } + b = encodeComma(b) + code = code.next + case opStructEscapedFieldPtrHeadInt16PtrOnly: + p := load(ctxptr, code.idx) + if p == 0 { + b = encodeNull(b) + b = encodeComma(b) + code = code.end.next + break + } + store(ctxptr, code.idx, e.ptrToPtr(p)) + fallthrough + case opStructEscapedFieldHeadInt16PtrOnly: + p := load(ctxptr, code.idx) + b = append(b, '{') + b = append(b, code.escapedKey...) + if p == 0 { + b = encodeNull(b) + } else { + b = appendInt(b, int64(e.ptrToInt16(p+code.offset))) + } + b = encodeComma(b) + code = code.next + case opStructEscapedFieldPtrAnonymousHeadInt16: + store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) + fallthrough + case opStructEscapedFieldAnonymousHeadInt16: + ptr := load(ctxptr, code.idx) + if ptr == 0 { + code = code.end.next + } else { + b = append(b, code.escapedKey...) + b = appendInt(b, int64(e.ptrToInt16(ptr+code.offset))) + b = encodeComma(b) + code = code.next + } + case opStructEscapedFieldPtrAnonymousHeadInt16Only, opStructEscapedFieldAnonymousHeadInt16Only: + ptr := load(ctxptr, code.idx) + if ptr == 0 { + code = code.end.next + } else { + b = append(b, code.escapedKey...) + b = appendInt(b, int64(e.ptrToInt16(ptr+code.offset))) + b = encodeComma(b) + code = code.next + } + case opStructEscapedFieldPtrAnonymousHeadInt16Ptr: + store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) + fallthrough + case opStructEscapedFieldAnonymousHeadInt16Ptr: + p := load(ctxptr, code.idx) + if p == 0 { + code = code.end.next + break + } + b = append(b, code.escapedKey...) + p = e.ptrToPtr(p) + if p == 0 { + b = encodeNull(b) + } else { + b = appendInt(b, int64(e.ptrToInt16(p+code.offset))) + } + b = encodeComma(b) + code = code.next + case opStructEscapedFieldPtrAnonymousHeadInt16PtrOnly: + p := load(ctxptr, code.idx) + if p == 0 { + code = code.end.next + break + } + store(ctxptr, code.idx, e.ptrToPtr(p)) + fallthrough + case opStructEscapedFieldAnonymousHeadInt16PtrOnly: + p := load(ctxptr, code.idx) + b = append(b, code.escapedKey...) + if p == 0 { + b = encodeNull(b) + } else { + b = appendInt(b, int64(e.ptrToInt16(p+code.offset))) + } + b = encodeComma(b) + code = code.next + case opStructEscapedFieldPtrHeadInt32: + store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) + fallthrough + case opStructEscapedFieldHeadInt32: + ptr := load(ctxptr, code.idx) + if ptr == 0 { + b = encodeNull(b) + b = encodeComma(b) + code = code.end.next + } else { + b = append(b, '{') + b = append(b, code.escapedKey...) + b = appendInt(b, int64(e.ptrToInt32(ptr+code.offset))) + b = encodeComma(b) + code = code.next + } + case opStructEscapedFieldPtrHeadInt32Only, opStructEscapedFieldHeadInt32Only: + p := load(ctxptr, code.idx) + b = append(b, '{') + b = append(b, code.escapedKey...) + b = appendInt(b, int64(e.ptrToInt32(p))) + b = encodeComma(b) + code = code.next + case opStructEscapedFieldPtrHeadInt32Ptr: + store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) + fallthrough + case opStructEscapedFieldHeadInt32Ptr: + p := load(ctxptr, code.idx) + if p == 0 { + b = encodeNull(b) + b = encodeComma(b) + code = code.end.next + break + } else { + b = append(b, '{') + b = append(b, code.escapedKey...) + p = e.ptrToPtr(p) + if p == 0 { + b = encodeNull(b) + } else { + b = appendInt(b, int64(e.ptrToInt32(p+code.offset))) + } + } + b = encodeComma(b) + code = code.next + case opStructEscapedFieldPtrHeadInt32PtrOnly: + p := load(ctxptr, code.idx) + if p == 0 { + b = encodeNull(b) + b = encodeComma(b) + code = code.end.next + break + } + store(ctxptr, code.idx, e.ptrToPtr(p)) + fallthrough + case opStructEscapedFieldHeadInt32PtrOnly: + p := load(ctxptr, code.idx) + b = append(b, '{') + b = append(b, code.escapedKey...) + if p == 0 { + b = encodeNull(b) + } else { + b = appendInt(b, int64(e.ptrToInt32(p+code.offset))) + } + b = encodeComma(b) + code = code.next + case opStructEscapedFieldPtrAnonymousHeadInt32: + store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) + fallthrough + case opStructEscapedFieldAnonymousHeadInt32: + ptr := load(ctxptr, code.idx) + if ptr == 0 { + code = code.end.next + } else { + b = append(b, code.escapedKey...) + b = appendInt(b, int64(e.ptrToInt32(ptr+code.offset))) + b = encodeComma(b) + code = code.next + } + case opStructEscapedFieldPtrAnonymousHeadInt32Only, opStructEscapedFieldAnonymousHeadInt32Only: + ptr := load(ctxptr, code.idx) + if ptr == 0 { + code = code.end.next + } else { + b = append(b, code.escapedKey...) + b = appendInt(b, int64(e.ptrToInt32(ptr+code.offset))) + b = encodeComma(b) + code = code.next + } + case opStructEscapedFieldPtrAnonymousHeadInt32Ptr: + store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) + fallthrough + case opStructEscapedFieldAnonymousHeadInt32Ptr: + p := load(ctxptr, code.idx) + if p == 0 { + code = code.end.next + break + } + b = append(b, code.escapedKey...) + p = e.ptrToPtr(p) + if p == 0 { + b = encodeNull(b) + } else { + b = appendInt(b, int64(e.ptrToInt32(p+code.offset))) + } + b = encodeComma(b) + code = code.next + case opStructEscapedFieldPtrAnonymousHeadInt32PtrOnly: + p := load(ctxptr, code.idx) + if p == 0 { + code = code.end.next + break + } + store(ctxptr, code.idx, e.ptrToPtr(p)) + fallthrough + case opStructEscapedFieldAnonymousHeadInt32PtrOnly: + p := load(ctxptr, code.idx) + b = append(b, code.escapedKey...) + if p == 0 { + b = encodeNull(b) + } else { + b = appendInt(b, int64(e.ptrToInt32(p+code.offset))) + } + b = encodeComma(b) + code = code.next + case opStructEscapedFieldPtrHeadInt64: + store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) + fallthrough + case opStructEscapedFieldHeadInt64: + ptr := load(ctxptr, code.idx) + if ptr == 0 { + b = encodeNull(b) + b = encodeComma(b) + code = code.end.next + } else { + b = append(b, '{') + b = append(b, code.escapedKey...) + b = appendInt(b, e.ptrToInt64(ptr+code.offset)) + b = encodeComma(b) + code = code.next + } + case opStructEscapedFieldPtrHeadInt64Only, opStructEscapedFieldHeadInt64Only: + p := load(ctxptr, code.idx) + b = append(b, '{') + b = append(b, code.escapedKey...) + b = appendInt(b, e.ptrToInt64(p)) + b = encodeComma(b) + code = code.next + case opStructEscapedFieldPtrHeadInt64Ptr: + store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) + fallthrough + case opStructEscapedFieldHeadInt64Ptr: + p := load(ctxptr, code.idx) + if p == 0 { + b = encodeNull(b) + b = encodeComma(b) + code = code.end.next + break + } else { + b = append(b, '{') + b = append(b, code.escapedKey...) + p = e.ptrToPtr(p) + if p == 0 { + b = encodeNull(b) + } else { + b = appendInt(b, e.ptrToInt64(p+code.offset)) + } + } + b = encodeComma(b) + code = code.next + case opStructEscapedFieldPtrHeadInt64PtrOnly: + p := load(ctxptr, code.idx) + if p == 0 { + b = encodeNull(b) + b = encodeComma(b) + code = code.end.next + break + } + store(ctxptr, code.idx, e.ptrToPtr(p)) + fallthrough + case opStructEscapedFieldHeadInt64PtrOnly: + p := load(ctxptr, code.idx) + b = append(b, '{') + b = append(b, code.escapedKey...) + if p == 0 { + b = encodeNull(b) + } else { + b = appendInt(b, e.ptrToInt64(p+code.offset)) + } + b = encodeComma(b) + code = code.next + case opStructEscapedFieldPtrAnonymousHeadInt64: + store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) + fallthrough + case opStructEscapedFieldAnonymousHeadInt64: + ptr := load(ctxptr, code.idx) + if ptr == 0 { + code = code.end.next + } else { + b = append(b, code.escapedKey...) + b = appendInt(b, e.ptrToInt64(ptr+code.offset)) + b = encodeComma(b) + code = code.next + } + case opStructEscapedFieldPtrAnonymousHeadInt64Only, opStructEscapedFieldAnonymousHeadInt64Only: + ptr := load(ctxptr, code.idx) + if ptr == 0 { + code = code.end.next + } else { + b = append(b, code.escapedKey...) + b = appendInt(b, e.ptrToInt64(ptr+code.offset)) + b = encodeComma(b) + code = code.next + } + case opStructEscapedFieldPtrAnonymousHeadInt64Ptr: + store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) + fallthrough + case opStructEscapedFieldAnonymousHeadInt64Ptr: + p := load(ctxptr, code.idx) + if p == 0 { + code = code.end.next + break + } + b = append(b, code.escapedKey...) + p = e.ptrToPtr(p) + if p == 0 { + b = encodeNull(b) + } else { + b = appendInt(b, e.ptrToInt64(p+code.offset)) + } + b = encodeComma(b) + code = code.next + case opStructEscapedFieldPtrAnonymousHeadInt64PtrOnly: + p := load(ctxptr, code.idx) + if p == 0 { + code = code.end.next + break + } + store(ctxptr, code.idx, e.ptrToPtr(p)) + fallthrough + case opStructEscapedFieldAnonymousHeadInt64PtrOnly: + p := load(ctxptr, code.idx) + b = append(b, code.escapedKey...) + if p == 0 { + b = encodeNull(b) + } else { + b = appendInt(b, e.ptrToInt64(p+code.offset)) + } + b = encodeComma(b) + code = code.next + case opStructEscapedFieldPtrHeadUint: + store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) + fallthrough + case opStructEscapedFieldHeadUint: + ptr := load(ctxptr, code.idx) + if ptr == 0 { + b = encodeNull(b) + b = encodeComma(b) + code = code.end.next + } else { + b = append(b, '{') + b = append(b, code.escapedKey...) + b = appendUint(b, uint64(e.ptrToUint(ptr+code.offset))) + b = encodeComma(b) + code = code.next + } + case opStructEscapedFieldPtrHeadUintOnly, opStructEscapedFieldHeadUintOnly: + p := load(ctxptr, code.idx) + b = append(b, '{') + b = append(b, code.escapedKey...) + b = appendUint(b, uint64(e.ptrToUint(p))) + b = encodeComma(b) + code = code.next + case opStructEscapedFieldPtrHeadUintPtr: + store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) + fallthrough + case opStructEscapedFieldHeadUintPtr: + p := load(ctxptr, code.idx) + if p == 0 { + b = encodeNull(b) + b = encodeComma(b) + code = code.end.next + break + } else { + b = append(b, '{') + b = append(b, code.escapedKey...) + p = e.ptrToPtr(p) + if p == 0 { + b = encodeNull(b) + } else { + b = appendUint(b, uint64(e.ptrToUint(p+code.offset))) + } + } + b = encodeComma(b) + code = code.next + case opStructEscapedFieldPtrHeadUintPtrOnly: + p := load(ctxptr, code.idx) + if p == 0 { + b = encodeNull(b) + b = encodeComma(b) + code = code.end.next + break + } + store(ctxptr, code.idx, e.ptrToPtr(p)) + fallthrough + case opStructEscapedFieldHeadUintPtrOnly: + p := load(ctxptr, code.idx) + b = append(b, '{') + b = append(b, code.escapedKey...) + if p == 0 { + b = encodeNull(b) + } else { + b = appendUint(b, uint64(e.ptrToUint(p+code.offset))) + } + b = encodeComma(b) + code = code.next + case opStructEscapedFieldHeadUintNPtr: + p := load(ctxptr, code.idx) + if p == 0 { + b = encodeNull(b) + } else { + b = append(b, '{') + b = append(b, code.escapedKey...) + 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 = encodeComma(b) + code = code.next + case opStructEscapedFieldPtrAnonymousHeadUint: + store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) + fallthrough + case opStructEscapedFieldAnonymousHeadUint: + ptr := load(ctxptr, code.idx) + if ptr == 0 { + code = code.end.next + } else { + b = append(b, code.escapedKey...) + b = appendUint(b, uint64(e.ptrToUint(ptr+code.offset))) + b = encodeComma(b) + code = code.next + } + case opStructEscapedFieldPtrAnonymousHeadUintOnly, opStructEscapedFieldAnonymousHeadUintOnly: + ptr := load(ctxptr, code.idx) + if ptr == 0 { + code = code.end.next + } else { + b = append(b, code.escapedKey...) + b = appendUint(b, uint64(e.ptrToUint(ptr+code.offset))) + b = encodeComma(b) + code = code.next + } + case opStructEscapedFieldPtrAnonymousHeadUintPtr: + store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) + fallthrough + case opStructEscapedFieldAnonymousHeadUintPtr: + p := load(ctxptr, code.idx) + if p == 0 { + code = code.end.next + break + } + b = append(b, code.escapedKey...) + p = e.ptrToPtr(p) + if p == 0 { + b = encodeNull(b) + } else { + b = appendUint(b, uint64(e.ptrToUint(p+code.offset))) + } + b = encodeComma(b) + code = code.next + case opStructEscapedFieldPtrAnonymousHeadUintPtrOnly: + p := load(ctxptr, code.idx) + if p == 0 { + code = code.end.next + break + } + store(ctxptr, code.idx, e.ptrToPtr(p)) + fallthrough + case opStructEscapedFieldAnonymousHeadUintPtrOnly: + p := load(ctxptr, code.idx) + b = append(b, code.escapedKey...) + if p == 0 { + b = encodeNull(b) + } else { + b = appendUint(b, uint64(e.ptrToUint(p+code.offset))) + } + b = encodeComma(b) + code = code.next + case opStructEscapedFieldPtrHeadUint8: + store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) + fallthrough + case opStructEscapedFieldHeadUint8: + ptr := load(ctxptr, code.idx) + if ptr == 0 { + b = encodeNull(b) + b = encodeComma(b) + code = code.end.next + } else { + b = append(b, '{') + b = append(b, code.escapedKey...) + b = appendUint(b, uint64(e.ptrToUint8(ptr+code.offset))) + b = encodeComma(b) + code = code.next + } + case opStructEscapedFieldPtrHeadUint8Only, opStructEscapedFieldHeadUint8Only: + p := load(ctxptr, code.idx) + b = append(b, '{') + b = append(b, code.escapedKey...) + b = appendUint(b, uint64(e.ptrToUint8(p))) + b = encodeComma(b) + code = code.next + case opStructEscapedFieldPtrHeadUint8Ptr: + store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) + fallthrough + case opStructEscapedFieldHeadUint8Ptr: + p := load(ctxptr, code.idx) + if p == 0 { + b = encodeNull(b) + b = encodeComma(b) + code = code.end.next + break + } else { + b = append(b, '{') + b = append(b, code.escapedKey...) + p = e.ptrToPtr(p) + if p == 0 { + b = encodeNull(b) + } else { + b = appendUint(b, uint64(e.ptrToUint8(p+code.offset))) + } + } + b = encodeComma(b) + code = code.next + case opStructEscapedFieldPtrHeadUint8PtrOnly: + p := load(ctxptr, code.idx) + if p == 0 { + b = encodeNull(b) + b = encodeComma(b) + code = code.end.next + break + } + store(ctxptr, code.idx, e.ptrToPtr(p)) + fallthrough + case opStructEscapedFieldHeadUint8PtrOnly: + p := load(ctxptr, code.idx) + b = append(b, '{') + b = append(b, code.escapedKey...) + if p == 0 { + b = encodeNull(b) + } else { + b = appendUint(b, uint64(e.ptrToUint8(p+code.offset))) + } + b = encodeComma(b) + code = code.next + case opStructEscapedFieldPtrAnonymousHeadUint8: + store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) + fallthrough + case opStructEscapedFieldAnonymousHeadUint8: + ptr := load(ctxptr, code.idx) + if ptr == 0 { + code = code.end.next + } else { + b = append(b, code.escapedKey...) + b = appendUint(b, uint64(e.ptrToUint8(ptr+code.offset))) + b = encodeComma(b) + code = code.next + } + case opStructEscapedFieldPtrAnonymousHeadUint8Only, opStructEscapedFieldAnonymousHeadUint8Only: + ptr := load(ctxptr, code.idx) + if ptr == 0 { + code = code.end.next + } else { + b = append(b, code.escapedKey...) + b = appendUint(b, uint64(e.ptrToUint8(ptr+code.offset))) + b = encodeComma(b) + code = code.next + } + case opStructEscapedFieldPtrAnonymousHeadUint8Ptr: + store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) + fallthrough + case opStructEscapedFieldAnonymousHeadUint8Ptr: + p := load(ctxptr, code.idx) + if p == 0 { + code = code.end.next + break + } + b = append(b, code.escapedKey...) + p = e.ptrToPtr(p) + if p == 0 { + b = encodeNull(b) + } else { + b = appendUint(b, uint64(e.ptrToUint8(p+code.offset))) + } + b = encodeComma(b) + code = code.next + case opStructEscapedFieldPtrAnonymousHeadUint8PtrOnly: + p := load(ctxptr, code.idx) + if p == 0 { + code = code.end.next + break + } + store(ctxptr, code.idx, e.ptrToPtr(p)) + fallthrough + case opStructEscapedFieldAnonymousHeadUint8PtrOnly: + p := load(ctxptr, code.idx) + b = append(b, code.escapedKey...) + if p == 0 { + b = encodeNull(b) + } else { + b = appendUint(b, uint64(e.ptrToUint8(p+code.offset))) + } + b = encodeComma(b) + code = code.next + case opStructEscapedFieldPtrHeadUint16: + store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) + fallthrough + case opStructEscapedFieldHeadUint16: + ptr := load(ctxptr, code.idx) + if ptr == 0 { + b = encodeNull(b) + b = encodeComma(b) + code = code.end.next + } else { + b = append(b, '{') + b = append(b, code.escapedKey...) + b = appendUint(b, uint64(e.ptrToUint16(ptr+code.offset))) + b = encodeComma(b) + code = code.next + } + case opStructEscapedFieldPtrHeadUint16Only, opStructEscapedFieldHeadUint16Only: + p := load(ctxptr, code.idx) + b = append(b, '{') + b = append(b, code.escapedKey...) + b = appendUint(b, uint64(e.ptrToUint16(p))) + b = encodeComma(b) + code = code.next + case opStructEscapedFieldPtrHeadUint16Ptr: + store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) + fallthrough + case opStructEscapedFieldHeadUint16Ptr: + p := load(ctxptr, code.idx) + if p == 0 { + b = encodeNull(b) + b = encodeComma(b) + code = code.end.next + break + } else { + b = append(b, '{') + b = append(b, code.escapedKey...) + p = e.ptrToPtr(p) + if p == 0 { + b = encodeNull(b) + } else { + b = appendUint(b, uint64(e.ptrToUint16(p+code.offset))) + } + } + b = encodeComma(b) + code = code.next + case opStructEscapedFieldPtrHeadUint16PtrOnly: + p := load(ctxptr, code.idx) + if p == 0 { + b = encodeNull(b) + b = encodeComma(b) + code = code.end.next + break + } + store(ctxptr, code.idx, e.ptrToPtr(p)) + fallthrough + case opStructEscapedFieldHeadUint16PtrOnly: + p := load(ctxptr, code.idx) + b = append(b, '{') + b = append(b, code.escapedKey...) + if p == 0 { + b = encodeNull(b) + } else { + b = appendUint(b, uint64(e.ptrToUint16(p+code.offset))) + } + b = encodeComma(b) + code = code.next + case opStructEscapedFieldPtrAnonymousHeadUint16: + store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) + fallthrough + case opStructEscapedFieldAnonymousHeadUint16: + ptr := load(ctxptr, code.idx) + if ptr == 0 { + code = code.end.next + } else { + b = append(b, code.escapedKey...) + b = appendUint(b, uint64(e.ptrToUint16(ptr+code.offset))) + b = encodeComma(b) + code = code.next + } + case opStructEscapedFieldPtrAnonymousHeadUint16Only, opStructEscapedFieldAnonymousHeadUint16Only: + ptr := load(ctxptr, code.idx) + if ptr == 0 { + code = code.end.next + } else { + b = append(b, code.escapedKey...) + b = appendUint(b, uint64(e.ptrToUint16(ptr+code.offset))) + b = encodeComma(b) + code = code.next + } + case opStructEscapedFieldPtrAnonymousHeadUint16Ptr: + store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) + fallthrough + case opStructEscapedFieldAnonymousHeadUint16Ptr: + p := load(ctxptr, code.idx) + if p == 0 { + code = code.end.next + break + } + b = append(b, code.escapedKey...) + p = e.ptrToPtr(p) + if p == 0 { + b = encodeNull(b) + } else { + b = appendUint(b, uint64(e.ptrToUint16(p+code.offset))) + } + b = encodeComma(b) + code = code.next + case opStructEscapedFieldPtrAnonymousHeadUint16PtrOnly: + p := load(ctxptr, code.idx) + if p == 0 { + code = code.end.next + break + } + store(ctxptr, code.idx, e.ptrToPtr(p)) + fallthrough + case opStructEscapedFieldAnonymousHeadUint16PtrOnly: + p := load(ctxptr, code.idx) + b = append(b, code.escapedKey...) + if p == 0 { + b = encodeNull(b) + } else { + b = appendUint(b, uint64(e.ptrToUint16(p+code.offset))) + } + b = encodeComma(b) + code = code.next + case opStructEscapedFieldPtrHeadUint32: + store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) + fallthrough + case opStructEscapedFieldHeadUint32: + ptr := load(ctxptr, code.idx) + if ptr == 0 { + b = encodeNull(b) + b = encodeComma(b) + code = code.end.next + } else { + b = append(b, '{') + b = append(b, code.escapedKey...) + b = appendUint(b, uint64(e.ptrToUint32(ptr+code.offset))) + b = encodeComma(b) + code = code.next + } + case opStructEscapedFieldPtrHeadUint32Only, opStructEscapedFieldHeadUint32Only: + p := load(ctxptr, code.idx) + b = append(b, '{') + b = append(b, code.escapedKey...) + b = appendUint(b, uint64(e.ptrToUint32(p))) + b = encodeComma(b) + code = code.next + case opStructEscapedFieldPtrHeadUint32Ptr: + store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) + fallthrough + case opStructEscapedFieldHeadUint32Ptr: + p := load(ctxptr, code.idx) + if p == 0 { + b = encodeNull(b) + b = encodeComma(b) + code = code.end.next + break + } else { + b = append(b, '{') + b = append(b, code.escapedKey...) + p = e.ptrToPtr(p) + if p == 0 { + b = encodeNull(b) + } else { + b = appendUint(b, uint64(e.ptrToUint32(p+code.offset))) + } + } + b = encodeComma(b) + code = code.next + case opStructEscapedFieldPtrHeadUint32PtrOnly: + p := load(ctxptr, code.idx) + if p == 0 { + b = encodeNull(b) + b = encodeComma(b) + code = code.end.next + break + } + store(ctxptr, code.idx, e.ptrToPtr(p)) + fallthrough + case opStructEscapedFieldHeadUint32PtrOnly: + p := load(ctxptr, code.idx) + b = append(b, '{') + b = append(b, code.escapedKey...) + if p == 0 { + b = encodeNull(b) + } else { + b = appendUint(b, uint64(e.ptrToUint32(p+code.offset))) + } + b = encodeComma(b) + code = code.next + case opStructEscapedFieldPtrAnonymousHeadUint32: + store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) + fallthrough + case opStructEscapedFieldAnonymousHeadUint32: + ptr := load(ctxptr, code.idx) + if ptr == 0 { + code = code.end.next + } else { + b = append(b, code.escapedKey...) + b = appendUint(b, uint64(e.ptrToUint32(ptr+code.offset))) + b = encodeComma(b) + code = code.next + } + case opStructEscapedFieldPtrAnonymousHeadUint32Only, opStructEscapedFieldAnonymousHeadUint32Only: + ptr := load(ctxptr, code.idx) + if ptr == 0 { + code = code.end.next + } else { + b = append(b, code.escapedKey...) + b = appendUint(b, uint64(e.ptrToUint32(ptr+code.offset))) + b = encodeComma(b) + code = code.next + } + case opStructEscapedFieldPtrAnonymousHeadUint32Ptr: + store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) + fallthrough + case opStructEscapedFieldAnonymousHeadUint32Ptr: + p := load(ctxptr, code.idx) + if p == 0 { + code = code.end.next + break + } + b = append(b, code.escapedKey...) + p = e.ptrToPtr(p) + if p == 0 { + b = encodeNull(b) + } else { + b = appendUint(b, uint64(e.ptrToUint32(p+code.offset))) + } + b = encodeComma(b) + code = code.next + case opStructEscapedFieldPtrAnonymousHeadUint32PtrOnly: + p := load(ctxptr, code.idx) + if p == 0 { + code = code.end.next + break + } + store(ctxptr, code.idx, e.ptrToPtr(p)) + fallthrough + case opStructEscapedFieldAnonymousHeadUint32PtrOnly: + p := load(ctxptr, code.idx) + b = append(b, code.escapedKey...) + if p == 0 { + b = encodeNull(b) + } else { + b = appendUint(b, uint64(e.ptrToUint32(p+code.offset))) + } + b = encodeComma(b) + code = code.next + case opStructEscapedFieldPtrHeadUint64: + store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) + fallthrough + case opStructEscapedFieldHeadUint64: + ptr := load(ctxptr, code.idx) + if ptr == 0 { + b = encodeNull(b) + b = encodeComma(b) + code = code.end.next + } else { + b = append(b, '{') + b = append(b, code.escapedKey...) + b = appendUint(b, e.ptrToUint64(ptr+code.offset)) + b = encodeComma(b) + code = code.next + } + case opStructEscapedFieldPtrHeadUint64Only, opStructEscapedFieldHeadUint64Only: + p := load(ctxptr, code.idx) + b = append(b, '{') + b = append(b, code.escapedKey...) + b = appendUint(b, e.ptrToUint64(p)) + b = encodeComma(b) + code = code.next + case opStructEscapedFieldPtrHeadUint64Ptr: + store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) + fallthrough + case opStructEscapedFieldHeadUint64Ptr: + p := load(ctxptr, code.idx) + if p == 0 { + b = encodeNull(b) + b = encodeComma(b) + code = code.end.next + break + } else { + b = append(b, '{') + b = append(b, code.escapedKey...) + p = e.ptrToPtr(p) + if p == 0 { + b = encodeNull(b) + } else { + b = appendUint(b, e.ptrToUint64(p+code.offset)) + } + } + b = encodeComma(b) + code = code.next + case opStructEscapedFieldPtrHeadUint64PtrOnly: + p := load(ctxptr, code.idx) + if p == 0 { + b = encodeNull(b) + b = encodeComma(b) + code = code.end.next + break + } + store(ctxptr, code.idx, e.ptrToPtr(p)) + fallthrough + case opStructEscapedFieldHeadUint64PtrOnly: + p := load(ctxptr, code.idx) + b = append(b, '{') + b = append(b, code.escapedKey...) + if p == 0 { + b = encodeNull(b) + } else { + b = appendUint(b, e.ptrToUint64(p+code.offset)) + } + b = encodeComma(b) + code = code.next + case opStructEscapedFieldPtrAnonymousHeadUint64: + store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) + fallthrough + case opStructEscapedFieldAnonymousHeadUint64: + ptr := load(ctxptr, code.idx) + if ptr == 0 { + code = code.end.next + } else { + b = append(b, code.escapedKey...) + b = appendUint(b, e.ptrToUint64(ptr+code.offset)) + b = encodeComma(b) + code = code.next + } + case opStructEscapedFieldPtrAnonymousHeadUint64Only, opStructEscapedFieldAnonymousHeadUint64Only: + ptr := load(ctxptr, code.idx) + if ptr == 0 { + code = code.end.next + } else { + b = append(b, code.escapedKey...) + b = appendUint(b, e.ptrToUint64(ptr+code.offset)) + b = encodeComma(b) + code = code.next + } + case opStructEscapedFieldPtrAnonymousHeadUint64Ptr: + store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) + fallthrough + case opStructEscapedFieldAnonymousHeadUint64Ptr: + p := load(ctxptr, code.idx) + if p == 0 { + code = code.end.next + break + } + b = append(b, code.escapedKey...) + p = e.ptrToPtr(p) + if p == 0 { + b = encodeNull(b) + } else { + b = appendUint(b, e.ptrToUint64(p+code.offset)) + } + b = encodeComma(b) + code = code.next + case opStructEscapedFieldPtrAnonymousHeadUint64PtrOnly: + p := load(ctxptr, code.idx) + if p == 0 { + code = code.end.next + break + } + store(ctxptr, code.idx, e.ptrToPtr(p)) + fallthrough + case opStructEscapedFieldAnonymousHeadUint64PtrOnly: + p := load(ctxptr, code.idx) + b = append(b, code.escapedKey...) + if p == 0 { + b = encodeNull(b) + } else { + b = appendUint(b, e.ptrToUint64(p+code.offset)) + } + b = encodeComma(b) + code = code.next + case opStructEscapedFieldPtrHeadFloat32: + store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) + fallthrough + case opStructEscapedFieldHeadFloat32: + ptr := load(ctxptr, code.idx) + if ptr == 0 { + b = encodeNull(b) + b = encodeComma(b) + code = code.end.next + } else { + b = append(b, '{') + b = append(b, code.escapedKey...) + b = encodeFloat32(b, e.ptrToFloat32(ptr+code.offset)) + b = encodeComma(b) + code = code.next + } + case opStructEscapedFieldPtrHeadFloat32Only, opStructEscapedFieldHeadFloat32Only: + p := load(ctxptr, code.idx) + b = append(b, '{') + b = append(b, code.escapedKey...) + b = encodeFloat32(b, e.ptrToFloat32(p)) + b = encodeComma(b) + code = code.next + case opStructEscapedFieldPtrHeadFloat32Ptr: + store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) + fallthrough + case opStructEscapedFieldHeadFloat32Ptr: + p := load(ctxptr, code.idx) + if p == 0 { + b = encodeNull(b) + b = encodeComma(b) + code = code.end.next + break + } else { + b = append(b, '{') + b = append(b, code.escapedKey...) + p = e.ptrToPtr(p) + if p == 0 { + b = encodeNull(b) + } else { + b = encodeFloat32(b, e.ptrToFloat32(p+code.offset)) + } + } + b = encodeComma(b) + code = code.next + case opStructEscapedFieldPtrHeadFloat32PtrOnly: + p := load(ctxptr, code.idx) + if p == 0 { + b = encodeNull(b) + b = encodeComma(b) + code = code.end.next + break + } + store(ctxptr, code.idx, e.ptrToPtr(p)) + fallthrough + case opStructEscapedFieldHeadFloat32PtrOnly: + p := load(ctxptr, code.idx) + b = append(b, '{') + b = append(b, code.escapedKey...) + if p == 0 { + b = encodeNull(b) + } else { + b = encodeFloat32(b, e.ptrToFloat32(p+code.offset)) + } + b = encodeComma(b) + code = code.next + case opStructEscapedFieldPtrAnonymousHeadFloat32: + store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) + fallthrough + case opStructEscapedFieldAnonymousHeadFloat32: + ptr := load(ctxptr, code.idx) + if ptr == 0 { + code = code.end.next + } else { + b = append(b, code.escapedKey...) + b = encodeFloat32(b, e.ptrToFloat32(ptr+code.offset)) + b = encodeComma(b) + code = code.next + } + case opStructEscapedFieldPtrAnonymousHeadFloat32Only, opStructEscapedFieldAnonymousHeadFloat32Only: + ptr := load(ctxptr, code.idx) + if ptr == 0 { + code = code.end.next + } else { + b = append(b, code.escapedKey...) + b = encodeFloat32(b, e.ptrToFloat32(ptr+code.offset)) + b = encodeComma(b) + code = code.next + } + case opStructEscapedFieldPtrAnonymousHeadFloat32Ptr: + store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) + fallthrough + case opStructEscapedFieldAnonymousHeadFloat32Ptr: + p := load(ctxptr, code.idx) + if p == 0 { + code = code.end.next + break + } + b = append(b, code.escapedKey...) + p = e.ptrToPtr(p) + if p == 0 { + b = encodeNull(b) + } else { + b = encodeFloat32(b, e.ptrToFloat32(p+code.offset)) + } + b = encodeComma(b) + code = code.next + case opStructEscapedFieldPtrAnonymousHeadFloat32PtrOnly: + p := load(ctxptr, code.idx) + if p == 0 { + code = code.end.next + break + } + store(ctxptr, code.idx, e.ptrToPtr(p)) + fallthrough + case opStructEscapedFieldAnonymousHeadFloat32PtrOnly: + p := load(ctxptr, code.idx) + b = append(b, code.escapedKey...) + if p == 0 { + b = encodeNull(b) + } else { + b = encodeFloat32(b, e.ptrToFloat32(p+code.offset)) + } + b = encodeComma(b) + code = code.next + case opStructEscapedFieldPtrHeadFloat64: + store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) + fallthrough + case opStructEscapedFieldHeadFloat64: + ptr := load(ctxptr, code.idx) + if ptr == 0 { + b = encodeNull(b) + b = encodeComma(b) + code = code.end.next + } else { + v := e.ptrToFloat64(ptr + code.offset) + if math.IsInf(v, 0) || math.IsNaN(v) { + return nil, errUnsupportedFloat(v) + } + b = append(b, '{') + b = append(b, code.escapedKey...) + b = encodeFloat64(b, v) + b = encodeComma(b) + code = code.next + } + case opStructEscapedFieldPtrHeadFloat64Only, opStructEscapedFieldHeadFloat64Only: + p := load(ctxptr, code.idx) + b = append(b, '{') + b = append(b, code.escapedKey...) + v := e.ptrToFloat64(p) + if math.IsInf(v, 0) || math.IsNaN(v) { + return nil, errUnsupportedFloat(v) + } + b = encodeFloat64(b, v) + b = encodeComma(b) + code = code.next + case opStructEscapedFieldPtrHeadFloat64Ptr: + store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) + fallthrough + case opStructEscapedFieldHeadFloat64Ptr: + p := load(ctxptr, code.idx) + if p == 0 { + b = encodeNull(b) + b = encodeComma(b) + code = code.end.next + break + } else { + b = append(b, '{') + b = append(b, code.escapedKey...) + p = e.ptrToPtr(p) + if p == 0 { + b = encodeNull(b) + } else { + v := e.ptrToFloat64(p + code.offset) + if math.IsInf(v, 0) || math.IsNaN(v) { + return nil, errUnsupportedFloat(v) + } + b = encodeFloat64(b, v) + } + } + b = encodeComma(b) + code = code.next + case opStructEscapedFieldPtrHeadFloat64PtrOnly: + p := load(ctxptr, code.idx) + if p == 0 { + b = encodeNull(b) + b = encodeComma(b) + code = code.end.next + break + } + store(ctxptr, code.idx, e.ptrToPtr(p)) + fallthrough + case opStructEscapedFieldHeadFloat64PtrOnly: + p := load(ctxptr, code.idx) + b = append(b, '{') + b = append(b, code.escapedKey...) + if p == 0 { + b = encodeNull(b) + } else { + v := e.ptrToFloat64(p + code.offset) + if math.IsInf(v, 0) || math.IsNaN(v) { + return nil, errUnsupportedFloat(v) + } + b = encodeFloat64(b, v) + } + b = encodeComma(b) + code = code.next + case opStructEscapedFieldPtrAnonymousHeadFloat64: + store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) + fallthrough + case opStructEscapedFieldAnonymousHeadFloat64: + ptr := load(ctxptr, code.idx) + if ptr == 0 { + code = code.end.next + } else { + v := e.ptrToFloat64(ptr + code.offset) + if math.IsInf(v, 0) || math.IsNaN(v) { + return nil, errUnsupportedFloat(v) + } + b = append(b, code.escapedKey...) + b = encodeFloat64(b, v) + b = encodeComma(b) + code = code.next + } + case opStructEscapedFieldPtrAnonymousHeadFloat64Only, opStructEscapedFieldAnonymousHeadFloat64Only: + ptr := load(ctxptr, code.idx) + if ptr == 0 { + code = code.end.next + } else { + b = append(b, code.escapedKey...) + v := e.ptrToFloat64(ptr + code.offset) + if math.IsInf(v, 0) || math.IsNaN(v) { + return nil, errUnsupportedFloat(v) + } + b = encodeFloat64(b, v) + b = encodeComma(b) + code = code.next + } + case opStructEscapedFieldPtrAnonymousHeadFloat64Ptr: + store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) + fallthrough + case opStructEscapedFieldAnonymousHeadFloat64Ptr: + p := load(ctxptr, code.idx) + if p == 0 { + code = code.end.next + break + } + b = append(b, code.escapedKey...) + p = e.ptrToPtr(p) + if p == 0 { + b = encodeNull(b) + } else { + v := e.ptrToFloat64(p + code.offset) + if math.IsInf(v, 0) || math.IsNaN(v) { + return nil, errUnsupportedFloat(v) + } + b = encodeFloat64(b, v) + } + b = encodeComma(b) + code = code.next + case opStructEscapedFieldPtrAnonymousHeadFloat64PtrOnly: + p := load(ctxptr, code.idx) + if p == 0 { + code = code.end.next + break + } + store(ctxptr, code.idx, e.ptrToPtr(p)) + fallthrough + case opStructEscapedFieldAnonymousHeadFloat64PtrOnly: + p := load(ctxptr, code.idx) + b = append(b, code.escapedKey...) + if p == 0 { + b = encodeNull(b) + } else { + v := e.ptrToFloat64(p + code.offset) + if math.IsInf(v, 0) || math.IsNaN(v) { + return nil, errUnsupportedFloat(v) + } + b = encodeFloat64(b, v) + } + b = encodeComma(b) + code = code.next + case opStructEscapedFieldPtrHeadEscapedString: + p := load(ctxptr, code.idx) + if p == 0 { + b = encodeNull(b) + b = encodeComma(b) + code = code.end.next + break + } + store(ctxptr, code.idx, e.ptrToPtr(p)) + fallthrough + case opStructEscapedFieldHeadEscapedString: + ptr := load(ctxptr, code.idx) + if ptr == 0 { + b = encodeNull(b) + b = encodeComma(b) + code = code.end.next + } else { + b = append(b, '{') + b = append(b, code.escapedKey...) + b = encodeEscapedString(b, e.ptrToString(ptr+code.offset)) + b = encodeComma(b) + code = code.next + } + case opStructEscapedFieldPtrHeadEscapedStringOnly, opStructEscapedFieldHeadEscapedStringOnly: + p := load(ctxptr, code.idx) + b = append(b, '{') + b = append(b, code.escapedKey...) + b = encodeEscapedString(b, e.ptrToString(p+code.offset)) + b = encodeComma(b) + code = code.next + case opStructEscapedFieldPtrHeadEscapedStringPtr: + store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) + fallthrough + case opStructEscapedFieldHeadEscapedStringPtr: + p := load(ctxptr, code.idx) + if p == 0 { + b = encodeNull(b) + b = encodeComma(b) + code = code.end.next + break + } else { + b = append(b, '{') + b = append(b, code.escapedKey...) + p = e.ptrToPtr(p) + if p == 0 { + b = encodeNull(b) + } else { + b = encodeEscapedString(b, e.ptrToString(p+code.offset)) + } + } + b = encodeComma(b) + code = code.next + case opStructEscapedFieldPtrHeadEscapedStringPtrOnly: + p := load(ctxptr, code.idx) + if p == 0 { + b = encodeNull(b) + b = encodeComma(b) + code = code.end.next + break + } + store(ctxptr, code.idx, e.ptrToPtr(p)) + fallthrough + case opStructEscapedFieldHeadEscapedStringPtrOnly: + p := load(ctxptr, code.idx) + b = append(b, '{') + b = append(b, code.escapedKey...) + if p == 0 { + b = encodeNull(b) + } else { + b = encodeEscapedString(b, e.ptrToString(p+code.offset)) + } + b = encodeComma(b) + code = code.next + case opStructEscapedFieldPtrAnonymousHeadEscapedString: + store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) + fallthrough + case opStructEscapedFieldAnonymousHeadEscapedString: + ptr := load(ctxptr, code.idx) + if ptr == 0 { + code = code.end.next + } else { + b = append(b, code.escapedKey...) + b = encodeEscapedString(b, e.ptrToString(ptr+code.offset)) + b = encodeComma(b) + code = code.next + } + case opStructEscapedFieldPtrAnonymousHeadEscapedStringOnly, opStructEscapedFieldAnonymousHeadEscapedStringOnly: + ptr := load(ctxptr, code.idx) + if ptr == 0 { + code = code.end.next + } else { + b = append(b, code.escapedKey...) + b = encodeEscapedString(b, e.ptrToString(ptr+code.offset)) + b = encodeComma(b) + code = code.next + } + case opStructEscapedFieldPtrAnonymousHeadEscapedStringPtr: + store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) + fallthrough + case opStructEscapedFieldAnonymousHeadEscapedStringPtr: + p := load(ctxptr, code.idx) + if p == 0 { + code = code.end.next + break + } + b = append(b, code.escapedKey...) + p = e.ptrToPtr(p) + if p == 0 { + b = encodeNull(b) + } else { + b = encodeEscapedString(b, e.ptrToString(p+code.offset)) + } + b = encodeComma(b) + code = code.next + case opStructEscapedFieldPtrAnonymousHeadEscapedStringPtrOnly: + p := load(ctxptr, code.idx) + if p == 0 { + code = code.end.next + break + } + store(ctxptr, code.idx, e.ptrToPtr(p)) + fallthrough + case opStructEscapedFieldAnonymousHeadEscapedStringPtrOnly: + p := load(ctxptr, code.idx) + b = append(b, code.escapedKey...) + if p == 0 { + b = encodeNull(b) + } else { + b = encodeEscapedString(b, e.ptrToString(p+code.offset)) + } + b = encodeComma(b) + code = code.next + case opStructEscapedFieldPtrHeadBool: + p := load(ctxptr, code.idx) + if p == 0 { + b = encodeNull(b) + b = encodeComma(b) + code = code.end.next + break + } + store(ctxptr, code.idx, e.ptrToPtr(p)) + fallthrough + case opStructEscapedFieldHeadBool: + ptr := load(ctxptr, code.idx) + if ptr == 0 { + if code.op == opStructEscapedFieldPtrHeadBool { + b = encodeNull(b) + b = encodeComma(b) + } else { + b = append(b, '{', '}', ',') + } + code = code.end.next + } else { + b = append(b, '{') + b = append(b, code.escapedKey...) + b = encodeBool(b, e.ptrToBool(ptr+code.offset)) + b = encodeComma(b) + code = code.next + } + case opStructEscapedFieldPtrHeadBoolOnly: + p := load(ctxptr, code.idx) + if p == 0 { + b = encodeNull(b) + b = encodeComma(b) + code = code.end.next + break + } + fallthrough + case opStructEscapedFieldHeadBoolOnly: + ptr := load(ctxptr, code.idx) + b = append(b, '{') + b = append(b, code.key...) + b = encodeBool(b, e.ptrToBool(ptr+code.offset)) + b = encodeComma(b) + code = code.next + case opStructEscapedFieldPtrAnonymousHeadBool: + store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) + fallthrough + case opStructEscapedFieldAnonymousHeadBool: + ptr := load(ctxptr, code.idx) + if ptr == 0 { + code = code.end.next + } else { + b = append(b, code.escapedKey...) + b = encodeBool(b, e.ptrToBool(ptr+code.offset)) + b = encodeComma(b) + code = code.next + } + case opStructEscapedFieldPtrHeadBytes: + p := load(ctxptr, code.idx) + if p == 0 { + b = encodeNull(b) + b = encodeComma(b) + code = code.end.next + break + } + store(ctxptr, code.idx, e.ptrToPtr(p)) + fallthrough + case opStructEscapedFieldHeadBytes: + ptr := load(ctxptr, code.idx) + if ptr == 0 { + if code.op == opStructEscapedFieldPtrHeadBytes { + b = encodeNull(b) + b = encodeComma(b) + } else { + b = append(b, '{', '}', ',') + } + code = code.end.next + } else { + b = append(b, '{') + b = append(b, code.escapedKey...) + b = encodeByteSlice(b, e.ptrToBytes(ptr+code.offset)) + b = encodeComma(b) + code = code.next + } + case opStructEscapedFieldPtrAnonymousHeadBytes: + store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) + fallthrough + case opStructEscapedFieldAnonymousHeadBytes: + ptr := load(ctxptr, code.idx) + if ptr == 0 { + code = code.end.next + } else { + b = append(b, code.escapedKey...) + b = encodeByteSlice(b, e.ptrToBytes(ptr+code.offset)) + b = encodeComma(b) + code = code.next + } + case opStructEscapedFieldPtrHeadArray: + p := load(ctxptr, code.idx) + if p == 0 { + b = encodeNull(b) + b = encodeComma(b) + code = code.end.next + break + } + store(ctxptr, code.idx, e.ptrToPtr(p)) + fallthrough + case opStructEscapedFieldHeadArray: + ptr := load(ctxptr, code.idx) + code.offset + if ptr == 0 { + if code.op == opStructEscapedFieldPtrHeadArray { + b = encodeNull(b) + b = encodeComma(b) + } else { + b = append(b, '[', ']', ',') + } + code = code.end.next + } else { + b = append(b, '{') + if !code.anonymousKey { + b = append(b, code.escapedKey...) + } + code = code.next + store(ctxptr, code.idx, ptr) + } + case opStructEscapedFieldPtrAnonymousHeadArray: + store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) + fallthrough + case opStructEscapedFieldAnonymousHeadArray: + ptr := load(ctxptr, code.idx) + code.offset + if ptr == 0 { + code = code.end.next + } else { + b = append(b, code.escapedKey...) + store(ctxptr, code.idx, ptr) + code = code.next + } + case opStructEscapedFieldPtrHeadSlice: + p := load(ctxptr, code.idx) + if p == 0 { + b = encodeNull(b) + b = encodeComma(b) + code = code.end.next + break + } + store(ctxptr, code.idx, e.ptrToPtr(p)) + fallthrough + case opStructEscapedFieldHeadSlice: + ptr := load(ctxptr, code.idx) + p := ptr + code.offset + if p == 0 { + if code.op == opStructEscapedFieldPtrHeadSlice { + b = encodeNull(b) + b = encodeComma(b) + } else { + b = append(b, '[', ']', ',') + } + code = code.end.next + } else { + b = append(b, '{') + if !code.anonymousKey { + b = append(b, code.escapedKey...) + } + code = code.next + store(ctxptr, code.idx, p) + } + case opStructEscapedFieldPtrAnonymousHeadSlice: + store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) + fallthrough + case opStructEscapedFieldAnonymousHeadSlice: + ptr := load(ctxptr, code.idx) + p := ptr + code.offset + if p == 0 { + code = code.end.next + } else { + b = append(b, code.escapedKey...) + store(ctxptr, code.idx, p) + code = code.next + } + case opStructEscapedFieldPtrHeadMarshalJSON: + p := load(ctxptr, code.idx) + if p == 0 { + b = encodeNull(b) + b = encodeComma(b) + code = code.end.next + break + } + store(ctxptr, code.idx, e.ptrToPtr(p)) + fallthrough + case opStructEscapedFieldHeadMarshalJSON: + ptr := load(ctxptr, code.idx) + if ptr == 0 { + b = encodeNull(b) + b = encodeComma(b) + code = code.end.next + } else { + b = append(b, '{') + b = append(b, code.escapedKey...) + ptr += code.offset + v := e.ptrToInterface(code, ptr) + rv := reflect.ValueOf(v) + if rv.Type().Kind() == reflect.Interface && rv.IsNil() { + b = encodeNull(b) + code = code.end + break + } + bb, err := rv.Interface().(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 := compact(&buf, bb, e.enabledHTMLEscape); err != nil { + return nil, err + } + b = append(b, buf.Bytes()...) + b = encodeComma(b) + code = code.next + } + case opStructEscapedFieldPtrAnonymousHeadMarshalJSON: + store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) + fallthrough + case opStructEscapedFieldAnonymousHeadMarshalJSON: + ptr := load(ctxptr, code.idx) + if ptr == 0 { + code = code.end.next + } else { + b = append(b, code.escapedKey...) + ptr += code.offset + v := e.ptrToInterface(code, ptr) + rv := reflect.ValueOf(v) + if rv.Type().Kind() == reflect.Interface && rv.IsNil() { + b = encodeNull(b) + code = code.end.next + break + } + bb, err := rv.Interface().(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 := compact(&buf, bb, e.enabledHTMLEscape); err != nil { + return nil, err + } + b = append(b, buf.Bytes()...) + b = encodeComma(b) + code = code.next + } + case opStructEscapedFieldPtrHeadMarshalText: + p := load(ctxptr, code.idx) + if p == 0 { + b = encodeNull(b) + b = encodeComma(b) + code = code.end.next + break + } + store(ctxptr, code.idx, e.ptrToPtr(p)) + fallthrough + case opStructEscapedFieldHeadMarshalText: + ptr := load(ctxptr, code.idx) + if ptr == 0 { + b = encodeNull(b) + b = encodeComma(b) + code = code.end.next + } else { + b = append(b, '{') + b = append(b, code.escapedKey...) + ptr += code.offset + v := e.ptrToInterface(code, ptr) + rv := reflect.ValueOf(v) + if rv.Type().Kind() == reflect.Interface && rv.IsNil() { + b = encodeNull(b) + b = encodeComma(b) + code = code.end + break + } + bytes, err := rv.Interface().(encoding.TextMarshaler).MarshalText() + if err != nil { + return nil, errMarshaler(code, err) + } + b = encodeEscapedString(b, *(*string)(unsafe.Pointer(&bytes))) + b = encodeComma(b) + code = code.next + } + case opStructEscapedFieldPtrAnonymousHeadMarshalText: + store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) + fallthrough + case opStructEscapedFieldAnonymousHeadMarshalText: + ptr := load(ctxptr, code.idx) + if ptr == 0 { + code = code.end.next + } else { + b = append(b, code.escapedKey...) + ptr += code.offset + v := e.ptrToInterface(code, ptr) + rv := reflect.ValueOf(v) + if rv.Type().Kind() == reflect.Interface && rv.IsNil() { + b = encodeNull(b) + b = encodeComma(b) + code = code.end.next + break + } + bytes, err := rv.Interface().(encoding.TextMarshaler).MarshalText() + if err != nil { + return nil, errMarshaler(code, err) + } + b = encodeEscapedString(b, *(*string)(unsafe.Pointer(&bytes))) + b = encodeComma(b) + code = code.next + } + case opStructEscapedFieldPtrHeadOmitEmpty: + ptr := load(ctxptr, code.idx) + if ptr != 0 { + store(ctxptr, code.idx, e.ptrToPtr(ptr)) + } + fallthrough + case opStructEscapedFieldHeadOmitEmpty: + ptr := load(ctxptr, code.idx) + if ptr == 0 { + b = encodeNull(b) + b = encodeComma(b) + code = code.end.next + } else { + b = append(b, '{') + p := ptr + code.offset + if p == 0 || *(*uintptr)(*(*unsafe.Pointer)(unsafe.Pointer(&p))) == 0 { + code = code.nextField + } else { + b = append(b, code.escapedKey...) + code = code.next + store(ctxptr, code.idx, p) + } + } + case opStructEscapedFieldPtrAnonymousHeadOmitEmpty: + ptr := load(ctxptr, code.idx) + if ptr != 0 { + store(ctxptr, code.idx, e.ptrToPtr(ptr)) + } + fallthrough + case opStructEscapedFieldAnonymousHeadOmitEmpty: + ptr := load(ctxptr, code.idx) + if ptr == 0 { + code = code.end.next + } else { + p := ptr + code.offset + if p == 0 || *(*uintptr)(*(*unsafe.Pointer)(unsafe.Pointer(&p))) == 0 { + code = code.nextField + } else { + b = append(b, code.escapedKey...) + code = code.next + store(ctxptr, code.idx, p) + } + } + case opStructEscapedFieldPtrHeadOmitEmptyInt: + ptr := load(ctxptr, code.idx) + if ptr != 0 { + store(ctxptr, code.idx, e.ptrToPtr(ptr)) + } + fallthrough + case opStructEscapedFieldHeadOmitEmptyInt: + ptr := load(ctxptr, code.idx) + if ptr == 0 { + b = encodeNull(b) + b = encodeComma(b) + code = code.end.next + } else { + b = append(b, '{') + v := e.ptrToInt(ptr + code.offset) + if v == 0 { + code = code.nextField + } else { + b = append(b, code.escapedKey...) + b = appendInt(b, int64(v)) + b = encodeComma(b) + code = code.next + } + } + case opStructEscapedFieldPtrHeadOmitEmptyIntOnly: + p := load(ctxptr, code.idx) + if p == 0 { + b = encodeNull(b) + b = encodeComma(b) + code = code.end.next + break + } + fallthrough + case opStructEscapedFieldHeadOmitEmptyIntOnly: + ptr := load(ctxptr, code.idx) + b = append(b, '{') + v := e.ptrToInt(ptr + code.offset) + if v == 0 { + code = code.nextField + } else { + b = append(b, code.escapedKey...) + b = appendInt(b, int64(v)) + b = encodeComma(b) + code = code.next + } + case opStructEscapedFieldPtrAnonymousHeadOmitEmptyInt: + ptr := load(ctxptr, code.idx) + if ptr != 0 { + store(ctxptr, code.idx, e.ptrToPtr(ptr)) + } + fallthrough + case opStructEscapedFieldAnonymousHeadOmitEmptyInt: + ptr := load(ctxptr, code.idx) + if ptr == 0 { + code = code.end.next + } else { + v := e.ptrToInt(ptr + code.offset) + if v == 0 { + code = code.nextField + } else { + b = append(b, code.escapedKey...) + b = appendInt(b, int64(v)) + b = encodeComma(b) + code = code.next + } + } + case opStructEscapedFieldPtrHeadOmitEmptyInt8: + ptr := load(ctxptr, code.idx) + if ptr != 0 { + store(ctxptr, code.idx, e.ptrToPtr(ptr)) + } + fallthrough + case opStructEscapedFieldHeadOmitEmptyInt8: + ptr := load(ctxptr, code.idx) + if ptr == 0 { + b = encodeNull(b) + b = encodeComma(b) + code = code.end.next + } else { + b = append(b, '{') + v := e.ptrToInt8(ptr + code.offset) + if v == 0 { + code = code.nextField + } else { + b = append(b, code.escapedKey...) + b = appendInt(b, int64(v)) + b = encodeComma(b) + code = code.next + } + } + case opStructEscapedFieldPtrAnonymousHeadOmitEmptyInt8: + ptr := load(ctxptr, code.idx) + if ptr != 0 { + store(ctxptr, code.idx, e.ptrToPtr(ptr)) + } + fallthrough + case opStructEscapedFieldAnonymousHeadOmitEmptyInt8: + ptr := load(ctxptr, code.idx) + if ptr == 0 { + code = code.end.next + } else { + v := e.ptrToInt8(ptr + code.offset) + if v == 0 { + code = code.nextField + } else { + b = append(b, code.escapedKey...) + b = appendInt(b, int64(v)) + b = encodeComma(b) + code = code.next + } + } + case opStructEscapedFieldPtrHeadOmitEmptyInt16: + ptr := load(ctxptr, code.idx) + if ptr != 0 { + store(ctxptr, code.idx, e.ptrToPtr(ptr)) + } + fallthrough + case opStructEscapedFieldHeadOmitEmptyInt16: + ptr := load(ctxptr, code.idx) + if ptr == 0 { + b = encodeNull(b) + b = encodeComma(b) + code = code.end.next + } else { + b = append(b, '{') + v := e.ptrToInt16(ptr + code.offset) + if v == 0 { + code = code.nextField + } else { + b = append(b, code.escapedKey...) + b = appendInt(b, int64(v)) + b = encodeComma(b) + code = code.next + } + } + case opStructEscapedFieldPtrAnonymousHeadOmitEmptyInt16: + ptr := load(ctxptr, code.idx) + if ptr != 0 { + store(ctxptr, code.idx, e.ptrToPtr(ptr)) + } + fallthrough + case opStructEscapedFieldAnonymousHeadOmitEmptyInt16: + ptr := load(ctxptr, code.idx) + if ptr == 0 { + code = code.end.next + } else { + v := e.ptrToInt16(ptr + code.offset) + if v == 0 { + code = code.nextField + } else { + b = append(b, code.escapedKey...) + b = appendInt(b, int64(v)) + b = encodeComma(b) + code = code.next + } + } + case opStructEscapedFieldPtrHeadOmitEmptyInt32: + ptr := load(ctxptr, code.idx) + if ptr != 0 { + store(ctxptr, code.idx, e.ptrToPtr(ptr)) + } + fallthrough + case opStructEscapedFieldHeadOmitEmptyInt32: + ptr := load(ctxptr, code.idx) + if ptr == 0 { + b = encodeNull(b) + b = encodeComma(b) + code = code.end.next + } else { + b = append(b, '{') + v := e.ptrToInt32(ptr + code.offset) + if v == 0 { + code = code.nextField + } else { + b = append(b, code.escapedKey...) + b = appendInt(b, int64(v)) + b = encodeComma(b) + code = code.next + } + } + case opStructEscapedFieldPtrAnonymousHeadOmitEmptyInt32: + ptr := load(ctxptr, code.idx) + if ptr != 0 { + store(ctxptr, code.idx, e.ptrToPtr(ptr)) + } + fallthrough + case opStructEscapedFieldAnonymousHeadOmitEmptyInt32: + ptr := load(ctxptr, code.idx) + if ptr == 0 { + code = code.end.next + } else { + v := e.ptrToInt32(ptr + code.offset) + if v == 0 { + code = code.nextField + } else { + b = append(b, code.escapedKey...) + b = appendInt(b, int64(v)) + b = encodeComma(b) + code = code.next + } + } + case opStructEscapedFieldPtrHeadOmitEmptyInt64: + ptr := load(ctxptr, code.idx) + if ptr != 0 { + store(ctxptr, code.idx, e.ptrToPtr(ptr)) + } + fallthrough + case opStructEscapedFieldHeadOmitEmptyInt64: + ptr := load(ctxptr, code.idx) + if ptr == 0 { + b = encodeNull(b) + b = encodeComma(b) + code = code.end.next + } else { + b = append(b, '{') + v := e.ptrToInt64(ptr + code.offset) + if v == 0 { + code = code.nextField + } else { + b = append(b, code.escapedKey...) + b = appendInt(b, v) + b = encodeComma(b) + code = code.next + } + } + case opStructEscapedFieldPtrAnonymousHeadOmitEmptyInt64: + ptr := load(ctxptr, code.idx) + if ptr != 0 { + store(ctxptr, code.idx, e.ptrToPtr(ptr)) + } + fallthrough + case opStructEscapedFieldAnonymousHeadOmitEmptyInt64: + ptr := load(ctxptr, code.idx) + if ptr == 0 { + code = code.end.next + } else { + v := e.ptrToInt64(ptr + code.offset) + if v == 0 { + code = code.nextField + } else { + b = append(b, code.escapedKey...) + b = appendInt(b, v) + b = encodeComma(b) + code = code.next + } + } + case opStructEscapedFieldPtrHeadOmitEmptyUint: + ptr := load(ctxptr, code.idx) + if ptr != 0 { + store(ctxptr, code.idx, e.ptrToPtr(ptr)) + } + fallthrough + case opStructEscapedFieldHeadOmitEmptyUint: + ptr := load(ctxptr, code.idx) + if ptr == 0 { + b = encodeNull(b) + b = encodeComma(b) + code = code.end.next + } else { + b = append(b, '{') + v := e.ptrToUint(ptr + code.offset) + if v == 0 { + code = code.nextField + } else { + b = append(b, code.escapedKey...) + b = appendUint(b, uint64(v)) + b = encodeComma(b) + code = code.next + } + } + case opStructEscapedFieldPtrAnonymousHeadOmitEmptyUint: + ptr := load(ctxptr, code.idx) + if ptr != 0 { + store(ctxptr, code.idx, e.ptrToPtr(ptr)) + } + fallthrough + case opStructEscapedFieldAnonymousHeadOmitEmptyUint: + ptr := load(ctxptr, code.idx) + if ptr == 0 { + code = code.end.next + } else { + v := e.ptrToUint(ptr + code.offset) + if v == 0 { + code = code.nextField + } else { + b = append(b, code.escapedKey...) + b = appendUint(b, uint64(v)) + b = encodeComma(b) + code = code.next + } + } + case opStructEscapedFieldPtrHeadOmitEmptyUint8: + ptr := load(ctxptr, code.idx) + if ptr != 0 { + store(ctxptr, code.idx, e.ptrToPtr(ptr)) + } + fallthrough + case opStructEscapedFieldHeadOmitEmptyUint8: + ptr := load(ctxptr, code.idx) + if ptr == 0 { + b = encodeNull(b) + b = encodeComma(b) + code = code.end.next + } else { + b = append(b, '{') + v := e.ptrToUint8(ptr + code.offset) + if v == 0 { + code = code.nextField + } else { + b = append(b, code.escapedKey...) + b = appendUint(b, uint64(v)) + b = encodeComma(b) + code = code.next + } + } + case opStructEscapedFieldPtrAnonymousHeadOmitEmptyUint8: + ptr := load(ctxptr, code.idx) + if ptr != 0 { + store(ctxptr, code.idx, e.ptrToPtr(ptr)) + } + fallthrough + case opStructEscapedFieldAnonymousHeadOmitEmptyUint8: + ptr := load(ctxptr, code.idx) + if ptr == 0 { + code = code.end.next + } else { + v := e.ptrToUint8(ptr + code.offset) + if v == 0 { + code = code.nextField + } else { + b = append(b, code.escapedKey...) + b = appendUint(b, uint64(v)) + b = encodeComma(b) + code = code.next + } + } + case opStructEscapedFieldPtrHeadOmitEmptyUint16: + ptr := load(ctxptr, code.idx) + if ptr != 0 { + store(ctxptr, code.idx, e.ptrToPtr(ptr)) + } + fallthrough + case opStructEscapedFieldHeadOmitEmptyUint16: + ptr := load(ctxptr, code.idx) + if ptr == 0 { + b = encodeNull(b) + b = encodeComma(b) + code = code.end.next + } else { + b = append(b, '{') + v := e.ptrToUint16(ptr + code.offset) + if v == 0 { + code = code.nextField + } else { + b = append(b, code.escapedKey...) + b = appendUint(b, uint64(v)) + b = encodeComma(b) + code = code.next + } + } + case opStructEscapedFieldPtrAnonymousHeadOmitEmptyUint16: + ptr := load(ctxptr, code.idx) + if ptr != 0 { + store(ctxptr, code.idx, e.ptrToPtr(ptr)) + } + fallthrough + case opStructEscapedFieldAnonymousHeadOmitEmptyUint16: + ptr := load(ctxptr, code.idx) + if ptr == 0 { + code = code.end.next + } else { + v := e.ptrToUint16(ptr + code.offset) + if v == 0 { + code = code.nextField + } else { + b = append(b, code.escapedKey...) + b = appendUint(b, uint64(v)) + b = encodeComma(b) + code = code.next + } + } + case opStructEscapedFieldPtrHeadOmitEmptyUint32: + ptr := load(ctxptr, code.idx) + if ptr != 0 { + store(ctxptr, code.idx, e.ptrToPtr(ptr)) + } + fallthrough + case opStructEscapedFieldHeadOmitEmptyUint32: + ptr := load(ctxptr, code.idx) + if ptr == 0 { + b = encodeNull(b) + b = encodeComma(b) + code = code.end.next + } else { + b = append(b, '{') + v := e.ptrToUint32(ptr + code.offset) + if v == 0 { + code = code.nextField + } else { + b = append(b, code.escapedKey...) + b = appendUint(b, uint64(v)) + b = encodeComma(b) + code = code.next + } + } + case opStructEscapedFieldPtrAnonymousHeadOmitEmptyUint32: + ptr := load(ctxptr, code.idx) + if ptr != 0 { + store(ctxptr, code.idx, e.ptrToPtr(ptr)) + } + fallthrough + case opStructEscapedFieldAnonymousHeadOmitEmptyUint32: + ptr := load(ctxptr, code.idx) + if ptr == 0 { + code = code.end.next + } else { + v := e.ptrToUint32(ptr + code.offset) + if v == 0 { + code = code.nextField + } else { + b = append(b, code.escapedKey...) + b = appendUint(b, uint64(v)) + b = encodeComma(b) + code = code.next + } + } + case opStructEscapedFieldPtrHeadOmitEmptyUint64: + ptr := load(ctxptr, code.idx) + if ptr != 0 { + store(ctxptr, code.idx, e.ptrToPtr(ptr)) + } + fallthrough + case opStructEscapedFieldHeadOmitEmptyUint64: + ptr := load(ctxptr, code.idx) + if ptr == 0 { + b = encodeNull(b) + b = encodeComma(b) + code = code.end.next + } else { + b = append(b, '{') + v := e.ptrToUint64(ptr + code.offset) + if v == 0 { + code = code.nextField + } else { + b = append(b, code.escapedKey...) + b = appendUint(b, v) + b = encodeComma(b) + code = code.next + } + } + case opStructEscapedFieldPtrAnonymousHeadOmitEmptyUint64: + ptr := load(ctxptr, code.idx) + if ptr != 0 { + store(ctxptr, code.idx, e.ptrToPtr(ptr)) + } + fallthrough + case opStructEscapedFieldAnonymousHeadOmitEmptyUint64: + ptr := load(ctxptr, code.idx) + if ptr == 0 { + code = code.end.next + } else { + v := e.ptrToUint64(ptr + code.offset) + if v == 0 { + code = code.nextField + } else { + b = append(b, code.escapedKey...) + b = appendUint(b, v) + b = encodeComma(b) + code = code.next + } + } + case opStructEscapedFieldPtrHeadOmitEmptyFloat32: + ptr := load(ctxptr, code.idx) + if ptr != 0 { + store(ctxptr, code.idx, e.ptrToPtr(ptr)) + } + fallthrough + case opStructEscapedFieldHeadOmitEmptyFloat32: + ptr := load(ctxptr, code.idx) + if ptr == 0 { + b = encodeNull(b) + b = encodeComma(b) + code = code.end.next + } else { + b = append(b, '{') + v := e.ptrToFloat32(ptr + code.offset) + if v == 0 { + code = code.nextField + } else { + b = append(b, code.escapedKey...) + b = encodeFloat32(b, v) + b = encodeComma(b) + code = code.next + } + } + case opStructEscapedFieldPtrAnonymousHeadOmitEmptyFloat32: + ptr := load(ctxptr, code.idx) + if ptr != 0 { + store(ctxptr, code.idx, e.ptrToPtr(ptr)) + } + fallthrough + case opStructEscapedFieldAnonymousHeadOmitEmptyFloat32: + ptr := load(ctxptr, code.idx) + if ptr == 0 { + code = code.end.next + } else { + v := e.ptrToFloat32(ptr + code.offset) + if v == 0 { + code = code.nextField + } else { + b = append(b, code.escapedKey...) + b = encodeFloat32(b, v) + b = encodeComma(b) + code = code.next + } + } + case opStructEscapedFieldPtrHeadOmitEmptyFloat64: + ptr := load(ctxptr, code.idx) + if ptr != 0 { + store(ctxptr, code.idx, e.ptrToPtr(ptr)) + } + fallthrough + case opStructEscapedFieldHeadOmitEmptyFloat64: + ptr := load(ctxptr, code.idx) + if ptr == 0 { + b = encodeNull(b) + b = encodeComma(b) + code = code.end.next + } else { + b = append(b, '{') + 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 = append(b, code.escapedKey...) + b = encodeFloat64(b, v) + b = encodeComma(b) + code = code.next + } + } + case opStructEscapedFieldPtrAnonymousHeadOmitEmptyFloat64: + ptr := load(ctxptr, code.idx) + if ptr != 0 { + store(ctxptr, code.idx, e.ptrToPtr(ptr)) + } + fallthrough + case opStructEscapedFieldAnonymousHeadOmitEmptyFloat64: + ptr := load(ctxptr, code.idx) + if ptr == 0 { + code = code.end.next + } else { + 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 = append(b, code.escapedKey...) + b = encodeFloat64(b, v) + b = encodeComma(b) + code = code.next + } + } + case opStructEscapedFieldPtrHeadOmitEmptyEscapedString: + ptr := load(ctxptr, code.idx) + if ptr != 0 { + store(ctxptr, code.idx, e.ptrToPtr(ptr)) + } + fallthrough + case opStructEscapedFieldHeadOmitEmptyEscapedString: + ptr := load(ctxptr, code.idx) + if ptr == 0 { + b = encodeNull(b) + b = encodeComma(b) + code = code.end.next + } else { + b = append(b, '{') + v := e.ptrToString(ptr + code.offset) + if v == "" { + code = code.nextField + } else { + b = append(b, code.escapedKey...) + b = encodeEscapedString(b, v) + b = encodeComma(b) + code = code.next + } + } + case opStructEscapedFieldPtrAnonymousHeadOmitEmptyEscapedString: + ptr := load(ctxptr, code.idx) + if ptr != 0 { + store(ctxptr, code.idx, e.ptrToPtr(ptr)) + } + fallthrough + case opStructEscapedFieldAnonymousHeadOmitEmptyEscapedString: + ptr := load(ctxptr, code.idx) + if ptr == 0 { + code = code.end.next + } else { + v := e.ptrToString(ptr + code.offset) + if v == "" { + code = code.nextField + } else { + b = append(b, code.escapedKey...) + b = encodeEscapedString(b, v) + b = encodeComma(b) + code = code.next + } + } + case opStructEscapedFieldPtrHeadOmitEmptyBool: + ptr := load(ctxptr, code.idx) + if ptr != 0 { + store(ctxptr, code.idx, e.ptrToPtr(ptr)) + } + fallthrough + case opStructEscapedFieldHeadOmitEmptyBool: + ptr := load(ctxptr, code.idx) + if ptr == 0 { + b = encodeNull(b) + b = encodeComma(b) + code = code.end.next + } else { + b = append(b, '{') + v := e.ptrToBool(ptr + code.offset) + if !v { + code = code.nextField + } else { + b = append(b, code.escapedKey...) + b = encodeBool(b, v) + b = encodeComma(b) + code = code.next + } + } + case opStructEscapedFieldPtrAnonymousHeadOmitEmptyBool: + ptr := load(ctxptr, code.idx) + if ptr != 0 { + store(ctxptr, code.idx, e.ptrToPtr(ptr)) + } + fallthrough + case opStructEscapedFieldAnonymousHeadOmitEmptyBool: + ptr := load(ctxptr, code.idx) + if ptr == 0 { + code = code.end.next + } else { + v := e.ptrToBool(ptr + code.offset) + if !v { + code = code.nextField + } else { + b = append(b, code.escapedKey...) + b = encodeBool(b, v) + b = encodeComma(b) + code = code.next + } + } + case opStructEscapedFieldPtrHeadOmitEmptyBytes: + ptr := load(ctxptr, code.idx) + if ptr != 0 { + store(ctxptr, code.idx, e.ptrToPtr(ptr)) + } + fallthrough + case opStructEscapedFieldHeadOmitEmptyBytes: + ptr := load(ctxptr, code.idx) + if ptr == 0 { + b = encodeNull(b) + b = encodeComma(b) + code = code.end.next + } else { + b = append(b, '{') + v := e.ptrToBytes(ptr + code.offset) + if len(v) == 0 { + code = code.nextField + } else { + b = append(b, code.escapedKey...) + b = encodeByteSlice(b, v) + b = encodeComma(b) + code = code.next + } + } + case opStructEscapedFieldPtrAnonymousHeadOmitEmptyBytes: + ptr := load(ctxptr, code.idx) + if ptr != 0 { + store(ctxptr, code.idx, e.ptrToPtr(ptr)) + } + fallthrough + case opStructEscapedFieldAnonymousHeadOmitEmptyBytes: + ptr := load(ctxptr, code.idx) + if ptr == 0 { + code = code.end.next + } else { + v := e.ptrToBytes(ptr + code.offset) + if len(v) == 0 { + code = code.nextField + } else { + b = append(b, code.escapedKey...) + b = encodeByteSlice(b, v) + b = encodeComma(b) + code = code.next + } + } + case opStructEscapedFieldPtrHeadOmitEmptyMarshalJSON: + ptr := load(ctxptr, code.idx) + if ptr != 0 { + store(ctxptr, code.idx, e.ptrToPtr(ptr)) + } + fallthrough + case opStructEscapedFieldHeadOmitEmptyMarshalJSON: + ptr := load(ctxptr, code.idx) + if ptr == 0 { + b = encodeNull(b) + b = encodeComma(b) + code = code.end.next + } else { + b = append(b, '{') + ptr += code.offset + p := e.ptrToUnsafePtr(ptr) + isPtr := code.typ.Kind() == reflect.Ptr + if p == nil || (!isPtr && *(*unsafe.Pointer)(p) == nil) { + code = code.nextField + } else { + v := *(*interface{})(unsafe.Pointer(&interfaceHeader{typ: code.typ, ptr: p})) + bb, err := v.(Marshaler).MarshalJSON() + if err != nil { + return nil, &MarshalerError{ + Type: rtype2type(code.typ), + Err: err, + } + } + if len(bb) == 0 { + if isPtr { + return nil, errUnexpectedEndOfJSON( + fmt.Sprintf("error calling MarshalJSON for type %s", code.typ), + 0, + ) + } + code = code.nextField + } else { + var buf bytes.Buffer + if err := compact(&buf, bb, e.enabledHTMLEscape); err != nil { + return nil, err + } + b = append(b, code.escapedKey...) + b = append(b, buf.Bytes()...) + b = encodeComma(b) + code = code.next + } + } + } + case opStructEscapedFieldPtrAnonymousHeadOmitEmptyMarshalJSON: + ptr := load(ctxptr, code.idx) + if ptr != 0 { + store(ctxptr, code.idx, e.ptrToPtr(ptr)) + } + fallthrough + case opStructEscapedFieldAnonymousHeadOmitEmptyMarshalJSON: + ptr := load(ctxptr, code.idx) + if ptr == 0 { + code = code.end.next + } else { + ptr += code.offset + p := e.ptrToUnsafePtr(ptr) + isPtr := code.typ.Kind() == reflect.Ptr + if p == nil || (!isPtr && *(*unsafe.Pointer)(p) == nil) { + code = code.nextField + } else { + v := *(*interface{})(unsafe.Pointer(&interfaceHeader{typ: code.typ, ptr: p})) + bb, err := v.(Marshaler).MarshalJSON() + if err != nil { + return nil, &MarshalerError{ + Type: rtype2type(code.typ), + Err: err, + } + } + if len(bb) == 0 { + if isPtr { + return nil, errUnexpectedEndOfJSON( + fmt.Sprintf("error calling MarshalJSON for type %s", code.typ), + 0, + ) + } + code = code.nextField + } else { + var buf bytes.Buffer + if err := compact(&buf, bb, e.enabledHTMLEscape); err != nil { + return nil, err + } + b = append(b, code.escapedKey...) + b = append(b, buf.Bytes()...) + b = encodeComma(b) + code = code.next + } + } + } + case opStructEscapedFieldPtrHeadOmitEmptyMarshalText: + ptr := load(ctxptr, code.idx) + if ptr != 0 { + store(ctxptr, code.idx, e.ptrToPtr(ptr)) + } + fallthrough + case opStructEscapedFieldHeadOmitEmptyMarshalText: + ptr := load(ctxptr, code.idx) + if ptr == 0 { + b = encodeNull(b) + b = encodeComma(b) + code = code.end.next + } else { + b = append(b, '{') + ptr += code.offset + p := e.ptrToUnsafePtr(ptr) + isPtr := code.typ.Kind() == reflect.Ptr + if p == nil || (!isPtr && *(*unsafe.Pointer)(p) == nil) { + code = code.nextField + } else { + v := *(*interface{})(unsafe.Pointer(&interfaceHeader{typ: code.typ, ptr: p})) + bytes, err := v.(encoding.TextMarshaler).MarshalText() + if err != nil { + return nil, &MarshalerError{ + Type: rtype2type(code.typ), + Err: err, + } + } + b = append(b, code.escapedKey...) + b = encodeEscapedString(b, *(*string)(unsafe.Pointer(&bytes))) + b = encodeComma(b) + code = code.next + } + } + case opStructEscapedFieldPtrAnonymousHeadOmitEmptyMarshalText: + ptr := load(ctxptr, code.idx) + if ptr != 0 { + store(ctxptr, code.idx, e.ptrToPtr(ptr)) + } + fallthrough + case opStructEscapedFieldAnonymousHeadOmitEmptyMarshalText: + ptr := load(ctxptr, code.idx) + if ptr == 0 { + code = code.end.next + } else { + ptr += code.offset + p := e.ptrToUnsafePtr(ptr) + isPtr := code.typ.Kind() == reflect.Ptr + if p == nil || (!isPtr && *(*unsafe.Pointer)(p) == nil) { + code = code.nextField + } else { + v := *(*interface{})(unsafe.Pointer(&interfaceHeader{typ: code.typ, ptr: p})) + bytes, err := v.(encoding.TextMarshaler).MarshalText() + if err != nil { + return nil, &MarshalerError{ + Type: rtype2type(code.typ), + Err: err, + } + } + b = append(b, code.escapedKey...) + b = encodeEscapedString(b, *(*string)(unsafe.Pointer(&bytes))) + b = encodeComma(b) + code = code.next + } + } + case opStructEscapedFieldPtrHeadStringTag: + ptr := load(ctxptr, code.idx) + if ptr != 0 { + store(ctxptr, code.idx, e.ptrToPtr(ptr)) + } + fallthrough + case opStructEscapedFieldHeadStringTag: + ptr := load(ctxptr, code.idx) + if ptr == 0 { + b = encodeNull(b) + b = encodeComma(b) + code = code.end.next + } else { + b = append(b, '{') + p := ptr + code.offset + b = append(b, code.escapedKey...) + code = code.next + store(ctxptr, code.idx, p) + } + case opStructEscapedFieldPtrAnonymousHeadStringTag: + ptr := load(ctxptr, code.idx) + if ptr != 0 { + store(ctxptr, code.idx, e.ptrToPtr(ptr)) + } + fallthrough + case opStructEscapedFieldAnonymousHeadStringTag: + ptr := load(ctxptr, code.idx) + if ptr == 0 { + code = code.end.next + } else { + b = append(b, code.escapedKey...) + code = code.next + store(ctxptr, code.idx, ptr+code.offset) + } + case opStructEscapedFieldPtrHeadStringTagInt: + ptr := load(ctxptr, code.idx) + if ptr != 0 { + store(ctxptr, code.idx, e.ptrToPtr(ptr)) + } + fallthrough + case opStructEscapedFieldHeadStringTagInt: + ptr := load(ctxptr, code.idx) + if ptr == 0 { + b = encodeNull(b) + b = encodeComma(b) + code = code.end.next + } else { + b = append(b, '{') + b = append(b, code.escapedKey...) + b = append(b, '"') + b = appendInt(b, int64(e.ptrToInt(ptr+code.offset))) + b = append(b, '"') + b = encodeComma(b) + code = code.next + } + case opStructEscapedFieldPtrAnonymousHeadStringTagInt: + ptr := load(ctxptr, code.idx) + if ptr != 0 { + store(ctxptr, code.idx, e.ptrToPtr(ptr)) + } + fallthrough + case opStructEscapedFieldAnonymousHeadStringTagInt: + ptr := load(ctxptr, code.idx) + if ptr == 0 { + code = code.end.next + } else { + b = append(b, code.escapedKey...) + b = append(b, '"') + b = appendInt(b, int64(e.ptrToInt(ptr+code.offset))) + b = append(b, '"') + b = encodeComma(b) + code = code.next + } + case opStructEscapedFieldPtrHeadStringTagInt8: + ptr := load(ctxptr, code.idx) + if ptr != 0 { + store(ctxptr, code.idx, e.ptrToPtr(ptr)) + } + fallthrough + case opStructEscapedFieldHeadStringTagInt8: + ptr := load(ctxptr, code.idx) + if ptr == 0 { + b = encodeNull(b) + b = encodeComma(b) + code = code.end.next + } else { + b = append(b, '{') + b = append(b, code.escapedKey...) + b = append(b, '"') + b = appendInt(b, int64(e.ptrToInt8(ptr+code.offset))) + b = append(b, '"') + b = encodeComma(b) + code = code.next + } + case opStructEscapedFieldPtrAnonymousHeadStringTagInt8: + ptr := load(ctxptr, code.idx) + if ptr != 0 { + store(ctxptr, code.idx, e.ptrToPtr(ptr)) + } + fallthrough + case opStructEscapedFieldAnonymousHeadStringTagInt8: + ptr := load(ctxptr, code.idx) + if ptr == 0 { + code = code.end.next + } else { + b = append(b, code.escapedKey...) + b = append(b, '"') + b = appendInt(b, int64(e.ptrToInt8(ptr+code.offset))) + b = append(b, '"') + b = encodeComma(b) + code = code.next + } + case opStructEscapedFieldPtrHeadStringTagInt16: + ptr := load(ctxptr, code.idx) + if ptr != 0 { + store(ctxptr, code.idx, e.ptrToPtr(ptr)) + } + fallthrough + case opStructEscapedFieldHeadStringTagInt16: + ptr := load(ctxptr, code.idx) + if ptr == 0 { + b = encodeNull(b) + b = encodeComma(b) + code = code.end.next + } else { + b = append(b, '{') + b = append(b, code.escapedKey...) + b = append(b, '"') + b = appendInt(b, int64(e.ptrToInt16(ptr+code.offset))) + b = append(b, '"') + b = encodeComma(b) + code = code.next + } + case opStructEscapedFieldPtrAnonymousHeadStringTagInt16: + ptr := load(ctxptr, code.idx) + if ptr != 0 { + store(ctxptr, code.idx, e.ptrToPtr(ptr)) + } + fallthrough + case opStructEscapedFieldAnonymousHeadStringTagInt16: + ptr := load(ctxptr, code.idx) + if ptr == 0 { + code = code.end.next + } else { + b = append(b, code.escapedKey...) + b = append(b, '"') + b = appendInt(b, int64(e.ptrToInt16(ptr+code.offset))) + b = append(b, '"') + b = encodeComma(b) + code = code.next + } + case opStructEscapedFieldPtrHeadStringTagInt32: + ptr := load(ctxptr, code.idx) + if ptr != 0 { + store(ctxptr, code.idx, e.ptrToPtr(ptr)) + } + fallthrough + case opStructEscapedFieldHeadStringTagInt32: + ptr := load(ctxptr, code.idx) + if ptr == 0 { + b = encodeNull(b) + b = encodeComma(b) + code = code.end.next + } else { + b = append(b, '{') + b = append(b, code.escapedKey...) + b = append(b, '"') + b = appendInt(b, int64(e.ptrToInt32(ptr+code.offset))) + b = append(b, '"') + b = encodeComma(b) + code = code.next + } + case opStructEscapedFieldPtrAnonymousHeadStringTagInt32: + ptr := load(ctxptr, code.idx) + if ptr != 0 { + store(ctxptr, code.idx, e.ptrToPtr(ptr)) + } + fallthrough + case opStructEscapedFieldAnonymousHeadStringTagInt32: + ptr := load(ctxptr, code.idx) + if ptr == 0 { + code = code.end.next + } else { + b = append(b, code.escapedKey...) + b = append(b, '"') + b = appendInt(b, int64(e.ptrToInt32(ptr+code.offset))) + b = append(b, '"') + b = encodeComma(b) + code = code.next + } + case opStructEscapedFieldPtrHeadStringTagInt64: + ptr := load(ctxptr, code.idx) + if ptr != 0 { + store(ctxptr, code.idx, e.ptrToPtr(ptr)) + } + fallthrough + case opStructEscapedFieldHeadStringTagInt64: + ptr := load(ctxptr, code.idx) + if ptr == 0 { + b = encodeNull(b) + b = encodeComma(b) + code = code.end.next + } else { + b = append(b, '{') + b = append(b, code.escapedKey...) + b = append(b, '"') + b = appendInt(b, e.ptrToInt64(ptr+code.offset)) + b = append(b, '"') + b = encodeComma(b) + code = code.next + } + case opStructEscapedFieldPtrHeadStringTagInt64Only: + p := load(ctxptr, code.idx) + if p == 0 { + b = encodeNull(b) + b = encodeComma(b) + code = code.end.next + break + } + fallthrough + case opStructEscapedFieldHeadStringTagInt64Only: + p := load(ctxptr, code.idx) + b = append(b, '{') + b = append(b, code.escapedKey...) + b = append(b, '"') + b = appendInt(b, e.ptrToInt64(p+code.offset)) + b = append(b, '"') + b = encodeComma(b) + code = code.next + case opStructEscapedFieldPtrHeadStringTagInt64PtrOnly: + p := load(ctxptr, code.idx) + if p == 0 { + b = encodeNull(b) + b = encodeComma(b) + code = code.end.next + break + } + fallthrough + case opStructEscapedFieldHeadStringTagInt64PtrOnly: + p := load(ctxptr, code.idx) + b = append(b, '{') + b = append(b, code.escapedKey...) + if p == 0 { + b = encodeNull(b) + } else { + b = append(b, '"') + b = appendInt(b, e.ptrToInt64(p+code.offset)) + b = append(b, '"') + } + b = encodeComma(b) + code = code.next + case opStructEscapedFieldPtrAnonymousHeadStringTagInt64: + ptr := load(ctxptr, code.idx) + if ptr != 0 { + store(ctxptr, code.idx, e.ptrToPtr(ptr)) + } + fallthrough + case opStructEscapedFieldAnonymousHeadStringTagInt64: + ptr := load(ctxptr, code.idx) + if ptr == 0 { + code = code.end.next + } else { + b = append(b, code.escapedKey...) + b = append(b, '"') + b = appendInt(b, e.ptrToInt64(ptr+code.offset)) + b = append(b, '"') + b = encodeComma(b) + code = code.next + } + case opStructEscapedFieldPtrHeadStringTagUint: + ptr := load(ctxptr, code.idx) + if ptr != 0 { + store(ctxptr, code.idx, e.ptrToPtr(ptr)) + } + fallthrough + case opStructEscapedFieldHeadStringTagUint: + ptr := load(ctxptr, code.idx) + if ptr == 0 { + b = encodeNull(b) + b = encodeComma(b) + code = code.end.next + } else { + b = append(b, '{') + b = append(b, code.escapedKey...) + b = append(b, '"') + b = appendUint(b, uint64(e.ptrToUint(ptr+code.offset))) + b = append(b, '"') + b = encodeComma(b) + code = code.next + } + case opStructEscapedFieldPtrAnonymousHeadStringTagUint: + ptr := load(ctxptr, code.idx) + if ptr != 0 { + store(ctxptr, code.idx, e.ptrToPtr(ptr)) + } + fallthrough + case opStructEscapedFieldAnonymousHeadStringTagUint: + ptr := load(ctxptr, code.idx) + if ptr == 0 { + code = code.end.next + } else { + b = append(b, code.escapedKey...) + b = append(b, '"') + b = appendUint(b, uint64(e.ptrToUint(ptr+code.offset))) + b = append(b, '"') + b = encodeComma(b) + code = code.next + } + case opStructEscapedFieldPtrHeadStringTagUint8: + ptr := load(ctxptr, code.idx) + if ptr != 0 { + store(ctxptr, code.idx, e.ptrToPtr(ptr)) + } + fallthrough + case opStructEscapedFieldHeadStringTagUint8: + ptr := load(ctxptr, code.idx) + if ptr == 0 { + b = encodeNull(b) + b = encodeComma(b) + code = code.end.next + } else { + b = append(b, '{') + b = append(b, code.escapedKey...) + b = append(b, '"') + b = appendUint(b, uint64(e.ptrToUint8(ptr+code.offset))) + b = append(b, '"') + b = encodeComma(b) + code = code.next + } + case opStructEscapedFieldPtrAnonymousHeadStringTagUint8: + ptr := load(ctxptr, code.idx) + if ptr != 0 { + store(ctxptr, code.idx, e.ptrToPtr(ptr)) + } + fallthrough + case opStructEscapedFieldAnonymousHeadStringTagUint8: + ptr := load(ctxptr, code.idx) + if ptr == 0 { + code = code.end.next + } else { + b = append(b, code.escapedKey...) + b = append(b, '"') + b = appendUint(b, uint64(e.ptrToUint8(ptr+code.offset))) + b = append(b, '"') + b = encodeComma(b) + code = code.next + } + case opStructEscapedFieldPtrHeadStringTagUint16: + ptr := load(ctxptr, code.idx) + if ptr != 0 { + store(ctxptr, code.idx, e.ptrToPtr(ptr)) + } + fallthrough + case opStructEscapedFieldHeadStringTagUint16: + ptr := load(ctxptr, code.idx) + if ptr == 0 { + b = encodeNull(b) + b = encodeComma(b) + code = code.end.next + } else { + b = append(b, '{') + b = append(b, code.escapedKey...) + b = append(b, '"') + b = appendUint(b, uint64(e.ptrToUint16(ptr+code.offset))) + b = append(b, '"') + b = encodeComma(b) + code = code.next + } + case opStructEscapedFieldPtrAnonymousHeadStringTagUint16: + ptr := load(ctxptr, code.idx) + if ptr != 0 { + store(ctxptr, code.idx, e.ptrToPtr(ptr)) + } + fallthrough + case opStructEscapedFieldAnonymousHeadStringTagUint16: + ptr := load(ctxptr, code.idx) + if ptr == 0 { + code = code.end.next + } else { + b = append(b, code.escapedKey...) + b = append(b, '"') + b = appendUint(b, uint64(e.ptrToUint16(ptr+code.offset))) + b = append(b, '"') + b = encodeComma(b) + code = code.next + } + case opStructEscapedFieldPtrHeadStringTagUint32: + ptr := load(ctxptr, code.idx) + if ptr != 0 { + store(ctxptr, code.idx, e.ptrToPtr(ptr)) + } + fallthrough + case opStructEscapedFieldHeadStringTagUint32: + ptr := load(ctxptr, code.idx) + if ptr == 0 { + b = encodeNull(b) + b = encodeComma(b) + code = code.end.next + } else { + b = append(b, '{') + b = append(b, code.escapedKey...) + b = append(b, '"') + b = appendUint(b, uint64(e.ptrToUint32(ptr+code.offset))) + b = append(b, '"') + b = encodeComma(b) + code = code.next + } + case opStructEscapedFieldPtrAnonymousHeadStringTagUint32: + ptr := load(ctxptr, code.idx) + if ptr != 0 { + store(ctxptr, code.idx, e.ptrToPtr(ptr)) + } + fallthrough + case opStructEscapedFieldAnonymousHeadStringTagUint32: + ptr := load(ctxptr, code.idx) + if ptr == 0 { + code = code.end.next + } else { + b = append(b, code.escapedKey...) + b = append(b, '"') + b = appendUint(b, uint64(e.ptrToUint32(ptr+code.offset))) + b = append(b, '"') + b = encodeComma(b) + code = code.next + } + case opStructEscapedFieldPtrHeadStringTagUint64: + ptr := load(ctxptr, code.idx) + if ptr != 0 { + store(ctxptr, code.idx, e.ptrToPtr(ptr)) + } + fallthrough + case opStructEscapedFieldHeadStringTagUint64: + ptr := load(ctxptr, code.idx) + if ptr == 0 { + b = encodeNull(b) + b = encodeComma(b) + code = code.end.next + } else { + b = append(b, '{') + b = append(b, code.escapedKey...) + b = append(b, '"') + b = appendUint(b, e.ptrToUint64(ptr+code.offset)) + b = append(b, '"') + b = encodeComma(b) + code = code.next + } + case opStructEscapedFieldPtrAnonymousHeadStringTagUint64: + ptr := load(ctxptr, code.idx) + if ptr != 0 { + store(ctxptr, code.idx, e.ptrToPtr(ptr)) + } + fallthrough + case opStructEscapedFieldAnonymousHeadStringTagUint64: + ptr := load(ctxptr, code.idx) + if ptr == 0 { + code = code.end.next + } else { + b = append(b, code.escapedKey...) + b = append(b, '"') + b = appendUint(b, e.ptrToUint64(ptr+code.offset)) + b = append(b, '"') + b = encodeComma(b) + code = code.next + } + case opStructEscapedFieldPtrHeadStringTagFloat32: + ptr := load(ctxptr, code.idx) + if ptr != 0 { + store(ctxptr, code.idx, e.ptrToPtr(ptr)) + } + fallthrough + case opStructEscapedFieldHeadStringTagFloat32: + ptr := load(ctxptr, code.idx) + if ptr == 0 { + b = encodeNull(b) + b = encodeComma(b) + code = code.end.next + } else { + b = append(b, '{') + b = append(b, code.escapedKey...) + b = append(b, '"') + b = encodeFloat32(b, e.ptrToFloat32(ptr+code.offset)) + b = append(b, '"') + b = encodeComma(b) + code = code.next + } + case opStructEscapedFieldPtrAnonymousHeadStringTagFloat32: + ptr := load(ctxptr, code.idx) + if ptr != 0 { + store(ctxptr, code.idx, e.ptrToPtr(ptr)) + } + fallthrough + case opStructEscapedFieldAnonymousHeadStringTagFloat32: + ptr := load(ctxptr, code.idx) + if ptr == 0 { + code = code.end.next + } else { + b = append(b, code.escapedKey...) + b = append(b, '"') + b = encodeFloat32(b, e.ptrToFloat32(ptr+code.offset)) + b = append(b, '"') + b = encodeComma(b) + code = code.next + } + case opStructEscapedFieldPtrHeadStringTagFloat64: + ptr := load(ctxptr, code.idx) + if ptr != 0 { + store(ctxptr, code.idx, e.ptrToPtr(ptr)) + } + fallthrough + case opStructEscapedFieldHeadStringTagFloat64: + ptr := load(ctxptr, code.idx) + if ptr == 0 { + b = encodeNull(b) + b = encodeComma(b) + code = code.end.next + } else { + b = append(b, '{') + v := e.ptrToFloat64(ptr + code.offset) + if math.IsInf(v, 0) || math.IsNaN(v) { + return nil, errUnsupportedFloat(v) + } + b = append(b, code.escapedKey...) + b = append(b, '"') + b = encodeFloat64(b, v) + b = append(b, '"') + b = encodeComma(b) + code = code.next + } + case opStructEscapedFieldPtrAnonymousHeadStringTagFloat64: + ptr := load(ctxptr, code.idx) + if ptr != 0 { + store(ctxptr, code.idx, e.ptrToPtr(ptr)) + } + fallthrough + case opStructEscapedFieldAnonymousHeadStringTagFloat64: + ptr := load(ctxptr, code.idx) + if ptr == 0 { + code = code.end.next + } else { + v := e.ptrToFloat64(ptr + code.offset) + if math.IsInf(v, 0) || math.IsNaN(v) { + return nil, errUnsupportedFloat(v) + } + b = append(b, code.escapedKey...) + b = append(b, '"') + b = encodeFloat64(b, v) + b = append(b, '"') + b = encodeComma(b) + code = code.next + } + case opStructEscapedFieldPtrHeadStringTagEscapedString: + ptr := load(ctxptr, code.idx) + if ptr != 0 { + store(ctxptr, code.idx, e.ptrToPtr(ptr)) + } + fallthrough + case opStructEscapedFieldHeadStringTagEscapedString: + ptr := load(ctxptr, code.idx) + if ptr == 0 { + b = encodeNull(b) + b = encodeComma(b) + code = code.end.next + } else { + b = append(b, '{') + b = append(b, code.escapedKey...) + s := e.ptrToString(ptr + code.offset) + b = encodeEscapedString(b, string(encodeEscapedString([]byte{}, s))) + b = encodeComma(b) + code = code.next + } + case opStructEscapedFieldPtrAnonymousHeadStringTagEscapedString: + ptr := load(ctxptr, code.idx) + if ptr != 0 { + store(ctxptr, code.idx, e.ptrToPtr(ptr)) + } + fallthrough + case opStructEscapedFieldAnonymousHeadStringTagEscapedString: + ptr := load(ctxptr, code.idx) + if ptr == 0 { + code = code.end.next + } else { + b = append(b, code.escapedKey...) + s := string(encodeEscapedString([]byte{}, e.ptrToString(ptr+code.offset))) + b = encodeEscapedString(b, s) + b = encodeComma(b) + code = code.next + } + case opStructEscapedFieldPtrHeadStringTagBool: + ptr := load(ctxptr, code.idx) + if ptr != 0 { + store(ctxptr, code.idx, e.ptrToPtr(ptr)) + } + fallthrough + case opStructEscapedFieldHeadStringTagBool: + ptr := load(ctxptr, code.idx) + if ptr == 0 { + b = encodeNull(b) + b = encodeComma(b) + code = code.end.next + } else { + b = append(b, '{') + b = append(b, code.escapedKey...) + b = append(b, '"') + b = encodeBool(b, e.ptrToBool(ptr+code.offset)) + b = append(b, '"') + b = encodeComma(b) + code = code.next + } + case opStructEscapedFieldPtrHeadStringTagBoolOnly: + p := load(ctxptr, code.idx) + if p == 0 { + b = encodeNull(b) + b = encodeComma(b) + code = code.end.next + break + } + fallthrough + case opStructEscapedFieldHeadStringTagBoolOnly: + ptr := load(ctxptr, code.idx) + b = append(b, '{') + b = append(b, code.escapedKey...) + b = append(b, '"') + b = encodeBool(b, e.ptrToBool(ptr+code.offset)) + b = append(b, '"') + b = encodeComma(b) + code = code.next + case opStructEscapedFieldPtrAnonymousHeadStringTagBool: + ptr := load(ctxptr, code.idx) + if ptr != 0 { + store(ctxptr, code.idx, e.ptrToPtr(ptr)) + } + fallthrough + case opStructEscapedFieldAnonymousHeadStringTagBool: + ptr := load(ctxptr, code.idx) + if ptr == 0 { + code = code.end.next + } else { + b = append(b, code.escapedKey...) + b = append(b, '"') + b = encodeBool(b, e.ptrToBool(ptr+code.offset)) + b = append(b, '"') + b = encodeComma(b) + code = code.next + } + case opStructEscapedFieldPtrHeadStringTagBytes: + ptr := load(ctxptr, code.idx) + if ptr != 0 { + store(ctxptr, code.idx, e.ptrToPtr(ptr)) + } + fallthrough + case opStructEscapedFieldHeadStringTagBytes: + ptr := load(ctxptr, code.idx) + if ptr == 0 { + b = encodeNull(b) + b = encodeComma(b) + code = code.end.next + } else { + b = append(b, '{') + b = append(b, code.escapedKey...) + b = encodeByteSlice(b, e.ptrToBytes(ptr+code.offset)) + b = encodeComma(b) + code = code.next + } + case opStructEscapedFieldPtrAnonymousHeadStringTagBytes: + ptr := load(ctxptr, code.idx) + if ptr != 0 { + store(ctxptr, code.idx, e.ptrToPtr(ptr)) + } + fallthrough + case opStructEscapedFieldAnonymousHeadStringTagBytes: + ptr := load(ctxptr, code.idx) + if ptr == 0 { + code = code.end.next + } else { + b = append(b, code.escapedKey...) + b = encodeByteSlice(b, e.ptrToBytes(ptr+code.offset)) + b = encodeComma(b) + code = code.next + } + case opStructEscapedFieldPtrHeadStringTagMarshalJSON: + ptr := load(ctxptr, code.idx) + if ptr != 0 { + store(ctxptr, code.idx, e.ptrToPtr(ptr)) + } + fallthrough + case opStructEscapedFieldHeadStringTagMarshalJSON: + ptr := load(ctxptr, code.idx) + if ptr == 0 { + b = encodeNull(b) + b = encodeComma(b) + code = code.end.next + } else { + b = append(b, '{') + ptr += code.offset + p := e.ptrToUnsafePtr(ptr) + isPtr := code.typ.Kind() == reflect.Ptr + v := *(*interface{})(unsafe.Pointer(&interfaceHeader{typ: code.typ, ptr: p})) + bb, err := v.(Marshaler).MarshalJSON() + if err != nil { + return nil, &MarshalerError{ + Type: rtype2type(code.typ), + Err: err, + } + } + if len(bb) == 0 { + if isPtr { + return nil, errUnexpectedEndOfJSON( + fmt.Sprintf("error calling MarshalJSON for type %s", code.typ), + 0, + ) + } + b = append(b, code.escapedKey...) + b = append(b, '"', '"') + b = encodeComma(b) + code = code.nextField + } else { + var buf bytes.Buffer + if err := compact(&buf, bb, e.enabledHTMLEscape); err != nil { + return nil, err + } + b = append(b, code.escapedKey...) + b = encodeEscapedString(b, buf.String()) + b = encodeComma(b) + code = code.next + } + } + case opStructEscapedFieldPtrAnonymousHeadStringTagMarshalJSON: + ptr := load(ctxptr, code.idx) + if ptr != 0 { + store(ctxptr, code.idx, e.ptrToPtr(ptr)) + } + fallthrough + case opStructEscapedFieldAnonymousHeadStringTagMarshalJSON: + ptr := load(ctxptr, code.idx) + if ptr == 0 { + code = code.end.next + } else { + ptr += code.offset + p := e.ptrToUnsafePtr(ptr) + isPtr := code.typ.Kind() == reflect.Ptr + v := *(*interface{})(unsafe.Pointer(&interfaceHeader{typ: code.typ, ptr: p})) + bb, err := v.(Marshaler).MarshalJSON() + if err != nil { + return nil, &MarshalerError{ + Type: rtype2type(code.typ), + Err: err, + } + } + if len(bb) == 0 { + if isPtr { + return nil, errUnexpectedEndOfJSON( + fmt.Sprintf("error calling MarshalJSON for type %s", code.typ), + 0, + ) + } + b = append(b, code.escapedKey...) + b = append(b, '"', '"') + b = encodeComma(b) + code = code.nextField + } else { + var buf bytes.Buffer + if err := compact(&buf, bb, e.enabledHTMLEscape); err != nil { + return nil, err + } + b = append(b, code.escapedKey...) + b = encodeEscapedString(b, buf.String()) + b = encodeComma(b) + code = code.next + } + } + case opStructEscapedFieldPtrHeadStringTagMarshalText: + ptr := load(ctxptr, code.idx) + if ptr != 0 { + store(ctxptr, code.idx, e.ptrToPtr(ptr)) + } + fallthrough + case opStructEscapedFieldHeadStringTagMarshalText: + ptr := load(ctxptr, code.idx) + if ptr == 0 { + b = encodeNull(b) + b = encodeComma(b) + code = code.end.next + } else { + b = append(b, '{') + ptr += code.offset + p := e.ptrToUnsafePtr(ptr) + v := *(*interface{})(unsafe.Pointer(&interfaceHeader{typ: code.typ, ptr: p})) + bytes, err := v.(encoding.TextMarshaler).MarshalText() + if err != nil { + return nil, &MarshalerError{ + Type: rtype2type(code.typ), + Err: err, + } + } + b = append(b, code.escapedKey...) + b = encodeEscapedString(b, *(*string)(unsafe.Pointer(&bytes))) + b = encodeComma(b) + code = code.next + } + case opStructEscapedFieldPtrAnonymousHeadStringTagMarshalText: + ptr := load(ctxptr, code.idx) + if ptr != 0 { + store(ctxptr, code.idx, e.ptrToPtr(ptr)) + } + fallthrough + case opStructEscapedFieldAnonymousHeadStringTagMarshalText: + ptr := load(ctxptr, code.idx) + if ptr == 0 { + code = code.end.next + } else { + ptr += code.offset + p := e.ptrToUnsafePtr(ptr) + 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 = append(b, code.escapedKey...) + b = encodeEscapedString(b, *(*string)(unsafe.Pointer(&bytes))) + b = encodeComma(b) + code = code.next + } + case opStructEscapedField: + if !code.anonymousKey { + b = append(b, code.escapedKey...) + } + ptr := load(ctxptr, code.headIdx) + code.offset + code = code.next + store(ctxptr, code.idx, ptr) + case opStructEscapedFieldIntPtr: + b = append(b, code.escapedKey...) + 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 = encodeComma(b) + code = code.next + case opStructEscapedFieldIntNPtr: + b = append(b, code.escapedKey...) + ptr := load(ctxptr, code.headIdx) + p := e.ptrToPtr(ptr + code.offset) + for i := 0; i < code.ptrNum-1; i++ { + if p == 0 { + break + } + p = e.ptrToPtr(p) + } + if p == 0 { + b = encodeNull(b) + } else { + b = appendInt(b, int64(e.ptrToInt(p))) + } + b = encodeComma(b) + code = code.next + case opStructEscapedFieldInt: + ptr := load(ctxptr, code.headIdx) + b = append(b, code.escapedKey...) + b = appendInt(b, int64(e.ptrToInt(ptr+code.offset))) + b = encodeComma(b) + code = code.next + case opStructEscapedFieldInt8Ptr: + b = append(b, code.escapedKey...) + 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 = encodeComma(b) + code = code.next + case opStructEscapedFieldInt8: + ptr := load(ctxptr, code.headIdx) + b = append(b, code.escapedKey...) + b = appendInt(b, int64(e.ptrToInt8(ptr+code.offset))) + b = encodeComma(b) + code = code.next + case opStructEscapedFieldInt16Ptr: + b = append(b, code.escapedKey...) + 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 = encodeComma(b) + code = code.next + case opStructEscapedFieldInt16: + ptr := load(ctxptr, code.headIdx) + b = append(b, code.escapedKey...) + b = appendInt(b, int64(e.ptrToInt16(ptr+code.offset))) + b = encodeComma(b) + code = code.next + case opStructEscapedFieldInt32Ptr: + b = append(b, code.escapedKey...) + 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 = encodeComma(b) + code = code.next + case opStructEscapedFieldInt32: + ptr := load(ctxptr, code.headIdx) + b = append(b, code.escapedKey...) + b = appendInt(b, int64(e.ptrToInt32(ptr+code.offset))) + b = encodeComma(b) + code = code.next + case opStructEscapedFieldInt64Ptr: + b = append(b, code.escapedKey...) + 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 = encodeComma(b) + code = code.next + case opStructEscapedFieldInt64: + ptr := load(ctxptr, code.headIdx) + b = append(b, code.escapedKey...) + b = appendInt(b, e.ptrToInt64(ptr+code.offset)) + b = encodeComma(b) + code = code.next + case opStructEscapedFieldUintPtr: + b = append(b, code.escapedKey...) + 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 = encodeComma(b) + code = code.next + case opStructEscapedFieldUint: + ptr := load(ctxptr, code.headIdx) + b = append(b, code.escapedKey...) + b = appendUint(b, uint64(e.ptrToUint(ptr+code.offset))) + b = encodeComma(b) + code = code.next + case opStructEscapedFieldUint8Ptr: + b = append(b, code.escapedKey...) + 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 = encodeComma(b) + code = code.next + case opStructEscapedFieldUint8: + ptr := load(ctxptr, code.headIdx) + b = append(b, code.escapedKey...) + b = appendUint(b, uint64(e.ptrToUint8(ptr+code.offset))) + b = encodeComma(b) + code = code.next + case opStructEscapedFieldUint16Ptr: + b = append(b, code.escapedKey...) + 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 = encodeComma(b) + code = code.next + case opStructEscapedFieldUint16: + ptr := load(ctxptr, code.headIdx) + b = append(b, code.escapedKey...) + b = appendUint(b, uint64(e.ptrToUint16(ptr+code.offset))) + b = encodeComma(b) + code = code.next + case opStructEscapedFieldUint32Ptr: + b = append(b, code.escapedKey...) + 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 = encodeComma(b) + code = code.next + case opStructEscapedFieldUint32: + ptr := load(ctxptr, code.headIdx) + b = append(b, code.escapedKey...) + b = appendUint(b, uint64(e.ptrToUint32(ptr+code.offset))) + b = encodeComma(b) + code = code.next + case opStructEscapedFieldUint64Ptr: + b = append(b, code.escapedKey...) + 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 = encodeComma(b) + code = code.next + case opStructEscapedFieldUint64: + ptr := load(ctxptr, code.headIdx) + b = append(b, code.escapedKey...) + b = appendUint(b, e.ptrToUint64(ptr+code.offset)) + b = encodeComma(b) + code = code.next + case opStructEscapedFieldFloat32Ptr: + b = append(b, code.escapedKey...) + 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 = encodeComma(b) + code = code.next + case opStructEscapedFieldFloat32: + ptr := load(ctxptr, code.headIdx) + b = append(b, code.escapedKey...) + b = encodeFloat32(b, e.ptrToFloat32(ptr+code.offset)) + b = encodeComma(b) + code = code.next + case opStructEscapedFieldFloat64Ptr: + b = append(b, code.escapedKey...) + ptr := load(ctxptr, code.headIdx) + p := e.ptrToPtr(ptr + code.offset) + if p == 0 { + b = encodeNull(b) + b = encodeComma(b) + code = code.next + break + } + v := e.ptrToFloat64(p) + if math.IsInf(v, 0) || math.IsNaN(v) { + return nil, errUnsupportedFloat(v) + } + b = encodeFloat64(b, v) + b = encodeComma(b) + code = code.next + case opStructEscapedFieldFloat64: + ptr := load(ctxptr, code.headIdx) + b = append(b, code.escapedKey...) + v := e.ptrToFloat64(ptr + code.offset) + if math.IsInf(v, 0) || math.IsNaN(v) { + return nil, errUnsupportedFloat(v) + } + b = encodeFloat64(b, v) + b = encodeComma(b) + code = code.next + case opStructEscapedFieldEscapedStringPtr: + b = append(b, code.escapedKey...) + ptr := load(ctxptr, code.headIdx) + p := e.ptrToPtr(ptr + code.offset) + if p == 0 { + b = encodeNull(b) + } else { + b = encodeEscapedString(b, e.ptrToString(p)) + } + b = encodeComma(b) + code = code.next + case opStructEscapedFieldEscapedString: + ptr := load(ctxptr, code.headIdx) + b = append(b, code.escapedKey...) + b = encodeEscapedString(b, e.ptrToString(ptr+code.offset)) + b = encodeComma(b) + code = code.next + case opStructEscapedFieldBoolPtr: + b = append(b, code.escapedKey...) + ptr := load(ctxptr, code.headIdx) + p := e.ptrToPtr(ptr + code.offset) + if p == 0 { + b = encodeNull(b) + } else { + b = encodeBool(b, e.ptrToBool(p)) + } + b = encodeComma(b) + code = code.next + case opStructEscapedFieldBool: + ptr := load(ctxptr, code.headIdx) + b = append(b, code.escapedKey...) + b = encodeBool(b, e.ptrToBool(ptr+code.offset)) + b = encodeComma(b) + code = code.next + case opStructEscapedFieldBytes: + ptr := load(ctxptr, code.headIdx) + b = append(b, code.escapedKey...) + b = encodeByteSlice(b, e.ptrToBytes(ptr+code.offset)) + b = encodeComma(b) + code = code.next + case opStructEscapedFieldMarshalJSON: + ptr := load(ctxptr, code.headIdx) + b = append(b, code.escapedKey...) + 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 = encodeComma(b) + code = code.next + case opStructEscapedFieldMarshalText: + ptr := load(ctxptr, code.headIdx) + b = append(b, code.escapedKey...) + 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 = encodeComma(b) + code = code.next + case opStructEscapedFieldArray: + b = append(b, code.escapedKey...) + ptr := load(ctxptr, code.headIdx) + p := ptr + code.offset + code = code.next + store(ctxptr, code.idx, p) + case opStructEscapedFieldSlice: + b = append(b, code.escapedKey...) + ptr := load(ctxptr, code.headIdx) + p := ptr + code.offset + code = code.next + store(ctxptr, code.idx, p) + case opStructEscapedFieldMap: + b = append(b, code.escapedKey...) + ptr := load(ctxptr, code.headIdx) + p := ptr + code.offset + code = code.next + store(ctxptr, code.idx, p) + case opStructEscapedFieldMapLoad: + b = append(b, code.escapedKey...) + ptr := load(ctxptr, code.headIdx) + p := ptr + code.offset + code = code.next + store(ctxptr, code.idx, p) + case opStructEscapedFieldStruct: + b = append(b, code.escapedKey...) + ptr := load(ctxptr, code.headIdx) + p := ptr + code.offset + code = code.next + store(ctxptr, code.idx, p) + case opStructEscapedFieldOmitEmpty: + ptr := load(ctxptr, code.headIdx) + p := ptr + code.offset + if p == 0 || **(**uintptr)(unsafe.Pointer(&p)) == 0 { + code = code.nextField + } else { + b = append(b, code.escapedKey...) + code = code.next + store(ctxptr, code.idx, p) + } + case opStructEscapedFieldOmitEmptyInt: + ptr := load(ctxptr, code.headIdx) + v := e.ptrToInt(ptr + code.offset) + if v != 0 { + b = append(b, code.escapedKey...) + b = appendInt(b, int64(v)) + b = encodeComma(b) + } + code = code.next + case opStructEscapedFieldOmitEmptyInt8: + ptr := load(ctxptr, code.headIdx) + v := e.ptrToInt8(ptr + code.offset) + if v != 0 { + b = append(b, code.escapedKey...) + b = appendInt(b, int64(v)) + b = encodeComma(b) + } + code = code.next + case opStructEscapedFieldOmitEmptyInt16: + ptr := load(ctxptr, code.headIdx) + v := e.ptrToInt16(ptr + code.offset) + if v != 0 { + b = append(b, code.escapedKey...) + b = appendInt(b, int64(v)) + b = encodeComma(b) + } + code = code.next + case opStructEscapedFieldOmitEmptyInt32: + ptr := load(ctxptr, code.headIdx) + v := e.ptrToInt32(ptr + code.offset) + if v != 0 { + b = append(b, code.escapedKey...) + b = appendInt(b, int64(v)) + b = encodeComma(b) + } + code = code.next + case opStructEscapedFieldOmitEmptyInt64: + ptr := load(ctxptr, code.headIdx) + v := e.ptrToInt64(ptr + code.offset) + if v != 0 { + b = append(b, code.escapedKey...) + b = appendInt(b, v) + b = encodeComma(b) + } + code = code.next + case opStructEscapedFieldOmitEmptyUint: + ptr := load(ctxptr, code.headIdx) + v := e.ptrToUint(ptr + code.offset) + if v != 0 { + b = append(b, code.escapedKey...) + b = appendUint(b, uint64(v)) + b = encodeComma(b) + } + code = code.next + case opStructEscapedFieldOmitEmptyUint8: + ptr := load(ctxptr, code.headIdx) + v := e.ptrToUint8(ptr + code.offset) + if v != 0 { + b = append(b, code.escapedKey...) + b = appendUint(b, uint64(v)) + b = encodeComma(b) + } + code = code.next + case opStructEscapedFieldOmitEmptyUint16: + ptr := load(ctxptr, code.headIdx) + v := e.ptrToUint16(ptr + code.offset) + if v != 0 { + b = append(b, code.escapedKey...) + b = appendUint(b, uint64(v)) + b = encodeComma(b) + } + code = code.next + case opStructEscapedFieldOmitEmptyUint32: + ptr := load(ctxptr, code.headIdx) + v := e.ptrToUint32(ptr + code.offset) + if v != 0 { + b = append(b, code.escapedKey...) + b = appendUint(b, uint64(v)) + b = encodeComma(b) + } + code = code.next + case opStructEscapedFieldOmitEmptyUint64: + ptr := load(ctxptr, code.headIdx) + v := e.ptrToUint64(ptr + code.offset) + if v != 0 { + b = append(b, code.escapedKey...) + b = appendUint(b, v) + b = encodeComma(b) + } + code = code.next + case opStructEscapedFieldOmitEmptyFloat32: + ptr := load(ctxptr, code.headIdx) + v := e.ptrToFloat32(ptr + code.offset) + if v != 0 { + b = append(b, code.escapedKey...) + b = encodeFloat32(b, v) + b = encodeComma(b) + } + code = code.next + case opStructEscapedFieldOmitEmptyFloat64: + 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 = append(b, code.escapedKey...) + b = encodeFloat64(b, v) + b = encodeComma(b) + } + code = code.next + case opStructEscapedFieldOmitEmptyEscapedString: + ptr := load(ctxptr, code.headIdx) + v := e.ptrToString(ptr + code.offset) + if v != "" { + b = append(b, code.escapedKey...) + b = encodeEscapedString(b, v) + b = encodeComma(b) + } + code = code.next + case opStructEscapedFieldOmitEmptyBool: + ptr := load(ctxptr, code.headIdx) + v := e.ptrToBool(ptr + code.offset) + if v { + b = append(b, code.escapedKey...) + b = encodeBool(b, v) + b = encodeComma(b) + } + code = code.next + case opStructEscapedFieldOmitEmptyBytes: + ptr := load(ctxptr, code.headIdx) + v := e.ptrToBytes(ptr + code.offset) + if len(v) > 0 { + b = append(b, code.escapedKey...) + b = encodeByteSlice(b, v) + b = encodeComma(b) + } + code = code.next + case opStructEscapedFieldOmitEmptyMarshalJSON: + ptr := load(ctxptr, code.headIdx) + p := ptr + code.offset + v := e.ptrToInterface(code, p) + if v != nil { + 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, code.escapedKey...) + b = append(b, buf.Bytes()...) + b = encodeComma(b) + } + code = code.next + case opStructEscapedFieldOmitEmptyMarshalText: + ptr := load(ctxptr, code.headIdx) + p := ptr + code.offset + v := e.ptrToInterface(code, p) + if v != nil { + bytes, err := v.(encoding.TextMarshaler).MarshalText() + if err != nil { + return nil, errMarshaler(code, err) + } + b = append(b, code.escapedKey...) + b = encodeEscapedString(b, *(*string)(unsafe.Pointer(&bytes))) + b = encodeComma(b) + } + code = code.next + case opStructEscapedFieldOmitEmptyArray: + ptr := load(ctxptr, code.headIdx) + p := ptr + code.offset + array := e.ptrToSlice(p) + if p == 0 || uintptr(array.data) == 0 { + code = code.nextField + } else { + code = code.next + } + case opStructEscapedFieldOmitEmptySlice: + ptr := load(ctxptr, code.headIdx) + p := ptr + code.offset + slice := e.ptrToSlice(p) + if p == 0 || uintptr(slice.data) == 0 { + code = code.nextField + } else { + code = code.next + } + case opStructEscapedFieldOmitEmptyMap: + 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 { + code = code.next + } + } + case opStructEscapedFieldOmitEmptyMapLoad: + 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 { + code = code.next + } + } + case opStructEscapedFieldStringTag: + ptr := load(ctxptr, code.headIdx) + p := ptr + code.offset + b = append(b, code.escapedKey...) + code = code.next + store(ctxptr, code.idx, p) + case opStructEscapedFieldStringTagInt: + ptr := load(ctxptr, code.headIdx) + b = append(b, code.escapedKey...) + b = append(b, '"') + b = appendInt(b, int64(e.ptrToInt(ptr+code.offset))) + b = append(b, '"') + b = encodeComma(b) + code = code.next + case opStructEscapedFieldStringTagInt8: + ptr := load(ctxptr, code.headIdx) + b = append(b, code.escapedKey...) + b = append(b, '"') + b = appendInt(b, int64(e.ptrToInt8(ptr+code.offset))) + b = append(b, '"') + b = encodeComma(b) + code = code.next + case opStructEscapedFieldStringTagInt16: + ptr := load(ctxptr, code.headIdx) + b = append(b, code.escapedKey...) + b = append(b, '"') + b = appendInt(b, int64(e.ptrToInt16(ptr+code.offset))) + b = append(b, '"') + b = encodeComma(b) + code = code.next + case opStructEscapedFieldStringTagInt32: + ptr := load(ctxptr, code.headIdx) + b = append(b, code.escapedKey...) + b = append(b, '"') + b = appendInt(b, int64(e.ptrToInt32(ptr+code.offset))) + b = append(b, '"') + b = encodeComma(b) + code = code.next + case opStructEscapedFieldStringTagInt64: + ptr := load(ctxptr, code.headIdx) + b = append(b, code.escapedKey...) + b = append(b, '"') + b = appendInt(b, e.ptrToInt64(ptr+code.offset)) + b = append(b, '"') + b = encodeComma(b) + code = code.next + case opStructEscapedFieldStringTagUint: + ptr := load(ctxptr, code.headIdx) + b = append(b, code.escapedKey...) + b = append(b, '"') + b = appendUint(b, uint64(e.ptrToUint(ptr+code.offset))) + b = append(b, '"') + b = encodeComma(b) + code = code.next + case opStructEscapedFieldStringTagUint8: + ptr := load(ctxptr, code.headIdx) + b = append(b, code.escapedKey...) + b = append(b, '"') + b = appendUint(b, uint64(e.ptrToUint8(ptr+code.offset))) + b = append(b, '"') + b = encodeComma(b) + code = code.next + case opStructEscapedFieldStringTagUint16: + ptr := load(ctxptr, code.headIdx) + b = append(b, code.escapedKey...) + b = append(b, '"') + b = appendUint(b, uint64(e.ptrToUint16(ptr+code.offset))) + b = append(b, '"') + b = encodeComma(b) + code = code.next + case opStructEscapedFieldStringTagUint32: + ptr := load(ctxptr, code.headIdx) + b = append(b, code.escapedKey...) + b = append(b, '"') + b = appendUint(b, uint64(e.ptrToUint32(ptr+code.offset))) + b = append(b, '"') + b = encodeComma(b) + code = code.next + case opStructEscapedFieldStringTagUint64: + ptr := load(ctxptr, code.headIdx) + b = append(b, code.escapedKey...) + b = append(b, '"') + b = appendUint(b, uint64(e.ptrToUint64(ptr+code.offset))) + b = append(b, '"') + b = encodeComma(b) + code = code.next + case opStructEscapedFieldStringTagFloat32: + ptr := load(ctxptr, code.headIdx) + b = append(b, code.escapedKey...) + b = append(b, '"') + b = encodeFloat32(b, e.ptrToFloat32(ptr+code.offset)) + b = append(b, '"') + b = encodeComma(b) + code = code.next + case opStructEscapedFieldStringTagFloat64: + ptr := load(ctxptr, code.headIdx) + v := e.ptrToFloat64(ptr + code.offset) + if math.IsInf(v, 0) || math.IsNaN(v) { + return nil, errUnsupportedFloat(v) + } + b = append(b, code.escapedKey...) + b = append(b, '"') + b = encodeFloat64(b, v) + b = append(b, '"') + b = encodeComma(b) + code = code.next + case opStructEscapedFieldStringTagEscapedString: + ptr := load(ctxptr, code.headIdx) + b = append(b, code.escapedKey...) + s := e.ptrToString(ptr + code.offset) + b = encodeEscapedString(b, string(encodeEscapedString([]byte{}, s))) + b = encodeComma(b) + code = code.next + case opStructEscapedFieldStringTagBool: + ptr := load(ctxptr, code.headIdx) + b = append(b, code.escapedKey...) + b = append(b, '"') + b = encodeBool(b, e.ptrToBool(ptr+code.offset)) + b = append(b, '"') + b = encodeComma(b) + code = code.next + case opStructEscapedFieldStringTagBytes: + ptr := load(ctxptr, code.headIdx) + v := e.ptrToBytes(ptr + code.offset) + b = append(b, code.escapedKey...) + b = encodeByteSlice(b, v) + b = encodeComma(b) + code = code.next + case opStructEscapedFieldStringTagMarshalJSON: + 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, code.escapedKey...) + b = encodeEscapedString(b, buf.String()) + b = encodeComma(b) + code = code.next + case opStructEscapedFieldStringTagMarshalText: + ptr := load(ctxptr, code.headIdx) + p := ptr + code.offset + v := e.ptrToInterface(code, p) + bytes, err := v.(encoding.TextMarshaler).MarshalText() + if err != nil { + return nil, errMarshaler(code, err) + } + b = append(b, code.escapedKey...) + b = encodeEscapedString(b, *(*string)(unsafe.Pointer(&bytes))) + b = encodeComma(b) + code = code.next + case opStructEscapedEnd: + last := len(b) - 1 + if b[last] == ',' { + b[last] = '}' + } else { + b = append(b, '}') + } + b = encodeComma(b) + code = code.next + case opStructAnonymousEnd: + code = code.next + case opStructEscapedEndIntPtr: + b = append(b, code.escapedKey...) + 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 = appendStructEnd(b) + code = code.next + case opStructEscapedEndIntNPtr: + b = append(b, code.escapedKey...) + ptr := load(ctxptr, code.headIdx) + p := e.ptrToPtr(ptr + code.offset) + for i := 0; i < code.ptrNum-1; i++ { + if p == 0 { + break + } + p = e.ptrToPtr(p) + } + if p == 0 { + b = encodeNull(b) + } else { + b = appendInt(b, int64(e.ptrToInt(p))) + } + b = appendStructEnd(b) + code = code.next + case opStructEscapedEndInt: + ptr := load(ctxptr, code.headIdx) + b = append(b, code.escapedKey...) + b = appendInt(b, int64(e.ptrToInt(ptr+code.offset))) + b = appendStructEnd(b) + code = code.next + case opStructEscapedEndInt8Ptr: + b = append(b, code.escapedKey...) + 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 = appendStructEnd(b) + code = code.next + case opStructEscapedEndInt8: + ptr := load(ctxptr, code.headIdx) + b = append(b, code.escapedKey...) + b = appendInt(b, int64(e.ptrToInt8(ptr+code.offset))) + b = appendStructEnd(b) + code = code.next + case opStructEscapedEndInt16Ptr: + b = append(b, code.escapedKey...) + 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 = appendStructEnd(b) + code = code.next + case opStructEscapedEndInt16: + ptr := load(ctxptr, code.headIdx) + b = append(b, code.escapedKey...) + b = appendInt(b, int64(e.ptrToInt16(ptr+code.offset))) + b = appendStructEnd(b) + code = code.next + case opStructEscapedEndInt32Ptr: + b = append(b, code.escapedKey...) + 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 = appendStructEnd(b) + code = code.next + case opStructEscapedEndInt32: + ptr := load(ctxptr, code.headIdx) + b = append(b, code.escapedKey...) + b = appendInt(b, int64(e.ptrToInt32(ptr+code.offset))) + b = appendStructEnd(b) + code = code.next + case opStructEscapedEndInt64Ptr: + b = append(b, code.escapedKey...) + 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 = appendStructEnd(b) + code = code.next + case opStructEscapedEndInt64: + ptr := load(ctxptr, code.headIdx) + b = append(b, code.escapedKey...) + b = appendInt(b, e.ptrToInt64(ptr+code.offset)) + b = appendStructEnd(b) + code = code.next + case opStructEscapedEndUintPtr: + b = append(b, code.escapedKey...) + 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 = appendStructEnd(b) + code = code.next + case opStructEscapedEndUint: + ptr := load(ctxptr, code.headIdx) + b = append(b, code.escapedKey...) + b = appendUint(b, uint64(e.ptrToUint(ptr+code.offset))) + b = appendStructEnd(b) + code = code.next + case opStructEscapedEndUint8Ptr: + b = append(b, code.escapedKey...) + 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 = appendStructEnd(b) + code = code.next + case opStructEscapedEndUint8: + ptr := load(ctxptr, code.headIdx) + b = append(b, code.escapedKey...) + b = appendUint(b, uint64(e.ptrToUint8(ptr+code.offset))) + b = appendStructEnd(b) + code = code.next + case opStructEscapedEndUint16Ptr: + b = append(b, code.escapedKey...) + 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 = appendStructEnd(b) + code = code.next + case opStructEscapedEndUint16: + ptr := load(ctxptr, code.headIdx) + b = append(b, code.escapedKey...) + b = appendUint(b, uint64(e.ptrToUint16(ptr+code.offset))) + b = appendStructEnd(b) + code = code.next + case opStructEscapedEndUint32Ptr: + b = append(b, code.escapedKey...) + 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 = appendStructEnd(b) + code = code.next + case opStructEscapedEndUint32: + ptr := load(ctxptr, code.headIdx) + b = append(b, code.escapedKey...) + b = appendUint(b, uint64(e.ptrToUint32(ptr+code.offset))) + b = appendStructEnd(b) + code = code.next + case opStructEscapedEndUint64Ptr: + b = append(b, code.escapedKey...) + 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 = appendStructEnd(b) + code = code.next + case opStructEscapedEndUint64: + ptr := load(ctxptr, code.headIdx) + b = append(b, code.escapedKey...) + b = appendUint(b, e.ptrToUint64(ptr+code.offset)) + b = appendStructEnd(b) + code = code.next + case opStructEscapedEndFloat32Ptr: + b = append(b, code.escapedKey...) + 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 = appendStructEnd(b) + code = code.next + case opStructEscapedEndFloat32: + ptr := load(ctxptr, code.headIdx) + b = append(b, code.escapedKey...) + b = encodeFloat32(b, e.ptrToFloat32(ptr+code.offset)) + b = appendStructEnd(b) + code = code.next + case opStructEscapedEndFloat64Ptr: + b = append(b, code.escapedKey...) + ptr := load(ctxptr, code.headIdx) + p := e.ptrToPtr(ptr + code.offset) + if p == 0 { + b = encodeNull(b) + b = appendStructEnd(b) + code = code.next + break + } + v := e.ptrToFloat64(p) + if math.IsInf(v, 0) || math.IsNaN(v) { + return nil, errUnsupportedFloat(v) + } + b = encodeFloat64(b, v) + b = appendStructEnd(b) + code = code.next + case opStructEscapedEndFloat64: + ptr := load(ctxptr, code.headIdx) + b = append(b, code.escapedKey...) + v := e.ptrToFloat64(ptr + code.offset) + if math.IsInf(v, 0) || math.IsNaN(v) { + return nil, errUnsupportedFloat(v) + } + b = encodeFloat64(b, v) + b = appendStructEnd(b) + code = code.next + case opStructEscapedEndEscapedStringPtr: + b = append(b, code.escapedKey...) + ptr := load(ctxptr, code.headIdx) + p := e.ptrToPtr(ptr + code.offset) + if p == 0 { + b = encodeNull(b) + } else { + b = encodeEscapedString(b, e.ptrToString(p)) + } + b = appendStructEnd(b) + code = code.next + case opStructEscapedEndEscapedString: + ptr := load(ctxptr, code.headIdx) + b = append(b, code.escapedKey...) + b = encodeEscapedString(b, e.ptrToString(ptr+code.offset)) + b = appendStructEnd(b) + code = code.next + case opStructEscapedEndBoolPtr: + b = append(b, code.escapedKey...) + ptr := load(ctxptr, code.headIdx) + p := e.ptrToPtr(ptr + code.offset) + if p == 0 { + b = encodeNull(b) + } else { + b = encodeBool(b, e.ptrToBool(p)) + } + b = appendStructEnd(b) + code = code.next + case opStructEscapedEndBool: + ptr := load(ctxptr, code.headIdx) + b = append(b, code.escapedKey...) + b = encodeBool(b, e.ptrToBool(ptr+code.offset)) + b = appendStructEnd(b) + code = code.next + case opStructEscapedEndBytes: + ptr := load(ctxptr, code.headIdx) + b = append(b, code.escapedKey...) + b = encodeByteSlice(b, e.ptrToBytes(ptr+code.offset)) + b = appendStructEnd(b) + code = code.next + case opStructEscapedEndMarshalJSON: + ptr := load(ctxptr, code.headIdx) + b = append(b, code.escapedKey...) + 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 = appendStructEnd(b) + code = code.next + case opStructEscapedEndMarshalText: + ptr := load(ctxptr, code.headIdx) + b = append(b, code.escapedKey...) + 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 = appendStructEnd(b) + code = code.next + case opStructEscapedEndOmitEmptyInt: + ptr := load(ctxptr, code.headIdx) + v := e.ptrToInt(ptr + code.offset) + if v != 0 { + b = append(b, code.escapedKey...) + b = appendInt(b, int64(v)) + } + b = appendStructEnd(b) + code = code.next + case opStructEscapedEndOmitEmptyInt8: + ptr := load(ctxptr, code.headIdx) + v := e.ptrToInt8(ptr + code.offset) + if v != 0 { + b = append(b, code.escapedKey...) + b = appendInt(b, int64(v)) + } + b = appendStructEnd(b) + code = code.next + case opStructEscapedEndOmitEmptyInt16: + ptr := load(ctxptr, code.headIdx) + v := e.ptrToInt16(ptr + code.offset) + if v != 0 { + b = append(b, code.escapedKey...) + b = appendInt(b, int64(v)) + } + b = appendStructEnd(b) + code = code.next + case opStructEscapedEndOmitEmptyInt32: + ptr := load(ctxptr, code.headIdx) + v := e.ptrToInt32(ptr + code.offset) + if v != 0 { + b = append(b, code.escapedKey...) + b = appendInt(b, int64(v)) + } + b = appendStructEnd(b) + code = code.next + case opStructEscapedEndOmitEmptyInt64: + ptr := load(ctxptr, code.headIdx) + v := e.ptrToInt64(ptr + code.offset) + if v != 0 { + b = append(b, code.escapedKey...) + b = appendInt(b, v) + } + b = appendStructEnd(b) + code = code.next + case opStructEscapedEndOmitEmptyUint: + ptr := load(ctxptr, code.headIdx) + v := e.ptrToUint(ptr + code.offset) + if v != 0 { + b = append(b, code.escapedKey...) + b = appendUint(b, uint64(v)) + } + b = appendStructEnd(b) + code = code.next + case opStructEscapedEndOmitEmptyUint8: + ptr := load(ctxptr, code.headIdx) + v := e.ptrToUint8(ptr + code.offset) + if v != 0 { + b = append(b, code.escapedKey...) + b = appendUint(b, uint64(v)) + } + b = appendStructEnd(b) + code = code.next + case opStructEscapedEndOmitEmptyUint16: + ptr := load(ctxptr, code.headIdx) + v := e.ptrToUint16(ptr + code.offset) + if v != 0 { + b = append(b, code.escapedKey...) + b = appendUint(b, uint64(v)) + } + b = appendStructEnd(b) + code = code.next + case opStructEscapedEndOmitEmptyUint32: + ptr := load(ctxptr, code.headIdx) + v := e.ptrToUint32(ptr + code.offset) + if v != 0 { + b = append(b, code.escapedKey...) + b = appendUint(b, uint64(v)) + } + b = appendStructEnd(b) + code = code.next + case opStructEscapedEndOmitEmptyUint64: + ptr := load(ctxptr, code.headIdx) + v := e.ptrToUint64(ptr + code.offset) + if v != 0 { + b = append(b, code.escapedKey...) + b = appendUint(b, v) + } + b = appendStructEnd(b) + code = code.next + case opStructEscapedEndOmitEmptyFloat32: + ptr := load(ctxptr, code.headIdx) + v := e.ptrToFloat32(ptr + code.offset) + if v != 0 { + b = append(b, code.escapedKey...) + b = encodeFloat32(b, v) + } + b = appendStructEnd(b) + code = code.next + case opStructEscapedEndOmitEmptyFloat64: + 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 = append(b, code.escapedKey...) + b = encodeFloat64(b, v) + } + b = appendStructEnd(b) + code = code.next + case opStructEscapedEndOmitEmptyEscapedString: + ptr := load(ctxptr, code.headIdx) + v := e.ptrToString(ptr + code.offset) + if v != "" { + b = append(b, code.escapedKey...) + b = encodeEscapedString(b, v) + } + b = appendStructEnd(b) + code = code.next + case opStructEscapedEndOmitEmptyBool: + ptr := load(ctxptr, code.headIdx) + v := e.ptrToBool(ptr + code.offset) + if v { + b = append(b, code.escapedKey...) + b = encodeBool(b, v) + } + b = appendStructEnd(b) + code = code.next + case opStructEscapedEndOmitEmptyBytes: + ptr := load(ctxptr, code.headIdx) + v := e.ptrToBytes(ptr + code.offset) + if len(v) > 0 { + b = append(b, code.escapedKey...) + b = encodeByteSlice(b, v) + } + b = appendStructEnd(b) + code = code.next + case opStructEscapedEndOmitEmptyMarshalJSON: + ptr := load(ctxptr, code.headIdx) + p := ptr + code.offset + v := e.ptrToInterface(code, p) + if v != nil { + 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, code.escapedKey...) + b = append(b, buf.Bytes()...) + } + b = appendStructEnd(b) + code = code.next + case opStructEscapedEndOmitEmptyMarshalText: + ptr := load(ctxptr, code.headIdx) + p := ptr + code.offset + v := e.ptrToInterface(code, p) + if v != nil { + bytes, err := v.(encoding.TextMarshaler).MarshalText() + if err != nil { + return nil, errMarshaler(code, err) + } + b = append(b, code.escapedKey...) + b = encodeEscapedString(b, *(*string)(unsafe.Pointer(&bytes))) + } + b = appendStructEnd(b) + code = code.next + case opStructEscapedEndStringTagInt: + ptr := load(ctxptr, code.headIdx) + b = append(b, code.escapedKey...) + b = append(b, '"') + b = appendInt(b, int64(e.ptrToInt(ptr+code.offset))) + b = append(b, '"') + b = appendStructEnd(b) + code = code.next + case opStructEscapedEndStringTagInt8: + ptr := load(ctxptr, code.headIdx) + b = append(b, code.escapedKey...) + b = append(b, '"') + b = appendInt(b, int64(e.ptrToInt8(ptr+code.offset))) + b = append(b, '"') + b = appendStructEnd(b) + code = code.next + case opStructEscapedEndStringTagInt16: + ptr := load(ctxptr, code.headIdx) + b = append(b, code.escapedKey...) + b = append(b, '"') + b = appendInt(b, int64(e.ptrToInt16(ptr+code.offset))) + b = append(b, '"') + b = appendStructEnd(b) + code = code.next + case opStructEscapedEndStringTagInt32: + ptr := load(ctxptr, code.headIdx) + b = append(b, code.escapedKey...) + b = append(b, '"') + b = appendInt(b, int64(e.ptrToInt32(ptr+code.offset))) + b = append(b, '"') + b = appendStructEnd(b) + code = code.next + case opStructEscapedEndStringTagInt64: + ptr := load(ctxptr, code.headIdx) + b = append(b, code.escapedKey...) + b = append(b, '"') + b = appendInt(b, e.ptrToInt64(ptr+code.offset)) + b = append(b, '"') + b = appendStructEnd(b) + code = code.next + case opStructEscapedEndStringTagUint: + ptr := load(ctxptr, code.headIdx) + b = append(b, code.escapedKey...) + b = append(b, '"') + b = appendUint(b, uint64(e.ptrToUint(ptr+code.offset))) + b = append(b, '"') + b = appendStructEnd(b) + code = code.next + case opStructEscapedEndStringTagUint8: + ptr := load(ctxptr, code.headIdx) + b = append(b, code.escapedKey...) + b = append(b, '"') + b = appendUint(b, uint64(e.ptrToUint8(ptr+code.offset))) + b = append(b, '"') + b = appendStructEnd(b) + code = code.next + case opStructEscapedEndStringTagUint16: + ptr := load(ctxptr, code.headIdx) + b = append(b, code.escapedKey...) + b = append(b, '"') + b = appendUint(b, uint64(e.ptrToUint16(ptr+code.offset))) + b = append(b, '"') + b = appendStructEnd(b) + code = code.next + case opStructEscapedEndStringTagUint32: + ptr := load(ctxptr, code.headIdx) + b = append(b, code.escapedKey...) + b = append(b, '"') + b = appendUint(b, uint64(e.ptrToUint32(ptr+code.offset))) + b = append(b, '"') + b = appendStructEnd(b) + code = code.next + case opStructEscapedEndStringTagUint64: + ptr := load(ctxptr, code.headIdx) + b = append(b, code.escapedKey...) + b = append(b, '"') + b = appendUint(b, uint64(e.ptrToUint64(ptr+code.offset))) + b = append(b, '"') + b = appendStructEnd(b) + code = code.next + case opStructEscapedEndStringTagFloat32: + ptr := load(ctxptr, code.headIdx) + b = append(b, code.escapedKey...) + b = append(b, '"') + b = encodeFloat32(b, e.ptrToFloat32(ptr+code.offset)) + b = append(b, '"') + b = appendStructEnd(b) + code = code.next + case opStructEscapedEndStringTagFloat64: + ptr := load(ctxptr, code.headIdx) + v := e.ptrToFloat64(ptr + code.offset) + if math.IsInf(v, 0) || math.IsNaN(v) { + return nil, errUnsupportedFloat(v) + } + b = append(b, code.escapedKey...) + b = append(b, '"') + b = encodeFloat64(b, v) + b = append(b, '"') + b = appendStructEnd(b) + code = code.next + case opStructEscapedEndStringTagEscapedString: + ptr := load(ctxptr, code.headIdx) + b = append(b, code.escapedKey...) + s := e.ptrToString(ptr + code.offset) + b = encodeEscapedString(b, string(encodeEscapedString([]byte{}, s))) + b = appendStructEnd(b) + code = code.next + case opStructEscapedEndStringTagBool: + ptr := load(ctxptr, code.headIdx) + b = append(b, code.escapedKey...) + b = append(b, '"') + b = encodeBool(b, e.ptrToBool(ptr+code.offset)) + b = append(b, '"') + b = appendStructEnd(b) + code = code.next + case opStructEscapedEndStringTagBytes: + ptr := load(ctxptr, code.headIdx) + v := e.ptrToBytes(ptr + code.offset) + b = append(b, code.escapedKey...) + b = encodeByteSlice(b, v) + b = appendStructEnd(b) + code = code.next + case opStructEscapedEndStringTagMarshalJSON: + 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, code.escapedKey...) + b = encodeEscapedString(b, buf.String()) + b = appendStructEnd(b) + code = code.next + case opStructEscapedEndStringTagMarshalText: + ptr := load(ctxptr, code.headIdx) + p := ptr + code.offset + v := e.ptrToInterface(code, p) + bytes, err := v.(encoding.TextMarshaler).MarshalText() + if err != nil { + return nil, errMarshaler(code, err) + } + b = append(b, code.escapedKey...) + b = encodeEscapedString(b, *(*string)(unsafe.Pointer(&bytes))) + b = appendStructEnd(b) + code = code.next + case opEnd: + goto END + } + } +END: + return b, nil +} diff --git a/encode_vm_escaped_indent.go b/encode_vm_escaped_indent.go new file mode 100644 index 0000000..661326f --- /dev/null +++ b/encode_vm_escaped_indent.go @@ -0,0 +1,4852 @@ +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) + case opPtrIndent: + ptr := load(ctxptr, code.idx) + code = code.next + store(ctxptr, code.idx, e.ptrToPtr(ptr)) + case opIntIndent: + b = appendInt(b, int64(e.ptrToInt(load(ctxptr, code.idx)))) + b = encodeIndentComma(b) + code = code.next + case opInt8Indent: + b = appendInt(b, int64(e.ptrToInt8(load(ctxptr, code.idx)))) + b = encodeIndentComma(b) + code = code.next + case opInt16Indent: + b = appendInt(b, int64(e.ptrToInt16(load(ctxptr, code.idx)))) + b = encodeIndentComma(b) + code = code.next + case opInt32Indent: + b = appendInt(b, int64(e.ptrToInt32(load(ctxptr, code.idx)))) + b = encodeIndentComma(b) + code = code.next + case opInt64Indent: + b = appendInt(b, e.ptrToInt64(load(ctxptr, code.idx))) + b = encodeIndentComma(b) + code = code.next + case opUintIndent: + b = appendUint(b, uint64(e.ptrToUint(load(ctxptr, code.idx)))) + b = encodeIndentComma(b) + code = code.next + case opUint8Indent: + b = appendUint(b, uint64(e.ptrToUint8(load(ctxptr, code.idx)))) + b = encodeIndentComma(b) + code = code.next + case opUint16Indent: + b = appendUint(b, uint64(e.ptrToUint16(load(ctxptr, code.idx)))) + b = encodeIndentComma(b) + code = code.next + case opUint32Indent: + b = appendUint(b, uint64(e.ptrToUint32(load(ctxptr, code.idx)))) + b = encodeIndentComma(b) + code = code.next + case opUint64Indent: + b = appendUint(b, e.ptrToUint64(load(ctxptr, code.idx))) + b = encodeIndentComma(b) + code = code.next + case opIntStringIndent: + b = append(b, '"') + b = appendInt(b, int64(e.ptrToInt(load(ctxptr, code.idx)))) + b = append(b, '"') + b = encodeIndentComma(b) + code = code.next + case opInt8StringIndent: + b = append(b, '"') + b = appendInt(b, int64(e.ptrToInt8(load(ctxptr, code.idx)))) + b = append(b, '"') + b = encodeIndentComma(b) + code = code.next + case opInt16StringIndent: + b = append(b, '"') + b = appendInt(b, int64(e.ptrToInt16(load(ctxptr, code.idx)))) + b = append(b, '"') + b = encodeIndentComma(b) + code = code.next + case opInt32StringIndent: + b = append(b, '"') + b = appendInt(b, int64(e.ptrToInt32(load(ctxptr, code.idx)))) + b = append(b, '"') + b = encodeIndentComma(b) + code = code.next + case opInt64StringIndent: + b = append(b, '"') + b = appendInt(b, e.ptrToInt64(load(ctxptr, code.idx))) + b = append(b, '"') + b = encodeIndentComma(b) + code = code.next + case opUintStringIndent: + b = append(b, '"') + b = appendUint(b, uint64(e.ptrToUint(load(ctxptr, code.idx)))) + b = append(b, '"') + b = encodeIndentComma(b) + code = code.next + case opUint8StringIndent: + b = append(b, '"') + b = appendUint(b, uint64(e.ptrToUint8(load(ctxptr, code.idx)))) + b = append(b, '"') + b = encodeIndentComma(b) + code = code.next + case opUint16StringIndent: + b = append(b, '"') + b = appendUint(b, uint64(e.ptrToUint16(load(ctxptr, code.idx)))) + b = append(b, '"') + b = encodeIndentComma(b) + code = code.next + case opUint32StringIndent: + b = append(b, '"') + b = appendUint(b, uint64(e.ptrToUint32(load(ctxptr, code.idx)))) + b = append(b, '"') + b = encodeIndentComma(b) + code = code.next + case opUint64StringIndent: + b = append(b, '"') + b = appendUint(b, e.ptrToUint64(load(ctxptr, code.idx))) + b = append(b, '"') + b = encodeIndentComma(b) + code = code.next + case opFloat32Indent: + b = encodeFloat32(b, e.ptrToFloat32(load(ctxptr, code.idx))) + b = encodeIndentComma(b) + code = code.next + case opFloat64Indent: + 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 + case opEscapedStringIndent: + b = encodeEscapedString(b, e.ptrToString(load(ctxptr, code.idx))) + b = encodeIndentComma(b) + code = code.next + case opBoolIndent: + b = encodeBool(b, e.ptrToBool(load(ctxptr, code.idx))) + b = encodeIndentComma(b) + code = code.next + case opBytesIndent: + 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 + case opInterfaceIndent: + 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 = toIndent(c) + 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 + lastCode.op = opInterfaceEndIndent + lastCode.next = code.next + + code = c + recursiveLevel++ + case opInterfaceEndIndent: + recursiveLevel-- + // restore ctxptr + offset := load(ctxptr, code.idx) + ctxptr = ctx.ptr() + offset + ptrOffset = offset + code = code.next + case opMarshalJSONIndent: + 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 + case opMarshalTextIndent: + 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 + case opSliceHeadIndent: + 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 + } + } + case opRootSliceHeadIndent: + 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 + } + } + case opSliceElemIndent: + 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 + } + case opRootSliceElemIndent: + 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 + } + case opArrayHeadIndent: + 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 + } + } + case opArrayElemIndent: + 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 + } + case opMapHeadIndent: + 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 + } + } + case opMapHeadLoadIndent: + 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 + } + } + case opMapKeyIndent: + 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 + } + } + case opMapValueIndent: + 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 + case opMapEndIndent: + // 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 + case opStructEscapedFieldPtrHeadIndent: + p := load(ctxptr, code.idx) + if p == 0 { + b = encodeNull(b) + code = code.end.next + break + } + store(ctxptr, code.idx, e.ptrToPtr(p)) + fallthrough + case opStructEscapedFieldHeadIndent: + 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) + } + case opStructEscapedFieldHeadOnlyIndent: + 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) + case opStructEscapedFieldPtrHeadIntIndent: + store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) + fallthrough + case opStructEscapedFieldHeadIntIndent: + 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 + } + case opStructEscapedFieldPtrHeadIntOnlyIndent, opStructEscapedFieldHeadIntOnlyIndent: + 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 + case opStructEscapedFieldPtrHeadIntPtrIndent: + store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) + fallthrough + case opStructEscapedFieldHeadIntPtrIndent: + 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 + case opStructEscapedFieldPtrHeadIntPtrOnlyIndent: + 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 + case opStructEscapedFieldHeadIntPtrOnlyIndent: + 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 + case opStructEscapedFieldHeadIntNPtrIndent: + 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 + case opStructEscapedFieldPtrAnonymousHeadIntIndent: + store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) + fallthrough + case opStructEscapedFieldAnonymousHeadIntIndent: + 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 + } + case opStructEscapedFieldPtrAnonymousHeadIntOnlyIndent, opStructEscapedFieldAnonymousHeadIntOnlyIndent: + 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 + } + case opStructEscapedFieldPtrAnonymousHeadIntPtrIndent: + store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) + fallthrough + case opStructEscapedFieldAnonymousHeadIntPtrIndent: + 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 + case opStructEscapedFieldPtrAnonymousHeadIntPtrOnlyIndent: + p := load(ctxptr, code.idx) + if p == 0 { + code = code.end.next + break + } + store(ctxptr, code.idx, e.ptrToPtr(p)) + fallthrough + case opStructEscapedFieldAnonymousHeadIntPtrOnlyIndent: + 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 + case opStructEscapedFieldPtrHeadInt8Indent: + store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) + fallthrough + case opStructEscapedFieldHeadInt8Indent: + 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 + } + case opStructEscapedFieldPtrHeadInt8OnlyIndent, opStructEscapedFieldHeadInt8OnlyIndent: + 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 + case opStructEscapedFieldPtrHeadInt8PtrIndent: + store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) + fallthrough + case opStructEscapedFieldHeadInt8PtrIndent: + 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 + case opStructEscapedFieldPtrHeadInt8PtrOnlyIndent: + 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 + case opStructEscapedFieldHeadInt8PtrOnlyIndent: + 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 + case opStructEscapedFieldHeadInt8NPtrIndent: + 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 + case opStructEscapedFieldPtrAnonymousHeadInt8Indent: + store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) + fallthrough + case opStructEscapedFieldAnonymousHeadInt8Indent: + 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 + } + case opStructEscapedFieldPtrAnonymousHeadInt8OnlyIndent, opStructEscapedFieldAnonymousHeadInt8OnlyIndent: + 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 + } + case opStructEscapedFieldPtrAnonymousHeadInt8PtrIndent: + store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) + fallthrough + case opStructEscapedFieldAnonymousHeadInt8PtrIndent: + 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 + case opStructEscapedFieldPtrAnonymousHeadInt8PtrOnlyIndent: + p := load(ctxptr, code.idx) + if p == 0 { + code = code.end.next + break + } + store(ctxptr, code.idx, e.ptrToPtr(p)) + fallthrough + case opStructEscapedFieldAnonymousHeadInt8PtrOnlyIndent: + 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 + case opStructEscapedFieldPtrHeadInt16Indent: + store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) + fallthrough + case opStructEscapedFieldHeadInt16Indent: + 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 + } + case opStructEscapedFieldPtrHeadInt16OnlyIndent, opStructEscapedFieldHeadInt16OnlyIndent: + 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 + case opStructEscapedFieldPtrHeadInt16PtrIndent: + store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) + fallthrough + case opStructEscapedFieldHeadInt16PtrIndent: + 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 + case opStructEscapedFieldPtrHeadInt16PtrOnlyIndent: + 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 + case opStructEscapedFieldHeadInt16PtrOnlyIndent: + 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 + case opStructEscapedFieldHeadInt16NPtrIndent: + 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 + case opStructEscapedFieldPtrAnonymousHeadInt16Indent: + store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) + fallthrough + case opStructEscapedFieldAnonymousHeadInt16Indent: + 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 + } + case opStructEscapedFieldPtrAnonymousHeadInt16OnlyIndent, opStructEscapedFieldAnonymousHeadInt16OnlyIndent: + 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 + } + case opStructEscapedFieldPtrAnonymousHeadInt16PtrIndent: + store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) + fallthrough + case opStructEscapedFieldAnonymousHeadInt16PtrIndent: + 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 + case opStructEscapedFieldPtrAnonymousHeadInt16PtrOnlyIndent: + p := load(ctxptr, code.idx) + if p == 0 { + code = code.end.next + break + } + store(ctxptr, code.idx, e.ptrToPtr(p)) + fallthrough + case opStructEscapedFieldAnonymousHeadInt16PtrOnlyIndent: + 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 + case opStructEscapedFieldPtrHeadInt32Indent: + store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) + fallthrough + case opStructEscapedFieldHeadInt32Indent: + 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 + } + case opStructEscapedFieldPtrHeadInt32OnlyIndent, opStructEscapedFieldHeadInt32OnlyIndent: + 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 + case opStructEscapedFieldPtrHeadInt32PtrIndent: + store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) + fallthrough + case opStructEscapedFieldHeadInt32PtrIndent: + 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 + case opStructEscapedFieldPtrHeadInt32PtrOnlyIndent: + 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 + case opStructEscapedFieldHeadInt32PtrOnlyIndent: + 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 + case opStructEscapedFieldHeadInt32NPtrIndent: + 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 + case opStructEscapedFieldPtrAnonymousHeadInt32Indent: + store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) + fallthrough + case opStructEscapedFieldAnonymousHeadInt32Indent: + 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 + } + case opStructEscapedFieldPtrAnonymousHeadInt32OnlyIndent, opStructEscapedFieldAnonymousHeadInt32OnlyIndent: + 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 + } + case opStructEscapedFieldPtrAnonymousHeadInt32PtrIndent: + store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) + fallthrough + case opStructEscapedFieldAnonymousHeadInt32PtrIndent: + 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 + case opStructEscapedFieldPtrAnonymousHeadInt32PtrOnlyIndent: + p := load(ctxptr, code.idx) + if p == 0 { + code = code.end.next + break + } + store(ctxptr, code.idx, e.ptrToPtr(p)) + fallthrough + case opStructEscapedFieldAnonymousHeadInt32PtrOnlyIndent: + 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 + case opStructEscapedFieldPtrHeadInt64Indent: + store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) + fallthrough + case opStructEscapedFieldHeadInt64Indent: + 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 + } + case opStructEscapedFieldPtrHeadInt64OnlyIndent, opStructEscapedFieldHeadInt64OnlyIndent: + 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 + case opStructEscapedFieldPtrHeadInt64PtrIndent: + store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) + fallthrough + case opStructEscapedFieldHeadInt64PtrIndent: + 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 + case opStructEscapedFieldPtrHeadInt64PtrOnlyIndent: + 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 + case opStructEscapedFieldHeadInt64PtrOnlyIndent: + 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 + case opStructEscapedFieldHeadInt64NPtrIndent: + 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 + case opStructEscapedFieldPtrAnonymousHeadInt64Indent: + store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) + fallthrough + case opStructEscapedFieldAnonymousHeadInt64Indent: + 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 + } + case opStructEscapedFieldPtrAnonymousHeadInt64OnlyIndent, opStructEscapedFieldAnonymousHeadInt64OnlyIndent: + 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 + } + case opStructEscapedFieldPtrAnonymousHeadInt64PtrIndent: + store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) + fallthrough + case opStructEscapedFieldAnonymousHeadInt64PtrIndent: + 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 + case opStructEscapedFieldPtrAnonymousHeadInt64PtrOnlyIndent: + p := load(ctxptr, code.idx) + if p == 0 { + code = code.end.next + break + } + store(ctxptr, code.idx, e.ptrToPtr(p)) + fallthrough + case opStructEscapedFieldAnonymousHeadInt64PtrOnlyIndent: + 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 + case opStructEscapedFieldPtrHeadUintIndent: + store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) + fallthrough + case opStructEscapedFieldHeadUintIndent: + 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 + } + case opStructEscapedFieldPtrHeadUintOnlyIndent, opStructEscapedFieldHeadUintOnlyIndent: + 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 + case opStructEscapedFieldPtrHeadUintPtrIndent: + store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) + fallthrough + case opStructEscapedFieldHeadUintPtrIndent: + 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 + case opStructEscapedFieldPtrHeadUintPtrOnlyIndent: + 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 + case opStructEscapedFieldHeadUintPtrOnlyIndent: + 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 + case opStructEscapedFieldHeadUintNPtrIndent: + 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 + case opStructEscapedFieldPtrAnonymousHeadUintIndent: + store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) + fallthrough + case opStructEscapedFieldAnonymousHeadUintIndent: + 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 + } + case opStructEscapedFieldPtrAnonymousHeadUintOnlyIndent, opStructEscapedFieldAnonymousHeadUintOnlyIndent: + 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 + } + case opStructEscapedFieldPtrAnonymousHeadUintPtrIndent: + store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) + fallthrough + case opStructEscapedFieldAnonymousHeadUintPtrIndent: + 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 + case opStructEscapedFieldPtrAnonymousHeadUintPtrOnlyIndent: + p := load(ctxptr, code.idx) + if p == 0 { + code = code.end.next + break + } + store(ctxptr, code.idx, e.ptrToPtr(p)) + fallthrough + case opStructEscapedFieldAnonymousHeadUintPtrOnlyIndent: + 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 + case opStructEscapedFieldPtrHeadUint8Indent: + store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) + fallthrough + case opStructEscapedFieldHeadUint8Indent: + 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 + } + case opStructEscapedFieldPtrHeadUint8OnlyIndent, opStructEscapedFieldHeadUint8OnlyIndent: + 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 + case opStructEscapedFieldPtrHeadUint8PtrIndent: + store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) + fallthrough + case opStructEscapedFieldHeadUint8PtrIndent: + 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 + case opStructEscapedFieldPtrHeadUint8PtrOnlyIndent: + 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 + case opStructEscapedFieldHeadUint8PtrOnlyIndent: + 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 + case opStructEscapedFieldHeadUint8NPtrIndent: + 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 + case opStructEscapedFieldPtrAnonymousHeadUint8Indent: + store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) + fallthrough + case opStructEscapedFieldAnonymousHeadUint8Indent: + 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 + } + case opStructEscapedFieldPtrAnonymousHeadUint8OnlyIndent, opStructEscapedFieldAnonymousHeadUint8OnlyIndent: + 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 + } + case opStructEscapedFieldPtrAnonymousHeadUint8PtrIndent: + store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) + fallthrough + case opStructEscapedFieldAnonymousHeadUint8PtrIndent: + 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 + case opStructEscapedFieldPtrAnonymousHeadUint8PtrOnlyIndent: + p := load(ctxptr, code.idx) + if p == 0 { + code = code.end.next + break + } + store(ctxptr, code.idx, e.ptrToPtr(p)) + fallthrough + case opStructEscapedFieldAnonymousHeadUint8PtrOnlyIndent: + 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 + case opStructEscapedFieldPtrHeadUint16Indent: + store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) + fallthrough + case opStructEscapedFieldHeadUint16Indent: + 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 + } + case opStructEscapedFieldPtrHeadUint16OnlyIndent, opStructEscapedFieldHeadUint16OnlyIndent: + 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 + case opStructEscapedFieldPtrHeadUint16PtrIndent: + store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) + fallthrough + case opStructEscapedFieldHeadUint16PtrIndent: + 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 + case opStructEscapedFieldPtrHeadUint16PtrOnlyIndent: + 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 + case opStructEscapedFieldHeadUint16PtrOnlyIndent: + 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 + case opStructEscapedFieldHeadUint16NPtrIndent: + 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 + case opStructEscapedFieldPtrAnonymousHeadUint16Indent: + store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) + fallthrough + case opStructEscapedFieldAnonymousHeadUint16Indent: + 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 + } + case opStructEscapedFieldPtrAnonymousHeadUint16OnlyIndent, opStructEscapedFieldAnonymousHeadUint16OnlyIndent: + 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 + } + case opStructEscapedFieldPtrAnonymousHeadUint16PtrIndent: + store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) + fallthrough + case opStructEscapedFieldAnonymousHeadUint16PtrIndent: + 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 + case opStructEscapedFieldPtrAnonymousHeadUint16PtrOnlyIndent: + p := load(ctxptr, code.idx) + if p == 0 { + code = code.end.next + break + } + store(ctxptr, code.idx, e.ptrToPtr(p)) + fallthrough + case opStructEscapedFieldAnonymousHeadUint16PtrOnlyIndent: + 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 + case opStructEscapedFieldPtrHeadUint32Indent: + store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) + fallthrough + case opStructEscapedFieldHeadUint32Indent: + 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 + } + case opStructEscapedFieldPtrHeadUint32OnlyIndent, opStructEscapedFieldHeadUint32OnlyIndent: + 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 + case opStructEscapedFieldPtrHeadUint32PtrIndent: + store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) + fallthrough + case opStructEscapedFieldHeadUint32PtrIndent: + 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 + case opStructEscapedFieldPtrHeadUint32PtrOnlyIndent: + 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 + case opStructEscapedFieldHeadUint32PtrOnlyIndent: + 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 + case opStructEscapedFieldHeadUint32NPtrIndent: + 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 + case opStructEscapedFieldPtrAnonymousHeadUint32Indent: + store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) + fallthrough + case opStructEscapedFieldAnonymousHeadUint32Indent: + 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 + } + case opStructEscapedFieldPtrAnonymousHeadUint32OnlyIndent, opStructEscapedFieldAnonymousHeadUint32OnlyIndent: + 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 + } + case opStructEscapedFieldPtrAnonymousHeadUint32PtrIndent: + store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) + fallthrough + case opStructEscapedFieldAnonymousHeadUint32PtrIndent: + 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 + case opStructEscapedFieldPtrAnonymousHeadUint32PtrOnlyIndent: + p := load(ctxptr, code.idx) + if p == 0 { + code = code.end.next + break + } + store(ctxptr, code.idx, e.ptrToPtr(p)) + fallthrough + case opStructEscapedFieldAnonymousHeadUint32PtrOnlyIndent: + 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 + case opStructEscapedFieldPtrHeadUint64Indent: + store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) + fallthrough + case opStructEscapedFieldHeadUint64Indent: + 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 + } + case opStructEscapedFieldPtrHeadUint64OnlyIndent, opStructEscapedFieldHeadUint64OnlyIndent: + 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 + case opStructEscapedFieldPtrHeadUint64PtrIndent: + store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) + fallthrough + case opStructEscapedFieldHeadUint64PtrIndent: + 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 + case opStructEscapedFieldPtrHeadUint64PtrOnlyIndent: + 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 + case opStructEscapedFieldHeadUint64PtrOnlyIndent: + 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 + case opStructEscapedFieldHeadUint64NPtrIndent: + 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 + case opStructEscapedFieldPtrAnonymousHeadUint64Indent: + store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) + fallthrough + case opStructEscapedFieldAnonymousHeadUint64Indent: + 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 + } + case opStructEscapedFieldPtrAnonymousHeadUint64OnlyIndent, opStructEscapedFieldAnonymousHeadUint64OnlyIndent: + 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 + } + case opStructEscapedFieldPtrAnonymousHeadUint64PtrIndent: + store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) + fallthrough + case opStructEscapedFieldAnonymousHeadUint64PtrIndent: + 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 + case opStructEscapedFieldPtrAnonymousHeadUint64PtrOnlyIndent: + p := load(ctxptr, code.idx) + if p == 0 { + code = code.end.next + break + } + store(ctxptr, code.idx, e.ptrToPtr(p)) + fallthrough + case opStructEscapedFieldAnonymousHeadUint64PtrOnlyIndent: + 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 + case opStructEscapedFieldPtrHeadFloat32Indent: + store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) + fallthrough + case opStructEscapedFieldHeadFloat32Indent: + 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 + } + case opStructEscapedFieldPtrHeadFloat32OnlyIndent, opStructEscapedFieldHeadFloat32OnlyIndent: + 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 + case opStructEscapedFieldPtrHeadFloat32PtrIndent: + store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) + fallthrough + case opStructEscapedFieldHeadFloat32PtrIndent: + 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 + case opStructEscapedFieldPtrHeadFloat32PtrOnlyIndent: + 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 + case opStructEscapedFieldHeadFloat32PtrOnlyIndent: + 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 + case opStructEscapedFieldHeadFloat32NPtrIndent: + 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 + case opStructEscapedFieldPtrAnonymousHeadFloat32Indent: + store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) + fallthrough + case opStructEscapedFieldAnonymousHeadFloat32Indent: + 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 + } + case opStructEscapedFieldPtrAnonymousHeadFloat32OnlyIndent, opStructEscapedFieldAnonymousHeadFloat32OnlyIndent: + 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 + } + case opStructEscapedFieldPtrAnonymousHeadFloat32PtrIndent: + store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) + fallthrough + case opStructEscapedFieldAnonymousHeadFloat32PtrIndent: + 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 + case opStructEscapedFieldPtrAnonymousHeadFloat32PtrOnlyIndent: + p := load(ctxptr, code.idx) + if p == 0 { + code = code.end.next + break + } + store(ctxptr, code.idx, e.ptrToPtr(p)) + fallthrough + case opStructEscapedFieldAnonymousHeadFloat32PtrOnlyIndent: + 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 + case opStructEscapedFieldPtrHeadFloat64Indent: + store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) + fallthrough + case opStructEscapedFieldHeadFloat64Indent: + 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 + } + case opStructEscapedFieldPtrHeadFloat64OnlyIndent, opStructEscapedFieldHeadFloat64OnlyIndent: + 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 + case opStructEscapedFieldPtrHeadFloat64PtrIndent: + store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) + fallthrough + case opStructEscapedFieldHeadFloat64PtrIndent: + 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 + case opStructEscapedFieldPtrHeadFloat64PtrOnlyIndent: + 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 + case opStructEscapedFieldHeadFloat64PtrOnlyIndent: + 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 + case opStructEscapedFieldHeadFloat64NPtrIndent: + 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 + case opStructEscapedFieldPtrAnonymousHeadFloat64Indent: + store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) + fallthrough + case opStructEscapedFieldAnonymousHeadFloat64Indent: + 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 + } + case opStructEscapedFieldPtrAnonymousHeadFloat64OnlyIndent, opStructEscapedFieldAnonymousHeadFloat64OnlyIndent: + 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 + } + case opStructEscapedFieldPtrAnonymousHeadFloat64PtrIndent: + store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) + fallthrough + case opStructEscapedFieldAnonymousHeadFloat64PtrIndent: + 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 + case opStructEscapedFieldPtrAnonymousHeadFloat64PtrOnlyIndent: + p := load(ctxptr, code.idx) + if p == 0 { + code = code.end.next + break + } + store(ctxptr, code.idx, e.ptrToPtr(p)) + fallthrough + case opStructEscapedFieldAnonymousHeadFloat64PtrOnlyIndent: + 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 + case opStructEscapedFieldPtrHeadEscapedStringIndent: + store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) + fallthrough + case opStructEscapedFieldHeadEscapedStringIndent: + 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 + } + case opStructEscapedFieldPtrHeadBoolIndent: + store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) + fallthrough + case opStructEscapedFieldHeadBoolIndent: + 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 + } + case opStructEscapedFieldPtrHeadBytesIndent: + store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) + fallthrough + case opStructEscapedFieldHeadBytesIndent: + 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 + } + case opStructEscapedFieldPtrHeadOmitEmptyIndent: + ptr := load(ctxptr, code.idx) + if ptr != 0 { + store(ctxptr, code.idx, e.ptrToPtr(ptr)) + } + fallthrough + case opStructEscapedFieldHeadOmitEmptyIndent: + 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) + } + } + case opStructEscapedFieldPtrHeadOmitEmptyIntIndent: + ptr := load(ctxptr, code.idx) + if ptr != 0 { + store(ctxptr, code.idx, e.ptrToPtr(ptr)) + } + fallthrough + case opStructEscapedFieldHeadOmitEmptyIntIndent: + 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 + } + } + case opStructEscapedFieldPtrHeadOmitEmptyInt8Indent: + ptr := load(ctxptr, code.idx) + if ptr != 0 { + store(ctxptr, code.idx, e.ptrToPtr(ptr)) + } + fallthrough + case opStructEscapedFieldHeadOmitEmptyInt8Indent: + 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 + } + } + case opStructEscapedFieldPtrHeadOmitEmptyInt16Indent: + ptr := load(ctxptr, code.idx) + if ptr != 0 { + store(ctxptr, code.idx, e.ptrToPtr(ptr)) + } + fallthrough + case opStructEscapedFieldHeadOmitEmptyInt16Indent: + 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 + } + } + case opStructEscapedFieldPtrHeadOmitEmptyInt32Indent: + ptr := load(ctxptr, code.idx) + if ptr != 0 { + store(ctxptr, code.idx, e.ptrToPtr(ptr)) + } + fallthrough + case opStructEscapedFieldHeadOmitEmptyInt32Indent: + 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 + } + } + case opStructEscapedFieldPtrHeadOmitEmptyInt64Indent: + ptr := load(ctxptr, code.idx) + if ptr != 0 { + store(ctxptr, code.idx, e.ptrToPtr(ptr)) + } + fallthrough + case opStructEscapedFieldHeadOmitEmptyInt64Indent: + 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 + } + } + case opStructEscapedFieldPtrHeadOmitEmptyUintIndent: + ptr := load(ctxptr, code.idx) + if ptr != 0 { + store(ctxptr, code.idx, e.ptrToPtr(ptr)) + } + fallthrough + case opStructEscapedFieldHeadOmitEmptyUintIndent: + 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 + } + } + case opStructEscapedFieldPtrHeadOmitEmptyUint8Indent: + ptr := load(ctxptr, code.idx) + if ptr != 0 { + store(ctxptr, code.idx, e.ptrToPtr(ptr)) + } + fallthrough + case opStructEscapedFieldHeadOmitEmptyUint8Indent: + 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 + } + } + case opStructEscapedFieldPtrHeadOmitEmptyUint16Indent: + ptr := load(ctxptr, code.idx) + if ptr != 0 { + store(ctxptr, code.idx, e.ptrToPtr(ptr)) + } + fallthrough + case opStructEscapedFieldHeadOmitEmptyUint16Indent: + 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 + } + } + case opStructEscapedFieldPtrHeadOmitEmptyUint32Indent: + ptr := load(ctxptr, code.idx) + if ptr != 0 { + store(ctxptr, code.idx, e.ptrToPtr(ptr)) + } + fallthrough + case opStructEscapedFieldHeadOmitEmptyUint32Indent: + 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 + } + } + case opStructEscapedFieldPtrHeadOmitEmptyUint64Indent: + ptr := load(ctxptr, code.idx) + if ptr != 0 { + store(ctxptr, code.idx, e.ptrToPtr(ptr)) + } + fallthrough + case opStructEscapedFieldHeadOmitEmptyUint64Indent: + 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 + } + } + case opStructEscapedFieldPtrHeadOmitEmptyFloat32Indent: + ptr := load(ctxptr, code.idx) + if ptr != 0 { + store(ctxptr, code.idx, e.ptrToPtr(ptr)) + } + fallthrough + case opStructEscapedFieldHeadOmitEmptyFloat32Indent: + 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 + } + } + case opStructEscapedFieldPtrHeadOmitEmptyFloat64Indent: + ptr := load(ctxptr, code.idx) + if ptr != 0 { + store(ctxptr, code.idx, e.ptrToPtr(ptr)) + } + fallthrough + case opStructEscapedFieldHeadOmitEmptyFloat64Indent: + 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 + } + } + case opStructEscapedFieldPtrHeadOmitEmptyEscapedStringIndent: + ptr := load(ctxptr, code.idx) + if ptr != 0 { + store(ctxptr, code.idx, e.ptrToPtr(ptr)) + } + fallthrough + case opStructEscapedFieldHeadOmitEmptyEscapedStringIndent: + 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 + } + } + case opStructEscapedFieldPtrHeadOmitEmptyBoolIndent: + ptr := load(ctxptr, code.idx) + if ptr != 0 { + store(ctxptr, code.idx, e.ptrToPtr(ptr)) + } + fallthrough + case opStructEscapedFieldHeadOmitEmptyBoolIndent: + 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 + } + } + case opStructEscapedFieldPtrHeadOmitEmptyBytesIndent: + ptr := load(ctxptr, code.idx) + if ptr != 0 { + store(ctxptr, code.idx, e.ptrToPtr(ptr)) + } + fallthrough + case opStructEscapedFieldHeadOmitEmptyBytesIndent: + 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 + } + } + case opStructEscapedFieldPtrHeadStringTagIndent: + ptr := load(ctxptr, code.idx) + if ptr != 0 { + store(ctxptr, code.idx, e.ptrToPtr(ptr)) + } + fallthrough + case opStructEscapedFieldHeadStringTagIndent: + 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) + } + case opStructEscapedFieldPtrHeadStringTagIntIndent: + ptr := load(ctxptr, code.idx) + if ptr != 0 { + store(ctxptr, code.idx, e.ptrToPtr(ptr)) + } + fallthrough + case opStructEscapedFieldHeadStringTagIntIndent: + 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 + } + case opStructEscapedFieldPtrHeadStringTagInt8Indent: + ptr := load(ctxptr, code.idx) + if ptr != 0 { + store(ctxptr, code.idx, e.ptrToPtr(ptr)) + } + fallthrough + case opStructEscapedFieldHeadStringTagInt8Indent: + 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 + } + case opStructEscapedFieldPtrHeadStringTagInt16Indent: + ptr := load(ctxptr, code.idx) + if ptr != 0 { + store(ctxptr, code.idx, e.ptrToPtr(ptr)) + } + fallthrough + case opStructEscapedFieldHeadStringTagInt16Indent: + 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 + } + case opStructEscapedFieldPtrHeadStringTagInt32Indent: + ptr := load(ctxptr, code.idx) + if ptr != 0 { + store(ctxptr, code.idx, e.ptrToPtr(ptr)) + } + fallthrough + case opStructEscapedFieldHeadStringTagInt32Indent: + 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 + } + case opStructEscapedFieldPtrHeadStringTagInt64Indent: + ptr := load(ctxptr, code.idx) + if ptr != 0 { + store(ctxptr, code.idx, e.ptrToPtr(ptr)) + } + fallthrough + case opStructEscapedFieldHeadStringTagInt64Indent: + 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 + } + case opStructEscapedFieldPtrHeadStringTagUintIndent: + ptr := load(ctxptr, code.idx) + if ptr != 0 { + store(ctxptr, code.idx, e.ptrToPtr(ptr)) + } + fallthrough + case opStructEscapedFieldHeadStringTagUintIndent: + 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 + } + case opStructEscapedFieldPtrHeadStringTagUint8Indent: + ptr := load(ctxptr, code.idx) + if ptr != 0 { + store(ctxptr, code.idx, e.ptrToPtr(ptr)) + } + fallthrough + case opStructEscapedFieldHeadStringTagUint8Indent: + 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 + } + case opStructEscapedFieldPtrHeadStringTagUint16Indent: + ptr := load(ctxptr, code.idx) + if ptr != 0 { + store(ctxptr, code.idx, e.ptrToPtr(ptr)) + } + fallthrough + case opStructEscapedFieldHeadStringTagUint16Indent: + 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 + } + case opStructEscapedFieldPtrHeadStringTagUint32Indent: + ptr := load(ctxptr, code.idx) + if ptr != 0 { + store(ctxptr, code.idx, e.ptrToPtr(ptr)) + } + fallthrough + case opStructEscapedFieldHeadStringTagUint32Indent: + 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 + } + case opStructEscapedFieldPtrHeadStringTagUint64Indent: + ptr := load(ctxptr, code.idx) + if ptr != 0 { + store(ctxptr, code.idx, e.ptrToPtr(ptr)) + } + fallthrough + case opStructEscapedFieldHeadStringTagUint64Indent: + 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 + } + case opStructEscapedFieldPtrHeadStringTagFloat32Indent: + ptr := load(ctxptr, code.idx) + if ptr != 0 { + store(ctxptr, code.idx, e.ptrToPtr(ptr)) + } + fallthrough + case opStructEscapedFieldHeadStringTagFloat32Indent: + 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 + } + case opStructEscapedFieldPtrHeadStringTagFloat64Indent: + ptr := load(ctxptr, code.idx) + if ptr != 0 { + store(ctxptr, code.idx, e.ptrToPtr(ptr)) + } + fallthrough + case opStructEscapedFieldHeadStringTagFloat64Indent: + 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 + } + case opStructEscapedFieldPtrHeadStringTagEscapedStringIndent: + ptr := load(ctxptr, code.idx) + if ptr != 0 { + store(ctxptr, code.idx, e.ptrToPtr(ptr)) + } + fallthrough + case opStructEscapedFieldHeadStringTagEscapedStringIndent: + 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 + } + case opStructEscapedFieldPtrHeadStringTagBoolIndent: + ptr := load(ctxptr, code.idx) + if ptr != 0 { + store(ctxptr, code.idx, e.ptrToPtr(ptr)) + } + fallthrough + case opStructEscapedFieldHeadStringTagBoolIndent: + 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 + } + case opStructEscapedFieldPtrHeadStringTagBytesIndent: + ptr := load(ctxptr, code.idx) + if ptr != 0 { + store(ctxptr, code.idx, e.ptrToPtr(ptr)) + } + fallthrough + case opStructEscapedFieldHeadStringTagBytesIndent: + 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 + } + case opStructEscapedFieldIndent: + 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) + case opStructEscapedFieldIntIndent: + 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 + case opStructEscapedFieldInt8Indent: + 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 + case opStructEscapedFieldInt16Indent: + 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 + case opStructEscapedFieldInt32Indent: + 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 + case opStructEscapedFieldInt64Indent: + 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 + case opStructEscapedFieldUintIndent: + 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 + case opStructEscapedFieldUint8Indent: + 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 + case opStructEscapedFieldUint16Indent: + 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 + case opStructEscapedFieldUint32Indent: + 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 + case opStructEscapedFieldUint64Indent: + 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 + case opStructEscapedFieldFloat32Indent: + 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 + case opStructEscapedFieldFloat64Indent: + 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 + case opStructEscapedFieldEscapedStringIndent: + 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 + case opStructEscapedFieldBoolIndent: + 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 + case opStructEscapedFieldBytesIndent: + 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 + case opStructEscapedFieldMarshalJSONIndent: + 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 + case opStructEscapedFieldArrayIndent: + 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 + } + case opStructEscapedFieldSliceIndent: + 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 + } + case opStructEscapedFieldMapIndent: + 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 + } + } + case opStructEscapedFieldMapLoadIndent: + 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 + } + } + case opStructEscapedFieldStructIndent: + 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) + } + } + case opStructEscapedFieldOmitEmptyIndent: + 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) + } + case opStructEscapedFieldOmitEmptyIntIndent: + 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 + case opStructEscapedFieldOmitEmptyInt8Indent: + 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 + case opStructEscapedFieldOmitEmptyInt16Indent: + 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 + case opStructEscapedFieldOmitEmptyInt32Indent: + 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 + case opStructEscapedFieldOmitEmptyInt64Indent: + 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 + case opStructEscapedFieldOmitEmptyUintIndent: + 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 + case opStructEscapedFieldOmitEmptyUint8Indent: + 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 + case opStructEscapedFieldOmitEmptyUint16Indent: + 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 + case opStructEscapedFieldOmitEmptyUint32Indent: + 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 + case opStructEscapedFieldOmitEmptyUint64Indent: + 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 + case opStructEscapedFieldOmitEmptyFloat32Indent: + 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 + case opStructEscapedFieldOmitEmptyFloat64Indent: + 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 + case opStructEscapedFieldOmitEmptyEscapedStringIndent: + 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 + case opStructEscapedFieldOmitEmptyBoolIndent: + 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 + case opStructEscapedFieldOmitEmptyBytesIndent: + 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 + case opStructEscapedFieldOmitEmptyArrayIndent: + 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 + } + case opStructEscapedFieldOmitEmptySliceIndent: + 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 + } + case opStructEscapedFieldOmitEmptyMapIndent: + 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 + } + } + case opStructEscapedFieldOmitEmptyMapLoadIndent: + 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 + } + } + case opStructEscapedFieldOmitEmptyStructIndent: + 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) + } + } + case opStructEscapedFieldStringTagIndent: + 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) + case opStructEscapedFieldStringTagIntIndent: + 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 + case opStructEscapedFieldStringTagInt8Indent: + 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 + case opStructEscapedFieldStringTagInt16Indent: + 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 + case opStructEscapedFieldStringTagInt32Indent: + 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 + case opStructEscapedFieldStringTagInt64Indent: + 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 + case opStructEscapedFieldStringTagUintIndent: + 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 + case opStructEscapedFieldStringTagUint8Indent: + 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 + case opStructEscapedFieldStringTagUint16Indent: + 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 + case opStructEscapedFieldStringTagUint32Indent: + 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 + case opStructEscapedFieldStringTagUint64Indent: + 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 + case opStructEscapedFieldStringTagFloat32Indent: + 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 + case opStructEscapedFieldStringTagFloat64Indent: + 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 + case opStructEscapedFieldStringTagEscapedStringIndent: + 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 + case opStructEscapedFieldStringTagBoolIndent: + 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 + case opStructEscapedFieldStringTagBytesIndent: + 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 + case opStructEscapedFieldStringTagMarshalJSONIndent: + 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 + case opStructEscapedFieldStringTagMarshalTextIndent: + 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 + case opStructAnonymousEndIndent: + code = code.next + case opStructEscapedEndIndent: + 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 + case opStructEscapedEndIntIndent: + 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 + case opStructEscapedEndIntPtrIndent: + 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 + case opStructEscapedEndInt8Indent: + 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 + case opStructEscapedEndInt8PtrIndent: + 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 + case opStructEscapedEndInt16Indent: + 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 + case opStructEscapedEndInt16PtrIndent: + 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 + case opStructEscapedEndInt32Indent: + 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 + case opStructEscapedEndInt32PtrIndent: + 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 + case opStructEscapedEndInt64Indent: + 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 + case opStructEscapedEndInt64PtrIndent: + 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 + case opStructEscapedEndUintIndent: + 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 + case opStructEscapedEndUintPtrIndent: + 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 + case opStructEscapedEndUint8Indent: + 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 + case opStructEscapedEndUint8PtrIndent: + 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 + case opStructEscapedEndUint16Indent: + 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 + case opStructEscapedEndUint16PtrIndent: + 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 + case opStructEscapedEndUint32Indent: + 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 + case opStructEscapedEndUint32PtrIndent: + 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 + case opStructEscapedEndUint64Indent: + 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 + case opStructEscapedEndUint64PtrIndent: + 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 + case opStructEscapedEndFloat32Indent: + 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 + case opStructEscapedEndFloat32PtrIndent: + 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 + case opStructEscapedEndFloat64Indent: + 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 + case opStructEscapedEndFloat64PtrIndent: + 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 + case opStructEscapedEndEscapedStringIndent: + 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 + case opStructEscapedEndBoolIndent: + 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 + case opStructEscapedEndBytesIndent: + 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 + case opStructEscapedEndMarshalJSONIndent: + 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 + case opStructEscapedEndOmitEmptyIntIndent: + 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 + case opStructEscapedEndOmitEmptyInt8Indent: + 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 + case opStructEscapedEndOmitEmptyInt16Indent: + 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 + case opStructEscapedEndOmitEmptyInt32Indent: + 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 + case opStructEscapedEndOmitEmptyInt64Indent: + 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 + case opStructEscapedEndOmitEmptyUintIndent: + 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 + case opStructEscapedEndOmitEmptyUint8Indent: + 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 + case opStructEscapedEndOmitEmptyUint16Indent: + 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 + case opStructEscapedEndOmitEmptyUint32Indent: + 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 + case opStructEscapedEndOmitEmptyUint64Indent: + 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 + case opStructEscapedEndOmitEmptyFloat32Indent: + 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 + case opStructEscapedEndOmitEmptyFloat64Indent: + 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 + case opStructEscapedEndOmitEmptyEscapedStringIndent: + 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 + case opStructEscapedEndOmitEmptyBoolIndent: + 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 + case opStructEscapedEndOmitEmptyBytesIndent: + 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 + case opStructEscapedEndStringTagIntIndent: + 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 + case opStructEscapedEndStringTagInt8Indent: + 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 + case opStructEscapedEndStringTagInt16Indent: + 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 + case opStructEscapedEndStringTagInt32Indent: + 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 + case opStructEscapedEndStringTagInt64Indent: + 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 + case opStructEscapedEndStringTagUintIndent: + 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 + case opStructEscapedEndStringTagUint8Indent: + 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 + case opStructEscapedEndStringTagUint16Indent: + 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 + case opStructEscapedEndStringTagUint32Indent: + 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 + case opStructEscapedEndStringTagUint64Indent: + 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 + case opStructEscapedEndStringTagFloat32Indent: + 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 + case opStructEscapedEndStringTagFloat64Indent: + 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 + case opStructEscapedEndStringTagEscapedStringIndent: + 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 + case opStructEscapedEndStringTagBoolIndent: + 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 + case opStructEscapedEndStringTagBytesIndent: + 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 + case opStructEscapedEndStringTagMarshalJSONIndent: + 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 + case opStructEscapedEndStringTagMarshalTextIndent: + 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 +} diff --git a/encode_vm_indent.go b/encode_vm_indent.go new file mode 100644 index 0000000..f226c5b --- /dev/null +++ b/encode_vm_indent.go @@ -0,0 +1,4851 @@ +package json + +import ( + "bytes" + "encoding" + "fmt" + "math" + "reflect" + "sort" + "unsafe" +) + +func (e *Encoder) runIndent(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) + case opPtrIndent: + ptr := load(ctxptr, code.idx) + code = code.next + store(ctxptr, code.idx, e.ptrToPtr(ptr)) + case opIntIndent: + b = appendInt(b, int64(e.ptrToInt(load(ctxptr, code.idx)))) + b = encodeIndentComma(b) + code = code.next + case opInt8Indent: + b = appendInt(b, int64(e.ptrToInt8(load(ctxptr, code.idx)))) + b = encodeIndentComma(b) + code = code.next + case opInt16Indent: + b = appendInt(b, int64(e.ptrToInt16(load(ctxptr, code.idx)))) + b = encodeIndentComma(b) + code = code.next + case opInt32Indent: + b = appendInt(b, int64(e.ptrToInt32(load(ctxptr, code.idx)))) + b = encodeIndentComma(b) + code = code.next + case opInt64Indent: + b = appendInt(b, e.ptrToInt64(load(ctxptr, code.idx))) + b = encodeIndentComma(b) + code = code.next + case opUintIndent: + b = appendUint(b, uint64(e.ptrToUint(load(ctxptr, code.idx)))) + b = encodeIndentComma(b) + code = code.next + case opUint8Indent: + b = appendUint(b, uint64(e.ptrToUint8(load(ctxptr, code.idx)))) + b = encodeIndentComma(b) + code = code.next + case opUint16Indent: + b = appendUint(b, uint64(e.ptrToUint16(load(ctxptr, code.idx)))) + b = encodeIndentComma(b) + code = code.next + case opUint32Indent: + b = appendUint(b, uint64(e.ptrToUint32(load(ctxptr, code.idx)))) + b = encodeIndentComma(b) + code = code.next + case opUint64Indent: + b = appendUint(b, e.ptrToUint64(load(ctxptr, code.idx))) + b = encodeIndentComma(b) + code = code.next + case opIntStringIndent: + b = append(b, '"') + b = appendInt(b, int64(e.ptrToInt(load(ctxptr, code.idx)))) + b = append(b, '"') + b = encodeIndentComma(b) + code = code.next + case opInt8StringIndent: + b = append(b, '"') + b = appendInt(b, int64(e.ptrToInt8(load(ctxptr, code.idx)))) + b = append(b, '"') + b = encodeIndentComma(b) + code = code.next + case opInt16StringIndent: + b = append(b, '"') + b = appendInt(b, int64(e.ptrToInt16(load(ctxptr, code.idx)))) + b = append(b, '"') + b = encodeIndentComma(b) + code = code.next + case opInt32StringIndent: + b = append(b, '"') + b = appendInt(b, int64(e.ptrToInt32(load(ctxptr, code.idx)))) + b = append(b, '"') + b = encodeIndentComma(b) + code = code.next + case opInt64StringIndent: + b = append(b, '"') + b = appendInt(b, e.ptrToInt64(load(ctxptr, code.idx))) + b = append(b, '"') + b = encodeIndentComma(b) + code = code.next + case opUintStringIndent: + b = append(b, '"') + b = appendUint(b, uint64(e.ptrToUint(load(ctxptr, code.idx)))) + b = append(b, '"') + b = encodeIndentComma(b) + code = code.next + case opUint8StringIndent: + b = append(b, '"') + b = appendUint(b, uint64(e.ptrToUint8(load(ctxptr, code.idx)))) + b = append(b, '"') + b = encodeIndentComma(b) + code = code.next + case opUint16StringIndent: + b = append(b, '"') + b = appendUint(b, uint64(e.ptrToUint16(load(ctxptr, code.idx)))) + b = append(b, '"') + b = encodeIndentComma(b) + code = code.next + case opUint32StringIndent: + b = append(b, '"') + b = appendUint(b, uint64(e.ptrToUint32(load(ctxptr, code.idx)))) + b = append(b, '"') + b = encodeIndentComma(b) + code = code.next + case opUint64StringIndent: + b = append(b, '"') + b = appendUint(b, e.ptrToUint64(load(ctxptr, code.idx))) + b = append(b, '"') + b = encodeIndentComma(b) + code = code.next + case opFloat32Indent: + b = encodeFloat32(b, e.ptrToFloat32(load(ctxptr, code.idx))) + b = encodeIndentComma(b) + code = code.next + case opFloat64Indent: + 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 + case opStringIndent: + b = encodeNoEscapedString(b, e.ptrToString(load(ctxptr, code.idx))) + b = encodeIndentComma(b) + code = code.next + case opBoolIndent: + b = encodeBool(b, e.ptrToBool(load(ctxptr, code.idx))) + b = encodeIndentComma(b) + code = code.next + case opBytesIndent: + 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 + case opInterfaceIndent: + 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 = toIndent(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 + lastCode.op = opInterfaceEndIndent + lastCode.next = code.next + + code = c + recursiveLevel++ + case opInterfaceEndIndent: + recursiveLevel-- + // restore ctxptr + offset := load(ctxptr, code.idx) + ctxptr = ctx.ptr() + offset + ptrOffset = offset + code = code.next + case opMarshalJSONIndent: + 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 + case opMarshalTextIndent: + 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 = encodeNoEscapedString(b, *(*string)(unsafe.Pointer(&bytes))) + b = encodeIndentComma(b) + } + code = code.next + case opSliceHeadIndent: + 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 + } + } + case opRootSliceHeadIndent: + 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 + } + } + case opSliceElemIndent: + 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 + } + case opRootSliceElemIndent: + 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 + } + case opArrayHeadIndent: + 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 + } + } + case opArrayElemIndent: + 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 + } + case opMapHeadIndent: + 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 + } + } + case opMapHeadLoadIndent: + 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 + } + } + case opMapKeyIndent: + 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 + } + } + case opMapValueIndent: + 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 + case opMapEndIndent: + // 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 + case opStructFieldPtrHeadIndent: + p := load(ctxptr, code.idx) + if p == 0 { + b = encodeNull(b) + code = code.end.next + break + } + store(ctxptr, code.idx, e.ptrToPtr(p)) + fallthrough + case opStructFieldHeadIndent: + 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.key...) + b = append(b, ' ') + } + p := ptr + code.offset + code = code.next + store(ctxptr, code.idx, p) + } + case opStructFieldHeadOnlyIndent: + ptr := load(ctxptr, code.idx) + b = append(b, '{', '\n') + if !code.anonymousKey { + b = e.encodeIndent(b, code.indent+1) + b = append(b, code.key...) + b = append(b, ' ') + } + p := ptr + code.offset + code = code.next + store(ctxptr, code.idx, p) + case opStructFieldPtrHeadIntIndent: + store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) + fallthrough + case opStructFieldHeadIntIndent: + 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.key...) + b = append(b, ' ') + b = appendInt(b, int64(e.ptrToInt(ptr+code.offset))) + b = encodeIndentComma(b) + code = code.next + } + case opStructFieldPtrHeadIntOnlyIndent, opStructFieldHeadIntOnlyIndent: + p := load(ctxptr, code.idx) + b = append(b, '{', '\n') + b = e.encodeIndent(b, code.indent+1) + b = append(b, code.key...) + b = append(b, ' ') + b = appendInt(b, int64(e.ptrToInt(p))) + b = encodeIndentComma(b) + code = code.next + case opStructFieldPtrHeadIntPtrIndent: + store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) + fallthrough + case opStructFieldHeadIntPtrIndent: + 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.key...) + 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 + case opStructFieldPtrHeadIntPtrOnlyIndent: + 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 + case opStructFieldHeadIntPtrOnlyIndent: + p := load(ctxptr, code.idx) + b = append(b, '{', '\n') + b = e.encodeIndent(b, code.indent+1) + b = append(b, code.key...) + 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 + case opStructFieldHeadIntNPtrIndent: + 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.key...) + 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 + case opStructFieldPtrAnonymousHeadIntIndent: + store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) + fallthrough + case opStructFieldAnonymousHeadIntIndent: + ptr := load(ctxptr, code.idx) + if ptr == 0 { + code = code.end.next + } else { + b = e.encodeIndent(b, code.indent) + b = append(b, code.key...) + b = append(b, ' ') + b = appendInt(b, int64(e.ptrToInt(ptr+code.offset))) + b = encodeIndentComma(b) + code = code.next + } + case opStructFieldPtrAnonymousHeadIntOnlyIndent, opStructFieldAnonymousHeadIntOnlyIndent: + ptr := load(ctxptr, code.idx) + if ptr == 0 { + code = code.end.next + } else { + b = e.encodeIndent(b, code.indent) + b = append(b, code.key...) + b = append(b, ' ') + b = appendInt(b, int64(e.ptrToInt(ptr+code.offset))) + b = encodeIndentComma(b) + code = code.next + } + case opStructFieldPtrAnonymousHeadIntPtrIndent: + store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) + fallthrough + case opStructFieldAnonymousHeadIntPtrIndent: + p := load(ctxptr, code.idx) + if p == 0 { + code = code.end.next + break + } + b = e.encodeIndent(b, code.indent) + b = append(b, code.key...) + 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 + case opStructFieldPtrAnonymousHeadIntPtrOnlyIndent: + p := load(ctxptr, code.idx) + if p == 0 { + code = code.end.next + break + } + store(ctxptr, code.idx, e.ptrToPtr(p)) + fallthrough + case opStructFieldAnonymousHeadIntPtrOnlyIndent: + p := load(ctxptr, code.idx) + b = e.encodeIndent(b, code.indent) + b = append(b, code.key...) + 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 + case opStructFieldPtrHeadInt8Indent: + store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) + fallthrough + case opStructFieldHeadInt8Indent: + 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.key...) + b = append(b, ' ') + b = appendInt(b, int64(e.ptrToInt8(ptr))) + b = encodeIndentComma(b) + code = code.next + } + case opStructFieldPtrHeadInt8OnlyIndent, opStructFieldHeadInt8OnlyIndent: + p := load(ctxptr, code.idx) + b = append(b, '{', '\n') + b = e.encodeIndent(b, code.indent+1) + b = append(b, code.key...) + b = append(b, ' ') + b = appendInt(b, int64(e.ptrToInt8(p))) + b = encodeIndentComma(b) + code = code.next + case opStructFieldPtrHeadInt8PtrIndent: + store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) + fallthrough + case opStructFieldHeadInt8PtrIndent: + 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.key...) + 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 + case opStructFieldPtrHeadInt8PtrOnlyIndent: + 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 + case opStructFieldHeadInt8PtrOnlyIndent: + p := load(ctxptr, code.idx) + b = append(b, '{', '\n') + b = e.encodeIndent(b, code.indent+1) + b = append(b, code.key...) + 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 + case opStructFieldHeadInt8NPtrIndent: + 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.key...) + 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 + case opStructFieldPtrAnonymousHeadInt8Indent: + store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) + fallthrough + case opStructFieldAnonymousHeadInt8Indent: + ptr := load(ctxptr, code.idx) + if ptr == 0 { + code = code.end.next + } else { + b = e.encodeIndent(b, code.indent) + b = append(b, code.key...) + b = append(b, ' ') + b = appendInt(b, int64(e.ptrToInt8(ptr+code.offset))) + b = encodeIndentComma(b) + code = code.next + } + case opStructFieldPtrAnonymousHeadInt8OnlyIndent, opStructFieldAnonymousHeadInt8OnlyIndent: + ptr := load(ctxptr, code.idx) + if ptr == 0 { + code = code.end.next + } else { + b = e.encodeIndent(b, code.indent) + b = append(b, code.key...) + b = append(b, ' ') + b = appendInt(b, int64(e.ptrToInt8(ptr+code.offset))) + b = encodeIndentComma(b) + code = code.next + } + case opStructFieldPtrAnonymousHeadInt8PtrIndent: + store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) + fallthrough + case opStructFieldAnonymousHeadInt8PtrIndent: + p := load(ctxptr, code.idx) + if p == 0 { + code = code.end.next + break + } + b = e.encodeIndent(b, code.indent) + b = append(b, code.key...) + 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 + case opStructFieldPtrAnonymousHeadInt8PtrOnlyIndent: + p := load(ctxptr, code.idx) + if p == 0 { + code = code.end.next + break + } + store(ctxptr, code.idx, e.ptrToPtr(p)) + fallthrough + case opStructFieldAnonymousHeadInt8PtrOnlyIndent: + p := load(ctxptr, code.idx) + b = e.encodeIndent(b, code.indent) + b = append(b, code.key...) + 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 + case opStructFieldPtrHeadInt16Indent: + store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) + fallthrough + case opStructFieldHeadInt16Indent: + 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.key...) + b = append(b, ' ') + b = appendInt(b, int64(e.ptrToInt16(ptr))) + b = encodeIndentComma(b) + code = code.next + } + case opStructFieldPtrHeadInt16OnlyIndent, opStructFieldHeadInt16OnlyIndent: + p := load(ctxptr, code.idx) + b = append(b, '{', '\n') + b = e.encodeIndent(b, code.indent+1) + b = append(b, code.key...) + b = append(b, ' ') + b = appendInt(b, int64(e.ptrToInt16(p))) + b = encodeIndentComma(b) + code = code.next + case opStructFieldPtrHeadInt16PtrIndent: + store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) + fallthrough + case opStructFieldHeadInt16PtrIndent: + 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.key...) + 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 + case opStructFieldPtrHeadInt16PtrOnlyIndent: + 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 + case opStructFieldHeadInt16PtrOnlyIndent: + p := load(ctxptr, code.idx) + b = append(b, '{', '\n') + b = e.encodeIndent(b, code.indent+1) + b = append(b, code.key...) + 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 + case opStructFieldHeadInt16NPtrIndent: + 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.key...) + 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 + case opStructFieldPtrAnonymousHeadInt16Indent: + store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) + fallthrough + case opStructFieldAnonymousHeadInt16Indent: + ptr := load(ctxptr, code.idx) + if ptr == 0 { + code = code.end.next + } else { + b = e.encodeIndent(b, code.indent) + b = append(b, code.key...) + b = append(b, ' ') + b = appendInt(b, int64(e.ptrToInt16(ptr+code.offset))) + b = encodeIndentComma(b) + code = code.next + } + case opStructFieldPtrAnonymousHeadInt16OnlyIndent, opStructFieldAnonymousHeadInt16OnlyIndent: + ptr := load(ctxptr, code.idx) + if ptr == 0 { + code = code.end.next + } else { + b = e.encodeIndent(b, code.indent) + b = append(b, code.key...) + b = append(b, ' ') + b = appendInt(b, int64(e.ptrToInt16(ptr+code.offset))) + b = encodeIndentComma(b) + code = code.next + } + case opStructFieldPtrAnonymousHeadInt16PtrIndent: + store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) + fallthrough + case opStructFieldAnonymousHeadInt16PtrIndent: + p := load(ctxptr, code.idx) + if p == 0 { + code = code.end.next + break + } + b = e.encodeIndent(b, code.indent) + b = append(b, code.key...) + 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 + case opStructFieldPtrAnonymousHeadInt16PtrOnlyIndent: + p := load(ctxptr, code.idx) + if p == 0 { + code = code.end.next + break + } + store(ctxptr, code.idx, e.ptrToPtr(p)) + fallthrough + case opStructFieldAnonymousHeadInt16PtrOnlyIndent: + p := load(ctxptr, code.idx) + b = e.encodeIndent(b, code.indent) + b = append(b, code.key...) + 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 + case opStructFieldPtrHeadInt32Indent: + store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) + fallthrough + case opStructFieldHeadInt32Indent: + 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.key...) + b = append(b, ' ') + b = appendInt(b, int64(e.ptrToInt32(ptr))) + b = encodeIndentComma(b) + code = code.next + } + case opStructFieldPtrHeadInt32OnlyIndent, opStructFieldHeadInt32OnlyIndent: + p := load(ctxptr, code.idx) + b = append(b, '{', '\n') + b = e.encodeIndent(b, code.indent+1) + b = append(b, code.key...) + b = append(b, ' ') + b = appendInt(b, int64(e.ptrToInt32(p))) + b = encodeIndentComma(b) + code = code.next + case opStructFieldPtrHeadInt32PtrIndent: + store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) + fallthrough + case opStructFieldHeadInt32PtrIndent: + 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.key...) + 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 + case opStructFieldPtrHeadInt32PtrOnlyIndent: + 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 + case opStructFieldHeadInt32PtrOnlyIndent: + p := load(ctxptr, code.idx) + b = append(b, '{', '\n') + b = e.encodeIndent(b, code.indent+1) + b = append(b, code.key...) + 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 + case opStructFieldHeadInt32NPtrIndent: + 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.key...) + 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 + case opStructFieldPtrAnonymousHeadInt32Indent: + store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) + fallthrough + case opStructFieldAnonymousHeadInt32Indent: + ptr := load(ctxptr, code.idx) + if ptr == 0 { + code = code.end.next + } else { + b = e.encodeIndent(b, code.indent) + b = append(b, code.key...) + b = append(b, ' ') + b = appendInt(b, int64(e.ptrToInt32(ptr+code.offset))) + b = encodeIndentComma(b) + code = code.next + } + case opStructFieldPtrAnonymousHeadInt32OnlyIndent, opStructFieldAnonymousHeadInt32OnlyIndent: + ptr := load(ctxptr, code.idx) + if ptr == 0 { + code = code.end.next + } else { + b = e.encodeIndent(b, code.indent) + b = append(b, code.key...) + b = append(b, ' ') + b = appendInt(b, int64(e.ptrToInt32(ptr+code.offset))) + b = encodeIndentComma(b) + code = code.next + } + case opStructFieldPtrAnonymousHeadInt32PtrIndent: + store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) + fallthrough + case opStructFieldAnonymousHeadInt32PtrIndent: + p := load(ctxptr, code.idx) + if p == 0 { + code = code.end.next + break + } + b = e.encodeIndent(b, code.indent) + b = append(b, code.key...) + 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 + case opStructFieldPtrAnonymousHeadInt32PtrOnlyIndent: + p := load(ctxptr, code.idx) + if p == 0 { + code = code.end.next + break + } + store(ctxptr, code.idx, e.ptrToPtr(p)) + fallthrough + case opStructFieldAnonymousHeadInt32PtrOnlyIndent: + p := load(ctxptr, code.idx) + b = e.encodeIndent(b, code.indent) + b = append(b, code.key...) + 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 + case opStructFieldPtrHeadInt64Indent: + store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) + fallthrough + case opStructFieldHeadInt64Indent: + 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.key...) + b = append(b, ' ') + b = appendInt(b, e.ptrToInt64(ptr)) + b = encodeIndentComma(b) + code = code.next + } + case opStructFieldPtrHeadInt64OnlyIndent, opStructFieldHeadInt64OnlyIndent: + p := load(ctxptr, code.idx) + b = append(b, '{', '\n') + b = e.encodeIndent(b, code.indent+1) + b = append(b, code.key...) + b = append(b, ' ') + b = appendInt(b, e.ptrToInt64(p)) + b = encodeIndentComma(b) + code = code.next + case opStructFieldPtrHeadInt64PtrIndent: + store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) + fallthrough + case opStructFieldHeadInt64PtrIndent: + 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.key...) + 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 + case opStructFieldPtrHeadInt64PtrOnlyIndent: + 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 + case opStructFieldHeadInt64PtrOnlyIndent: + p := load(ctxptr, code.idx) + b = append(b, '{', '\n') + b = e.encodeIndent(b, code.indent+1) + b = append(b, code.key...) + b = append(b, ' ') + if p == 0 { + b = encodeNull(b) + } else { + b = appendInt(b, e.ptrToInt64(p+code.offset)) + } + b = encodeIndentComma(b) + code = code.next + case opStructFieldHeadInt64NPtrIndent: + 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.key...) + 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 + case opStructFieldPtrAnonymousHeadInt64Indent: + store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) + fallthrough + case opStructFieldAnonymousHeadInt64Indent: + ptr := load(ctxptr, code.idx) + if ptr == 0 { + code = code.end.next + } else { + b = e.encodeIndent(b, code.indent) + b = append(b, code.key...) + b = append(b, ' ') + b = appendInt(b, e.ptrToInt64(ptr+code.offset)) + b = encodeIndentComma(b) + code = code.next + } + case opStructFieldPtrAnonymousHeadInt64OnlyIndent, opStructFieldAnonymousHeadInt64OnlyIndent: + ptr := load(ctxptr, code.idx) + if ptr == 0 { + code = code.end.next + } else { + b = e.encodeIndent(b, code.indent) + b = append(b, code.key...) + b = append(b, ' ') + b = appendInt(b, e.ptrToInt64(ptr+code.offset)) + b = encodeIndentComma(b) + code = code.next + } + case opStructFieldPtrAnonymousHeadInt64PtrIndent: + store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) + fallthrough + case opStructFieldAnonymousHeadInt64PtrIndent: + p := load(ctxptr, code.idx) + if p == 0 { + code = code.end.next + break + } + b = e.encodeIndent(b, code.indent) + b = append(b, code.key...) + 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 + case opStructFieldPtrAnonymousHeadInt64PtrOnlyIndent: + p := load(ctxptr, code.idx) + if p == 0 { + code = code.end.next + break + } + store(ctxptr, code.idx, e.ptrToPtr(p)) + fallthrough + case opStructFieldAnonymousHeadInt64PtrOnlyIndent: + p := load(ctxptr, code.idx) + b = e.encodeIndent(b, code.indent) + b = append(b, code.key...) + b = append(b, ' ') + if p == 0 { + b = encodeNull(b) + } else { + b = appendInt(b, e.ptrToInt64(p+code.offset)) + } + b = encodeIndentComma(b) + code = code.next + case opStructFieldPtrHeadUintIndent: + store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) + fallthrough + case opStructFieldHeadUintIndent: + 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.key...) + b = append(b, ' ') + b = appendUint(b, uint64(e.ptrToUint(ptr+code.offset))) + b = encodeIndentComma(b) + code = code.next + } + case opStructFieldPtrHeadUintOnlyIndent, opStructFieldHeadUintOnlyIndent: + p := load(ctxptr, code.idx) + b = append(b, '{', '\n') + b = e.encodeIndent(b, code.indent+1) + b = append(b, code.key...) + b = append(b, ' ') + b = appendUint(b, uint64(e.ptrToUint(p))) + b = encodeIndentComma(b) + code = code.next + case opStructFieldPtrHeadUintPtrIndent: + store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) + fallthrough + case opStructFieldHeadUintPtrIndent: + 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.key...) + 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 + case opStructFieldPtrHeadUintPtrOnlyIndent: + 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 + case opStructFieldHeadUintPtrOnlyIndent: + p := load(ctxptr, code.idx) + b = append(b, '{', '\n') + b = e.encodeIndent(b, code.indent+1) + b = append(b, code.key...) + 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 + case opStructFieldHeadUintNPtrIndent: + 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.key...) + 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 + case opStructFieldPtrAnonymousHeadUintIndent: + store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) + fallthrough + case opStructFieldAnonymousHeadUintIndent: + ptr := load(ctxptr, code.idx) + if ptr == 0 { + code = code.end.next + } else { + b = e.encodeIndent(b, code.indent) + b = append(b, code.key...) + b = append(b, ' ') + b = appendUint(b, uint64(e.ptrToUint(ptr+code.offset))) + b = encodeIndentComma(b) + code = code.next + } + case opStructFieldPtrAnonymousHeadUintOnlyIndent, opStructFieldAnonymousHeadUintOnlyIndent: + ptr := load(ctxptr, code.idx) + if ptr == 0 { + code = code.end.next + } else { + b = e.encodeIndent(b, code.indent) + b = append(b, code.key...) + b = append(b, ' ') + b = appendUint(b, uint64(e.ptrToUint(ptr+code.offset))) + b = encodeIndentComma(b) + code = code.next + } + case opStructFieldPtrAnonymousHeadUintPtrIndent: + store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) + fallthrough + case opStructFieldAnonymousHeadUintPtrIndent: + p := load(ctxptr, code.idx) + if p == 0 { + code = code.end.next + break + } + b = e.encodeIndent(b, code.indent) + b = append(b, code.key...) + 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 + case opStructFieldPtrAnonymousHeadUintPtrOnlyIndent: + p := load(ctxptr, code.idx) + if p == 0 { + code = code.end.next + break + } + store(ctxptr, code.idx, e.ptrToPtr(p)) + fallthrough + case opStructFieldAnonymousHeadUintPtrOnlyIndent: + p := load(ctxptr, code.idx) + b = e.encodeIndent(b, code.indent) + b = append(b, code.key...) + 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 + case opStructFieldPtrHeadUint8Indent: + store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) + fallthrough + case opStructFieldHeadUint8Indent: + 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.key...) + b = append(b, ' ') + b = appendUint(b, uint64(e.ptrToUint8(ptr))) + b = encodeIndentComma(b) + code = code.next + } + case opStructFieldPtrHeadUint8OnlyIndent, opStructFieldHeadUint8OnlyIndent: + p := load(ctxptr, code.idx) + b = append(b, '{', '\n') + b = e.encodeIndent(b, code.indent+1) + b = append(b, code.key...) + b = append(b, ' ') + b = appendUint(b, uint64(e.ptrToUint8(p))) + b = encodeIndentComma(b) + code = code.next + case opStructFieldPtrHeadUint8PtrIndent: + store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) + fallthrough + case opStructFieldHeadUint8PtrIndent: + 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.key...) + 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 + case opStructFieldPtrHeadUint8PtrOnlyIndent: + 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 + case opStructFieldHeadUint8PtrOnlyIndent: + p := load(ctxptr, code.idx) + b = append(b, '{', '\n') + b = e.encodeIndent(b, code.indent+1) + b = append(b, code.key...) + 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 + case opStructFieldHeadUint8NPtrIndent: + 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.key...) + 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 + case opStructFieldPtrAnonymousHeadUint8Indent: + store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) + fallthrough + case opStructFieldAnonymousHeadUint8Indent: + ptr := load(ctxptr, code.idx) + if ptr == 0 { + code = code.end.next + } else { + b = e.encodeIndent(b, code.indent) + b = append(b, code.key...) + b = append(b, ' ') + b = appendUint(b, uint64(e.ptrToUint8(ptr+code.offset))) + b = encodeIndentComma(b) + code = code.next + } + case opStructFieldPtrAnonymousHeadUint8OnlyIndent, opStructFieldAnonymousHeadUint8OnlyIndent: + ptr := load(ctxptr, code.idx) + if ptr == 0 { + code = code.end.next + } else { + b = e.encodeIndent(b, code.indent) + b = append(b, code.key...) + b = append(b, ' ') + b = appendUint(b, uint64(e.ptrToUint8(ptr+code.offset))) + b = encodeIndentComma(b) + code = code.next + } + case opStructFieldPtrAnonymousHeadUint8PtrIndent: + store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) + fallthrough + case opStructFieldAnonymousHeadUint8PtrIndent: + p := load(ctxptr, code.idx) + if p == 0 { + code = code.end.next + break + } + b = e.encodeIndent(b, code.indent) + b = append(b, code.key...) + 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 + case opStructFieldPtrAnonymousHeadUint8PtrOnlyIndent: + p := load(ctxptr, code.idx) + if p == 0 { + code = code.end.next + break + } + store(ctxptr, code.idx, e.ptrToPtr(p)) + fallthrough + case opStructFieldAnonymousHeadUint8PtrOnlyIndent: + p := load(ctxptr, code.idx) + b = e.encodeIndent(b, code.indent) + b = append(b, code.key...) + 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 + case opStructFieldPtrHeadUint16Indent: + store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) + fallthrough + case opStructFieldHeadUint16Indent: + 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.key...) + b = append(b, ' ') + b = appendUint(b, uint64(e.ptrToUint16(ptr))) + b = encodeIndentComma(b) + code = code.next + } + case opStructFieldPtrHeadUint16OnlyIndent, opStructFieldHeadUint16OnlyIndent: + p := load(ctxptr, code.idx) + b = append(b, '{', '\n') + b = e.encodeIndent(b, code.indent+1) + b = append(b, code.key...) + b = append(b, ' ') + b = appendUint(b, uint64(e.ptrToUint16(p))) + b = encodeIndentComma(b) + code = code.next + case opStructFieldPtrHeadUint16PtrIndent: + store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) + fallthrough + case opStructFieldHeadUint16PtrIndent: + 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.key...) + 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 + case opStructFieldPtrHeadUint16PtrOnlyIndent: + 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 + case opStructFieldHeadUint16PtrOnlyIndent: + p := load(ctxptr, code.idx) + b = append(b, '{', '\n') + b = e.encodeIndent(b, code.indent+1) + b = append(b, code.key...) + 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 + case opStructFieldHeadUint16NPtrIndent: + 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.key...) + 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 + case opStructFieldPtrAnonymousHeadUint16Indent: + store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) + fallthrough + case opStructFieldAnonymousHeadUint16Indent: + ptr := load(ctxptr, code.idx) + if ptr == 0 { + code = code.end.next + } else { + b = e.encodeIndent(b, code.indent) + b = append(b, code.key...) + b = append(b, ' ') + b = appendUint(b, uint64(e.ptrToUint16(ptr+code.offset))) + b = encodeIndentComma(b) + code = code.next + } + case opStructFieldPtrAnonymousHeadUint16OnlyIndent, opStructFieldAnonymousHeadUint16OnlyIndent: + ptr := load(ctxptr, code.idx) + if ptr == 0 { + code = code.end.next + } else { + b = e.encodeIndent(b, code.indent) + b = append(b, code.key...) + b = append(b, ' ') + b = appendUint(b, uint64(e.ptrToUint16(ptr+code.offset))) + b = encodeIndentComma(b) + code = code.next + } + case opStructFieldPtrAnonymousHeadUint16PtrIndent: + store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) + fallthrough + case opStructFieldAnonymousHeadUint16PtrIndent: + p := load(ctxptr, code.idx) + if p == 0 { + code = code.end.next + break + } + b = e.encodeIndent(b, code.indent) + b = append(b, code.key...) + 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 + case opStructFieldPtrAnonymousHeadUint16PtrOnlyIndent: + p := load(ctxptr, code.idx) + if p == 0 { + code = code.end.next + break + } + store(ctxptr, code.idx, e.ptrToPtr(p)) + fallthrough + case opStructFieldAnonymousHeadUint16PtrOnlyIndent: + p := load(ctxptr, code.idx) + b = e.encodeIndent(b, code.indent) + b = append(b, code.key...) + 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 + case opStructFieldPtrHeadUint32Indent: + store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) + fallthrough + case opStructFieldHeadUint32Indent: + 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.key...) + b = append(b, ' ') + b = appendUint(b, uint64(e.ptrToUint32(ptr))) + b = encodeIndentComma(b) + code = code.next + } + case opStructFieldPtrHeadUint32OnlyIndent, opStructFieldHeadUint32OnlyIndent: + p := load(ctxptr, code.idx) + b = append(b, '{', '\n') + b = e.encodeIndent(b, code.indent+1) + b = append(b, code.key...) + b = append(b, ' ') + b = appendUint(b, uint64(e.ptrToUint32(p))) + b = encodeIndentComma(b) + code = code.next + case opStructFieldPtrHeadUint32PtrIndent: + store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) + fallthrough + case opStructFieldHeadUint32PtrIndent: + 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.key...) + 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 + case opStructFieldPtrHeadUint32PtrOnlyIndent: + 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 + case opStructFieldHeadUint32PtrOnlyIndent: + p := load(ctxptr, code.idx) + b = append(b, '{', '\n') + b = e.encodeIndent(b, code.indent+1) + b = append(b, code.key...) + 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 + case opStructFieldHeadUint32NPtrIndent: + 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.key...) + 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 + case opStructFieldPtrAnonymousHeadUint32Indent: + store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) + fallthrough + case opStructFieldAnonymousHeadUint32Indent: + ptr := load(ctxptr, code.idx) + if ptr == 0 { + code = code.end.next + } else { + b = e.encodeIndent(b, code.indent) + b = append(b, code.key...) + b = append(b, ' ') + b = appendUint(b, uint64(e.ptrToUint32(ptr+code.offset))) + b = encodeIndentComma(b) + code = code.next + } + case opStructFieldPtrAnonymousHeadUint32OnlyIndent, opStructFieldAnonymousHeadUint32OnlyIndent: + ptr := load(ctxptr, code.idx) + if ptr == 0 { + code = code.end.next + } else { + b = e.encodeIndent(b, code.indent) + b = append(b, code.key...) + b = append(b, ' ') + b = appendUint(b, uint64(e.ptrToUint32(ptr+code.offset))) + b = encodeIndentComma(b) + code = code.next + } + case opStructFieldPtrAnonymousHeadUint32PtrIndent: + store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) + fallthrough + case opStructFieldAnonymousHeadUint32PtrIndent: + p := load(ctxptr, code.idx) + if p == 0 { + code = code.end.next + break + } + b = e.encodeIndent(b, code.indent) + b = append(b, code.key...) + 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 + case opStructFieldPtrAnonymousHeadUint32PtrOnlyIndent: + p := load(ctxptr, code.idx) + if p == 0 { + code = code.end.next + break + } + store(ctxptr, code.idx, e.ptrToPtr(p)) + fallthrough + case opStructFieldAnonymousHeadUint32PtrOnlyIndent: + p := load(ctxptr, code.idx) + b = e.encodeIndent(b, code.indent) + b = append(b, code.key...) + 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 + case opStructFieldPtrHeadUint64Indent: + store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) + fallthrough + case opStructFieldHeadUint64Indent: + 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.key...) + b = append(b, ' ') + b = appendUint(b, e.ptrToUint64(ptr)) + b = encodeIndentComma(b) + code = code.next + } + case opStructFieldPtrHeadUint64OnlyIndent, opStructFieldHeadUint64OnlyIndent: + p := load(ctxptr, code.idx) + b = append(b, '{', '\n') + b = e.encodeIndent(b, code.indent+1) + b = append(b, code.key...) + b = append(b, ' ') + b = appendUint(b, e.ptrToUint64(p)) + b = encodeIndentComma(b) + code = code.next + case opStructFieldPtrHeadUint64PtrIndent: + store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) + fallthrough + case opStructFieldHeadUint64PtrIndent: + 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.key...) + 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 + case opStructFieldPtrHeadUint64PtrOnlyIndent: + 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 + case opStructFieldHeadUint64PtrOnlyIndent: + p := load(ctxptr, code.idx) + b = append(b, '{', '\n') + b = e.encodeIndent(b, code.indent+1) + b = append(b, code.key...) + b = append(b, ' ') + if p == 0 { + b = encodeNull(b) + } else { + b = appendUint(b, e.ptrToUint64(p+code.offset)) + } + b = encodeIndentComma(b) + code = code.next + case opStructFieldHeadUint64NPtrIndent: + 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.key...) + 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 + case opStructFieldPtrAnonymousHeadUint64Indent: + store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) + fallthrough + case opStructFieldAnonymousHeadUint64Indent: + ptr := load(ctxptr, code.idx) + if ptr == 0 { + code = code.end.next + } else { + b = e.encodeIndent(b, code.indent) + b = append(b, code.key...) + b = append(b, ' ') + b = appendUint(b, e.ptrToUint64(ptr+code.offset)) + b = encodeIndentComma(b) + code = code.next + } + case opStructFieldPtrAnonymousHeadUint64OnlyIndent, opStructFieldAnonymousHeadUint64OnlyIndent: + ptr := load(ctxptr, code.idx) + if ptr == 0 { + code = code.end.next + } else { + b = e.encodeIndent(b, code.indent) + b = append(b, code.key...) + b = append(b, ' ') + b = appendUint(b, e.ptrToUint64(ptr+code.offset)) + b = encodeIndentComma(b) + code = code.next + } + case opStructFieldPtrAnonymousHeadUint64PtrIndent: + store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) + fallthrough + case opStructFieldAnonymousHeadUint64PtrIndent: + p := load(ctxptr, code.idx) + if p == 0 { + code = code.end.next + break + } + b = e.encodeIndent(b, code.indent) + b = append(b, code.key...) + 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 + case opStructFieldPtrAnonymousHeadUint64PtrOnlyIndent: + p := load(ctxptr, code.idx) + if p == 0 { + code = code.end.next + break + } + store(ctxptr, code.idx, e.ptrToPtr(p)) + fallthrough + case opStructFieldAnonymousHeadUint64PtrOnlyIndent: + p := load(ctxptr, code.idx) + b = e.encodeIndent(b, code.indent) + b = append(b, code.key...) + b = append(b, ' ') + if p == 0 { + b = encodeNull(b) + } else { + b = appendUint(b, e.ptrToUint64(p+code.offset)) + } + b = encodeIndentComma(b) + code = code.next + case opStructFieldPtrHeadFloat32Indent: + store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) + fallthrough + case opStructFieldHeadFloat32Indent: + 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.key...) + b = append(b, ' ') + b = encodeFloat32(b, e.ptrToFloat32(ptr)) + b = encodeIndentComma(b) + code = code.next + } + case opStructFieldPtrHeadFloat32OnlyIndent, opStructFieldHeadFloat32OnlyIndent: + p := load(ctxptr, code.idx) + b = append(b, '{', '\n') + b = e.encodeIndent(b, code.indent+1) + b = append(b, code.key...) + b = append(b, ' ') + b = encodeFloat32(b, e.ptrToFloat32(p)) + b = encodeIndentComma(b) + code = code.next + case opStructFieldPtrHeadFloat32PtrIndent: + store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) + fallthrough + case opStructFieldHeadFloat32PtrIndent: + 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.key...) + 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 + case opStructFieldPtrHeadFloat32PtrOnlyIndent: + 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 + case opStructFieldHeadFloat32PtrOnlyIndent: + p := load(ctxptr, code.idx) + b = append(b, '{', '\n') + b = e.encodeIndent(b, code.indent+1) + b = append(b, code.key...) + b = append(b, ' ') + if p == 0 { + b = encodeNull(b) + } else { + b = encodeFloat32(b, e.ptrToFloat32(p)) + } + b = encodeIndentComma(b) + code = code.next + case opStructFieldHeadFloat32NPtrIndent: + 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.key...) + 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 + case opStructFieldPtrAnonymousHeadFloat32Indent: + store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) + fallthrough + case opStructFieldAnonymousHeadFloat32Indent: + ptr := load(ctxptr, code.idx) + if ptr == 0 { + code = code.end.next + } else { + b = e.encodeIndent(b, code.indent) + b = append(b, code.key...) + b = append(b, ' ') + b = encodeFloat32(b, e.ptrToFloat32(ptr)) + b = encodeIndentComma(b) + code = code.next + } + case opStructFieldPtrAnonymousHeadFloat32OnlyIndent, opStructFieldAnonymousHeadFloat32OnlyIndent: + ptr := load(ctxptr, code.idx) + if ptr == 0 { + code = code.end.next + } else { + b = e.encodeIndent(b, code.indent) + b = append(b, code.key...) + b = append(b, ' ') + b = encodeFloat32(b, e.ptrToFloat32(ptr)) + b = encodeIndentComma(b) + code = code.next + } + case opStructFieldPtrAnonymousHeadFloat32PtrIndent: + store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) + fallthrough + case opStructFieldAnonymousHeadFloat32PtrIndent: + p := load(ctxptr, code.idx) + if p == 0 { + code = code.end.next + break + } + b = e.encodeIndent(b, code.indent) + b = append(b, code.key...) + 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 + case opStructFieldPtrAnonymousHeadFloat32PtrOnlyIndent: + p := load(ctxptr, code.idx) + if p == 0 { + code = code.end.next + break + } + store(ctxptr, code.idx, e.ptrToPtr(p)) + fallthrough + case opStructFieldAnonymousHeadFloat32PtrOnlyIndent: + p := load(ctxptr, code.idx) + b = e.encodeIndent(b, code.indent) + b = append(b, code.key...) + b = append(b, ' ') + if p == 0 { + b = encodeNull(b) + } else { + b = encodeFloat32(b, e.ptrToFloat32(p)) + } + b = encodeIndentComma(b) + code = code.next + case opStructFieldPtrHeadFloat64Indent: + store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) + fallthrough + case opStructFieldHeadFloat64Indent: + 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.key...) + b = append(b, ' ') + b = encodeFloat64(b, v) + b = encodeIndentComma(b) + code = code.next + } + case opStructFieldPtrHeadFloat64OnlyIndent, opStructFieldHeadFloat64OnlyIndent: + p := load(ctxptr, code.idx) + b = append(b, '{', '\n') + b = e.encodeIndent(b, code.indent+1) + b = append(b, code.key...) + 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 + case opStructFieldPtrHeadFloat64PtrIndent: + store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) + fallthrough + case opStructFieldHeadFloat64PtrIndent: + 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.key...) + 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 + case opStructFieldPtrHeadFloat64PtrOnlyIndent: + 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 + case opStructFieldHeadFloat64PtrOnlyIndent: + p := load(ctxptr, code.idx) + b = append(b, '{', '\n') + b = e.encodeIndent(b, code.indent+1) + b = append(b, code.key...) + 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 + case opStructFieldHeadFloat64NPtrIndent: + 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.key...) + 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 + case opStructFieldPtrAnonymousHeadFloat64Indent: + store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) + fallthrough + case opStructFieldAnonymousHeadFloat64Indent: + ptr := load(ctxptr, code.idx) + if ptr == 0 { + code = code.end.next + } else { + b = e.encodeIndent(b, code.indent) + b = append(b, code.key...) + 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 + } + case opStructFieldPtrAnonymousHeadFloat64OnlyIndent, opStructFieldAnonymousHeadFloat64OnlyIndent: + ptr := load(ctxptr, code.idx) + if ptr == 0 { + code = code.end.next + } else { + b = e.encodeIndent(b, code.indent) + b = append(b, code.key...) + 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 + } + case opStructFieldPtrAnonymousHeadFloat64PtrIndent: + store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) + fallthrough + case opStructFieldAnonymousHeadFloat64PtrIndent: + p := load(ctxptr, code.idx) + if p == 0 { + code = code.end.next + break + } + b = e.encodeIndent(b, code.indent) + b = append(b, code.key...) + 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 + case opStructFieldPtrAnonymousHeadFloat64PtrOnlyIndent: + p := load(ctxptr, code.idx) + if p == 0 { + code = code.end.next + break + } + store(ctxptr, code.idx, e.ptrToPtr(p)) + fallthrough + case opStructFieldAnonymousHeadFloat64PtrOnlyIndent: + p := load(ctxptr, code.idx) + b = e.encodeIndent(b, code.indent) + b = append(b, code.key...) + 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 + case opStructFieldPtrHeadStringIndent: + store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) + fallthrough + case opStructFieldHeadStringIndent: + 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.key...) + b = append(b, ' ') + b = encodeNoEscapedString(b, e.ptrToString(ptr)) + b = encodeIndentComma(b) + code = code.next + } + case opStructFieldPtrHeadBoolIndent: + store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) + fallthrough + case opStructFieldHeadBoolIndent: + 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.key...) + b = append(b, ' ') + b = encodeBool(b, e.ptrToBool(ptr)) + b = encodeIndentComma(b) + code = code.next + } + case opStructFieldPtrHeadBytesIndent: + store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx))) + fallthrough + case opStructFieldHeadBytesIndent: + 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.key...) + b = append(b, ' ') + b = encodeByteSlice(b, e.ptrToBytes(ptr)) + b = encodeIndentComma(b) + code = code.next + } + case opStructFieldPtrHeadOmitEmptyIndent: + ptr := load(ctxptr, code.idx) + if ptr != 0 { + store(ctxptr, code.idx, e.ptrToPtr(ptr)) + } + fallthrough + case opStructFieldHeadOmitEmptyIndent: + 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.key...) + b = append(b, ' ') + code = code.next + store(ctxptr, code.idx, p) + } + } + case opStructFieldPtrHeadOmitEmptyIntIndent: + ptr := load(ctxptr, code.idx) + if ptr != 0 { + store(ctxptr, code.idx, e.ptrToPtr(ptr)) + } + fallthrough + case opStructFieldHeadOmitEmptyIntIndent: + 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.key...) + b = append(b, ' ') + b = appendInt(b, int64(v)) + b = encodeIndentComma(b) + code = code.next + } + } + case opStructFieldPtrHeadOmitEmptyInt8Indent: + ptr := load(ctxptr, code.idx) + if ptr != 0 { + store(ctxptr, code.idx, e.ptrToPtr(ptr)) + } + fallthrough + case opStructFieldHeadOmitEmptyInt8Indent: + 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.key...) + b = append(b, ' ') + b = appendInt(b, int64(v)) + b = encodeIndentComma(b) + code = code.next + } + } + case opStructFieldPtrHeadOmitEmptyInt16Indent: + ptr := load(ctxptr, code.idx) + if ptr != 0 { + store(ctxptr, code.idx, e.ptrToPtr(ptr)) + } + fallthrough + case opStructFieldHeadOmitEmptyInt16Indent: + 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.key...) + b = append(b, ' ') + b = appendInt(b, int64(v)) + b = encodeIndentComma(b) + code = code.next + } + } + case opStructFieldPtrHeadOmitEmptyInt32Indent: + ptr := load(ctxptr, code.idx) + if ptr != 0 { + store(ctxptr, code.idx, e.ptrToPtr(ptr)) + } + fallthrough + case opStructFieldHeadOmitEmptyInt32Indent: + 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.key...) + b = append(b, ' ') + b = appendInt(b, int64(v)) + b = encodeIndentComma(b) + code = code.next + } + } + case opStructFieldPtrHeadOmitEmptyInt64Indent: + ptr := load(ctxptr, code.idx) + if ptr != 0 { + store(ctxptr, code.idx, e.ptrToPtr(ptr)) + } + fallthrough + case opStructFieldHeadOmitEmptyInt64Indent: + 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.key...) + b = append(b, ' ') + b = appendInt(b, v) + b = encodeIndentComma(b) + code = code.next + } + } + case opStructFieldPtrHeadOmitEmptyUintIndent: + ptr := load(ctxptr, code.idx) + if ptr != 0 { + store(ctxptr, code.idx, e.ptrToPtr(ptr)) + } + fallthrough + case opStructFieldHeadOmitEmptyUintIndent: + 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.key...) + b = append(b, ' ') + b = appendUint(b, uint64(v)) + b = encodeIndentComma(b) + code = code.next + } + } + case opStructFieldPtrHeadOmitEmptyUint8Indent: + ptr := load(ctxptr, code.idx) + if ptr != 0 { + store(ctxptr, code.idx, e.ptrToPtr(ptr)) + } + fallthrough + case opStructFieldHeadOmitEmptyUint8Indent: + 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.key...) + b = append(b, ' ') + b = appendUint(b, uint64(v)) + b = encodeIndentComma(b) + code = code.next + } + } + case opStructFieldPtrHeadOmitEmptyUint16Indent: + ptr := load(ctxptr, code.idx) + if ptr != 0 { + store(ctxptr, code.idx, e.ptrToPtr(ptr)) + } + fallthrough + case opStructFieldHeadOmitEmptyUint16Indent: + 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.key...) + b = append(b, ' ') + b = appendUint(b, uint64(v)) + b = encodeIndentComma(b) + code = code.next + } + } + case opStructFieldPtrHeadOmitEmptyUint32Indent: + ptr := load(ctxptr, code.idx) + if ptr != 0 { + store(ctxptr, code.idx, e.ptrToPtr(ptr)) + } + fallthrough + case opStructFieldHeadOmitEmptyUint32Indent: + 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.key...) + b = append(b, ' ') + b = appendUint(b, uint64(v)) + b = encodeIndentComma(b) + code = code.next + } + } + case opStructFieldPtrHeadOmitEmptyUint64Indent: + ptr := load(ctxptr, code.idx) + if ptr != 0 { + store(ctxptr, code.idx, e.ptrToPtr(ptr)) + } + fallthrough + case opStructFieldHeadOmitEmptyUint64Indent: + 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.key...) + b = append(b, ' ') + b = appendUint(b, v) + b = encodeIndentComma(b) + code = code.next + } + } + case opStructFieldPtrHeadOmitEmptyFloat32Indent: + ptr := load(ctxptr, code.idx) + if ptr != 0 { + store(ctxptr, code.idx, e.ptrToPtr(ptr)) + } + fallthrough + case opStructFieldHeadOmitEmptyFloat32Indent: + 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.key...) + b = append(b, ' ') + b = encodeFloat32(b, v) + b = encodeIndentComma(b) + code = code.next + } + } + case opStructFieldPtrHeadOmitEmptyFloat64Indent: + ptr := load(ctxptr, code.idx) + if ptr != 0 { + store(ctxptr, code.idx, e.ptrToPtr(ptr)) + } + fallthrough + case opStructFieldHeadOmitEmptyFloat64Indent: + 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.key...) + b = append(b, ' ') + b = encodeFloat64(b, v) + b = encodeIndentComma(b) + code = code.next + } + } + case opStructFieldPtrHeadOmitEmptyStringIndent: + ptr := load(ctxptr, code.idx) + if ptr != 0 { + store(ctxptr, code.idx, e.ptrToPtr(ptr)) + } + fallthrough + case opStructFieldHeadOmitEmptyStringIndent: + 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.key...) + b = append(b, ' ') + b = encodeNoEscapedString(b, v) + b = encodeIndentComma(b) + code = code.next + } + } + case opStructFieldPtrHeadOmitEmptyBoolIndent: + ptr := load(ctxptr, code.idx) + if ptr != 0 { + store(ctxptr, code.idx, e.ptrToPtr(ptr)) + } + fallthrough + case opStructFieldHeadOmitEmptyBoolIndent: + 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.key...) + b = append(b, ' ') + b = encodeBool(b, v) + b = encodeIndentComma(b) + code = code.next + } + } + case opStructFieldPtrHeadOmitEmptyBytesIndent: + ptr := load(ctxptr, code.idx) + if ptr != 0 { + store(ctxptr, code.idx, e.ptrToPtr(ptr)) + } + fallthrough + case opStructFieldHeadOmitEmptyBytesIndent: + 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.key...) + b = append(b, ' ') + b = encodeByteSlice(b, v) + b = encodeIndentComma(b) + code = code.next + } + } + case opStructFieldPtrHeadStringTagIndent: + ptr := load(ctxptr, code.idx) + if ptr != 0 { + store(ctxptr, code.idx, e.ptrToPtr(ptr)) + } + fallthrough + case opStructFieldHeadStringTagIndent: + 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.key...) + b = append(b, ' ') + code = code.next + store(ctxptr, code.idx, p) + } + case opStructFieldPtrHeadStringTagIntIndent: + ptr := load(ctxptr, code.idx) + if ptr != 0 { + store(ctxptr, code.idx, e.ptrToPtr(ptr)) + } + fallthrough + case opStructFieldHeadStringTagIntIndent: + 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.key...) + b = append(b, ' ', '"') + b = appendInt(b, int64(e.ptrToInt(ptr+code.offset))) + b = append(b, '"') + b = encodeIndentComma(b) + code = code.next + } + case opStructFieldPtrHeadStringTagInt8Indent: + ptr := load(ctxptr, code.idx) + if ptr != 0 { + store(ctxptr, code.idx, e.ptrToPtr(ptr)) + } + fallthrough + case opStructFieldHeadStringTagInt8Indent: + 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.key...) + b = append(b, ' ', '"') + b = appendInt(b, int64(e.ptrToInt8(ptr+code.offset))) + b = append(b, '"') + b = encodeIndentComma(b) + code = code.next + } + case opStructFieldPtrHeadStringTagInt16Indent: + ptr := load(ctxptr, code.idx) + if ptr != 0 { + store(ctxptr, code.idx, e.ptrToPtr(ptr)) + } + fallthrough + case opStructFieldHeadStringTagInt16Indent: + 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.key...) + b = append(b, ' ', '"') + b = appendInt(b, int64(e.ptrToInt16(ptr+code.offset))) + b = append(b, '"') + b = encodeIndentComma(b) + code = code.next + } + case opStructFieldPtrHeadStringTagInt32Indent: + ptr := load(ctxptr, code.idx) + if ptr != 0 { + store(ctxptr, code.idx, e.ptrToPtr(ptr)) + } + fallthrough + case opStructFieldHeadStringTagInt32Indent: + 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.key...) + b = append(b, ' ', '"') + b = appendInt(b, int64(e.ptrToInt32(ptr+code.offset))) + b = append(b, '"') + b = encodeIndentComma(b) + code = code.next + } + case opStructFieldPtrHeadStringTagInt64Indent: + ptr := load(ctxptr, code.idx) + if ptr != 0 { + store(ctxptr, code.idx, e.ptrToPtr(ptr)) + } + fallthrough + case opStructFieldHeadStringTagInt64Indent: + 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.key...) + b = append(b, ' ', '"') + b = appendInt(b, e.ptrToInt64(ptr+code.offset)) + b = append(b, '"') + b = encodeIndentComma(b) + code = code.next + } + case opStructFieldPtrHeadStringTagUintIndent: + ptr := load(ctxptr, code.idx) + if ptr != 0 { + store(ctxptr, code.idx, e.ptrToPtr(ptr)) + } + fallthrough + case opStructFieldHeadStringTagUintIndent: + 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.key...) + b = append(b, ' ', '"') + b = appendUint(b, uint64(e.ptrToUint(ptr+code.offset))) + b = append(b, '"') + b = encodeIndentComma(b) + code = code.next + } + case opStructFieldPtrHeadStringTagUint8Indent: + ptr := load(ctxptr, code.idx) + if ptr != 0 { + store(ctxptr, code.idx, e.ptrToPtr(ptr)) + } + fallthrough + case opStructFieldHeadStringTagUint8Indent: + 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.key...) + b = append(b, ' ', '"') + b = appendUint(b, uint64(e.ptrToUint8(ptr+code.offset))) + b = append(b, '"') + b = encodeIndentComma(b) + code = code.next + } + case opStructFieldPtrHeadStringTagUint16Indent: + ptr := load(ctxptr, code.idx) + if ptr != 0 { + store(ctxptr, code.idx, e.ptrToPtr(ptr)) + } + fallthrough + case opStructFieldHeadStringTagUint16Indent: + 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.key...) + b = append(b, ' ', '"') + b = appendUint(b, uint64(e.ptrToUint16(ptr+code.offset))) + b = append(b, '"') + b = encodeIndentComma(b) + code = code.next + } + case opStructFieldPtrHeadStringTagUint32Indent: + ptr := load(ctxptr, code.idx) + if ptr != 0 { + store(ctxptr, code.idx, e.ptrToPtr(ptr)) + } + fallthrough + case opStructFieldHeadStringTagUint32Indent: + 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.key...) + b = append(b, ' ', '"') + b = appendUint(b, uint64(e.ptrToUint32(ptr+code.offset))) + b = append(b, '"') + b = encodeIndentComma(b) + code = code.next + } + case opStructFieldPtrHeadStringTagUint64Indent: + ptr := load(ctxptr, code.idx) + if ptr != 0 { + store(ctxptr, code.idx, e.ptrToPtr(ptr)) + } + fallthrough + case opStructFieldHeadStringTagUint64Indent: + 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.key...) + b = append(b, ' ', '"') + b = appendUint(b, e.ptrToUint64(ptr+code.offset)) + b = append(b, '"') + b = encodeIndentComma(b) + code = code.next + } + case opStructFieldPtrHeadStringTagFloat32Indent: + ptr := load(ctxptr, code.idx) + if ptr != 0 { + store(ctxptr, code.idx, e.ptrToPtr(ptr)) + } + fallthrough + case opStructFieldHeadStringTagFloat32Indent: + 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.key...) + b = append(b, ' ', '"') + b = encodeFloat32(b, e.ptrToFloat32(ptr+code.offset)) + b = append(b, '"') + b = encodeIndentComma(b) + code = code.next + } + case opStructFieldPtrHeadStringTagFloat64Indent: + ptr := load(ctxptr, code.idx) + if ptr != 0 { + store(ctxptr, code.idx, e.ptrToPtr(ptr)) + } + fallthrough + case opStructFieldHeadStringTagFloat64Indent: + 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.key...) + b = append(b, ' ', '"') + b = encodeFloat64(b, v) + b = append(b, '"') + b = encodeIndentComma(b) + code = code.next + } + case opStructFieldPtrHeadStringTagStringIndent: + ptr := load(ctxptr, code.idx) + if ptr != 0 { + store(ctxptr, code.idx, e.ptrToPtr(ptr)) + } + fallthrough + case opStructFieldHeadStringTagStringIndent: + 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.key...) + b = append(b, ' ') + s := e.ptrToString(ptr + code.offset) + b = encodeNoEscapedString(b, string(encodeNoEscapedString([]byte{}, s))) + b = encodeIndentComma(b) + code = code.next + } + case opStructFieldPtrHeadStringTagBoolIndent: + ptr := load(ctxptr, code.idx) + if ptr != 0 { + store(ctxptr, code.idx, e.ptrToPtr(ptr)) + } + fallthrough + case opStructFieldHeadStringTagBoolIndent: + 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.key...) + b = append(b, ' ', '"') + b = encodeBool(b, e.ptrToBool(ptr+code.offset)) + b = append(b, '"') + b = encodeIndentComma(b) + code = code.next + } + case opStructFieldPtrHeadStringTagBytesIndent: + ptr := load(ctxptr, code.idx) + if ptr != 0 { + store(ctxptr, code.idx, e.ptrToPtr(ptr)) + } + fallthrough + case opStructFieldHeadStringTagBytesIndent: + 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.key...) + b = append(b, ' ') + b = encodeByteSlice(b, e.ptrToBytes(ptr+code.offset)) + b = encodeIndentComma(b) + code = code.next + } + case opStructFieldIndent: + b = e.encodeIndent(b, code.indent) + b = append(b, code.key...) + b = append(b, ' ') + ptr := load(ctxptr, code.headIdx) + p := ptr + code.offset + code = code.next + store(ctxptr, code.idx, p) + case opStructFieldIntIndent: + b = e.encodeIndent(b, code.indent) + b = append(b, code.key...) + b = append(b, ' ') + ptr := load(ctxptr, code.headIdx) + b = appendInt(b, int64(e.ptrToInt(ptr+code.offset))) + b = encodeIndentComma(b) + code = code.next + case opStructFieldInt8Indent: + b = e.encodeIndent(b, code.indent) + b = append(b, code.key...) + b = append(b, ' ') + ptr := load(ctxptr, code.headIdx) + b = appendInt(b, int64(e.ptrToInt8(ptr+code.offset))) + b = encodeIndentComma(b) + code = code.next + case opStructFieldInt16Indent: + b = e.encodeIndent(b, code.indent) + b = append(b, code.key...) + b = append(b, ' ') + ptr := load(ctxptr, code.headIdx) + b = appendInt(b, int64(e.ptrToInt16(ptr+code.offset))) + b = encodeIndentComma(b) + code = code.next + case opStructFieldInt32Indent: + b = e.encodeIndent(b, code.indent) + b = append(b, code.key...) + b = append(b, ' ') + ptr := load(ctxptr, code.headIdx) + b = appendInt(b, int64(e.ptrToInt32(ptr+code.offset))) + b = encodeIndentComma(b) + code = code.next + case opStructFieldInt64Indent: + b = e.encodeIndent(b, code.indent) + b = append(b, code.key...) + b = append(b, ' ') + ptr := load(ctxptr, code.headIdx) + b = appendInt(b, e.ptrToInt64(ptr+code.offset)) + b = encodeIndentComma(b) + code = code.next + case opStructFieldUintIndent: + b = e.encodeIndent(b, code.indent) + b = append(b, code.key...) + b = append(b, ' ') + ptr := load(ctxptr, code.headIdx) + b = appendUint(b, uint64(e.ptrToUint(ptr+code.offset))) + b = encodeIndentComma(b) + code = code.next + case opStructFieldUint8Indent: + b = e.encodeIndent(b, code.indent) + b = append(b, code.key...) + b = append(b, ' ') + ptr := load(ctxptr, code.headIdx) + b = appendUint(b, uint64(e.ptrToUint8(ptr+code.offset))) + b = encodeIndentComma(b) + code = code.next + case opStructFieldUint16Indent: + b = e.encodeIndent(b, code.indent) + b = append(b, code.key...) + b = append(b, ' ') + ptr := load(ctxptr, code.headIdx) + b = appendUint(b, uint64(e.ptrToUint16(ptr+code.offset))) + b = encodeIndentComma(b) + code = code.next + case opStructFieldUint32Indent: + b = e.encodeIndent(b, code.indent) + b = append(b, code.key...) + b = append(b, ' ') + ptr := load(ctxptr, code.headIdx) + b = appendUint(b, uint64(e.ptrToUint32(ptr+code.offset))) + b = encodeIndentComma(b) + code = code.next + case opStructFieldUint64Indent: + b = e.encodeIndent(b, code.indent) + b = append(b, code.key...) + b = append(b, ' ') + ptr := load(ctxptr, code.headIdx) + b = appendUint(b, e.ptrToUint64(ptr+code.offset)) + b = encodeIndentComma(b) + code = code.next + case opStructFieldFloat32Indent: + b = e.encodeIndent(b, code.indent) + b = append(b, code.key...) + b = append(b, ' ') + ptr := load(ctxptr, code.headIdx) + b = encodeFloat32(b, e.ptrToFloat32(ptr+code.offset)) + b = encodeIndentComma(b) + code = code.next + case opStructFieldFloat64Indent: + b = e.encodeIndent(b, code.indent) + b = append(b, code.key...) + 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 + case opStructFieldStringIndent: + b = e.encodeIndent(b, code.indent) + b = append(b, code.key...) + b = append(b, ' ') + ptr := load(ctxptr, code.headIdx) + b = encodeNoEscapedString(b, e.ptrToString(ptr+code.offset)) + b = encodeIndentComma(b) + code = code.next + case opStructFieldBoolIndent: + b = e.encodeIndent(b, code.indent) + b = append(b, code.key...) + b = append(b, ' ') + ptr := load(ctxptr, code.headIdx) + b = encodeBool(b, e.ptrToBool(ptr+code.offset)) + b = encodeIndentComma(b) + code = code.next + case opStructFieldBytesIndent: + b = e.encodeIndent(b, code.indent) + b = append(b, code.key...) + b = append(b, ' ') + ptr := load(ctxptr, code.headIdx) + b = encodeByteSlice(b, e.ptrToBytes(ptr+code.offset)) + b = encodeIndentComma(b) + code = code.next + case opStructFieldMarshalJSONIndent: + b = e.encodeIndent(b, code.indent) + b = append(b, code.key...) + 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 + case opStructFieldArrayIndent: + b = e.encodeIndent(b, code.indent) + b = append(b, code.key...) + 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 + } + case opStructFieldSliceIndent: + b = e.encodeIndent(b, code.indent) + b = append(b, code.key...) + 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 + } + case opStructFieldMapIndent: + b = e.encodeIndent(b, code.indent) + b = append(b, code.key...) + 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 + } + } + case opStructFieldMapLoadIndent: + b = e.encodeIndent(b, code.indent) + b = append(b, code.key...) + 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 + } + } + case opStructFieldStructIndent: + ptr := load(ctxptr, code.headIdx) + p := ptr + code.offset + b = e.encodeIndent(b, code.indent) + b = append(b, code.key...) + 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) + } + } + case opStructFieldOmitEmptyIndent: + 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.key...) + b = append(b, ' ') + code = code.next + store(ctxptr, code.idx, p) + } + case opStructFieldOmitEmptyIntIndent: + ptr := load(ctxptr, code.headIdx) + v := e.ptrToInt(ptr + code.offset) + if v != 0 { + b = e.encodeIndent(b, code.indent) + b = append(b, code.key...) + b = append(b, ' ') + b = appendInt(b, int64(v)) + b = encodeIndentComma(b) + } + code = code.next + case opStructFieldOmitEmptyInt8Indent: + ptr := load(ctxptr, code.headIdx) + v := e.ptrToInt8(ptr + code.offset) + if v != 0 { + b = e.encodeIndent(b, code.indent) + b = append(b, code.key...) + b = append(b, ' ') + b = appendInt(b, int64(v)) + b = encodeIndentComma(b) + } + code = code.next + case opStructFieldOmitEmptyInt16Indent: + ptr := load(ctxptr, code.headIdx) + v := e.ptrToInt16(ptr + code.offset) + if v != 0 { + b = e.encodeIndent(b, code.indent) + b = append(b, code.key...) + b = append(b, ' ') + b = appendInt(b, int64(v)) + b = encodeIndentComma(b) + } + code = code.next + case opStructFieldOmitEmptyInt32Indent: + ptr := load(ctxptr, code.headIdx) + v := e.ptrToInt32(ptr + code.offset) + if v != 0 { + b = e.encodeIndent(b, code.indent) + b = append(b, code.key...) + b = append(b, ' ') + b = appendInt(b, int64(v)) + b = encodeIndentComma(b) + } + code = code.next + case opStructFieldOmitEmptyInt64Indent: + ptr := load(ctxptr, code.headIdx) + v := e.ptrToInt64(ptr + code.offset) + if v != 0 { + b = e.encodeIndent(b, code.indent) + b = append(b, code.key...) + b = append(b, ' ') + b = appendInt(b, v) + b = encodeIndentComma(b) + } + code = code.next + case opStructFieldOmitEmptyUintIndent: + ptr := load(ctxptr, code.headIdx) + v := e.ptrToUint(ptr + code.offset) + if v != 0 { + b = e.encodeIndent(b, code.indent) + b = append(b, code.key...) + b = append(b, ' ') + b = appendUint(b, uint64(v)) + b = encodeIndentComma(b) + } + code = code.next + case opStructFieldOmitEmptyUint8Indent: + ptr := load(ctxptr, code.headIdx) + v := e.ptrToUint8(ptr + code.offset) + if v != 0 { + b = e.encodeIndent(b, code.indent) + b = append(b, code.key...) + b = append(b, ' ') + b = appendUint(b, uint64(v)) + b = encodeIndentComma(b) + } + code = code.next + case opStructFieldOmitEmptyUint16Indent: + ptr := load(ctxptr, code.headIdx) + v := e.ptrToUint16(ptr + code.offset) + if v != 0 { + b = e.encodeIndent(b, code.indent) + b = append(b, code.key...) + b = append(b, ' ') + b = appendUint(b, uint64(v)) + b = encodeIndentComma(b) + } + code = code.next + case opStructFieldOmitEmptyUint32Indent: + ptr := load(ctxptr, code.headIdx) + v := e.ptrToUint32(ptr + code.offset) + if v != 0 { + b = e.encodeIndent(b, code.indent) + b = append(b, code.key...) + b = append(b, ' ') + b = appendUint(b, uint64(v)) + b = encodeIndentComma(b) + } + code = code.next + case opStructFieldOmitEmptyUint64Indent: + ptr := load(ctxptr, code.headIdx) + v := e.ptrToUint64(ptr + code.offset) + if v != 0 { + b = e.encodeIndent(b, code.indent) + b = append(b, code.key...) + b = append(b, ' ') + b = appendUint(b, v) + b = encodeIndentComma(b) + } + code = code.next + case opStructFieldOmitEmptyFloat32Indent: + ptr := load(ctxptr, code.headIdx) + v := e.ptrToFloat32(ptr + code.offset) + if v != 0 { + b = e.encodeIndent(b, code.indent) + b = append(b, code.key...) + b = append(b, ' ') + b = encodeFloat32(b, v) + b = encodeIndentComma(b) + } + code = code.next + case opStructFieldOmitEmptyFloat64Indent: + 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.key...) + b = append(b, ' ') + b = encodeFloat64(b, v) + b = encodeIndentComma(b) + } + code = code.next + case opStructFieldOmitEmptyStringIndent: + ptr := load(ctxptr, code.headIdx) + v := e.ptrToString(ptr + code.offset) + if v != "" { + b = e.encodeIndent(b, code.indent) + b = append(b, code.key...) + b = append(b, ' ') + b = encodeNoEscapedString(b, v) + b = encodeIndentComma(b) + } + code = code.next + case opStructFieldOmitEmptyBoolIndent: + ptr := load(ctxptr, code.headIdx) + v := e.ptrToBool(ptr + code.offset) + if v { + b = e.encodeIndent(b, code.indent) + b = append(b, code.key...) + b = append(b, ' ') + b = encodeBool(b, v) + b = encodeIndentComma(b) + } + code = code.next + case opStructFieldOmitEmptyBytesIndent: + 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.key...) + b = append(b, ' ') + b = encodeByteSlice(b, v) + b = encodeIndentComma(b) + } + code = code.next + case opStructFieldOmitEmptyArrayIndent: + 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.key...) + b = append(b, ' ') + code = code.next + } + case opStructFieldOmitEmptySliceIndent: + 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.key...) + b = append(b, ' ') + code = code.next + } + case opStructFieldOmitEmptyMapIndent: + 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.key...) + b = append(b, ' ') + code = code.next + } + } + case opStructFieldOmitEmptyMapLoadIndent: + 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.key...) + b = append(b, ' ') + code = code.next + } + } + case opStructFieldOmitEmptyStructIndent: + 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.key...) + 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) + } + } + case opStructFieldStringTagIndent: + ptr := load(ctxptr, code.headIdx) + p := ptr + code.offset + b = e.encodeIndent(b, code.indent) + b = append(b, code.key...) + b = append(b, ' ') + code = code.next + store(ctxptr, code.idx, p) + case opStructFieldStringTagIntIndent: + ptr := load(ctxptr, code.headIdx) + b = e.encodeIndent(b, code.indent) + b = append(b, code.key...) + b = append(b, ' ', '"') + b = appendInt(b, int64(e.ptrToInt(ptr+code.offset))) + b = append(b, '"') + b = encodeIndentComma(b) + code = code.next + case opStructFieldStringTagInt8Indent: + ptr := load(ctxptr, code.headIdx) + b = e.encodeIndent(b, code.indent) + b = append(b, code.key...) + b = append(b, ' ', '"') + b = appendInt(b, int64(e.ptrToInt8(ptr+code.offset))) + b = append(b, '"') + b = encodeIndentComma(b) + code = code.next + case opStructFieldStringTagInt16Indent: + ptr := load(ctxptr, code.headIdx) + b = e.encodeIndent(b, code.indent) + b = append(b, code.key...) + b = append(b, ' ', '"') + b = appendInt(b, int64(e.ptrToInt16(ptr+code.offset))) + b = append(b, '"') + b = encodeIndentComma(b) + code = code.next + case opStructFieldStringTagInt32Indent: + ptr := load(ctxptr, code.headIdx) + b = e.encodeIndent(b, code.indent) + b = append(b, code.key...) + b = append(b, ' ', '"') + b = appendInt(b, int64(e.ptrToInt32(ptr+code.offset))) + b = append(b, '"') + b = encodeIndentComma(b) + code = code.next + case opStructFieldStringTagInt64Indent: + ptr := load(ctxptr, code.headIdx) + b = e.encodeIndent(b, code.indent) + b = append(b, code.key...) + b = append(b, ' ', '"') + b = appendInt(b, e.ptrToInt64(ptr+code.offset)) + b = append(b, '"') + b = encodeIndentComma(b) + code = code.next + case opStructFieldStringTagUintIndent: + ptr := load(ctxptr, code.headIdx) + b = e.encodeIndent(b, code.indent) + b = append(b, code.key...) + b = append(b, ' ', '"') + b = appendUint(b, uint64(e.ptrToUint(ptr+code.offset))) + b = append(b, '"') + b = encodeIndentComma(b) + code = code.next + case opStructFieldStringTagUint8Indent: + ptr := load(ctxptr, code.headIdx) + b = e.encodeIndent(b, code.indent) + b = append(b, code.key...) + b = append(b, ' ', '"') + b = appendUint(b, uint64(e.ptrToUint8(ptr+code.offset))) + b = append(b, '"') + b = encodeIndentComma(b) + code = code.next + case opStructFieldStringTagUint16Indent: + ptr := load(ctxptr, code.headIdx) + b = e.encodeIndent(b, code.indent) + b = append(b, code.key...) + b = append(b, ' ', '"') + b = appendUint(b, uint64(e.ptrToUint16(ptr+code.offset))) + b = append(b, '"') + b = encodeIndentComma(b) + code = code.next + case opStructFieldStringTagUint32Indent: + ptr := load(ctxptr, code.headIdx) + b = e.encodeIndent(b, code.indent) + b = append(b, code.key...) + b = append(b, ' ', '"') + b = appendUint(b, uint64(e.ptrToUint32(ptr+code.offset))) + b = append(b, '"') + b = encodeIndentComma(b) + code = code.next + case opStructFieldStringTagUint64Indent: + ptr := load(ctxptr, code.headIdx) + b = e.encodeIndent(b, code.indent) + b = append(b, code.key...) + b = append(b, ' ', '"') + b = appendUint(b, e.ptrToUint64(ptr+code.offset)) + b = append(b, '"') + b = encodeIndentComma(b) + code = code.next + case opStructFieldStringTagFloat32Indent: + ptr := load(ctxptr, code.headIdx) + b = e.encodeIndent(b, code.indent) + b = append(b, code.key...) + b = append(b, ' ', '"') + b = encodeFloat32(b, e.ptrToFloat32(ptr+code.offset)) + b = append(b, '"') + b = encodeIndentComma(b) + code = code.next + case opStructFieldStringTagFloat64Indent: + 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.key...) + b = append(b, ' ', '"') + b = encodeFloat64(b, v) + b = append(b, '"') + b = encodeIndentComma(b) + code = code.next + case opStructFieldStringTagStringIndent: + ptr := load(ctxptr, code.headIdx) + b = e.encodeIndent(b, code.indent) + b = append(b, code.key...) + b = append(b, ' ') + s := e.ptrToString(ptr + code.offset) + b = encodeNoEscapedString(b, string(encodeNoEscapedString([]byte{}, s))) + b = encodeIndentComma(b) + code = code.next + case opStructFieldStringTagBoolIndent: + ptr := load(ctxptr, code.headIdx) + b = e.encodeIndent(b, code.indent) + b = append(b, code.key...) + b = append(b, ' ', '"') + b = encodeBool(b, e.ptrToBool(ptr+code.offset)) + b = append(b, '"') + b = encodeIndentComma(b) + code = code.next + case opStructFieldStringTagBytesIndent: + ptr := load(ctxptr, code.headIdx) + b = e.encodeIndent(b, code.indent) + b = append(b, code.key...) + b = append(b, ' ') + b = encodeByteSlice(b, e.ptrToBytes(ptr+code.offset)) + b = encodeIndentComma(b) + code = code.next + case opStructFieldStringTagMarshalJSONIndent: + ptr := load(ctxptr, code.headIdx) + b = e.encodeIndent(b, code.indent) + b = append(b, code.key...) + 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 + case opStructFieldStringTagMarshalTextIndent: + ptr := load(ctxptr, code.headIdx) + b = e.encodeIndent(b, code.indent) + b = append(b, code.key...) + 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 = encodeNoEscapedString(b, *(*string)(unsafe.Pointer(&bytes))) + b = encodeIndentComma(b) + code = code.next + case opStructAnonymousEndIndent: + code = code.next + case opStructEndIndent: + 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 + case opStructEndIntIndent: + b = e.encodeIndent(b, code.indent) + b = append(b, code.key...) + 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 + case opStructEndIntPtrIndent: + b = e.encodeIndent(b, code.indent) + b = append(b, code.key...) + 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 + case opStructEndInt8Indent: + b = e.encodeIndent(b, code.indent) + b = append(b, code.key...) + 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 + case opStructEndInt8PtrIndent: + b = e.encodeIndent(b, code.indent) + b = append(b, code.key...) + 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 + case opStructEndInt16Indent: + b = e.encodeIndent(b, code.indent) + b = append(b, code.key...) + 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 + case opStructEndInt16PtrIndent: + b = e.encodeIndent(b, code.indent) + b = append(b, code.key...) + 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 + case opStructEndInt32Indent: + b = e.encodeIndent(b, code.indent) + b = append(b, code.key...) + 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 + case opStructEndInt32PtrIndent: + b = e.encodeIndent(b, code.indent) + b = append(b, code.key...) + 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 + case opStructEndInt64Indent: + b = e.encodeIndent(b, code.indent) + b = append(b, code.key...) + 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 + case opStructEndInt64PtrIndent: + b = e.encodeIndent(b, code.indent) + b = append(b, code.key...) + 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 + case opStructEndUintIndent: + b = e.encodeIndent(b, code.indent) + b = append(b, code.key...) + 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 + case opStructEndUintPtrIndent: + b = e.encodeIndent(b, code.indent) + b = append(b, code.key...) + 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 + case opStructEndUint8Indent: + b = e.encodeIndent(b, code.indent) + b = append(b, code.key...) + 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 + case opStructEndUint8PtrIndent: + b = e.encodeIndent(b, code.indent) + b = append(b, code.key...) + 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 + case opStructEndUint16Indent: + b = e.encodeIndent(b, code.indent) + b = append(b, code.key...) + 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 + case opStructEndUint16PtrIndent: + b = e.encodeIndent(b, code.indent) + b = append(b, code.key...) + 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 + case opStructEndUint32Indent: + b = e.encodeIndent(b, code.indent) + b = append(b, code.key...) + 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 + case opStructEndUint32PtrIndent: + b = e.encodeIndent(b, code.indent) + b = append(b, code.key...) + 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 + case opStructEndUint64Indent: + b = e.encodeIndent(b, code.indent) + b = append(b, code.key...) + 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 + case opStructEndUint64PtrIndent: + b = e.encodeIndent(b, code.indent) + b = append(b, code.key...) + 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 + case opStructEndFloat32Indent: + b = e.encodeIndent(b, code.indent) + b = append(b, code.key...) + 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 + case opStructEndFloat32PtrIndent: + b = e.encodeIndent(b, code.indent) + b = append(b, code.key...) + 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 + case opStructEndFloat64Indent: + b = e.encodeIndent(b, code.indent) + b = append(b, code.key...) + 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 + case opStructEndFloat64PtrIndent: + b = e.encodeIndent(b, code.indent) + b = append(b, code.key...) + 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 + case opStructEndStringIndent: + b = e.encodeIndent(b, code.indent) + b = append(b, code.key...) + b = append(b, ' ') + ptr := load(ctxptr, code.headIdx) + b = encodeNoEscapedString(b, e.ptrToString(ptr+code.offset)) + b = e.appendStructEndIndent(b, code.indent-1) + code = code.next + case opStructEndBoolIndent: + b = e.encodeIndent(b, code.indent) + b = append(b, code.key...) + 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 + case opStructEndBytesIndent: + b = e.encodeIndent(b, code.indent) + b = append(b, code.key...) + 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 + case opStructEndMarshalJSONIndent: + b = e.encodeIndent(b, code.indent) + b = append(b, code.key...) + 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 + case opStructEndOmitEmptyIntIndent: + ptr := load(ctxptr, code.headIdx) + v := e.ptrToInt(ptr + code.offset) + if v != 0 { + b = e.encodeIndent(b, code.indent) + b = append(b, code.key...) + b = append(b, ' ') + b = appendInt(b, int64(v)) + } + b = e.appendStructEndIndent(b, code.indent-1) + code = code.next + case opStructEndOmitEmptyInt8Indent: + ptr := load(ctxptr, code.headIdx) + v := e.ptrToInt8(ptr + code.offset) + if v != 0 { + b = e.encodeIndent(b, code.indent) + b = append(b, code.key...) + b = append(b, ' ') + b = appendInt(b, int64(v)) + } + b = e.appendStructEndIndent(b, code.indent-1) + code = code.next + case opStructEndOmitEmptyInt16Indent: + ptr := load(ctxptr, code.headIdx) + v := e.ptrToInt16(ptr + code.offset) + if v != 0 { + b = e.encodeIndent(b, code.indent) + b = append(b, code.key...) + b = append(b, ' ') + b = appendInt(b, int64(v)) + } + b = e.appendStructEndIndent(b, code.indent-1) + code = code.next + case opStructEndOmitEmptyInt32Indent: + ptr := load(ctxptr, code.headIdx) + v := e.ptrToInt32(ptr + code.offset) + if v != 0 { + b = e.encodeIndent(b, code.indent) + b = append(b, code.key...) + b = append(b, ' ') + b = appendInt(b, int64(v)) + } + b = e.appendStructEndIndent(b, code.indent-1) + code = code.next + case opStructEndOmitEmptyInt64Indent: + ptr := load(ctxptr, code.headIdx) + v := e.ptrToInt64(ptr + code.offset) + if v != 0 { + b = e.encodeIndent(b, code.indent) + b = append(b, code.key...) + b = append(b, ' ') + b = appendInt(b, v) + } + b = e.appendStructEndIndent(b, code.indent-1) + code = code.next + case opStructEndOmitEmptyUintIndent: + ptr := load(ctxptr, code.headIdx) + v := e.ptrToUint(ptr + code.offset) + if v != 0 { + b = e.encodeIndent(b, code.indent) + b = append(b, code.key...) + b = append(b, ' ') + b = appendUint(b, uint64(v)) + } + b = e.appendStructEndIndent(b, code.indent-1) + code = code.next + case opStructEndOmitEmptyUint8Indent: + ptr := load(ctxptr, code.headIdx) + v := e.ptrToUint8(ptr + code.offset) + if v != 0 { + b = e.encodeIndent(b, code.indent) + b = append(b, code.key...) + b = append(b, ' ') + b = appendUint(b, uint64(v)) + } + b = e.appendStructEndIndent(b, code.indent-1) + code = code.next + case opStructEndOmitEmptyUint16Indent: + ptr := load(ctxptr, code.headIdx) + v := e.ptrToUint16(ptr + code.offset) + if v != 0 { + b = e.encodeIndent(b, code.indent) + b = append(b, code.key...) + b = append(b, ' ') + b = appendUint(b, uint64(v)) + } + b = e.appendStructEndIndent(b, code.indent-1) + code = code.next + case opStructEndOmitEmptyUint32Indent: + ptr := load(ctxptr, code.headIdx) + v := e.ptrToUint32(ptr + code.offset) + if v != 0 { + b = e.encodeIndent(b, code.indent) + b = append(b, code.key...) + b = append(b, ' ') + b = appendUint(b, uint64(v)) + } + b = e.appendStructEndIndent(b, code.indent-1) + code = code.next + case opStructEndOmitEmptyUint64Indent: + ptr := load(ctxptr, code.headIdx) + v := e.ptrToUint64(ptr + code.offset) + if v != 0 { + b = e.encodeIndent(b, code.indent) + b = append(b, code.key...) + b = append(b, ' ') + b = appendUint(b, v) + } + b = e.appendStructEndIndent(b, code.indent-1) + code = code.next + case opStructEndOmitEmptyFloat32Indent: + ptr := load(ctxptr, code.headIdx) + v := e.ptrToFloat32(ptr + code.offset) + if v != 0 { + b = e.encodeIndent(b, code.indent) + b = append(b, code.key...) + b = append(b, ' ') + b = encodeFloat32(b, v) + } + b = e.appendStructEndIndent(b, code.indent-1) + code = code.next + case opStructEndOmitEmptyFloat64Indent: + 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.key...) + b = append(b, ' ') + b = encodeFloat64(b, v) + } + b = e.appendStructEndIndent(b, code.indent-1) + code = code.next + case opStructEndOmitEmptyStringIndent: + ptr := load(ctxptr, code.headIdx) + v := e.ptrToString(ptr + code.offset) + if v != "" { + b = e.encodeIndent(b, code.indent) + b = append(b, code.key...) + b = append(b, ' ') + b = encodeNoEscapedString(b, v) + } + b = e.appendStructEndIndent(b, code.indent-1) + code = code.next + case opStructEndOmitEmptyBoolIndent: + ptr := load(ctxptr, code.headIdx) + v := e.ptrToBool(ptr + code.offset) + if v { + b = e.encodeIndent(b, code.indent) + b = append(b, code.key...) + b = append(b, ' ') + b = encodeBool(b, v) + } + b = e.appendStructEndIndent(b, code.indent-1) + code = code.next + case opStructEndOmitEmptyBytesIndent: + 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.key...) + b = append(b, ' ') + b = encodeByteSlice(b, v) + } + b = e.appendStructEndIndent(b, code.indent-1) + code = code.next + case opStructEndStringTagIntIndent: + ptr := load(ctxptr, code.headIdx) + b = e.encodeIndent(b, code.indent) + b = append(b, code.key...) + 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 + case opStructEndStringTagInt8Indent: + ptr := load(ctxptr, code.headIdx) + b = e.encodeIndent(b, code.indent) + b = append(b, code.key...) + 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 + case opStructEndStringTagInt16Indent: + ptr := load(ctxptr, code.headIdx) + b = e.encodeIndent(b, code.indent) + b = append(b, code.key...) + 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 + case opStructEndStringTagInt32Indent: + ptr := load(ctxptr, code.headIdx) + b = e.encodeIndent(b, code.indent) + b = append(b, code.key...) + 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 + case opStructEndStringTagInt64Indent: + ptr := load(ctxptr, code.headIdx) + b = e.encodeIndent(b, code.indent) + b = append(b, code.key...) + b = append(b, ' ', '"') + b = appendInt(b, e.ptrToInt64(ptr+code.offset)) + b = append(b, '"') + b = e.appendStructEndIndent(b, code.indent-1) + code = code.next + case opStructEndStringTagUintIndent: + ptr := load(ctxptr, code.headIdx) + b = e.encodeIndent(b, code.indent) + b = append(b, code.key...) + 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 + case opStructEndStringTagUint8Indent: + ptr := load(ctxptr, code.headIdx) + b = e.encodeIndent(b, code.indent) + b = append(b, code.key...) + 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 + case opStructEndStringTagUint16Indent: + ptr := load(ctxptr, code.headIdx) + b = e.encodeIndent(b, code.indent) + b = append(b, code.key...) + 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 + case opStructEndStringTagUint32Indent: + ptr := load(ctxptr, code.headIdx) + b = e.encodeIndent(b, code.indent) + b = append(b, code.key...) + 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 + case opStructEndStringTagUint64Indent: + ptr := load(ctxptr, code.headIdx) + b = e.encodeIndent(b, code.indent) + b = append(b, code.key...) + b = append(b, ' ', '"') + b = appendUint(b, e.ptrToUint64(ptr+code.offset)) + b = append(b, '"') + b = e.appendStructEndIndent(b, code.indent-1) + code = code.next + case opStructEndStringTagFloat32Indent: + ptr := load(ctxptr, code.headIdx) + b = e.encodeIndent(b, code.indent) + b = append(b, code.key...) + b = append(b, ' ', '"') + b = encodeFloat32(b, e.ptrToFloat32(ptr+code.offset)) + b = append(b, '"') + b = e.appendStructEndIndent(b, code.indent-1) + code = code.next + case opStructEndStringTagFloat64Indent: + 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.key...) + b = append(b, ' ', '"') + b = encodeFloat64(b, v) + b = append(b, '"') + b = e.appendStructEndIndent(b, code.indent-1) + code = code.next + case opStructEndStringTagStringIndent: + ptr := load(ctxptr, code.headIdx) + b = e.encodeIndent(b, code.indent) + b = append(b, code.key...) + b = append(b, ' ') + s := e.ptrToString(ptr + code.offset) + b = encodeNoEscapedString(b, string(encodeNoEscapedString([]byte{}, s))) + b = e.appendStructEndIndent(b, code.indent-1) + code = code.next + case opStructEndStringTagBoolIndent: + ptr := load(ctxptr, code.headIdx) + b = e.encodeIndent(b, code.indent) + b = append(b, code.key...) + b = append(b, ' ', '"') + b = encodeBool(b, e.ptrToBool(ptr+code.offset)) + b = append(b, '"') + b = e.appendStructEndIndent(b, code.indent-1) + code = code.next + case opStructEndStringTagBytesIndent: + ptr := load(ctxptr, code.headIdx) + b = e.encodeIndent(b, code.indent) + b = append(b, code.key...) + b = append(b, ' ') + b = encodeByteSlice(b, e.ptrToBytes(ptr+code.offset)) + b = e.appendStructEndIndent(b, code.indent-1) + code = code.next + case opStructEndStringTagMarshalJSONIndent: + ptr := load(ctxptr, code.headIdx) + b = e.encodeIndent(b, code.indent) + b = append(b, code.key...) + 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 = encodeNoEscapedString(b, buf.String()) + b = e.appendStructEndIndent(b, code.indent-1) + code = code.next + case opStructEndStringTagMarshalTextIndent: + ptr := load(ctxptr, code.headIdx) + b = e.encodeIndent(b, code.indent) + b = append(b, code.key...) + 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 = encodeNoEscapedString(b, *(*string)(unsafe.Pointer(&bytes))) + b = e.appendStructEndIndent(b, code.indent-1) + code = code.next + case opEnd: + goto END + } + } +END: + return b, nil +}