From 72765ed5238021dd99cbbd363e72e7bea6c9b45c Mon Sep 17 00:00:00 2001 From: Masaaki Goshima Date: Mon, 15 Feb 2021 11:31:49 +0900 Subject: [PATCH] Add StructField operation for ptr type --- encode_vm.go | 323 +++++++++++++++++++++ encode_vm_escaped.go | 323 +++++++++++++++++++++ encode_vm_escaped_indent.go | 554 ++++++++++++++++++++++++++++++++++++ encode_vm_indent.go | 554 ++++++++++++++++++++++++++++++++++++ 4 files changed, 1754 insertions(+) diff --git a/encode_vm.go b/encode_vm.go index eb199ad..d66a872 100644 --- a/encode_vm.go +++ b/encode_vm.go @@ -7328,6 +7328,28 @@ func encodeRun(ctx *encodeRuntimeContext, b []byte, codeSet *opcodeSet, opt Enco } b = encodeComma(b) code = code.next + case opStructFieldOmitEmptyIntPtr: + ptr := load(ctxptr, code.headIdx) + p := ptrToPtr(ptr + code.offset) + if p != 0 { + b = append(b, code.key...) + b = appendInt(b, int64(ptrToInt(p))) + b = encodeComma(b) + } + code = code.next + case opStructFieldStringTagIntPtr: + ptr := load(ctxptr, code.headIdx) + p := ptrToPtr(ptr + code.offset) + b = append(b, code.key...) + if p == 0 { + b = encodeNull(b) + } else { + b = append(b, '"') + b = appendInt(b, int64(ptrToInt(p))) + b = append(b, '"') + } + b = encodeComma(b) + code = code.next case opStructFieldIntNPtr: b = append(b, code.key...) ptr := load(ctxptr, code.headIdx) @@ -7379,6 +7401,28 @@ func encodeRun(ctx *encodeRuntimeContext, b []byte, codeSet *opcodeSet, opt Enco } b = encodeComma(b) code = code.next + case opStructFieldOmitEmptyInt8Ptr: + ptr := load(ctxptr, code.headIdx) + p := ptrToPtr(ptr + code.offset) + if p != 0 { + b = append(b, code.key...) + b = appendInt(b, int64(ptrToInt8(p))) + b = encodeComma(b) + } + code = code.next + case opStructFieldStringTagInt8Ptr: + ptr := load(ctxptr, code.headIdx) + p := ptrToPtr(ptr + code.offset) + b = append(b, code.key...) + if p == 0 { + b = encodeNull(b) + } else { + b = append(b, '"') + b = appendInt(b, int64(ptrToInt8(p))) + b = append(b, '"') + } + b = encodeComma(b) + code = code.next case opStructFieldInt16: ptr := load(ctxptr, code.headIdx) b = append(b, code.key...) @@ -7413,6 +7457,28 @@ func encodeRun(ctx *encodeRuntimeContext, b []byte, codeSet *opcodeSet, opt Enco } b = encodeComma(b) code = code.next + case opStructFieldOmitEmptyInt16Ptr: + ptr := load(ctxptr, code.headIdx) + p := ptrToPtr(ptr + code.offset) + if p != 0 { + b = append(b, code.key...) + b = appendInt(b, int64(ptrToInt16(p))) + b = encodeComma(b) + } + code = code.next + case opStructFieldStringTagInt16Ptr: + ptr := load(ctxptr, code.headIdx) + p := ptrToPtr(ptr + code.offset) + b = append(b, code.key...) + if p == 0 { + b = encodeNull(b) + } else { + b = append(b, '"') + b = appendInt(b, int64(ptrToInt16(p))) + b = append(b, '"') + } + b = encodeComma(b) + code = code.next case opStructFieldInt32: ptr := load(ctxptr, code.headIdx) b = append(b, code.key...) @@ -7447,6 +7513,28 @@ func encodeRun(ctx *encodeRuntimeContext, b []byte, codeSet *opcodeSet, opt Enco } b = encodeComma(b) code = code.next + case opStructFieldOmitEmptyInt32Ptr: + ptr := load(ctxptr, code.headIdx) + p := ptrToPtr(ptr + code.offset) + if p != 0 { + b = append(b, code.key...) + b = appendInt(b, int64(ptrToInt32(p))) + b = encodeComma(b) + } + code = code.next + case opStructFieldStringTagInt32Ptr: + ptr := load(ctxptr, code.headIdx) + p := ptrToPtr(ptr + code.offset) + b = append(b, code.key...) + if p == 0 { + b = encodeNull(b) + } else { + b = append(b, '"') + b = appendInt(b, int64(ptrToInt32(p))) + b = append(b, '"') + } + b = encodeComma(b) + code = code.next case opStructFieldInt64: ptr := load(ctxptr, code.headIdx) b = append(b, code.key...) @@ -7481,6 +7569,28 @@ func encodeRun(ctx *encodeRuntimeContext, b []byte, codeSet *opcodeSet, opt Enco } b = encodeComma(b) code = code.next + case opStructFieldOmitEmptyInt64Ptr: + ptr := load(ctxptr, code.headIdx) + p := ptrToPtr(ptr + code.offset) + if p != 0 { + b = append(b, code.key...) + b = appendInt(b, ptrToInt64(p)) + b = encodeComma(b) + } + code = code.next + case opStructFieldStringTagInt64Ptr: + ptr := load(ctxptr, code.headIdx) + p := ptrToPtr(ptr + code.offset) + b = append(b, code.key...) + if p == 0 { + b = encodeNull(b) + } else { + b = append(b, '"') + b = appendInt(b, ptrToInt64(p)) + b = append(b, '"') + } + b = encodeComma(b) + code = code.next case opStructFieldUint: ptr := load(ctxptr, code.headIdx) b = append(b, code.key...) @@ -7515,6 +7625,28 @@ func encodeRun(ctx *encodeRuntimeContext, b []byte, codeSet *opcodeSet, opt Enco } b = encodeComma(b) code = code.next + case opStructFieldOmitEmptyUintPtr: + ptr := load(ctxptr, code.headIdx) + p := ptrToPtr(ptr + code.offset) + if p != 0 { + b = append(b, code.key...) + b = appendUint(b, uint64(ptrToUint(p))) + b = encodeComma(b) + } + code = code.next + case opStructFieldStringTagUintPtr: + ptr := load(ctxptr, code.headIdx) + p := ptrToPtr(ptr + code.offset) + b = append(b, code.key...) + if p == 0 { + b = encodeNull(b) + } else { + b = append(b, '"') + b = appendUint(b, uint64(ptrToUint(p))) + b = append(b, '"') + } + b = encodeComma(b) + code = code.next case opStructFieldUint8: ptr := load(ctxptr, code.headIdx) b = append(b, code.key...) @@ -7549,6 +7681,28 @@ func encodeRun(ctx *encodeRuntimeContext, b []byte, codeSet *opcodeSet, opt Enco } b = encodeComma(b) code = code.next + case opStructFieldOmitEmptyUint8Ptr: + ptr := load(ctxptr, code.headIdx) + p := ptrToPtr(ptr + code.offset) + if p != 0 { + b = append(b, code.key...) + b = appendUint(b, uint64(ptrToUint8(p))) + b = encodeComma(b) + } + code = code.next + case opStructFieldStringTagUint8Ptr: + ptr := load(ctxptr, code.headIdx) + p := ptrToPtr(ptr + code.offset) + b = append(b, code.key...) + if p == 0 { + b = encodeNull(b) + } else { + b = append(b, '"') + b = appendUint(b, uint64(ptrToUint8(p))) + b = append(b, '"') + } + b = encodeComma(b) + code = code.next case opStructFieldUint16: ptr := load(ctxptr, code.headIdx) b = append(b, code.key...) @@ -7583,6 +7737,28 @@ func encodeRun(ctx *encodeRuntimeContext, b []byte, codeSet *opcodeSet, opt Enco } b = encodeComma(b) code = code.next + case opStructFieldOmitEmptyUint16Ptr: + ptr := load(ctxptr, code.headIdx) + p := ptrToPtr(ptr + code.offset) + if p != 0 { + b = append(b, code.key...) + b = appendUint(b, uint64(ptrToUint16(p))) + b = encodeComma(b) + } + code = code.next + case opStructFieldStringTagUint16Ptr: + ptr := load(ctxptr, code.headIdx) + p := ptrToPtr(ptr + code.offset) + b = append(b, code.key...) + if p == 0 { + b = encodeNull(b) + } else { + b = append(b, '"') + b = appendUint(b, uint64(ptrToUint16(p))) + b = append(b, '"') + } + b = encodeComma(b) + code = code.next case opStructFieldUint32: ptr := load(ctxptr, code.headIdx) b = append(b, code.key...) @@ -7617,6 +7793,28 @@ func encodeRun(ctx *encodeRuntimeContext, b []byte, codeSet *opcodeSet, opt Enco } b = encodeComma(b) code = code.next + case opStructFieldOmitEmptyUint32Ptr: + ptr := load(ctxptr, code.headIdx) + p := ptrToPtr(ptr + code.offset) + if p != 0 { + b = append(b, code.key...) + b = appendUint(b, uint64(ptrToUint32(p))) + b = encodeComma(b) + } + code = code.next + case opStructFieldStringTagUint32Ptr: + ptr := load(ctxptr, code.headIdx) + p := ptrToPtr(ptr + code.offset) + b = append(b, code.key...) + if p == 0 { + b = encodeNull(b) + } else { + b = append(b, '"') + b = appendUint(b, uint64(ptrToUint32(p))) + b = append(b, '"') + } + b = encodeComma(b) + code = code.next case opStructFieldUint64: ptr := load(ctxptr, code.headIdx) b = append(b, code.key...) @@ -7651,6 +7849,28 @@ func encodeRun(ctx *encodeRuntimeContext, b []byte, codeSet *opcodeSet, opt Enco } b = encodeComma(b) code = code.next + case opStructFieldOmitEmptyUint64Ptr: + ptr := load(ctxptr, code.headIdx) + p := ptrToPtr(ptr + code.offset) + if p != 0 { + b = append(b, code.key...) + b = appendUint(b, ptrToUint64(p)) + b = encodeComma(b) + } + code = code.next + case opStructFieldStringTagUint64Ptr: + ptr := load(ctxptr, code.headIdx) + p := ptrToPtr(ptr + code.offset) + b = append(b, code.key...) + if p == 0 { + b = encodeNull(b) + } else { + b = append(b, '"') + b = appendUint(b, ptrToUint64(p)) + b = append(b, '"') + } + b = encodeComma(b) + code = code.next case opStructFieldFloat32: ptr := load(ctxptr, code.headIdx) b = append(b, code.key...) @@ -7685,6 +7905,28 @@ func encodeRun(ctx *encodeRuntimeContext, b []byte, codeSet *opcodeSet, opt Enco } b = encodeComma(b) code = code.next + case opStructFieldOmitEmptyFloat32Ptr: + ptr := load(ctxptr, code.headIdx) + p := ptrToPtr(ptr + code.offset) + if p != 0 { + b = append(b, code.key...) + b = encodeFloat32(b, ptrToFloat32(p)) + b = encodeComma(b) + } + code = code.next + case opStructFieldStringTagFloat32Ptr: + ptr := load(ctxptr, code.headIdx) + p := ptrToPtr(ptr + code.offset) + b = append(b, code.key...) + if p == 0 { + b = encodeNull(b) + } else { + b = append(b, '"') + b = encodeFloat32(b, ptrToFloat32(p)) + b = append(b, '"') + } + b = encodeComma(b) + code = code.next case opStructFieldFloat64: ptr := load(ctxptr, code.headIdx) b = append(b, code.key...) @@ -7736,6 +7978,36 @@ func encodeRun(ctx *encodeRuntimeContext, b []byte, codeSet *opcodeSet, opt Enco b = encodeFloat64(b, v) b = encodeComma(b) code = code.next + case opStructFieldOmitEmptyFloat64Ptr: + ptr := load(ctxptr, code.headIdx) + p := ptrToPtr(ptr + code.offset) + if p != 0 { + b = append(b, code.key...) + v := 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 opStructFieldStringTagFloat64Ptr: + ptr := load(ctxptr, code.headIdx) + p := ptrToPtr(ptr + code.offset) + b = append(b, code.key...) + if p == 0 { + b = encodeNull(b) + } else { + v := ptrToFloat64(p) + if math.IsInf(v, 0) || math.IsNaN(v) { + return nil, errUnsupportedFloat(v) + } + b = append(b, '"') + b = encodeFloat64(b, v) + b = append(b, '"') + } + b = encodeComma(b) + code = code.next case opStructFieldString: ptr := load(ctxptr, code.headIdx) b = append(b, code.key...) @@ -7823,6 +8095,26 @@ func encodeRun(ctx *encodeRuntimeContext, b []byte, codeSet *opcodeSet, opt Enco } b = encodeComma(b) code = code.next + case opStructFieldOmitEmptyBoolPtr: + ptr := load(ctxptr, code.headIdx) + p := ptrToPtr(ptr + code.offset) + if p != 0 { + b = append(b, code.key...) + b = encodeBool(b, ptrToBool(p)) + b = encodeComma(b) + } + code = code.next + case opStructFieldStringTagBoolPtr: + b = append(b, code.key...) + ptr := load(ctxptr, code.headIdx) + p := ptrToPtr(ptr + code.offset) + if p == 0 { + b = encodeNull(b) + } else { + b = encodeBool(b, ptrToBool(p)) + } + b = encodeComma(b) + code = code.next case opStructFieldBytes: ptr := load(ctxptr, code.headIdx) b = append(b, code.key...) @@ -7845,6 +8137,37 @@ func encodeRun(ctx *encodeRuntimeContext, b []byte, codeSet *opcodeSet, opt Enco b = encodeByteSlice(b, v) b = encodeComma(b) code = code.next + case opStructFieldBytesPtr: + b = append(b, code.key...) + ptr := load(ctxptr, code.headIdx) + p := ptrToPtr(ptr + code.offset) + if p == 0 { + b = encodeNull(b) + } else { + b = encodeByteSlice(b, ptrToBytes(p)) + } + b = encodeComma(b) + code = code.next + case opStructFieldOmitEmptyBytesPtr: + ptr := load(ctxptr, code.headIdx) + p := ptrToPtr(ptr + code.offset) + if p != 0 { + b = append(b, code.key...) + b = encodeByteSlice(b, ptrToBytes(p)) + b = encodeComma(b) + } + code = code.next + case opStructFieldStringTagBytesPtr: + b = append(b, code.key...) + ptr := load(ctxptr, code.headIdx) + p := ptrToPtr(ptr + code.offset) + if p == 0 { + b = encodeNull(b) + } else { + b = encodeByteSlice(b, ptrToBytes(p)) + } + b = encodeComma(b) + code = code.next case opStructFieldMarshalJSON: ptr := load(ctxptr, code.headIdx) b = append(b, code.key...) diff --git a/encode_vm_escaped.go b/encode_vm_escaped.go index 34c9096..bbac701 100644 --- a/encode_vm_escaped.go +++ b/encode_vm_escaped.go @@ -7280,6 +7280,28 @@ func encodeRunEscaped(ctx *encodeRuntimeContext, b []byte, codeSet *opcodeSet, o } b = encodeComma(b) code = code.next + case opStructFieldOmitEmptyIntPtr: + ptr := load(ctxptr, code.headIdx) + p := ptrToPtr(ptr + code.offset) + if p != 0 { + b = append(b, code.escapedKey...) + b = appendInt(b, int64(ptrToInt(p))) + b = encodeComma(b) + } + code = code.next + case opStructFieldStringTagIntPtr: + ptr := load(ctxptr, code.headIdx) + p := ptrToPtr(ptr + code.offset) + b = append(b, code.escapedKey...) + if p == 0 { + b = encodeNull(b) + } else { + b = append(b, '"') + b = appendInt(b, int64(ptrToInt(p))) + b = append(b, '"') + } + b = encodeComma(b) + code = code.next case opStructFieldIntNPtr: b = append(b, code.escapedKey...) ptr := load(ctxptr, code.headIdx) @@ -7331,6 +7353,28 @@ func encodeRunEscaped(ctx *encodeRuntimeContext, b []byte, codeSet *opcodeSet, o } b = encodeComma(b) code = code.next + case opStructFieldOmitEmptyInt8Ptr: + ptr := load(ctxptr, code.headIdx) + p := ptrToPtr(ptr + code.offset) + if p != 0 { + b = append(b, code.escapedKey...) + b = appendInt(b, int64(ptrToInt8(p))) + b = encodeComma(b) + } + code = code.next + case opStructFieldStringTagInt8Ptr: + ptr := load(ctxptr, code.headIdx) + p := ptrToPtr(ptr + code.offset) + b = append(b, code.escapedKey...) + if p == 0 { + b = encodeNull(b) + } else { + b = append(b, '"') + b = appendInt(b, int64(ptrToInt8(p))) + b = append(b, '"') + } + b = encodeComma(b) + code = code.next case opStructFieldInt16: ptr := load(ctxptr, code.headIdx) b = append(b, code.escapedKey...) @@ -7365,6 +7409,28 @@ func encodeRunEscaped(ctx *encodeRuntimeContext, b []byte, codeSet *opcodeSet, o } b = encodeComma(b) code = code.next + case opStructFieldOmitEmptyInt16Ptr: + ptr := load(ctxptr, code.headIdx) + p := ptrToPtr(ptr + code.offset) + if p != 0 { + b = append(b, code.escapedKey...) + b = appendInt(b, int64(ptrToInt16(p))) + b = encodeComma(b) + } + code = code.next + case opStructFieldStringTagInt16Ptr: + ptr := load(ctxptr, code.headIdx) + p := ptrToPtr(ptr + code.offset) + b = append(b, code.escapedKey...) + if p == 0 { + b = encodeNull(b) + } else { + b = append(b, '"') + b = appendInt(b, int64(ptrToInt16(p))) + b = append(b, '"') + } + b = encodeComma(b) + code = code.next case opStructFieldInt32: ptr := load(ctxptr, code.headIdx) b = append(b, code.escapedKey...) @@ -7399,6 +7465,28 @@ func encodeRunEscaped(ctx *encodeRuntimeContext, b []byte, codeSet *opcodeSet, o } b = encodeComma(b) code = code.next + case opStructFieldOmitEmptyInt32Ptr: + ptr := load(ctxptr, code.headIdx) + p := ptrToPtr(ptr + code.offset) + if p != 0 { + b = append(b, code.escapedKey...) + b = appendInt(b, int64(ptrToInt32(p))) + b = encodeComma(b) + } + code = code.next + case opStructFieldStringTagInt32Ptr: + ptr := load(ctxptr, code.headIdx) + p := ptrToPtr(ptr + code.offset) + b = append(b, code.escapedKey...) + if p == 0 { + b = encodeNull(b) + } else { + b = append(b, '"') + b = appendInt(b, int64(ptrToInt32(p))) + b = append(b, '"') + } + b = encodeComma(b) + code = code.next case opStructFieldInt64: ptr := load(ctxptr, code.headIdx) b = append(b, code.escapedKey...) @@ -7433,6 +7521,28 @@ func encodeRunEscaped(ctx *encodeRuntimeContext, b []byte, codeSet *opcodeSet, o } b = encodeComma(b) code = code.next + case opStructFieldOmitEmptyInt64Ptr: + ptr := load(ctxptr, code.headIdx) + p := ptrToPtr(ptr + code.offset) + if p != 0 { + b = append(b, code.escapedKey...) + b = appendInt(b, ptrToInt64(p)) + b = encodeComma(b) + } + code = code.next + case opStructFieldStringTagInt64Ptr: + ptr := load(ctxptr, code.headIdx) + p := ptrToPtr(ptr + code.offset) + b = append(b, code.escapedKey...) + if p == 0 { + b = encodeNull(b) + } else { + b = append(b, '"') + b = appendInt(b, ptrToInt64(p)) + b = append(b, '"') + } + b = encodeComma(b) + code = code.next case opStructFieldUint: ptr := load(ctxptr, code.headIdx) b = append(b, code.escapedKey...) @@ -7467,6 +7577,28 @@ func encodeRunEscaped(ctx *encodeRuntimeContext, b []byte, codeSet *opcodeSet, o } b = encodeComma(b) code = code.next + case opStructFieldOmitEmptyUintPtr: + ptr := load(ctxptr, code.headIdx) + p := ptrToPtr(ptr + code.offset) + if p != 0 { + b = append(b, code.escapedKey...) + b = appendUint(b, uint64(ptrToUint(p))) + b = encodeComma(b) + } + code = code.next + case opStructFieldStringTagUintPtr: + ptr := load(ctxptr, code.headIdx) + p := ptrToPtr(ptr + code.offset) + b = append(b, code.escapedKey...) + if p == 0 { + b = encodeNull(b) + } else { + b = append(b, '"') + b = appendUint(b, uint64(ptrToUint(p))) + b = append(b, '"') + } + b = encodeComma(b) + code = code.next case opStructFieldUint8: ptr := load(ctxptr, code.headIdx) b = append(b, code.escapedKey...) @@ -7501,6 +7633,28 @@ func encodeRunEscaped(ctx *encodeRuntimeContext, b []byte, codeSet *opcodeSet, o } b = encodeComma(b) code = code.next + case opStructFieldOmitEmptyUint8Ptr: + ptr := load(ctxptr, code.headIdx) + p := ptrToPtr(ptr + code.offset) + if p != 0 { + b = append(b, code.escapedKey...) + b = appendUint(b, uint64(ptrToUint8(p))) + b = encodeComma(b) + } + code = code.next + case opStructFieldStringTagUint8Ptr: + ptr := load(ctxptr, code.headIdx) + p := ptrToPtr(ptr + code.offset) + b = append(b, code.escapedKey...) + if p == 0 { + b = encodeNull(b) + } else { + b = append(b, '"') + b = appendUint(b, uint64(ptrToUint8(p))) + b = append(b, '"') + } + b = encodeComma(b) + code = code.next case opStructFieldUint16: ptr := load(ctxptr, code.headIdx) b = append(b, code.escapedKey...) @@ -7535,6 +7689,28 @@ func encodeRunEscaped(ctx *encodeRuntimeContext, b []byte, codeSet *opcodeSet, o } b = encodeComma(b) code = code.next + case opStructFieldOmitEmptyUint16Ptr: + ptr := load(ctxptr, code.headIdx) + p := ptrToPtr(ptr + code.offset) + if p != 0 { + b = append(b, code.escapedKey...) + b = appendUint(b, uint64(ptrToUint16(p))) + b = encodeComma(b) + } + code = code.next + case opStructFieldStringTagUint16Ptr: + ptr := load(ctxptr, code.headIdx) + p := ptrToPtr(ptr + code.offset) + b = append(b, code.escapedKey...) + if p == 0 { + b = encodeNull(b) + } else { + b = append(b, '"') + b = appendUint(b, uint64(ptrToUint16(p))) + b = append(b, '"') + } + b = encodeComma(b) + code = code.next case opStructFieldUint32: ptr := load(ctxptr, code.headIdx) b = append(b, code.escapedKey...) @@ -7569,6 +7745,28 @@ func encodeRunEscaped(ctx *encodeRuntimeContext, b []byte, codeSet *opcodeSet, o } b = encodeComma(b) code = code.next + case opStructFieldOmitEmptyUint32Ptr: + ptr := load(ctxptr, code.headIdx) + p := ptrToPtr(ptr + code.offset) + if p != 0 { + b = append(b, code.escapedKey...) + b = appendUint(b, uint64(ptrToUint32(p))) + b = encodeComma(b) + } + code = code.next + case opStructFieldStringTagUint32Ptr: + ptr := load(ctxptr, code.headIdx) + p := ptrToPtr(ptr + code.offset) + b = append(b, code.escapedKey...) + if p == 0 { + b = encodeNull(b) + } else { + b = append(b, '"') + b = appendUint(b, uint64(ptrToUint32(p))) + b = append(b, '"') + } + b = encodeComma(b) + code = code.next case opStructFieldUint64: ptr := load(ctxptr, code.headIdx) b = append(b, code.escapedKey...) @@ -7603,6 +7801,28 @@ func encodeRunEscaped(ctx *encodeRuntimeContext, b []byte, codeSet *opcodeSet, o } b = encodeComma(b) code = code.next + case opStructFieldOmitEmptyUint64Ptr: + ptr := load(ctxptr, code.headIdx) + p := ptrToPtr(ptr + code.offset) + if p != 0 { + b = append(b, code.escapedKey...) + b = appendUint(b, ptrToUint64(p)) + b = encodeComma(b) + } + code = code.next + case opStructFieldStringTagUint64Ptr: + ptr := load(ctxptr, code.headIdx) + p := ptrToPtr(ptr + code.offset) + b = append(b, code.escapedKey...) + if p == 0 { + b = encodeNull(b) + } else { + b = append(b, '"') + b = appendUint(b, ptrToUint64(p)) + b = append(b, '"') + } + b = encodeComma(b) + code = code.next case opStructFieldFloat32: ptr := load(ctxptr, code.headIdx) b = append(b, code.escapedKey...) @@ -7637,6 +7857,28 @@ func encodeRunEscaped(ctx *encodeRuntimeContext, b []byte, codeSet *opcodeSet, o } b = encodeComma(b) code = code.next + case opStructFieldOmitEmptyFloat32Ptr: + ptr := load(ctxptr, code.headIdx) + p := ptrToPtr(ptr + code.offset) + if p != 0 { + b = append(b, code.escapedKey...) + b = encodeFloat32(b, ptrToFloat32(p)) + b = encodeComma(b) + } + code = code.next + case opStructFieldStringTagFloat32Ptr: + ptr := load(ctxptr, code.headIdx) + p := ptrToPtr(ptr + code.offset) + b = append(b, code.escapedKey...) + if p == 0 { + b = encodeNull(b) + } else { + b = append(b, '"') + b = encodeFloat32(b, ptrToFloat32(p)) + b = append(b, '"') + } + b = encodeComma(b) + code = code.next case opStructFieldFloat64: ptr := load(ctxptr, code.headIdx) b = append(b, code.escapedKey...) @@ -7688,6 +7930,36 @@ func encodeRunEscaped(ctx *encodeRuntimeContext, b []byte, codeSet *opcodeSet, o b = encodeFloat64(b, v) b = encodeComma(b) code = code.next + case opStructFieldOmitEmptyFloat64Ptr: + ptr := load(ctxptr, code.headIdx) + p := ptrToPtr(ptr + code.offset) + if p != 0 { + b = append(b, code.escapedKey...) + v := 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 opStructFieldStringTagFloat64Ptr: + ptr := load(ctxptr, code.headIdx) + p := ptrToPtr(ptr + code.offset) + b = append(b, code.escapedKey...) + if p == 0 { + b = encodeNull(b) + } else { + v := ptrToFloat64(p) + if math.IsInf(v, 0) || math.IsNaN(v) { + return nil, errUnsupportedFloat(v) + } + b = append(b, '"') + b = encodeFloat64(b, v) + b = append(b, '"') + } + b = encodeComma(b) + code = code.next case opStructFieldString: ptr := load(ctxptr, code.headIdx) b = append(b, code.escapedKey...) @@ -7775,6 +8047,26 @@ func encodeRunEscaped(ctx *encodeRuntimeContext, b []byte, codeSet *opcodeSet, o } b = encodeComma(b) code = code.next + case opStructFieldOmitEmptyBoolPtr: + ptr := load(ctxptr, code.headIdx) + p := ptrToPtr(ptr + code.offset) + if p != 0 { + b = append(b, code.escapedKey...) + b = encodeBool(b, ptrToBool(p)) + b = encodeComma(b) + } + code = code.next + case opStructFieldStringTagBoolPtr: + b = append(b, code.escapedKey...) + ptr := load(ctxptr, code.headIdx) + p := ptrToPtr(ptr + code.offset) + if p == 0 { + b = encodeNull(b) + } else { + b = encodeBool(b, ptrToBool(p)) + } + b = encodeComma(b) + code = code.next case opStructFieldBytes: ptr := load(ctxptr, code.headIdx) b = append(b, code.escapedKey...) @@ -7797,6 +8089,37 @@ func encodeRunEscaped(ctx *encodeRuntimeContext, b []byte, codeSet *opcodeSet, o b = encodeByteSlice(b, v) b = encodeComma(b) code = code.next + case opStructFieldBytesPtr: + b = append(b, code.escapedKey...) + ptr := load(ctxptr, code.headIdx) + p := ptrToPtr(ptr + code.offset) + if p == 0 { + b = encodeNull(b) + } else { + b = encodeByteSlice(b, ptrToBytes(p)) + } + b = encodeComma(b) + code = code.next + case opStructFieldOmitEmptyBytesPtr: + ptr := load(ctxptr, code.headIdx) + p := ptrToPtr(ptr + code.offset) + if p != 0 { + b = append(b, code.escapedKey...) + b = encodeByteSlice(b, ptrToBytes(p)) + b = encodeComma(b) + } + code = code.next + case opStructFieldStringTagBytesPtr: + b = append(b, code.escapedKey...) + ptr := load(ctxptr, code.headIdx) + p := ptrToPtr(ptr + code.offset) + if p == 0 { + b = encodeNull(b) + } else { + b = encodeByteSlice(b, ptrToBytes(p)) + } + b = encodeComma(b) + code = code.next case opStructFieldMarshalJSON: ptr := load(ctxptr, code.headIdx) b = append(b, code.escapedKey...) diff --git a/encode_vm_escaped_indent.go b/encode_vm_escaped_indent.go index c8804a1..8674b46 100644 --- a/encode_vm_escaped_indent.go +++ b/encode_vm_escaped_indent.go @@ -7174,6 +7174,45 @@ func encodeRunEscapedIndent(ctx *encodeRuntimeContext, b []byte, codeSet *opcode b = append(b, '"') b = encodeIndentComma(b) code = code.next + case opStructFieldIntPtr: + b = appendIndent(ctx, b, code.indent) + b = append(b, code.escapedKey...) + b = append(b, ' ') + ptr := load(ctxptr, code.headIdx) + p := ptrToPtr(ptr + code.offset) + if p == 0 { + b = encodeNull(b) + } else { + b = appendInt(b, int64(ptrToInt(p))) + } + b = encodeIndentComma(b) + code = code.next + case opStructFieldOmitEmptyIntPtr: + ptr := load(ctxptr, code.headIdx) + p := ptrToPtr(ptr + code.offset) + if p != 0 { + b = appendIndent(ctx, b, code.indent) + b = append(b, code.escapedKey...) + b = append(b, ' ') + b = appendInt(b, int64(ptrToInt(p))) + b = encodeIndentComma(b) + } + code = code.next + case opStructFieldStringTagIntPtr: + ptr := load(ctxptr, code.headIdx) + p := ptrToPtr(ptr + code.offset) + b = appendIndent(ctx, b, code.indent) + b = append(b, code.escapedKey...) + b = append(b, ' ') + if p == 0 { + b = encodeNull(b) + } else { + b = append(b, '"') + b = appendInt(b, int64(ptrToInt(p))) + b = append(b, '"') + } + b = encodeIndentComma(b) + code = code.next case opStructFieldInt8: b = appendIndent(ctx, b, code.indent) b = append(b, code.escapedKey...) @@ -7202,6 +7241,45 @@ func encodeRunEscapedIndent(ctx *encodeRuntimeContext, b []byte, codeSet *opcode b = append(b, '"') b = encodeIndentComma(b) code = code.next + case opStructFieldInt8Ptr: + b = appendIndent(ctx, b, code.indent) + b = append(b, code.escapedKey...) + b = append(b, ' ') + ptr := load(ctxptr, code.headIdx) + p := ptrToPtr(ptr + code.offset) + if p == 0 { + b = encodeNull(b) + } else { + b = appendInt(b, int64(ptrToInt8(p))) + } + b = encodeIndentComma(b) + code = code.next + case opStructFieldOmitEmptyInt8Ptr: + ptr := load(ctxptr, code.headIdx) + p := ptrToPtr(ptr + code.offset) + if p != 0 { + b = appendIndent(ctx, b, code.indent) + b = append(b, code.escapedKey...) + b = append(b, ' ') + b = appendInt(b, int64(ptrToInt8(p))) + b = encodeIndentComma(b) + } + code = code.next + case opStructFieldStringTagInt8Ptr: + ptr := load(ctxptr, code.headIdx) + p := ptrToPtr(ptr + code.offset) + b = appendIndent(ctx, b, code.indent) + b = append(b, code.escapedKey...) + b = append(b, ' ') + if p == 0 { + b = encodeNull(b) + } else { + b = append(b, '"') + b = appendInt(b, int64(ptrToInt8(p))) + b = append(b, '"') + } + b = encodeIndentComma(b) + code = code.next case opStructFieldInt16: b = appendIndent(ctx, b, code.indent) b = append(b, code.escapedKey...) @@ -7230,6 +7308,45 @@ func encodeRunEscapedIndent(ctx *encodeRuntimeContext, b []byte, codeSet *opcode b = append(b, '"') b = encodeIndentComma(b) code = code.next + case opStructFieldInt16Ptr: + b = appendIndent(ctx, b, code.indent) + b = append(b, code.escapedKey...) + b = append(b, ' ') + ptr := load(ctxptr, code.headIdx) + p := ptrToPtr(ptr + code.offset) + if p == 0 { + b = encodeNull(b) + } else { + b = appendInt(b, int64(ptrToInt16(p))) + } + b = encodeIndentComma(b) + code = code.next + case opStructFieldOmitEmptyInt16Ptr: + ptr := load(ctxptr, code.headIdx) + p := ptrToPtr(ptr + code.offset) + if p != 0 { + b = appendIndent(ctx, b, code.indent) + b = append(b, code.escapedKey...) + b = append(b, ' ') + b = appendInt(b, int64(ptrToInt16(p))) + b = encodeIndentComma(b) + } + code = code.next + case opStructFieldStringTagInt16Ptr: + ptr := load(ctxptr, code.headIdx) + p := ptrToPtr(ptr + code.offset) + b = appendIndent(ctx, b, code.indent) + b = append(b, code.escapedKey...) + b = append(b, ' ') + if p == 0 { + b = encodeNull(b) + } else { + b = append(b, '"') + b = appendInt(b, int64(ptrToInt16(p))) + b = append(b, '"') + } + b = encodeIndentComma(b) + code = code.next case opStructFieldInt32: b = appendIndent(ctx, b, code.indent) b = append(b, code.escapedKey...) @@ -7258,6 +7375,45 @@ func encodeRunEscapedIndent(ctx *encodeRuntimeContext, b []byte, codeSet *opcode b = append(b, '"') b = encodeIndentComma(b) code = code.next + case opStructFieldInt32Ptr: + b = appendIndent(ctx, b, code.indent) + b = append(b, code.escapedKey...) + b = append(b, ' ') + ptr := load(ctxptr, code.headIdx) + p := ptrToPtr(ptr + code.offset) + if p == 0 { + b = encodeNull(b) + } else { + b = appendInt(b, int64(ptrToInt32(p))) + } + b = encodeIndentComma(b) + code = code.next + case opStructFieldOmitEmptyInt32Ptr: + ptr := load(ctxptr, code.headIdx) + p := ptrToPtr(ptr + code.offset) + if p != 0 { + b = appendIndent(ctx, b, code.indent) + b = append(b, code.escapedKey...) + b = append(b, ' ') + b = appendInt(b, int64(ptrToInt32(p))) + b = encodeIndentComma(b) + } + code = code.next + case opStructFieldStringTagInt32Ptr: + ptr := load(ctxptr, code.headIdx) + p := ptrToPtr(ptr + code.offset) + b = appendIndent(ctx, b, code.indent) + b = append(b, code.escapedKey...) + b = append(b, ' ') + if p == 0 { + b = encodeNull(b) + } else { + b = append(b, '"') + b = appendInt(b, int64(ptrToInt32(p))) + b = append(b, '"') + } + b = encodeIndentComma(b) + code = code.next case opStructFieldInt64: b = appendIndent(ctx, b, code.indent) b = append(b, code.escapedKey...) @@ -7286,6 +7442,45 @@ func encodeRunEscapedIndent(ctx *encodeRuntimeContext, b []byte, codeSet *opcode b = append(b, '"') b = encodeIndentComma(b) code = code.next + case opStructFieldInt64Ptr: + b = appendIndent(ctx, b, code.indent) + b = append(b, code.escapedKey...) + b = append(b, ' ') + ptr := load(ctxptr, code.headIdx) + p := ptrToPtr(ptr + code.offset) + if p == 0 { + b = encodeNull(b) + } else { + b = appendInt(b, ptrToInt64(p)) + } + b = encodeIndentComma(b) + code = code.next + case opStructFieldOmitEmptyInt64Ptr: + ptr := load(ctxptr, code.headIdx) + p := ptrToPtr(ptr + code.offset) + if p != 0 { + b = appendIndent(ctx, b, code.indent) + b = append(b, code.escapedKey...) + b = append(b, ' ') + b = appendInt(b, ptrToInt64(p)) + b = encodeIndentComma(b) + } + code = code.next + case opStructFieldStringTagInt64Ptr: + ptr := load(ctxptr, code.headIdx) + p := ptrToPtr(ptr + code.offset) + b = appendIndent(ctx, b, code.indent) + b = append(b, code.escapedKey...) + b = append(b, ' ') + if p == 0 { + b = encodeNull(b) + } else { + b = append(b, '"') + b = appendInt(b, ptrToInt64(p)) + b = append(b, '"') + } + b = encodeIndentComma(b) + code = code.next case opStructFieldUint: b = appendIndent(ctx, b, code.indent) b = append(b, code.escapedKey...) @@ -7314,6 +7509,45 @@ func encodeRunEscapedIndent(ctx *encodeRuntimeContext, b []byte, codeSet *opcode b = append(b, '"') b = encodeIndentComma(b) code = code.next + case opStructFieldUintPtr: + b = appendIndent(ctx, b, code.indent) + b = append(b, code.escapedKey...) + b = append(b, ' ') + ptr := load(ctxptr, code.headIdx) + p := ptrToPtr(ptr + code.offset) + if p == 0 { + b = encodeNull(b) + } else { + b = appendUint(b, uint64(ptrToUint(p))) + } + b = encodeIndentComma(b) + code = code.next + case opStructFieldOmitEmptyUintPtr: + ptr := load(ctxptr, code.headIdx) + p := ptrToPtr(ptr + code.offset) + if p != 0 { + b = appendIndent(ctx, b, code.indent) + b = append(b, code.escapedKey...) + b = append(b, ' ') + b = appendUint(b, uint64(ptrToUint(p))) + b = encodeIndentComma(b) + } + code = code.next + case opStructFieldStringTagUintPtr: + ptr := load(ctxptr, code.headIdx) + p := ptrToPtr(ptr + code.offset) + b = appendIndent(ctx, b, code.indent) + b = append(b, code.escapedKey...) + b = append(b, ' ') + if p == 0 { + b = encodeNull(b) + } else { + b = append(b, '"') + b = appendUint(b, uint64(ptrToUint(p))) + b = append(b, '"') + } + b = encodeIndentComma(b) + code = code.next case opStructFieldUint8: b = appendIndent(ctx, b, code.indent) b = append(b, code.escapedKey...) @@ -7342,6 +7576,45 @@ func encodeRunEscapedIndent(ctx *encodeRuntimeContext, b []byte, codeSet *opcode b = append(b, '"') b = encodeIndentComma(b) code = code.next + case opStructFieldUint8Ptr: + b = appendIndent(ctx, b, code.indent) + b = append(b, code.escapedKey...) + b = append(b, ' ') + ptr := load(ctxptr, code.headIdx) + p := ptrToPtr(ptr + code.offset) + if p == 0 { + b = encodeNull(b) + } else { + b = appendUint(b, uint64(ptrToUint8(p))) + } + b = encodeIndentComma(b) + code = code.next + case opStructFieldOmitEmptyUint8Ptr: + ptr := load(ctxptr, code.headIdx) + p := ptrToPtr(ptr + code.offset) + if p != 0 { + b = appendIndent(ctx, b, code.indent) + b = append(b, code.escapedKey...) + b = append(b, ' ') + b = appendUint(b, uint64(ptrToUint8(p))) + b = encodeIndentComma(b) + } + code = code.next + case opStructFieldStringTagUint8Ptr: + ptr := load(ctxptr, code.headIdx) + p := ptrToPtr(ptr + code.offset) + b = appendIndent(ctx, b, code.indent) + b = append(b, code.escapedKey...) + b = append(b, ' ') + if p == 0 { + b = encodeNull(b) + } else { + b = append(b, '"') + b = appendUint(b, uint64(ptrToUint8(p))) + b = append(b, '"') + } + b = encodeIndentComma(b) + code = code.next case opStructFieldUint16: b = appendIndent(ctx, b, code.indent) b = append(b, code.escapedKey...) @@ -7370,6 +7643,45 @@ func encodeRunEscapedIndent(ctx *encodeRuntimeContext, b []byte, codeSet *opcode b = append(b, '"') b = encodeIndentComma(b) code = code.next + case opStructFieldUint16Ptr: + b = appendIndent(ctx, b, code.indent) + b = append(b, code.escapedKey...) + b = append(b, ' ') + ptr := load(ctxptr, code.headIdx) + p := ptrToPtr(ptr + code.offset) + if p == 0 { + b = encodeNull(b) + } else { + b = appendUint(b, uint64(ptrToUint16(p))) + } + b = encodeIndentComma(b) + code = code.next + case opStructFieldOmitEmptyUint16Ptr: + ptr := load(ctxptr, code.headIdx) + p := ptrToPtr(ptr + code.offset) + if p != 0 { + b = appendIndent(ctx, b, code.indent) + b = append(b, code.escapedKey...) + b = append(b, ' ') + b = appendUint(b, uint64(ptrToUint16(p))) + b = encodeIndentComma(b) + } + code = code.next + case opStructFieldStringTagUint16Ptr: + ptr := load(ctxptr, code.headIdx) + p := ptrToPtr(ptr + code.offset) + b = appendIndent(ctx, b, code.indent) + b = append(b, code.escapedKey...) + b = append(b, ' ') + if p == 0 { + b = encodeNull(b) + } else { + b = append(b, '"') + b = appendUint(b, uint64(ptrToUint16(p))) + b = append(b, '"') + } + b = encodeIndentComma(b) + code = code.next case opStructFieldUint32: b = appendIndent(ctx, b, code.indent) b = append(b, code.escapedKey...) @@ -7398,6 +7710,45 @@ func encodeRunEscapedIndent(ctx *encodeRuntimeContext, b []byte, codeSet *opcode b = append(b, '"') b = encodeIndentComma(b) code = code.next + case opStructFieldUint32Ptr: + b = appendIndent(ctx, b, code.indent) + b = append(b, code.escapedKey...) + b = append(b, ' ') + ptr := load(ctxptr, code.headIdx) + p := ptrToPtr(ptr + code.offset) + if p == 0 { + b = encodeNull(b) + } else { + b = appendUint(b, uint64(ptrToUint32(p))) + } + b = encodeIndentComma(b) + code = code.next + case opStructFieldOmitEmptyUint32Ptr: + ptr := load(ctxptr, code.headIdx) + p := ptrToPtr(ptr + code.offset) + if p != 0 { + b = appendIndent(ctx, b, code.indent) + b = append(b, code.escapedKey...) + b = append(b, ' ') + b = appendUint(b, uint64(ptrToUint32(p))) + b = encodeIndentComma(b) + } + code = code.next + case opStructFieldStringTagUint32Ptr: + ptr := load(ctxptr, code.headIdx) + p := ptrToPtr(ptr + code.offset) + b = appendIndent(ctx, b, code.indent) + b = append(b, code.escapedKey...) + b = append(b, ' ') + if p == 0 { + b = encodeNull(b) + } else { + b = append(b, '"') + b = appendUint(b, uint64(ptrToUint32(p))) + b = append(b, '"') + } + b = encodeIndentComma(b) + code = code.next case opStructFieldUint64: b = appendIndent(ctx, b, code.indent) b = append(b, code.escapedKey...) @@ -7426,6 +7777,45 @@ func encodeRunEscapedIndent(ctx *encodeRuntimeContext, b []byte, codeSet *opcode b = append(b, '"') b = encodeIndentComma(b) code = code.next + case opStructFieldUint64Ptr: + b = appendIndent(ctx, b, code.indent) + b = append(b, code.escapedKey...) + b = append(b, ' ') + ptr := load(ctxptr, code.headIdx) + p := ptrToPtr(ptr + code.offset) + if p == 0 { + b = encodeNull(b) + } else { + b = appendUint(b, ptrToUint64(p)) + } + b = encodeIndentComma(b) + code = code.next + case opStructFieldOmitEmptyUint64Ptr: + ptr := load(ctxptr, code.headIdx) + p := ptrToPtr(ptr + code.offset) + if p != 0 { + b = appendIndent(ctx, b, code.indent) + b = append(b, code.escapedKey...) + b = append(b, ' ') + b = appendUint(b, ptrToUint64(p)) + b = encodeIndentComma(b) + } + code = code.next + case opStructFieldStringTagUint64Ptr: + ptr := load(ctxptr, code.headIdx) + p := ptrToPtr(ptr + code.offset) + b = appendIndent(ctx, b, code.indent) + b = append(b, code.escapedKey...) + b = append(b, ' ') + if p == 0 { + b = encodeNull(b) + } else { + b = append(b, '"') + b = appendUint(b, ptrToUint64(p)) + b = append(b, '"') + } + b = encodeIndentComma(b) + code = code.next case opStructFieldFloat32: b = appendIndent(ctx, b, code.indent) b = append(b, code.escapedKey...) @@ -7454,6 +7844,45 @@ func encodeRunEscapedIndent(ctx *encodeRuntimeContext, b []byte, codeSet *opcode b = append(b, '"') b = encodeIndentComma(b) code = code.next + case opStructFieldFloat32Ptr: + b = appendIndent(ctx, b, code.indent) + b = append(b, code.escapedKey...) + b = append(b, ' ') + ptr := load(ctxptr, code.headIdx) + p := ptrToPtr(ptr + code.offset) + if p == 0 { + b = encodeNull(b) + } else { + b = encodeFloat32(b, ptrToFloat32(p)) + } + b = encodeIndentComma(b) + code = code.next + case opStructFieldOmitEmptyFloat32Ptr: + ptr := load(ctxptr, code.headIdx) + p := ptrToPtr(ptr + code.offset) + if p != 0 { + b = appendIndent(ctx, b, code.indent) + b = append(b, code.escapedKey...) + b = append(b, ' ') + b = encodeFloat32(b, ptrToFloat32(p)) + b = encodeIndentComma(b) + } + code = code.next + case opStructFieldStringTagFloat32Ptr: + ptr := load(ctxptr, code.headIdx) + p := ptrToPtr(ptr + code.offset) + b = appendIndent(ctx, b, code.indent) + b = append(b, code.escapedKey...) + b = append(b, ' ') + if p == 0 { + b = encodeNull(b) + } else { + b = append(b, '"') + b = encodeFloat32(b, ptrToFloat32(p)) + b = append(b, '"') + } + b = encodeIndentComma(b) + code = code.next case opStructFieldFloat64: b = appendIndent(ctx, b, code.indent) b = append(b, code.escapedKey...) @@ -7493,6 +7922,57 @@ func encodeRunEscapedIndent(ctx *encodeRuntimeContext, b []byte, codeSet *opcode b = append(b, '"') b = encodeIndentComma(b) code = code.next + case opStructFieldFloat64Ptr: + b = appendIndent(ctx, b, code.indent) + b = append(b, code.escapedKey...) + b = append(b, ' ') + ptr := load(ctxptr, code.headIdx) + p := ptrToPtr(ptr + code.offset) + if p == 0 { + b = encodeNull(b) + } else { + v := 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 opStructFieldOmitEmptyFloat64Ptr: + ptr := load(ctxptr, code.headIdx) + p := ptrToPtr(ptr + code.offset) + if p != 0 { + b = appendIndent(ctx, b, code.indent) + b = append(b, code.escapedKey...) + b = append(b, ' ') + v := 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 opStructFieldStringTagFloat64Ptr: + ptr := load(ctxptr, code.headIdx) + p := ptrToPtr(ptr + code.offset) + b = appendIndent(ctx, b, code.indent) + b = append(b, code.escapedKey...) + b = append(b, ' ') + if p == 0 { + b = encodeNull(b) + } else { + b = append(b, '"') + v := ptrToFloat64(p) + if math.IsInf(v, 0) || math.IsNaN(v) { + return nil, errUnsupportedFloat(v) + } + b = encodeFloat64(b, v) + b = append(b, '"') + } + b = encodeIndentComma(b) + code = code.next case opStructFieldString: b = appendIndent(ctx, b, code.indent) b = append(b, code.escapedKey...) @@ -7586,6 +8066,43 @@ func encodeRunEscapedIndent(ctx *encodeRuntimeContext, b []byte, codeSet *opcode b = append(b, '"') b = encodeIndentComma(b) code = code.next + case opStructFieldBoolPtr: + b = appendIndent(ctx, b, code.indent) + b = append(b, code.escapedKey...) + b = append(b, ' ') + ptr := load(ctxptr, code.headIdx) + p := ptrToPtr(ptr + code.offset) + if p == 0 { + b = encodeNull(b) + } else { + b = encodeBool(b, ptrToBool(p)) + } + b = encodeIndentComma(b) + code = code.next + case opStructFieldOmitEmptyBoolPtr: + ptr := load(ctxptr, code.headIdx) + p := ptrToPtr(ptr + code.offset) + if p != 0 { + b = appendIndent(ctx, b, code.indent) + b = append(b, code.escapedKey...) + b = append(b, ' ') + b = encodeBool(b, ptrToBool(p)) + b = encodeIndentComma(b) + } + code = code.next + case opStructFieldStringTagBoolPtr: + b = appendIndent(ctx, b, code.indent) + b = append(b, code.escapedKey...) + b = append(b, ' ') + ptr := load(ctxptr, code.headIdx) + p := ptrToPtr(ptr + code.offset) + if p == 0 { + b = encodeNull(b) + } else { + b = encodeBool(b, ptrToBool(p)) + } + b = encodeIndentComma(b) + code = code.next case opStructFieldBytes: b = appendIndent(ctx, b, code.indent) b = append(b, code.escapedKey...) @@ -7613,6 +8130,43 @@ func encodeRunEscapedIndent(ctx *encodeRuntimeContext, b []byte, codeSet *opcode b = encodeByteSlice(b, ptrToBytes(ptr+code.offset)) b = encodeIndentComma(b) code = code.next + case opStructFieldBytesPtr: + b = appendIndent(ctx, b, code.indent) + b = append(b, code.escapedKey...) + b = append(b, ' ') + ptr := load(ctxptr, code.headIdx) + p := ptrToPtr(ptr + code.offset) + if p == 0 { + b = encodeNull(b) + } else { + b = encodeByteSlice(b, ptrToBytes(p)) + } + b = encodeIndentComma(b) + code = code.next + case opStructFieldOmitEmptyBytesPtr: + ptr := load(ctxptr, code.headIdx) + p := ptrToPtr(ptr + code.offset) + if p != 0 { + b = appendIndent(ctx, b, code.indent) + b = append(b, code.escapedKey...) + b = append(b, ' ') + b = encodeByteSlice(b, ptrToBytes(p)) + b = encodeIndentComma(b) + } + code = code.next + case opStructFieldStringTagBytesPtr: + b = appendIndent(ctx, b, code.indent) + b = append(b, code.escapedKey...) + b = append(b, ' ') + ptr := load(ctxptr, code.headIdx) + p := ptrToPtr(ptr + code.offset) + if p == 0 { + b = encodeNull(b) + } else { + b = encodeByteSlice(b, ptrToBytes(p)) + } + b = encodeIndentComma(b) + code = code.next case opStructFieldMarshalJSON: b = appendIndent(ctx, b, code.indent) b = append(b, code.escapedKey...) diff --git a/encode_vm_indent.go b/encode_vm_indent.go index 587e328..231060e 100644 --- a/encode_vm_indent.go +++ b/encode_vm_indent.go @@ -7174,6 +7174,45 @@ func encodeRunIndent(ctx *encodeRuntimeContext, b []byte, codeSet *opcodeSet, op b = append(b, '"') b = encodeIndentComma(b) code = code.next + case opStructFieldIntPtr: + b = appendIndent(ctx, b, code.indent) + b = append(b, code.key...) + b = append(b, ' ') + ptr := load(ctxptr, code.headIdx) + p := ptrToPtr(ptr + code.offset) + if p == 0 { + b = encodeNull(b) + } else { + b = appendInt(b, int64(ptrToInt(p))) + } + b = encodeIndentComma(b) + code = code.next + case opStructFieldOmitEmptyIntPtr: + ptr := load(ctxptr, code.headIdx) + p := ptrToPtr(ptr + code.offset) + if p != 0 { + b = appendIndent(ctx, b, code.indent) + b = append(b, code.key...) + b = append(b, ' ') + b = appendInt(b, int64(ptrToInt(p))) + b = encodeIndentComma(b) + } + code = code.next + case opStructFieldStringTagIntPtr: + ptr := load(ctxptr, code.headIdx) + p := ptrToPtr(ptr + code.offset) + b = appendIndent(ctx, b, code.indent) + b = append(b, code.key...) + b = append(b, ' ') + if p == 0 { + b = encodeNull(b) + } else { + b = append(b, '"') + b = appendInt(b, int64(ptrToInt(p))) + b = append(b, '"') + } + b = encodeIndentComma(b) + code = code.next case opStructFieldInt8: b = appendIndent(ctx, b, code.indent) b = append(b, code.key...) @@ -7202,6 +7241,45 @@ func encodeRunIndent(ctx *encodeRuntimeContext, b []byte, codeSet *opcodeSet, op b = append(b, '"') b = encodeIndentComma(b) code = code.next + case opStructFieldInt8Ptr: + b = appendIndent(ctx, b, code.indent) + b = append(b, code.key...) + b = append(b, ' ') + ptr := load(ctxptr, code.headIdx) + p := ptrToPtr(ptr + code.offset) + if p == 0 { + b = encodeNull(b) + } else { + b = appendInt(b, int64(ptrToInt8(p))) + } + b = encodeIndentComma(b) + code = code.next + case opStructFieldOmitEmptyInt8Ptr: + ptr := load(ctxptr, code.headIdx) + p := ptrToPtr(ptr + code.offset) + if p != 0 { + b = appendIndent(ctx, b, code.indent) + b = append(b, code.key...) + b = append(b, ' ') + b = appendInt(b, int64(ptrToInt8(p))) + b = encodeIndentComma(b) + } + code = code.next + case opStructFieldStringTagInt8Ptr: + ptr := load(ctxptr, code.headIdx) + p := ptrToPtr(ptr + code.offset) + b = appendIndent(ctx, b, code.indent) + b = append(b, code.key...) + b = append(b, ' ') + if p == 0 { + b = encodeNull(b) + } else { + b = append(b, '"') + b = appendInt(b, int64(ptrToInt8(p))) + b = append(b, '"') + } + b = encodeIndentComma(b) + code = code.next case opStructFieldInt16: b = appendIndent(ctx, b, code.indent) b = append(b, code.key...) @@ -7230,6 +7308,45 @@ func encodeRunIndent(ctx *encodeRuntimeContext, b []byte, codeSet *opcodeSet, op b = append(b, '"') b = encodeIndentComma(b) code = code.next + case opStructFieldInt16Ptr: + b = appendIndent(ctx, b, code.indent) + b = append(b, code.key...) + b = append(b, ' ') + ptr := load(ctxptr, code.headIdx) + p := ptrToPtr(ptr + code.offset) + if p == 0 { + b = encodeNull(b) + } else { + b = appendInt(b, int64(ptrToInt16(p))) + } + b = encodeIndentComma(b) + code = code.next + case opStructFieldOmitEmptyInt16Ptr: + ptr := load(ctxptr, code.headIdx) + p := ptrToPtr(ptr + code.offset) + if p != 0 { + b = appendIndent(ctx, b, code.indent) + b = append(b, code.key...) + b = append(b, ' ') + b = appendInt(b, int64(ptrToInt16(p))) + b = encodeIndentComma(b) + } + code = code.next + case opStructFieldStringTagInt16Ptr: + ptr := load(ctxptr, code.headIdx) + p := ptrToPtr(ptr + code.offset) + b = appendIndent(ctx, b, code.indent) + b = append(b, code.key...) + b = append(b, ' ') + if p == 0 { + b = encodeNull(b) + } else { + b = append(b, '"') + b = appendInt(b, int64(ptrToInt16(p))) + b = append(b, '"') + } + b = encodeIndentComma(b) + code = code.next case opStructFieldInt32: b = appendIndent(ctx, b, code.indent) b = append(b, code.key...) @@ -7258,6 +7375,45 @@ func encodeRunIndent(ctx *encodeRuntimeContext, b []byte, codeSet *opcodeSet, op b = append(b, '"') b = encodeIndentComma(b) code = code.next + case opStructFieldInt32Ptr: + b = appendIndent(ctx, b, code.indent) + b = append(b, code.key...) + b = append(b, ' ') + ptr := load(ctxptr, code.headIdx) + p := ptrToPtr(ptr + code.offset) + if p == 0 { + b = encodeNull(b) + } else { + b = appendInt(b, int64(ptrToInt32(p))) + } + b = encodeIndentComma(b) + code = code.next + case opStructFieldOmitEmptyInt32Ptr: + ptr := load(ctxptr, code.headIdx) + p := ptrToPtr(ptr + code.offset) + if p != 0 { + b = appendIndent(ctx, b, code.indent) + b = append(b, code.key...) + b = append(b, ' ') + b = appendInt(b, int64(ptrToInt32(p))) + b = encodeIndentComma(b) + } + code = code.next + case opStructFieldStringTagInt32Ptr: + ptr := load(ctxptr, code.headIdx) + p := ptrToPtr(ptr + code.offset) + b = appendIndent(ctx, b, code.indent) + b = append(b, code.key...) + b = append(b, ' ') + if p == 0 { + b = encodeNull(b) + } else { + b = append(b, '"') + b = appendInt(b, int64(ptrToInt32(p))) + b = append(b, '"') + } + b = encodeIndentComma(b) + code = code.next case opStructFieldInt64: b = appendIndent(ctx, b, code.indent) b = append(b, code.key...) @@ -7286,6 +7442,45 @@ func encodeRunIndent(ctx *encodeRuntimeContext, b []byte, codeSet *opcodeSet, op b = append(b, '"') b = encodeIndentComma(b) code = code.next + case opStructFieldInt64Ptr: + b = appendIndent(ctx, b, code.indent) + b = append(b, code.key...) + b = append(b, ' ') + ptr := load(ctxptr, code.headIdx) + p := ptrToPtr(ptr + code.offset) + if p == 0 { + b = encodeNull(b) + } else { + b = appendInt(b, ptrToInt64(p)) + } + b = encodeIndentComma(b) + code = code.next + case opStructFieldOmitEmptyInt64Ptr: + ptr := load(ctxptr, code.headIdx) + p := ptrToPtr(ptr + code.offset) + if p != 0 { + b = appendIndent(ctx, b, code.indent) + b = append(b, code.key...) + b = append(b, ' ') + b = appendInt(b, ptrToInt64(p)) + b = encodeIndentComma(b) + } + code = code.next + case opStructFieldStringTagInt64Ptr: + ptr := load(ctxptr, code.headIdx) + p := ptrToPtr(ptr + code.offset) + b = appendIndent(ctx, b, code.indent) + b = append(b, code.key...) + b = append(b, ' ') + if p == 0 { + b = encodeNull(b) + } else { + b = append(b, '"') + b = appendInt(b, ptrToInt64(p)) + b = append(b, '"') + } + b = encodeIndentComma(b) + code = code.next case opStructFieldUint: b = appendIndent(ctx, b, code.indent) b = append(b, code.key...) @@ -7314,6 +7509,45 @@ func encodeRunIndent(ctx *encodeRuntimeContext, b []byte, codeSet *opcodeSet, op b = append(b, '"') b = encodeIndentComma(b) code = code.next + case opStructFieldUintPtr: + b = appendIndent(ctx, b, code.indent) + b = append(b, code.key...) + b = append(b, ' ') + ptr := load(ctxptr, code.headIdx) + p := ptrToPtr(ptr + code.offset) + if p == 0 { + b = encodeNull(b) + } else { + b = appendUint(b, uint64(ptrToUint(p))) + } + b = encodeIndentComma(b) + code = code.next + case opStructFieldOmitEmptyUintPtr: + ptr := load(ctxptr, code.headIdx) + p := ptrToPtr(ptr + code.offset) + if p != 0 { + b = appendIndent(ctx, b, code.indent) + b = append(b, code.key...) + b = append(b, ' ') + b = appendUint(b, uint64(ptrToUint(p))) + b = encodeIndentComma(b) + } + code = code.next + case opStructFieldStringTagUintPtr: + ptr := load(ctxptr, code.headIdx) + p := ptrToPtr(ptr + code.offset) + b = appendIndent(ctx, b, code.indent) + b = append(b, code.key...) + b = append(b, ' ') + if p == 0 { + b = encodeNull(b) + } else { + b = append(b, '"') + b = appendUint(b, uint64(ptrToUint(p))) + b = append(b, '"') + } + b = encodeIndentComma(b) + code = code.next case opStructFieldUint8: b = appendIndent(ctx, b, code.indent) b = append(b, code.key...) @@ -7342,6 +7576,45 @@ func encodeRunIndent(ctx *encodeRuntimeContext, b []byte, codeSet *opcodeSet, op b = append(b, '"') b = encodeIndentComma(b) code = code.next + case opStructFieldUint8Ptr: + b = appendIndent(ctx, b, code.indent) + b = append(b, code.key...) + b = append(b, ' ') + ptr := load(ctxptr, code.headIdx) + p := ptrToPtr(ptr + code.offset) + if p == 0 { + b = encodeNull(b) + } else { + b = appendUint(b, uint64(ptrToUint8(p))) + } + b = encodeIndentComma(b) + code = code.next + case opStructFieldOmitEmptyUint8Ptr: + ptr := load(ctxptr, code.headIdx) + p := ptrToPtr(ptr + code.offset) + if p != 0 { + b = appendIndent(ctx, b, code.indent) + b = append(b, code.key...) + b = append(b, ' ') + b = appendUint(b, uint64(ptrToUint8(p))) + b = encodeIndentComma(b) + } + code = code.next + case opStructFieldStringTagUint8Ptr: + ptr := load(ctxptr, code.headIdx) + p := ptrToPtr(ptr + code.offset) + b = appendIndent(ctx, b, code.indent) + b = append(b, code.key...) + b = append(b, ' ') + if p == 0 { + b = encodeNull(b) + } else { + b = append(b, '"') + b = appendUint(b, uint64(ptrToUint8(p))) + b = append(b, '"') + } + b = encodeIndentComma(b) + code = code.next case opStructFieldUint16: b = appendIndent(ctx, b, code.indent) b = append(b, code.key...) @@ -7370,6 +7643,45 @@ func encodeRunIndent(ctx *encodeRuntimeContext, b []byte, codeSet *opcodeSet, op b = append(b, '"') b = encodeIndentComma(b) code = code.next + case opStructFieldUint16Ptr: + b = appendIndent(ctx, b, code.indent) + b = append(b, code.key...) + b = append(b, ' ') + ptr := load(ctxptr, code.headIdx) + p := ptrToPtr(ptr + code.offset) + if p == 0 { + b = encodeNull(b) + } else { + b = appendUint(b, uint64(ptrToUint16(p))) + } + b = encodeIndentComma(b) + code = code.next + case opStructFieldOmitEmptyUint16Ptr: + ptr := load(ctxptr, code.headIdx) + p := ptrToPtr(ptr + code.offset) + if p != 0 { + b = appendIndent(ctx, b, code.indent) + b = append(b, code.key...) + b = append(b, ' ') + b = appendUint(b, uint64(ptrToUint16(p))) + b = encodeIndentComma(b) + } + code = code.next + case opStructFieldStringTagUint16Ptr: + ptr := load(ctxptr, code.headIdx) + p := ptrToPtr(ptr + code.offset) + b = appendIndent(ctx, b, code.indent) + b = append(b, code.key...) + b = append(b, ' ') + if p == 0 { + b = encodeNull(b) + } else { + b = append(b, '"') + b = appendUint(b, uint64(ptrToUint16(p))) + b = append(b, '"') + } + b = encodeIndentComma(b) + code = code.next case opStructFieldUint32: b = appendIndent(ctx, b, code.indent) b = append(b, code.key...) @@ -7398,6 +7710,45 @@ func encodeRunIndent(ctx *encodeRuntimeContext, b []byte, codeSet *opcodeSet, op b = append(b, '"') b = encodeIndentComma(b) code = code.next + case opStructFieldUint32Ptr: + b = appendIndent(ctx, b, code.indent) + b = append(b, code.key...) + b = append(b, ' ') + ptr := load(ctxptr, code.headIdx) + p := ptrToPtr(ptr + code.offset) + if p == 0 { + b = encodeNull(b) + } else { + b = appendUint(b, uint64(ptrToUint32(p))) + } + b = encodeIndentComma(b) + code = code.next + case opStructFieldOmitEmptyUint32Ptr: + ptr := load(ctxptr, code.headIdx) + p := ptrToPtr(ptr + code.offset) + if p != 0 { + b = appendIndent(ctx, b, code.indent) + b = append(b, code.key...) + b = append(b, ' ') + b = appendUint(b, uint64(ptrToUint32(p))) + b = encodeIndentComma(b) + } + code = code.next + case opStructFieldStringTagUint32Ptr: + ptr := load(ctxptr, code.headIdx) + p := ptrToPtr(ptr + code.offset) + b = appendIndent(ctx, b, code.indent) + b = append(b, code.key...) + b = append(b, ' ') + if p == 0 { + b = encodeNull(b) + } else { + b = append(b, '"') + b = appendUint(b, uint64(ptrToUint32(p))) + b = append(b, '"') + } + b = encodeIndentComma(b) + code = code.next case opStructFieldUint64: b = appendIndent(ctx, b, code.indent) b = append(b, code.key...) @@ -7426,6 +7777,45 @@ func encodeRunIndent(ctx *encodeRuntimeContext, b []byte, codeSet *opcodeSet, op b = append(b, '"') b = encodeIndentComma(b) code = code.next + case opStructFieldUint64Ptr: + b = appendIndent(ctx, b, code.indent) + b = append(b, code.key...) + b = append(b, ' ') + ptr := load(ctxptr, code.headIdx) + p := ptrToPtr(ptr + code.offset) + if p == 0 { + b = encodeNull(b) + } else { + b = appendUint(b, ptrToUint64(p)) + } + b = encodeIndentComma(b) + code = code.next + case opStructFieldOmitEmptyUint64Ptr: + ptr := load(ctxptr, code.headIdx) + p := ptrToPtr(ptr + code.offset) + if p != 0 { + b = appendIndent(ctx, b, code.indent) + b = append(b, code.key...) + b = append(b, ' ') + b = appendUint(b, ptrToUint64(p)) + b = encodeIndentComma(b) + } + code = code.next + case opStructFieldStringTagUint64Ptr: + ptr := load(ctxptr, code.headIdx) + p := ptrToPtr(ptr + code.offset) + b = appendIndent(ctx, b, code.indent) + b = append(b, code.key...) + b = append(b, ' ') + if p == 0 { + b = encodeNull(b) + } else { + b = append(b, '"') + b = appendUint(b, ptrToUint64(p)) + b = append(b, '"') + } + b = encodeIndentComma(b) + code = code.next case opStructFieldFloat32: b = appendIndent(ctx, b, code.indent) b = append(b, code.key...) @@ -7454,6 +7844,45 @@ func encodeRunIndent(ctx *encodeRuntimeContext, b []byte, codeSet *opcodeSet, op b = append(b, '"') b = encodeIndentComma(b) code = code.next + case opStructFieldFloat32Ptr: + b = appendIndent(ctx, b, code.indent) + b = append(b, code.key...) + b = append(b, ' ') + ptr := load(ctxptr, code.headIdx) + p := ptrToPtr(ptr + code.offset) + if p == 0 { + b = encodeNull(b) + } else { + b = encodeFloat32(b, ptrToFloat32(p)) + } + b = encodeIndentComma(b) + code = code.next + case opStructFieldOmitEmptyFloat32Ptr: + ptr := load(ctxptr, code.headIdx) + p := ptrToPtr(ptr + code.offset) + if p != 0 { + b = appendIndent(ctx, b, code.indent) + b = append(b, code.key...) + b = append(b, ' ') + b = encodeFloat32(b, ptrToFloat32(p)) + b = encodeIndentComma(b) + } + code = code.next + case opStructFieldStringTagFloat32Ptr: + ptr := load(ctxptr, code.headIdx) + p := ptrToPtr(ptr + code.offset) + b = appendIndent(ctx, b, code.indent) + b = append(b, code.key...) + b = append(b, ' ') + if p == 0 { + b = encodeNull(b) + } else { + b = append(b, '"') + b = encodeFloat32(b, ptrToFloat32(p)) + b = append(b, '"') + } + b = encodeIndentComma(b) + code = code.next case opStructFieldFloat64: b = appendIndent(ctx, b, code.indent) b = append(b, code.key...) @@ -7493,6 +7922,57 @@ func encodeRunIndent(ctx *encodeRuntimeContext, b []byte, codeSet *opcodeSet, op b = append(b, '"') b = encodeIndentComma(b) code = code.next + case opStructFieldFloat64Ptr: + b = appendIndent(ctx, b, code.indent) + b = append(b, code.key...) + b = append(b, ' ') + ptr := load(ctxptr, code.headIdx) + p := ptrToPtr(ptr + code.offset) + if p == 0 { + b = encodeNull(b) + } else { + v := 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 opStructFieldOmitEmptyFloat64Ptr: + ptr := load(ctxptr, code.headIdx) + p := ptrToPtr(ptr + code.offset) + if p != 0 { + b = appendIndent(ctx, b, code.indent) + b = append(b, code.key...) + b = append(b, ' ') + v := 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 opStructFieldStringTagFloat64Ptr: + ptr := load(ctxptr, code.headIdx) + p := ptrToPtr(ptr + code.offset) + b = appendIndent(ctx, b, code.indent) + b = append(b, code.key...) + b = append(b, ' ') + if p == 0 { + b = encodeNull(b) + } else { + b = append(b, '"') + v := ptrToFloat64(p) + if math.IsInf(v, 0) || math.IsNaN(v) { + return nil, errUnsupportedFloat(v) + } + b = encodeFloat64(b, v) + b = append(b, '"') + } + b = encodeIndentComma(b) + code = code.next case opStructFieldString: b = appendIndent(ctx, b, code.indent) b = append(b, code.key...) @@ -7586,6 +8066,43 @@ func encodeRunIndent(ctx *encodeRuntimeContext, b []byte, codeSet *opcodeSet, op b = append(b, '"') b = encodeIndentComma(b) code = code.next + case opStructFieldBoolPtr: + b = appendIndent(ctx, b, code.indent) + b = append(b, code.key...) + b = append(b, ' ') + ptr := load(ctxptr, code.headIdx) + p := ptrToPtr(ptr + code.offset) + if p == 0 { + b = encodeNull(b) + } else { + b = encodeBool(b, ptrToBool(p)) + } + b = encodeIndentComma(b) + code = code.next + case opStructFieldOmitEmptyBoolPtr: + ptr := load(ctxptr, code.headIdx) + p := ptrToPtr(ptr + code.offset) + if p != 0 { + b = appendIndent(ctx, b, code.indent) + b = append(b, code.key...) + b = append(b, ' ') + b = encodeBool(b, ptrToBool(p)) + b = encodeIndentComma(b) + } + code = code.next + case opStructFieldStringTagBoolPtr: + b = appendIndent(ctx, b, code.indent) + b = append(b, code.key...) + b = append(b, ' ') + ptr := load(ctxptr, code.headIdx) + p := ptrToPtr(ptr + code.offset) + if p == 0 { + b = encodeNull(b) + } else { + b = encodeBool(b, ptrToBool(p)) + } + b = encodeIndentComma(b) + code = code.next case opStructFieldBytes: b = appendIndent(ctx, b, code.indent) b = append(b, code.key...) @@ -7613,6 +8130,43 @@ func encodeRunIndent(ctx *encodeRuntimeContext, b []byte, codeSet *opcodeSet, op b = encodeByteSlice(b, ptrToBytes(ptr+code.offset)) b = encodeIndentComma(b) code = code.next + case opStructFieldBytesPtr: + b = appendIndent(ctx, b, code.indent) + b = append(b, code.key...) + b = append(b, ' ') + ptr := load(ctxptr, code.headIdx) + p := ptrToPtr(ptr + code.offset) + if p == 0 { + b = encodeNull(b) + } else { + b = encodeByteSlice(b, ptrToBytes(p)) + } + b = encodeIndentComma(b) + code = code.next + case opStructFieldOmitEmptyBytesPtr: + ptr := load(ctxptr, code.headIdx) + p := ptrToPtr(ptr + code.offset) + if p != 0 { + b = appendIndent(ctx, b, code.indent) + b = append(b, code.key...) + b = append(b, ' ') + b = encodeByteSlice(b, ptrToBytes(p)) + b = encodeIndentComma(b) + } + code = code.next + case opStructFieldStringTagBytesPtr: + b = appendIndent(ctx, b, code.indent) + b = append(b, code.key...) + b = append(b, ' ') + ptr := load(ctxptr, code.headIdx) + p := ptrToPtr(ptr + code.offset) + if p == 0 { + b = encodeNull(b) + } else { + b = encodeByteSlice(b, ptrToBytes(p)) + } + b = encodeIndentComma(b) + code = code.next case opStructFieldMarshalJSON: b = appendIndent(ctx, b, code.indent) b = append(b, code.key...)