Add test cases for string type

This commit is contained in:
Masaaki Goshima 2021-01-21 00:22:20 +09:00
parent aea9579a7b
commit d859255868
5 changed files with 3993 additions and 285 deletions

File diff suppressed because it is too large Load Diff

View File

@ -6029,6 +6029,50 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte
b = encodeComma(b)
code = code.next
}
case opStructFieldPtrHeadOmitEmptyString:
ptr := load(ctxptr, code.idx)
if ptr != 0 {
store(ctxptr, code.idx, e.ptrToPtr(ptr))
}
fallthrough
case opStructFieldHeadOmitEmptyString:
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.key...)
b = encodeNoEscapedString(b, v)
b = encodeComma(b)
code = code.next
}
}
case opStructFieldPtrHeadStringTagString:
ptr := load(ctxptr, code.idx)
if ptr != 0 {
store(ctxptr, code.idx, e.ptrToPtr(ptr))
}
fallthrough
case opStructFieldHeadStringTagString:
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.key...)
s := e.ptrToString(ptr + code.offset)
b = encodeNoEscapedString(b, string(encodeNoEscapedString([]byte{}, s)))
b = encodeComma(b)
code = code.next
}
case opStructFieldPtrHeadStringOnly, opStructFieldHeadStringOnly:
p := load(ctxptr, code.idx)
b = append(b, '{')
@ -6036,6 +6080,23 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte
b = encodeNoEscapedString(b, e.ptrToString(p))
b = encodeComma(b)
code = code.next
case opStructFieldPtrHeadOmitEmptyStringOnly, opStructFieldHeadOmitEmptyStringOnly:
p := load(ctxptr, code.idx)
b = append(b, '{')
v := e.ptrToString(p)
if v != "" {
b = append(b, code.key...)
b = encodeNoEscapedString(b, v)
b = encodeComma(b)
}
code = code.next
case opStructFieldPtrHeadStringTagStringOnly, opStructFieldHeadStringTagStringOnly:
p := load(ctxptr, code.idx)
b = append(b, '{')
b = append(b, code.key...)
b = encodeNoEscapedString(b, string(encodeNoEscapedString([]byte{}, e.ptrToString(p))))
b = encodeComma(b)
code = code.next
case opStructFieldPtrHeadStringPtr:
store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx)))
fallthrough
@ -6058,6 +6119,47 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte
}
b = encodeComma(b)
code = code.next
case opStructFieldPtrHeadOmitEmptyStringPtr:
store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx)))
fallthrough
case opStructFieldHeadOmitEmptyStringPtr:
p := load(ctxptr, code.idx)
if p == 0 {
b = encodeNull(b)
b = encodeComma(b)
code = code.end.next
} else {
b = append(b, '{')
p = e.ptrToPtr(p)
if p != 0 {
b = append(b, code.key...)
b = encodeNoEscapedString(b, e.ptrToString(p))
b = encodeComma(b)
}
code = code.next
}
case opStructFieldPtrHeadStringTagStringPtr:
store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx)))
fallthrough
case opStructFieldHeadStringTagStringPtr:
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.key...)
p = e.ptrToPtr(p)
if p == 0 {
b = encodeNull(b)
} else {
b = encodeNoEscapedString(b, string(encodeNoEscapedString([]byte{}, e.ptrToString(p))))
}
}
b = encodeComma(b)
code = code.next
case opStructFieldPtrHeadStringPtrOnly:
p := load(ctxptr, code.idx)
if p == 0 {
@ -6079,6 +6181,67 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte
}
b = encodeComma(b)
code = code.next
case opStructFieldPtrHeadOmitEmptyStringPtrOnly:
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 opStructFieldHeadOmitEmptyStringPtrOnly:
b = append(b, '{')
p := load(ctxptr, code.idx)
if p != 0 {
b = append(b, code.key...)
b = encodeNoEscapedString(b, e.ptrToString(p+code.offset))
b = encodeComma(b)
}
code = code.next
case opStructFieldPtrHeadStringTagStringPtrOnly:
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 opStructFieldHeadStringTagStringPtrOnly:
p := load(ctxptr, code.idx)
b = append(b, '{')
b = append(b, code.key...)
if p == 0 {
b = encodeNull(b)
} else {
b = encodeNoEscapedString(b, string(encodeNoEscapedString([]byte{}, e.ptrToString(p))))
}
b = encodeComma(b)
code = code.next
case opStructFieldHeadStringNPtr:
p := load(ctxptr, code.idx)
if p == 0 {
b = encodeNull(b)
} else {
b = append(b, '{')
b = append(b, code.key...)
for i := 0; i < code.ptrNum; i++ {
if p == 0 {
break
}
p = e.ptrToPtr(p)
}
if p == 0 {
b = encodeNull(b)
} else {
b = encodeNoEscapedString(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
@ -6092,6 +6255,43 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte
b = encodeComma(b)
code = code.next
}
case opStructFieldPtrAnonymousHeadOmitEmptyString:
ptr := load(ctxptr, code.idx)
if ptr != 0 {
store(ctxptr, code.idx, e.ptrToPtr(ptr))
}
fallthrough
case opStructFieldAnonymousHeadOmitEmptyString:
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.key...)
b = encodeNoEscapedString(b, v)
b = encodeComma(b)
code = code.next
}
}
case opStructFieldPtrAnonymousHeadStringTagString:
ptr := load(ctxptr, code.idx)
if ptr != 0 {
store(ctxptr, code.idx, e.ptrToPtr(ptr))
}
fallthrough
case opStructFieldAnonymousHeadStringTagString:
ptr := load(ctxptr, code.idx)
if ptr == 0 {
code = code.end.next
} else {
b = append(b, code.key...)
b = encodeNoEscapedString(b, string(encodeNoEscapedString([]byte{}, e.ptrToString(ptr))))
b = encodeComma(b)
code = code.next
}
case opStructFieldPtrAnonymousHeadStringOnly, opStructFieldAnonymousHeadStringOnly:
ptr := load(ctxptr, code.idx)
if ptr == 0 {
@ -6102,6 +6302,31 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte
b = encodeComma(b)
code = code.next
}
case opStructFieldPtrAnonymousHeadOmitEmptyStringOnly, opStructFieldAnonymousHeadOmitEmptyStringOnly:
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.key...)
b = encodeNoEscapedString(b, v)
b = encodeComma(b)
code = code.next
}
}
case opStructFieldPtrAnonymousHeadStringTagStringOnly, opStructFieldAnonymousHeadStringTagStringOnly:
ptr := load(ctxptr, code.idx)
if ptr == 0 {
code = code.end.next
} else {
b = append(b, code.key...)
b = encodeNoEscapedString(b, string(encodeNoEscapedString([]byte{}, e.ptrToString(ptr))))
b = encodeComma(b)
code = code.next
}
case opStructFieldPtrAnonymousHeadStringPtr:
store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx)))
fallthrough
@ -6120,6 +6345,42 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte
}
b = encodeComma(b)
code = code.next
case opStructFieldPtrAnonymousHeadOmitEmptyStringPtr:
store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx)))
fallthrough
case opStructFieldAnonymousHeadOmitEmptyStringPtr:
p := load(ctxptr, code.idx)
if p == 0 {
code = code.end.next
break
}
p = e.ptrToPtr(p)
if p == 0 {
code = code.nextField
} else {
b = append(b, code.key...)
b = encodeNoEscapedString(b, e.ptrToString(p))
b = encodeComma(b)
code = code.next
}
case opStructFieldPtrAnonymousHeadStringTagStringPtr:
store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx)))
fallthrough
case opStructFieldAnonymousHeadStringTagStringPtr:
p := load(ctxptr, code.idx)
if p == 0 {
code = code.end.next
break
}
b = append(b, code.key...)
p = e.ptrToPtr(p)
if p == 0 {
b = encodeNull(b)
} else {
b = encodeNoEscapedString(b, string(encodeNoEscapedString([]byte{}, e.ptrToString(p))))
}
b = encodeComma(b)
code = code.next
case opStructFieldPtrAnonymousHeadStringPtrOnly:
p := load(ctxptr, code.idx)
if p == 0 {
@ -6138,6 +6399,42 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte
}
b = encodeComma(b)
code = code.next
case opStructFieldPtrAnonymousHeadOmitEmptyStringPtrOnly:
p := load(ctxptr, code.idx)
if p == 0 {
code = code.end.next
break
}
store(ctxptr, code.idx, e.ptrToPtr(p))
fallthrough
case opStructFieldAnonymousHeadOmitEmptyStringPtrOnly:
p := load(ctxptr, code.idx)
if p == 0 {
code = code.nextField
} else {
b = append(b, code.key...)
b = encodeNoEscapedString(b, e.ptrToString(p+code.offset))
b = encodeComma(b)
code = code.next
}
case opStructFieldPtrAnonymousHeadStringTagStringPtrOnly:
p := load(ctxptr, code.idx)
if p == 0 {
code = code.end.next
break
}
store(ctxptr, code.idx, e.ptrToPtr(p))
fallthrough
case opStructFieldAnonymousHeadStringTagStringPtrOnly:
p := load(ctxptr, code.idx)
b = append(b, code.key...)
if p == 0 {
b = encodeNull(b)
} else {
b = encodeNoEscapedString(b, string(encodeNoEscapedString([]byte{}, e.ptrToString(p))))
}
b = encodeComma(b)
code = code.next
case opStructFieldPtrHeadBool:
p := load(ctxptr, code.idx)
if p == 0 {
@ -6458,51 +6755,6 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte
b = encodeComma(b)
code = code.next
}
case opStructFieldPtrHeadOmitEmptyString:
ptr := load(ctxptr, code.idx)
if ptr != 0 {
store(ctxptr, code.idx, e.ptrToPtr(ptr))
}
fallthrough
case opStructFieldHeadOmitEmptyString:
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.key...)
b = encodeNoEscapedString(b, v)
b = encodeComma(b)
code = code.next
}
}
case opStructFieldPtrAnonymousHeadOmitEmptyString:
ptr := load(ctxptr, code.idx)
if ptr != 0 {
store(ctxptr, code.idx, e.ptrToPtr(ptr))
}
fallthrough
case opStructFieldAnonymousHeadOmitEmptyString:
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.key...)
b = encodeNoEscapedString(b, v)
b = encodeComma(b)
code = code.next
}
}
case opStructFieldPtrHeadOmitEmptyBool:
ptr := load(ctxptr, code.idx)
if ptr != 0 {
@ -6785,43 +7037,6 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte
code = code.next
store(ctxptr, code.idx, ptr+code.offset)
}
case opStructFieldPtrHeadStringTagString:
ptr := load(ctxptr, code.idx)
if ptr != 0 {
store(ctxptr, code.idx, e.ptrToPtr(ptr))
}
fallthrough
case opStructFieldHeadStringTagString:
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.key...)
s := e.ptrToString(ptr + code.offset)
b = encodeNoEscapedString(b, string(encodeNoEscapedString([]byte{}, s)))
b = encodeComma(b)
code = code.next
}
case opStructFieldPtrAnonymousHeadStringTagString:
ptr := load(ctxptr, code.idx)
if ptr != 0 {
store(ctxptr, code.idx, e.ptrToPtr(ptr))
}
fallthrough
case opStructFieldAnonymousHeadStringTagString:
ptr := load(ctxptr, code.idx)
if ptr == 0 {
code = code.end.next
} else {
b = append(b, code.key...)
s := string(encodeNoEscapedString([]byte{}, (e.ptrToString(ptr + code.offset))))
b = encodeNoEscapedString(b, s)
b = encodeComma(b)
code = code.next
}
case opStructFieldPtrHeadStringTagBool:
ptr := load(ctxptr, code.idx)
if ptr != 0 {
@ -8703,6 +8918,44 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte
}
b = appendStructEnd(b)
code = code.next
case opStructEndOmitEmptyStringPtr:
ptr := load(ctxptr, code.headIdx)
p := e.ptrToPtr(ptr + code.offset)
if p != 0 {
b = append(b, code.key...)
b = encodeNoEscapedString(b, e.ptrToString(p))
}
b = appendStructEnd(b)
code = code.next
case opStructEndStringTagStringPtr:
b = append(b, code.key...)
ptr := load(ctxptr, code.headIdx)
p := e.ptrToPtr(ptr + code.offset)
if p == 0 {
b = encodeNull(b)
} else {
v := e.ptrToString(p)
b = encodeNoEscapedString(b, string(encodeNoEscapedString([]byte{}, v)))
}
b = appendStructEnd(b)
code = code.next
case opStructEndStringNPtr:
b = append(b, code.key...)
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 = encodeNoEscapedString(b, e.ptrToString(p))
}
b = appendStructEnd(b)
code = code.next
case opStructEndBool:
ptr := load(ctxptr, code.headIdx)
b = append(b, code.key...)

View File

@ -5996,6 +5996,50 @@ func (e *Encoder) runEscaped(ctx *encodeRuntimeContext, b []byte, code *opcode)
b = encodeComma(b)
code = code.next
}
case opStructFieldPtrHeadOmitEmptyString:
ptr := load(ctxptr, code.idx)
if ptr != 0 {
store(ctxptr, code.idx, e.ptrToPtr(ptr))
}
fallthrough
case opStructFieldHeadOmitEmptyString:
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 opStructFieldPtrHeadStringTagString:
ptr := load(ctxptr, code.idx)
if ptr != 0 {
store(ctxptr, code.idx, e.ptrToPtr(ptr))
}
fallthrough
case opStructFieldHeadStringTagString:
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 opStructFieldPtrHeadStringOnly, opStructFieldHeadStringOnly:
p := load(ctxptr, code.idx)
b = append(b, '{')
@ -6003,6 +6047,23 @@ func (e *Encoder) runEscaped(ctx *encodeRuntimeContext, b []byte, code *opcode)
b = encodeEscapedString(b, e.ptrToString(p+code.offset))
b = encodeComma(b)
code = code.next
case opStructFieldPtrHeadOmitEmptyStringOnly, opStructFieldHeadOmitEmptyStringOnly:
p := load(ctxptr, code.idx)
b = append(b, '{')
v := e.ptrToString(p)
if v != "" {
b = append(b, code.escapedKey...)
b = encodeEscapedString(b, v)
b = encodeComma(b)
}
code = code.next
case opStructFieldPtrHeadStringTagStringOnly, opStructFieldHeadStringTagStringOnly:
p := load(ctxptr, code.idx)
b = append(b, '{')
b = append(b, code.escapedKey...)
b = encodeEscapedString(b, string(encodeEscapedString([]byte{}, e.ptrToString(p))))
b = encodeComma(b)
code = code.next
case opStructFieldPtrHeadStringPtr:
store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx)))
fallthrough
@ -6025,6 +6086,47 @@ func (e *Encoder) runEscaped(ctx *encodeRuntimeContext, b []byte, code *opcode)
}
b = encodeComma(b)
code = code.next
case opStructFieldPtrHeadOmitEmptyStringPtr:
store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx)))
fallthrough
case opStructFieldHeadOmitEmptyStringPtr:
p := load(ctxptr, code.idx)
if p == 0 {
b = encodeNull(b)
b = encodeComma(b)
code = code.end.next
} else {
b = append(b, '{')
p = e.ptrToPtr(p)
if p != 0 {
b = append(b, code.escapedKey...)
b = encodeEscapedString(b, e.ptrToString(p))
b = encodeComma(b)
}
code = code.next
}
case opStructFieldPtrHeadStringTagStringPtr:
store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx)))
fallthrough
case opStructFieldHeadStringTagStringPtr:
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, string(encodeEscapedString([]byte{}, e.ptrToString(p))))
}
}
b = encodeComma(b)
code = code.next
case opStructFieldPtrHeadStringPtrOnly:
p := load(ctxptr, code.idx)
if p == 0 {
@ -6046,6 +6148,67 @@ func (e *Encoder) runEscaped(ctx *encodeRuntimeContext, b []byte, code *opcode)
}
b = encodeComma(b)
code = code.next
case opStructFieldPtrHeadOmitEmptyStringPtrOnly:
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 opStructFieldHeadOmitEmptyStringPtrOnly:
b = append(b, '{')
p := load(ctxptr, code.idx)
if p != 0 {
b = append(b, code.escapedKey...)
b = encodeEscapedString(b, e.ptrToString(p+code.offset))
b = encodeComma(b)
}
code = code.next
case opStructFieldPtrHeadStringTagStringPtrOnly:
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 opStructFieldHeadStringTagStringPtrOnly:
p := load(ctxptr, code.idx)
b = append(b, '{')
b = append(b, code.escapedKey...)
if p == 0 {
b = encodeNull(b)
} else {
b = encodeEscapedString(b, string(encodeEscapedString([]byte{}, e.ptrToString(p))))
}
b = encodeComma(b)
code = code.next
case opStructFieldHeadStringNPtr:
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 = 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
@ -6059,6 +6222,43 @@ func (e *Encoder) runEscaped(ctx *encodeRuntimeContext, b []byte, code *opcode)
b = encodeComma(b)
code = code.next
}
case opStructFieldPtrAnonymousHeadOmitEmptyString:
ptr := load(ctxptr, code.idx)
if ptr != 0 {
store(ctxptr, code.idx, e.ptrToPtr(ptr))
}
fallthrough
case opStructFieldAnonymousHeadOmitEmptyString:
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 opStructFieldPtrAnonymousHeadStringTagString:
ptr := load(ctxptr, code.idx)
if ptr != 0 {
store(ctxptr, code.idx, e.ptrToPtr(ptr))
}
fallthrough
case opStructFieldAnonymousHeadStringTagString:
ptr := load(ctxptr, code.idx)
if ptr == 0 {
code = code.end.next
} else {
b = append(b, code.escapedKey...)
b = encodeEscapedString(b, string(encodeEscapedString([]byte{}, e.ptrToString(ptr))))
b = encodeComma(b)
code = code.next
}
case opStructFieldPtrAnonymousHeadStringOnly, opStructFieldAnonymousHeadStringOnly:
ptr := load(ctxptr, code.idx)
if ptr == 0 {
@ -6069,6 +6269,31 @@ func (e *Encoder) runEscaped(ctx *encodeRuntimeContext, b []byte, code *opcode)
b = encodeComma(b)
code = code.next
}
case opStructFieldPtrAnonymousHeadOmitEmptyStringOnly, opStructFieldAnonymousHeadOmitEmptyStringOnly:
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 opStructFieldPtrAnonymousHeadStringTagStringOnly, opStructFieldAnonymousHeadStringTagStringOnly:
ptr := load(ctxptr, code.idx)
if ptr == 0 {
code = code.end.next
} else {
b = append(b, code.escapedKey...)
b = encodeEscapedString(b, string(encodeEscapedString([]byte{}, e.ptrToString(ptr))))
b = encodeComma(b)
code = code.next
}
case opStructFieldPtrAnonymousHeadStringPtr:
store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx)))
fallthrough
@ -6087,6 +6312,42 @@ func (e *Encoder) runEscaped(ctx *encodeRuntimeContext, b []byte, code *opcode)
}
b = encodeComma(b)
code = code.next
case opStructFieldPtrAnonymousHeadOmitEmptyStringPtr:
store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx)))
fallthrough
case opStructFieldAnonymousHeadOmitEmptyStringPtr:
p := load(ctxptr, code.idx)
if p == 0 {
code = code.end.next
break
}
p = e.ptrToPtr(p)
if p == 0 {
code = code.nextField
} else {
b = append(b, code.escapedKey...)
b = encodeEscapedString(b, e.ptrToString(p))
b = encodeComma(b)
code = code.next
}
case opStructFieldPtrAnonymousHeadStringTagStringPtr:
store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx)))
fallthrough
case opStructFieldAnonymousHeadStringTagStringPtr:
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, string(encodeEscapedString([]byte{}, e.ptrToString(p))))
}
b = encodeComma(b)
code = code.next
case opStructFieldPtrAnonymousHeadStringPtrOnly:
p := load(ctxptr, code.idx)
if p == 0 {
@ -6105,6 +6366,42 @@ func (e *Encoder) runEscaped(ctx *encodeRuntimeContext, b []byte, code *opcode)
}
b = encodeComma(b)
code = code.next
case opStructFieldPtrAnonymousHeadOmitEmptyStringPtrOnly:
p := load(ctxptr, code.idx)
if p == 0 {
code = code.end.next
break
}
store(ctxptr, code.idx, e.ptrToPtr(p))
fallthrough
case opStructFieldAnonymousHeadOmitEmptyStringPtrOnly:
p := load(ctxptr, code.idx)
if p == 0 {
code = code.nextField
} else {
b = append(b, code.escapedKey...)
b = encodeEscapedString(b, e.ptrToString(p+code.offset))
b = encodeComma(b)
code = code.next
}
case opStructFieldPtrAnonymousHeadStringTagStringPtrOnly:
p := load(ctxptr, code.idx)
if p == 0 {
code = code.end.next
break
}
store(ctxptr, code.idx, e.ptrToPtr(p))
fallthrough
case opStructFieldAnonymousHeadStringTagStringPtrOnly:
p := load(ctxptr, code.idx)
b = append(b, code.escapedKey...)
if p == 0 {
b = encodeNull(b)
} else {
b = encodeEscapedString(b, string(encodeEscapedString([]byte{}, e.ptrToString(p))))
}
b = encodeComma(b)
code = code.next
case opStructFieldPtrHeadBool:
p := load(ctxptr, code.idx)
if p == 0 {
@ -6425,51 +6722,6 @@ func (e *Encoder) runEscaped(ctx *encodeRuntimeContext, b []byte, code *opcode)
b = encodeComma(b)
code = code.next
}
case opStructFieldPtrHeadOmitEmptyString:
ptr := load(ctxptr, code.idx)
if ptr != 0 {
store(ctxptr, code.idx, e.ptrToPtr(ptr))
}
fallthrough
case opStructFieldHeadOmitEmptyString:
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 {
store(ctxptr, code.idx, e.ptrToPtr(ptr))
}
fallthrough
case opStructFieldAnonymousHeadOmitEmptyString:
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 {
@ -6752,43 +7004,6 @@ func (e *Encoder) runEscaped(ctx *encodeRuntimeContext, b []byte, code *opcode)
code = code.next
store(ctxptr, code.idx, ptr+code.offset)
}
case opStructFieldPtrHeadStringTagString:
ptr := load(ctxptr, code.idx)
if ptr != 0 {
store(ctxptr, code.idx, e.ptrToPtr(ptr))
}
fallthrough
case opStructFieldHeadStringTagString:
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 {
store(ctxptr, code.idx, e.ptrToPtr(ptr))
}
fallthrough
case opStructFieldAnonymousHeadStringTagString:
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 {
@ -8689,6 +8904,44 @@ func (e *Encoder) runEscaped(ctx *encodeRuntimeContext, b []byte, code *opcode)
}
b = appendStructEnd(b)
code = code.next
case opStructEndOmitEmptyStringPtr:
ptr := load(ctxptr, code.headIdx)
p := e.ptrToPtr(ptr + code.offset)
if p != 0 {
b = append(b, code.escapedKey...)
b = encodeEscapedString(b, e.ptrToString(p))
}
b = appendStructEnd(b)
code = code.next
case opStructEndStringTagStringPtr:
b = append(b, code.escapedKey...)
ptr := load(ctxptr, code.headIdx)
p := e.ptrToPtr(ptr + code.offset)
if p == 0 {
b = encodeNull(b)
} else {
v := e.ptrToString(p)
b = encodeEscapedString(b, string(encodeEscapedString([]byte{}, v)))
}
b = appendStructEnd(b)
code = code.next
case opStructEndStringNPtr:
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 = encodeEscapedString(b, e.ptrToString(p))
}
b = appendStructEnd(b)
code = code.next
case opStructEndBool:
ptr := load(ctxptr, code.headIdx)
b = append(b, code.escapedKey...)

View File

@ -6519,12 +6519,10 @@ func (e *Encoder) runEscapedIndent(ctx *encodeRuntimeContext, b []byte, code *op
case opStructFieldHeadString:
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...)
@ -6533,6 +6531,454 @@ func (e *Encoder) runEscapedIndent(ctx *encodeRuntimeContext, b []byte, code *op
b = encodeIndentComma(b)
code = code.next
}
case opStructFieldPtrHeadOmitEmptyString:
ptr := load(ctxptr, code.idx)
if ptr != 0 {
store(ctxptr, code.idx, e.ptrToPtr(ptr))
}
fallthrough
case opStructFieldHeadOmitEmptyString:
ptr := load(ctxptr, code.idx)
if ptr == 0 {
b = encodeNull(b)
b = encodeIndentComma(b)
code = code.end.next
} else {
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 opStructFieldPtrHeadStringTagString:
ptr := load(ctxptr, code.idx)
if ptr != 0 {
store(ctxptr, code.idx, e.ptrToPtr(ptr))
}
fallthrough
case opStructFieldHeadStringTagString:
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, ' ')
v := e.ptrToString(ptr + code.offset)
b = encodeEscapedString(b, string(encodeEscapedString([]byte{}, v)))
b = encodeIndentComma(b)
code = code.next
}
case opStructFieldPtrHeadStringOnly, opStructFieldHeadStringOnly:
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 = encodeEscapedString(b, e.ptrToString(p))
b = encodeIndentComma(b)
code = code.next
case opStructFieldPtrHeadOmitEmptyStringOnly, opStructFieldHeadOmitEmptyStringOnly:
p := load(ctxptr, code.idx)
b = append(b, '{', '\n')
v := e.ptrToString(p)
if v != "" {
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 opStructFieldPtrHeadStringTagStringOnly, opStructFieldHeadStringTagStringOnly:
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 = encodeEscapedString(b, string(encodeEscapedString([]byte{}, e.ptrToString(p))))
b = encodeIndentComma(b)
code = code.next
case opStructFieldPtrHeadStringPtr:
store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx)))
fallthrough
case opStructFieldHeadStringPtr:
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 = encodeEscapedString(b, e.ptrToString(p))
}
}
b = encodeIndentComma(b)
code = code.next
case opStructFieldPtrHeadOmitEmptyStringPtr:
store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx)))
fallthrough
case opStructFieldHeadOmitEmptyStringPtr:
p := load(ctxptr, code.idx)
if p == 0 {
b = encodeNull(b)
b = encodeIndentComma(b)
code = code.end.next
} else {
b = append(b, '{', '\n')
p = e.ptrToPtr(p)
if p != 0 {
b = e.encodeIndent(b, code.indent+1)
b = append(b, code.escapedKey...)
b = append(b, ' ')
b = encodeEscapedString(b, e.ptrToString(p))
b = encodeIndentComma(b)
}
code = code.next
}
case opStructFieldPtrHeadStringTagStringPtr:
store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx)))
fallthrough
case opStructFieldHeadStringTagStringPtr:
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 = encodeEscapedString(b, string(encodeEscapedString([]byte{}, e.ptrToString(p))))
}
}
b = encodeIndentComma(b)
code = code.next
case opStructFieldPtrHeadStringPtrOnly:
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 opStructFieldHeadStringPtrOnly:
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 = encodeEscapedString(b, e.ptrToString(p+code.offset))
}
b = encodeIndentComma(b)
code = code.next
case opStructFieldPtrHeadOmitEmptyStringPtrOnly:
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 opStructFieldHeadOmitEmptyStringPtrOnly:
p := load(ctxptr, code.idx)
b = append(b, '{', '\n')
if p != 0 {
b = e.encodeIndent(b, code.indent+1)
b = append(b, code.escapedKey...)
b = append(b, ' ')
b = encodeEscapedString(b, e.ptrToString(p+code.offset))
b = encodeIndentComma(b)
}
code = code.next
case opStructFieldPtrHeadStringTagStringPtrOnly:
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 opStructFieldHeadStringTagStringPtrOnly:
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 = encodeEscapedString(b, string(encodeEscapedString([]byte{}, e.ptrToString(p+code.offset))))
}
b = encodeIndentComma(b)
code = code.next
case opStructFieldHeadStringNPtr:
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 = encodeEscapedString(b, e.ptrToString(p+code.offset))
}
}
b = encodeIndentComma(b)
code = code.next
case opStructFieldPtrAnonymousHeadString:
store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx)))
fallthrough
case opStructFieldAnonymousHeadString:
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 = encodeEscapedString(b, e.ptrToString(ptr+code.offset))
b = encodeIndentComma(b)
code = code.next
}
case opStructFieldPtrAnonymousHeadOmitEmptyString:
store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx)))
fallthrough
case opStructFieldAnonymousHeadOmitEmptyString:
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 = e.encodeIndent(b, code.indent)
b = append(b, code.escapedKey...)
b = append(b, ' ')
b = encodeEscapedString(b, v)
b = encodeIndentComma(b)
code = code.next
}
}
case opStructFieldPtrAnonymousHeadStringTagString:
store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx)))
fallthrough
case opStructFieldAnonymousHeadStringTagString:
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 = encodeEscapedString(b, string(encodeEscapedString([]byte{}, e.ptrToString(ptr+code.offset))))
b = encodeIndentComma(b)
code = code.next
}
case opStructFieldPtrAnonymousHeadStringOnly, opStructFieldAnonymousHeadStringOnly:
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 = encodeEscapedString(b, e.ptrToString(ptr+code.offset))
b = encodeIndentComma(b)
code = code.next
}
case opStructFieldPtrAnonymousHeadOmitEmptyStringOnly, opStructFieldAnonymousHeadOmitEmptyStringOnly:
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 = e.encodeIndent(b, code.indent)
b = append(b, code.escapedKey...)
b = append(b, ' ')
b = encodeEscapedString(b, v)
b = encodeIndentComma(b)
code = code.next
}
}
case opStructFieldPtrAnonymousHeadStringTagStringOnly, opStructFieldAnonymousHeadStringTagStringOnly:
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 = encodeEscapedString(b, string(encodeEscapedString([]byte{}, e.ptrToString(ptr+code.offset))))
b = encodeIndentComma(b)
code = code.next
}
case opStructFieldPtrAnonymousHeadStringPtr:
store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx)))
fallthrough
case opStructFieldAnonymousHeadStringPtr:
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 = encodeEscapedString(b, e.ptrToString(p+code.offset))
}
b = encodeIndentComma(b)
code = code.next
case opStructFieldPtrAnonymousHeadOmitEmptyStringPtr:
store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx)))
fallthrough
case opStructFieldAnonymousHeadOmitEmptyStringPtr:
p := load(ctxptr, code.idx)
if p == 0 {
code = code.end.next
break
}
p = e.ptrToPtr(p)
if p == 0 {
code = code.nextField
} else {
b = e.encodeIndent(b, code.indent)
b = append(b, code.escapedKey...)
b = append(b, ' ')
b = encodeEscapedString(b, e.ptrToString(p))
b = encodeIndentComma(b)
code = code.next
}
case opStructFieldPtrAnonymousHeadStringTagStringPtr:
store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx)))
fallthrough
case opStructFieldAnonymousHeadStringTagStringPtr:
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 = encodeEscapedString(b, string(encodeEscapedString([]byte{}, e.ptrToString(p+code.offset))))
}
b = encodeIndentComma(b)
code = code.next
case opStructFieldPtrAnonymousHeadStringPtrOnly:
p := load(ctxptr, code.idx)
if p == 0 {
code = code.end.next
break
}
store(ctxptr, code.idx, e.ptrToPtr(p))
fallthrough
case opStructFieldAnonymousHeadStringPtrOnly:
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 = encodeEscapedString(b, e.ptrToString(p+code.offset))
}
b = encodeIndentComma(b)
code = code.next
case opStructFieldPtrAnonymousHeadOmitEmptyStringPtrOnly:
p := load(ctxptr, code.idx)
if p == 0 {
code = code.end.next
break
}
store(ctxptr, code.idx, e.ptrToPtr(p))
fallthrough
case opStructFieldAnonymousHeadOmitEmptyStringPtrOnly:
p := load(ctxptr, code.idx)
if p == 0 {
code = code.nextField
} else {
b = e.encodeIndent(b, code.indent)
b = append(b, code.escapedKey...)
b = append(b, ' ')
b = encodeEscapedString(b, e.ptrToString(p+code.offset))
b = encodeIndentComma(b)
code = code.next
}
case opStructFieldPtrAnonymousHeadStringTagStringPtrOnly:
p := load(ctxptr, code.idx)
if p == 0 {
code = code.end.next
break
}
store(ctxptr, code.idx, e.ptrToPtr(p))
fallthrough
case opStructFieldAnonymousHeadStringTagStringPtrOnly:
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 = encodeEscapedString(b, string(encodeEscapedString([]byte{}, e.ptrToString(p+code.offset))))
}
b = encodeIndentComma(b)
code = code.next
case opStructFieldPtrHeadBool:
store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx)))
fallthrough
@ -6573,34 +7019,6 @@ func (e *Encoder) runEscapedIndent(ctx *encodeRuntimeContext, b []byte, code *op
b = encodeIndentComma(b)
code = code.next
}
case opStructFieldPtrHeadOmitEmptyString:
ptr := load(ctxptr, code.idx)
if ptr != 0 {
store(ctxptr, code.idx, e.ptrToPtr(ptr))
}
fallthrough
case opStructFieldHeadOmitEmptyString:
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 opStructFieldPtrHeadOmitEmptyBool:
ptr := load(ctxptr, code.idx)
if ptr != 0 {
@ -6678,29 +7096,6 @@ func (e *Encoder) runEscapedIndent(ctx *encodeRuntimeContext, b []byte, code *op
code = code.next
store(ctxptr, code.idx, p)
}
case opStructFieldPtrHeadStringTagString:
ptr := load(ctxptr, code.idx)
if ptr != 0 {
store(ctxptr, code.idx, e.ptrToPtr(ptr))
}
fallthrough
case opStructFieldHeadStringTagString:
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 opStructFieldPtrHeadStringTagBool:
ptr := load(ctxptr, code.idx)
if ptr != 0 {
@ -8494,8 +8889,17 @@ func (e *Encoder) runEscapedIndent(ctx *encodeRuntimeContext, b []byte, code *op
b = append(b, code.escapedKey...)
b = append(b, ' ')
b = encodeEscapedString(b, v)
b = e.appendStructEndIndent(b, code.indent-1)
} else {
last := len(b) - 1
if b[last-1] == '{' {
// doesn't exist any fields
b[last] = '}'
} else {
b = append(b, '}')
}
b = encodeIndentComma(b)
}
b = e.appendStructEndIndent(b, code.indent-1)
code = code.next
case opStructEndStringTagString:
ptr := load(ctxptr, code.headIdx)
@ -8506,6 +8910,52 @@ func (e *Encoder) runEscapedIndent(ctx *encodeRuntimeContext, b []byte, code *op
b = encodeEscapedString(b, string(encodeEscapedString([]byte{}, s)))
b = e.appendStructEndIndent(b, code.indent-1)
code = code.next
case opStructEndStringPtr:
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 = encodeEscapedString(b, e.ptrToString(p))
}
b = e.appendStructEndIndent(b, code.indent-1)
code = code.next
case opStructEndOmitEmptyStringPtr:
ptr := load(ctxptr, code.headIdx)
p := e.ptrToPtr(ptr + code.offset)
if p != 0 {
b = e.encodeIndent(b, code.indent)
b = append(b, code.escapedKey...)
b = append(b, ' ')
b = encodeEscapedString(b, e.ptrToString(p))
b = e.appendStructEndIndent(b, code.indent-1)
} else {
last := len(b) - 1
if b[last-1] == '{' {
// doesn't exist any fields
b[last] = '}'
} else {
b = append(b, '}')
}
b = encodeIndentComma(b)
}
code = code.next
case opStructEndStringTagStringPtr:
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 = encodeEscapedString(b, string(encodeEscapedString([]byte{}, e.ptrToString(p))))
}
b = e.appendStructEndIndent(b, code.indent-1)
code = code.next
case opStructEndBool:
b = e.encodeIndent(b, code.indent)
b = append(b, code.escapedKey...)

View File

@ -6519,12 +6519,10 @@ func (e *Encoder) runIndent(ctx *encodeRuntimeContext, b []byte, code *opcode) (
case opStructFieldHeadString:
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...)
@ -6533,6 +6531,454 @@ func (e *Encoder) runIndent(ctx *encodeRuntimeContext, b []byte, code *opcode) (
b = encodeIndentComma(b)
code = code.next
}
case opStructFieldPtrHeadOmitEmptyString:
ptr := load(ctxptr, code.idx)
if ptr != 0 {
store(ctxptr, code.idx, e.ptrToPtr(ptr))
}
fallthrough
case opStructFieldHeadOmitEmptyString:
ptr := load(ctxptr, code.idx)
if ptr == 0 {
b = encodeNull(b)
b = encodeIndentComma(b)
code = code.end.next
} else {
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 opStructFieldPtrHeadStringTagString:
ptr := load(ctxptr, code.idx)
if ptr != 0 {
store(ctxptr, code.idx, e.ptrToPtr(ptr))
}
fallthrough
case opStructFieldHeadStringTagString:
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, ' ')
v := e.ptrToString(ptr + code.offset)
b = encodeNoEscapedString(b, string(encodeNoEscapedString([]byte{}, v)))
b = encodeIndentComma(b)
code = code.next
}
case opStructFieldPtrHeadStringOnly, opStructFieldHeadStringOnly:
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 = encodeNoEscapedString(b, e.ptrToString(p))
b = encodeIndentComma(b)
code = code.next
case opStructFieldPtrHeadOmitEmptyStringOnly, opStructFieldHeadOmitEmptyStringOnly:
p := load(ctxptr, code.idx)
b = append(b, '{', '\n')
v := e.ptrToString(p)
if v != "" {
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 opStructFieldPtrHeadStringTagStringOnly, opStructFieldHeadStringTagStringOnly:
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 = encodeNoEscapedString(b, string(encodeNoEscapedString([]byte{}, e.ptrToString(p))))
b = encodeIndentComma(b)
code = code.next
case opStructFieldPtrHeadStringPtr:
store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx)))
fallthrough
case opStructFieldHeadStringPtr:
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 = encodeNoEscapedString(b, e.ptrToString(p))
}
}
b = encodeIndentComma(b)
code = code.next
case opStructFieldPtrHeadOmitEmptyStringPtr:
store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx)))
fallthrough
case opStructFieldHeadOmitEmptyStringPtr:
p := load(ctxptr, code.idx)
if p == 0 {
b = encodeNull(b)
b = encodeIndentComma(b)
code = code.end.next
} else {
b = append(b, '{', '\n')
p = e.ptrToPtr(p)
if p != 0 {
b = e.encodeIndent(b, code.indent+1)
b = append(b, code.key...)
b = append(b, ' ')
b = encodeNoEscapedString(b, e.ptrToString(p))
b = encodeIndentComma(b)
}
code = code.next
}
case opStructFieldPtrHeadStringTagStringPtr:
store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx)))
fallthrough
case opStructFieldHeadStringTagStringPtr:
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 = encodeNoEscapedString(b, string(encodeNoEscapedString([]byte{}, e.ptrToString(p))))
}
}
b = encodeIndentComma(b)
code = code.next
case opStructFieldPtrHeadStringPtrOnly:
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 opStructFieldHeadStringPtrOnly:
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 = encodeNoEscapedString(b, e.ptrToString(p+code.offset))
}
b = encodeIndentComma(b)
code = code.next
case opStructFieldPtrHeadOmitEmptyStringPtrOnly:
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 opStructFieldHeadOmitEmptyStringPtrOnly:
p := load(ctxptr, code.idx)
b = append(b, '{', '\n')
if p != 0 {
b = e.encodeIndent(b, code.indent+1)
b = append(b, code.key...)
b = append(b, ' ')
b = encodeNoEscapedString(b, e.ptrToString(p+code.offset))
b = encodeIndentComma(b)
}
code = code.next
case opStructFieldPtrHeadStringTagStringPtrOnly:
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 opStructFieldHeadStringTagStringPtrOnly:
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 = encodeNoEscapedString(b, string(encodeNoEscapedString([]byte{}, e.ptrToString(p+code.offset))))
}
b = encodeIndentComma(b)
code = code.next
case opStructFieldHeadStringNPtr:
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 = encodeNoEscapedString(b, e.ptrToString(p+code.offset))
}
}
b = encodeIndentComma(b)
code = code.next
case opStructFieldPtrAnonymousHeadString:
store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx)))
fallthrough
case opStructFieldAnonymousHeadString:
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 = encodeNoEscapedString(b, e.ptrToString(ptr+code.offset))
b = encodeIndentComma(b)
code = code.next
}
case opStructFieldPtrAnonymousHeadOmitEmptyString:
store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx)))
fallthrough
case opStructFieldAnonymousHeadOmitEmptyString:
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 = e.encodeIndent(b, code.indent)
b = append(b, code.key...)
b = append(b, ' ')
b = encodeNoEscapedString(b, v)
b = encodeIndentComma(b)
code = code.next
}
}
case opStructFieldPtrAnonymousHeadStringTagString:
store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx)))
fallthrough
case opStructFieldAnonymousHeadStringTagString:
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 = encodeNoEscapedString(b, string(encodeNoEscapedString([]byte{}, e.ptrToString(ptr+code.offset))))
b = encodeIndentComma(b)
code = code.next
}
case opStructFieldPtrAnonymousHeadStringOnly, opStructFieldAnonymousHeadStringOnly:
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 = encodeNoEscapedString(b, e.ptrToString(ptr+code.offset))
b = encodeIndentComma(b)
code = code.next
}
case opStructFieldPtrAnonymousHeadOmitEmptyStringOnly, opStructFieldAnonymousHeadOmitEmptyStringOnly:
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 = e.encodeIndent(b, code.indent)
b = append(b, code.key...)
b = append(b, ' ')
b = encodeNoEscapedString(b, v)
b = encodeIndentComma(b)
code = code.next
}
}
case opStructFieldPtrAnonymousHeadStringTagStringOnly, opStructFieldAnonymousHeadStringTagStringOnly:
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 = encodeNoEscapedString(b, string(encodeNoEscapedString([]byte{}, e.ptrToString(ptr+code.offset))))
b = encodeIndentComma(b)
code = code.next
}
case opStructFieldPtrAnonymousHeadStringPtr:
store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx)))
fallthrough
case opStructFieldAnonymousHeadStringPtr:
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 = encodeNoEscapedString(b, e.ptrToString(p+code.offset))
}
b = encodeIndentComma(b)
code = code.next
case opStructFieldPtrAnonymousHeadOmitEmptyStringPtr:
store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx)))
fallthrough
case opStructFieldAnonymousHeadOmitEmptyStringPtr:
p := load(ctxptr, code.idx)
if p == 0 {
code = code.end.next
break
}
p = e.ptrToPtr(p)
if p == 0 {
code = code.nextField
} else {
b = e.encodeIndent(b, code.indent)
b = append(b, code.key...)
b = append(b, ' ')
b = encodeNoEscapedString(b, e.ptrToString(p))
b = encodeIndentComma(b)
code = code.next
}
case opStructFieldPtrAnonymousHeadStringTagStringPtr:
store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx)))
fallthrough
case opStructFieldAnonymousHeadStringTagStringPtr:
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 = encodeNoEscapedString(b, string(encodeNoEscapedString([]byte{}, e.ptrToString(p+code.offset))))
}
b = encodeIndentComma(b)
code = code.next
case opStructFieldPtrAnonymousHeadStringPtrOnly:
p := load(ctxptr, code.idx)
if p == 0 {
code = code.end.next
break
}
store(ctxptr, code.idx, e.ptrToPtr(p))
fallthrough
case opStructFieldAnonymousHeadStringPtrOnly:
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 = encodeNoEscapedString(b, e.ptrToString(p+code.offset))
}
b = encodeIndentComma(b)
code = code.next
case opStructFieldPtrAnonymousHeadOmitEmptyStringPtrOnly:
p := load(ctxptr, code.idx)
if p == 0 {
code = code.end.next
break
}
store(ctxptr, code.idx, e.ptrToPtr(p))
fallthrough
case opStructFieldAnonymousHeadOmitEmptyStringPtrOnly:
p := load(ctxptr, code.idx)
if p == 0 {
code = code.nextField
} else {
b = e.encodeIndent(b, code.indent)
b = append(b, code.key...)
b = append(b, ' ')
b = encodeNoEscapedString(b, e.ptrToString(p+code.offset))
b = encodeIndentComma(b)
code = code.next
}
case opStructFieldPtrAnonymousHeadStringTagStringPtrOnly:
p := load(ctxptr, code.idx)
if p == 0 {
code = code.end.next
break
}
store(ctxptr, code.idx, e.ptrToPtr(p))
fallthrough
case opStructFieldAnonymousHeadStringTagStringPtrOnly:
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 = encodeNoEscapedString(b, string(encodeNoEscapedString([]byte{}, e.ptrToString(p+code.offset))))
}
b = encodeIndentComma(b)
code = code.next
case opStructFieldPtrHeadBool:
store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx)))
fallthrough
@ -6573,34 +7019,6 @@ func (e *Encoder) runIndent(ctx *encodeRuntimeContext, b []byte, code *opcode) (
b = encodeIndentComma(b)
code = code.next
}
case opStructFieldPtrHeadOmitEmptyString:
ptr := load(ctxptr, code.idx)
if ptr != 0 {
store(ctxptr, code.idx, e.ptrToPtr(ptr))
}
fallthrough
case opStructFieldHeadOmitEmptyString:
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 opStructFieldPtrHeadOmitEmptyBool:
ptr := load(ctxptr, code.idx)
if ptr != 0 {
@ -6678,29 +7096,6 @@ func (e *Encoder) runIndent(ctx *encodeRuntimeContext, b []byte, code *opcode) (
code = code.next
store(ctxptr, code.idx, p)
}
case opStructFieldPtrHeadStringTagString:
ptr := load(ctxptr, code.idx)
if ptr != 0 {
store(ctxptr, code.idx, e.ptrToPtr(ptr))
}
fallthrough
case opStructFieldHeadStringTagString:
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 opStructFieldPtrHeadStringTagBool:
ptr := load(ctxptr, code.idx)
if ptr != 0 {
@ -8494,8 +8889,17 @@ func (e *Encoder) runIndent(ctx *encodeRuntimeContext, b []byte, code *opcode) (
b = append(b, code.key...)
b = append(b, ' ')
b = encodeNoEscapedString(b, v)
b = e.appendStructEndIndent(b, code.indent-1)
} else {
last := len(b) - 1
if b[last-1] == '{' {
// doesn't exist any fields
b[last] = '}'
} else {
b = append(b, '}')
}
b = encodeIndentComma(b)
}
b = e.appendStructEndIndent(b, code.indent-1)
code = code.next
case opStructEndStringTagString:
ptr := load(ctxptr, code.headIdx)
@ -8506,6 +8910,52 @@ func (e *Encoder) runIndent(ctx *encodeRuntimeContext, b []byte, code *opcode) (
b = encodeNoEscapedString(b, string(encodeNoEscapedString([]byte{}, s)))
b = e.appendStructEndIndent(b, code.indent-1)
code = code.next
case opStructEndStringPtr:
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 = encodeNoEscapedString(b, e.ptrToString(p))
}
b = e.appendStructEndIndent(b, code.indent-1)
code = code.next
case opStructEndOmitEmptyStringPtr:
ptr := load(ctxptr, code.headIdx)
p := e.ptrToPtr(ptr + code.offset)
if p != 0 {
b = e.encodeIndent(b, code.indent)
b = append(b, code.key...)
b = append(b, ' ')
b = encodeNoEscapedString(b, e.ptrToString(p))
b = e.appendStructEndIndent(b, code.indent-1)
} else {
last := len(b) - 1
if b[last-1] == '{' {
// doesn't exist any fields
b[last] = '}'
} else {
b = append(b, '}')
}
b = encodeIndentComma(b)
}
code = code.next
case opStructEndStringTagStringPtr:
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 = encodeNoEscapedString(b, string(encodeNoEscapedString([]byte{}, e.ptrToString(p))))
}
b = e.appendStructEndIndent(b, code.indent-1)
code = code.next
case opStructEndBool:
b = e.encodeIndent(b, code.indent)
b = append(b, code.key...)