Add test cases for int32 type

This commit is contained in:
Masaaki Goshima 2021-01-18 21:50:52 +09:00
parent 8b3bc49833
commit 861236119a
5 changed files with 3372 additions and 272 deletions

File diff suppressed because it is too large Load Diff

View File

@ -1998,6 +1998,51 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte
b = encodeComma(b)
code = code.next
}
case opStructFieldPtrHeadOmitEmptyInt32:
ptr := load(ctxptr, code.idx)
if ptr != 0 {
store(ctxptr, code.idx, e.ptrToPtr(ptr))
}
fallthrough
case opStructFieldHeadOmitEmptyInt32:
ptr := load(ctxptr, code.idx)
if ptr == 0 {
b = encodeNull(b)
b = encodeComma(b)
code = code.end.next
} else {
b = append(b, '{')
v := e.ptrToInt32(ptr + code.offset)
if v == 0 {
code = code.nextField
} else {
b = append(b, code.key...)
b = appendInt(b, int64(v))
b = encodeComma(b)
code = code.next
}
}
case opStructFieldPtrHeadStringTagInt32:
ptr := load(ctxptr, code.idx)
if ptr != 0 {
store(ctxptr, code.idx, e.ptrToPtr(ptr))
}
fallthrough
case opStructFieldHeadStringTagInt32:
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...)
b = append(b, '"')
b = appendInt(b, int64(e.ptrToInt32(ptr+code.offset)))
b = append(b, '"')
b = encodeComma(b)
code = code.next
}
case opStructFieldPtrHeadInt32Only, opStructFieldHeadInt32Only:
p := load(ctxptr, code.idx)
b = append(b, '{')
@ -2005,6 +2050,25 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte
b = appendInt(b, int64(e.ptrToInt32(p)))
b = encodeComma(b)
code = code.next
case opStructFieldPtrHeadOmitEmptyInt32Only, opStructFieldHeadOmitEmptyInt32Only:
p := load(ctxptr, code.idx)
b = append(b, '{')
v := int64(e.ptrToInt32(p))
if v != 0 {
b = append(b, code.key...)
b = appendInt(b, v)
b = encodeComma(b)
}
code = code.next
case opStructFieldPtrHeadStringTagInt32Only, opStructFieldHeadStringTagInt32Only:
p := load(ctxptr, code.idx)
b = append(b, '{')
b = append(b, code.key...)
b = append(b, '"')
b = appendInt(b, int64(e.ptrToInt32(p)))
b = append(b, '"')
b = encodeComma(b)
code = code.next
case opStructFieldPtrHeadInt32Ptr:
store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx)))
fallthrough
@ -2027,6 +2091,49 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte
}
b = encodeComma(b)
code = code.next
case opStructFieldPtrHeadOmitEmptyInt32Ptr:
store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx)))
fallthrough
case opStructFieldHeadOmitEmptyInt32Ptr:
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 = appendInt(b, int64(e.ptrToInt32(p)))
b = encodeComma(b)
}
code = code.next
}
case opStructFieldPtrHeadStringTagInt32Ptr:
store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx)))
fallthrough
case opStructFieldHeadStringTagInt32Ptr:
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 = append(b, '"')
b = appendInt(b, int64(e.ptrToInt32(p+code.offset)))
b = append(b, '"')
}
}
b = encodeComma(b)
code = code.next
case opStructFieldPtrHeadInt32PtrOnly:
p := load(ctxptr, code.idx)
if p == 0 {
@ -2048,6 +2155,69 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte
}
b = encodeComma(b)
code = code.next
case opStructFieldPtrHeadOmitEmptyInt32PtrOnly:
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 opStructFieldHeadOmitEmptyInt32PtrOnly:
b = append(b, '{')
p := load(ctxptr, code.idx)
if p != 0 {
b = append(b, code.key...)
b = appendInt(b, int64(e.ptrToInt32(p+code.offset)))
b = encodeComma(b)
}
code = code.next
case opStructFieldPtrHeadStringTagInt32PtrOnly:
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 opStructFieldHeadStringTagInt32PtrOnly:
p := load(ctxptr, code.idx)
b = append(b, '{')
b = append(b, code.key...)
if p == 0 {
b = encodeNull(b)
} else {
b = append(b, '"')
b = appendInt(b, int64(e.ptrToInt32(p+code.offset)))
b = append(b, '"')
}
b = encodeComma(b)
code = code.next
case opStructFieldHeadInt32NPtr:
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 = appendInt(b, int64(e.ptrToInt32(p+code.offset)))
}
}
b = encodeComma(b)
code = code.next
case opStructFieldPtrAnonymousHeadInt32:
store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx)))
fallthrough
@ -2061,6 +2231,45 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte
b = encodeComma(b)
code = code.next
}
case opStructFieldPtrAnonymousHeadOmitEmptyInt32:
ptr := load(ctxptr, code.idx)
if ptr != 0 {
store(ctxptr, code.idx, e.ptrToPtr(ptr))
}
fallthrough
case opStructFieldAnonymousHeadOmitEmptyInt32:
ptr := load(ctxptr, code.idx)
if ptr == 0 {
code = code.end.next
} else {
v := e.ptrToInt32(ptr + code.offset)
if v == 0 {
code = code.nextField
} else {
b = append(b, code.key...)
b = appendInt(b, int64(v))
b = encodeComma(b)
code = code.next
}
}
case opStructFieldPtrAnonymousHeadStringTagInt32:
ptr := load(ctxptr, code.idx)
if ptr != 0 {
store(ctxptr, code.idx, e.ptrToPtr(ptr))
}
fallthrough
case opStructFieldAnonymousHeadStringTagInt32:
ptr := load(ctxptr, code.idx)
if ptr == 0 {
code = code.end.next
} else {
b = append(b, code.key...)
b = append(b, '"')
b = appendInt(b, int64(e.ptrToInt32(ptr+code.offset)))
b = append(b, '"')
b = encodeComma(b)
code = code.next
}
case opStructFieldPtrAnonymousHeadInt32Only, opStructFieldAnonymousHeadInt32Only:
ptr := load(ctxptr, code.idx)
if ptr == 0 {
@ -2071,6 +2280,33 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte
b = encodeComma(b)
code = code.next
}
case opStructFieldPtrAnonymousHeadOmitEmptyInt32Only, opStructFieldAnonymousHeadOmitEmptyInt32Only:
ptr := load(ctxptr, code.idx)
if ptr == 0 {
code = code.end.next
} else {
v := e.ptrToInt32(ptr + code.offset)
if v == 0 {
code = code.nextField
} else {
b = append(b, code.key...)
b = appendInt(b, int64(v))
b = encodeComma(b)
code = code.next
}
}
case opStructFieldPtrAnonymousHeadStringTagInt32Only, opStructFieldAnonymousHeadStringTagInt32Only:
ptr := load(ctxptr, code.idx)
if ptr == 0 {
code = code.end.next
} else {
b = append(b, code.key...)
b = append(b, '"')
b = appendInt(b, int64(e.ptrToInt32(ptr+code.offset)))
b = append(b, '"')
b = encodeComma(b)
code = code.next
}
case opStructFieldPtrAnonymousHeadInt32Ptr:
store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx)))
fallthrough
@ -2089,6 +2325,44 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte
}
b = encodeComma(b)
code = code.next
case opStructFieldPtrAnonymousHeadOmitEmptyInt32Ptr:
store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx)))
fallthrough
case opStructFieldAnonymousHeadOmitEmptyInt32Ptr:
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 = appendInt(b, int64(e.ptrToInt32(p)))
b = encodeComma(b)
code = code.next
}
case opStructFieldPtrAnonymousHeadStringTagInt32Ptr:
store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx)))
fallthrough
case opStructFieldAnonymousHeadStringTagInt32Ptr:
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 = append(b, '"')
b = appendInt(b, int64(e.ptrToInt32(p+code.offset)))
b = append(b, '"')
}
b = encodeComma(b)
code = code.next
case opStructFieldPtrAnonymousHeadInt32PtrOnly:
p := load(ctxptr, code.idx)
if p == 0 {
@ -2107,6 +2381,45 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte
}
b = encodeComma(b)
code = code.next
case opStructFieldPtrAnonymousHeadOmitEmptyInt32PtrOnly:
p := load(ctxptr, code.idx)
if p == 0 {
code = code.end.next
break
}
store(ctxptr, code.idx, e.ptrToPtr(p))
fallthrough
case opStructFieldAnonymousHeadOmitEmptyInt32PtrOnly:
p := load(ctxptr, code.idx)
if p == 0 {
code = code.nextField
} else {
b = append(b, code.key...)
b = appendInt(b, int64(e.ptrToInt32(p+code.offset)))
b = encodeComma(b)
code = code.next
}
case opStructFieldPtrAnonymousHeadStringTagInt32PtrOnly:
p := load(ctxptr, code.idx)
if p == 0 {
code = code.end.next
break
}
store(ctxptr, code.idx, e.ptrToPtr(p))
fallthrough
case opStructFieldAnonymousHeadStringTagInt32PtrOnly:
p := load(ctxptr, code.idx)
b = append(b, code.key...)
if p == 0 {
b = encodeNull(b)
} else {
b = append(b, '"')
b = appendInt(b, int64(e.ptrToInt32(p+code.offset)))
b = append(b, '"')
}
b = encodeComma(b)
code = code.next
case opStructFieldPtrHeadInt64:
store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx)))
fallthrough
@ -3605,51 +3918,6 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte
b = encodeComma(b)
code = code.next
}
case opStructFieldPtrHeadOmitEmptyInt32:
ptr := load(ctxptr, code.idx)
if ptr != 0 {
store(ctxptr, code.idx, e.ptrToPtr(ptr))
}
fallthrough
case opStructFieldHeadOmitEmptyInt32:
ptr := load(ctxptr, code.idx)
if ptr == 0 {
b = encodeNull(b)
b = encodeComma(b)
code = code.end.next
} else {
b = append(b, '{')
v := e.ptrToInt32(ptr + code.offset)
if v == 0 {
code = code.nextField
} else {
b = append(b, code.key...)
b = appendInt(b, int64(v))
b = encodeComma(b)
code = code.next
}
}
case opStructFieldPtrAnonymousHeadOmitEmptyInt32:
ptr := load(ctxptr, code.idx)
if ptr != 0 {
store(ctxptr, code.idx, e.ptrToPtr(ptr))
}
fallthrough
case opStructFieldAnonymousHeadOmitEmptyInt32:
ptr := load(ctxptr, code.idx)
if ptr == 0 {
code = code.end.next
} else {
v := e.ptrToInt32(ptr + code.offset)
if v == 0 {
code = code.nextField
} else {
b = append(b, code.key...)
b = appendInt(b, int64(v))
b = encodeComma(b)
code = code.next
}
}
case opStructFieldPtrHeadOmitEmptyInt64:
ptr := load(ctxptr, code.idx)
if ptr != 0 {
@ -4343,45 +4611,6 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte
code = code.next
store(ctxptr, code.idx, ptr+code.offset)
}
case opStructFieldPtrHeadStringTagInt32:
ptr := load(ctxptr, code.idx)
if ptr != 0 {
store(ctxptr, code.idx, e.ptrToPtr(ptr))
}
fallthrough
case opStructFieldHeadStringTagInt32:
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...)
b = append(b, '"')
b = appendInt(b, int64(e.ptrToInt32(ptr+code.offset)))
b = append(b, '"')
b = encodeComma(b)
code = code.next
}
case opStructFieldPtrAnonymousHeadStringTagInt32:
ptr := load(ctxptr, code.idx)
if ptr != 0 {
store(ctxptr, code.idx, e.ptrToPtr(ptr))
}
fallthrough
case opStructFieldAnonymousHeadStringTagInt32:
ptr := load(ctxptr, code.idx)
if ptr == 0 {
code = code.end.next
} else {
b = append(b, code.key...)
b = append(b, '"')
b = appendInt(b, int64(e.ptrToInt32(ptr+code.offset)))
b = append(b, '"')
b = encodeComma(b)
code = code.next
}
case opStructFieldPtrHeadStringTagInt64:
ptr := load(ctxptr, code.idx)
if ptr != 0 {
@ -5935,6 +6164,45 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte
}
b = appendStructEnd(b)
code = code.next
case opStructEndOmitEmptyInt32Ptr:
ptr := load(ctxptr, code.headIdx)
p := e.ptrToPtr(ptr + code.offset)
if p != 0 {
b = append(b, code.key...)
b = appendInt(b, int64(e.ptrToInt32(p)))
}
b = appendStructEnd(b)
code = code.next
case opStructEndStringTagInt32Ptr:
b = append(b, code.key...)
ptr := load(ctxptr, code.headIdx)
p := e.ptrToPtr(ptr + code.offset)
if p == 0 {
b = encodeNull(b)
} else {
b = append(b, '"')
b = appendInt(b, int64(e.ptrToInt32(p)))
b = append(b, '"')
}
b = appendStructEnd(b)
code = code.next
case opStructEndInt32NPtr:
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 = appendInt(b, int64(e.ptrToInt32(p)))
}
b = appendStructEnd(b)
code = code.next
case opStructEndInt64:
ptr := load(ctxptr, code.headIdx)
b = append(b, code.key...)

View File

@ -1958,6 +1958,51 @@ func (e *Encoder) runEscaped(ctx *encodeRuntimeContext, b []byte, code *opcode)
b = encodeComma(b)
code = code.next
}
case opStructFieldPtrHeadOmitEmptyInt32:
ptr := load(ctxptr, code.idx)
if ptr != 0 {
store(ctxptr, code.idx, e.ptrToPtr(ptr))
}
fallthrough
case opStructFieldHeadOmitEmptyInt32:
ptr := load(ctxptr, code.idx)
if ptr == 0 {
b = encodeNull(b)
b = encodeComma(b)
code = code.end.next
} else {
b = append(b, '{')
v := e.ptrToInt32(ptr + code.offset)
if v == 0 {
code = code.nextField
} else {
b = append(b, code.escapedKey...)
b = appendInt(b, int64(v))
b = encodeComma(b)
code = code.next
}
}
case opStructFieldPtrHeadStringTagInt32:
ptr := load(ctxptr, code.idx)
if ptr != 0 {
store(ctxptr, code.idx, e.ptrToPtr(ptr))
}
fallthrough
case opStructFieldHeadStringTagInt32:
ptr := load(ctxptr, code.idx)
if ptr == 0 {
b = encodeNull(b)
b = encodeComma(b)
code = code.end.next
} else {
b = append(b, '{')
b = append(b, code.escapedKey...)
b = append(b, '"')
b = appendInt(b, int64(e.ptrToInt32(ptr+code.offset)))
b = append(b, '"')
b = encodeComma(b)
code = code.next
}
case opStructFieldPtrHeadInt32Only, opStructFieldHeadInt32Only:
p := load(ctxptr, code.idx)
b = append(b, '{')
@ -1965,6 +2010,25 @@ func (e *Encoder) runEscaped(ctx *encodeRuntimeContext, b []byte, code *opcode)
b = appendInt(b, int64(e.ptrToInt32(p)))
b = encodeComma(b)
code = code.next
case opStructFieldPtrHeadOmitEmptyInt32Only, opStructFieldHeadOmitEmptyInt32Only:
p := load(ctxptr, code.idx)
b = append(b, '{')
v := int64(e.ptrToInt32(p))
if v != 0 {
b = append(b, code.escapedKey...)
b = appendInt(b, v)
b = encodeComma(b)
}
code = code.next
case opStructFieldPtrHeadStringTagInt32Only, opStructFieldHeadStringTagInt32Only:
p := load(ctxptr, code.idx)
b = append(b, '{')
b = append(b, code.escapedKey...)
b = append(b, '"')
b = appendInt(b, int64(e.ptrToInt32(p)))
b = append(b, '"')
b = encodeComma(b)
code = code.next
case opStructFieldPtrHeadInt32Ptr:
store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx)))
fallthrough
@ -1987,6 +2051,49 @@ func (e *Encoder) runEscaped(ctx *encodeRuntimeContext, b []byte, code *opcode)
}
b = encodeComma(b)
code = code.next
case opStructFieldPtrHeadOmitEmptyInt32Ptr:
store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx)))
fallthrough
case opStructFieldHeadOmitEmptyInt32Ptr:
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 = appendInt(b, int64(e.ptrToInt32(p)))
b = encodeComma(b)
}
code = code.next
}
case opStructFieldPtrHeadStringTagInt32Ptr:
store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx)))
fallthrough
case opStructFieldHeadStringTagInt32Ptr:
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 = append(b, '"')
b = appendInt(b, int64(e.ptrToInt32(p+code.offset)))
b = append(b, '"')
}
}
b = encodeComma(b)
code = code.next
case opStructFieldPtrHeadInt32PtrOnly:
p := load(ctxptr, code.idx)
if p == 0 {
@ -2008,6 +2115,69 @@ func (e *Encoder) runEscaped(ctx *encodeRuntimeContext, b []byte, code *opcode)
}
b = encodeComma(b)
code = code.next
case opStructFieldPtrHeadOmitEmptyInt32PtrOnly:
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 opStructFieldHeadOmitEmptyInt32PtrOnly:
b = append(b, '{')
p := load(ctxptr, code.idx)
if p != 0 {
b = append(b, code.escapedKey...)
b = appendInt(b, int64(e.ptrToInt32(p+code.offset)))
b = encodeComma(b)
}
code = code.next
case opStructFieldPtrHeadStringTagInt32PtrOnly:
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 opStructFieldHeadStringTagInt32PtrOnly:
p := load(ctxptr, code.idx)
b = append(b, '{')
b = append(b, code.escapedKey...)
if p == 0 {
b = encodeNull(b)
} else {
b = append(b, '"')
b = appendInt(b, int64(e.ptrToInt32(p+code.offset)))
b = append(b, '"')
}
b = encodeComma(b)
code = code.next
case opStructFieldHeadInt32NPtr:
p := load(ctxptr, code.idx)
if p == 0 {
b = encodeNull(b)
} else {
b = append(b, '{')
b = append(b, code.escapedKey...)
for i := 0; i < code.ptrNum; i++ {
if p == 0 {
break
}
p = e.ptrToPtr(p)
}
if p == 0 {
b = encodeNull(b)
} else {
b = appendInt(b, int64(e.ptrToInt32(p+code.offset)))
}
}
b = encodeComma(b)
code = code.next
case opStructFieldPtrAnonymousHeadInt32:
store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx)))
fallthrough
@ -2021,6 +2191,45 @@ func (e *Encoder) runEscaped(ctx *encodeRuntimeContext, b []byte, code *opcode)
b = encodeComma(b)
code = code.next
}
case opStructFieldPtrAnonymousHeadOmitEmptyInt32:
ptr := load(ctxptr, code.idx)
if ptr != 0 {
store(ctxptr, code.idx, e.ptrToPtr(ptr))
}
fallthrough
case opStructFieldAnonymousHeadOmitEmptyInt32:
ptr := load(ctxptr, code.idx)
if ptr == 0 {
code = code.end.next
} else {
v := e.ptrToInt32(ptr + code.offset)
if v == 0 {
code = code.nextField
} else {
b = append(b, code.escapedKey...)
b = appendInt(b, int64(v))
b = encodeComma(b)
code = code.next
}
}
case opStructFieldPtrAnonymousHeadStringTagInt32:
ptr := load(ctxptr, code.idx)
if ptr != 0 {
store(ctxptr, code.idx, e.ptrToPtr(ptr))
}
fallthrough
case opStructFieldAnonymousHeadStringTagInt32:
ptr := load(ctxptr, code.idx)
if ptr == 0 {
code = code.end.next
} else {
b = append(b, code.escapedKey...)
b = append(b, '"')
b = appendInt(b, int64(e.ptrToInt32(ptr+code.offset)))
b = append(b, '"')
b = encodeComma(b)
code = code.next
}
case opStructFieldPtrAnonymousHeadInt32Only, opStructFieldAnonymousHeadInt32Only:
ptr := load(ctxptr, code.idx)
if ptr == 0 {
@ -2031,6 +2240,33 @@ func (e *Encoder) runEscaped(ctx *encodeRuntimeContext, b []byte, code *opcode)
b = encodeComma(b)
code = code.next
}
case opStructFieldPtrAnonymousHeadOmitEmptyInt32Only, opStructFieldAnonymousHeadOmitEmptyInt32Only:
ptr := load(ctxptr, code.idx)
if ptr == 0 {
code = code.end.next
} else {
v := e.ptrToInt32(ptr + code.offset)
if v == 0 {
code = code.nextField
} else {
b = append(b, code.escapedKey...)
b = appendInt(b, int64(v))
b = encodeComma(b)
code = code.next
}
}
case opStructFieldPtrAnonymousHeadStringTagInt32Only, opStructFieldAnonymousHeadStringTagInt32Only:
ptr := load(ctxptr, code.idx)
if ptr == 0 {
code = code.end.next
} else {
b = append(b, code.escapedKey...)
b = append(b, '"')
b = appendInt(b, int64(e.ptrToInt32(ptr+code.offset)))
b = append(b, '"')
b = encodeComma(b)
code = code.next
}
case opStructFieldPtrAnonymousHeadInt32Ptr:
store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx)))
fallthrough
@ -2049,6 +2285,44 @@ func (e *Encoder) runEscaped(ctx *encodeRuntimeContext, b []byte, code *opcode)
}
b = encodeComma(b)
code = code.next
case opStructFieldPtrAnonymousHeadOmitEmptyInt32Ptr:
store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx)))
fallthrough
case opStructFieldAnonymousHeadOmitEmptyInt32Ptr:
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 = appendInt(b, int64(e.ptrToInt32(p)))
b = encodeComma(b)
code = code.next
}
case opStructFieldPtrAnonymousHeadStringTagInt32Ptr:
store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx)))
fallthrough
case opStructFieldAnonymousHeadStringTagInt32Ptr:
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 = append(b, '"')
b = appendInt(b, int64(e.ptrToInt32(p+code.offset)))
b = append(b, '"')
}
b = encodeComma(b)
code = code.next
case opStructFieldPtrAnonymousHeadInt32PtrOnly:
p := load(ctxptr, code.idx)
if p == 0 {
@ -2067,6 +2341,45 @@ func (e *Encoder) runEscaped(ctx *encodeRuntimeContext, b []byte, code *opcode)
}
b = encodeComma(b)
code = code.next
case opStructFieldPtrAnonymousHeadOmitEmptyInt32PtrOnly:
p := load(ctxptr, code.idx)
if p == 0 {
code = code.end.next
break
}
store(ctxptr, code.idx, e.ptrToPtr(p))
fallthrough
case opStructFieldAnonymousHeadOmitEmptyInt32PtrOnly:
p := load(ctxptr, code.idx)
if p == 0 {
code = code.nextField
} else {
b = append(b, code.escapedKey...)
b = appendInt(b, int64(e.ptrToInt32(p+code.offset)))
b = encodeComma(b)
code = code.next
}
case opStructFieldPtrAnonymousHeadStringTagInt32PtrOnly:
p := load(ctxptr, code.idx)
if p == 0 {
code = code.end.next
break
}
store(ctxptr, code.idx, e.ptrToPtr(p))
fallthrough
case opStructFieldAnonymousHeadStringTagInt32PtrOnly:
p := load(ctxptr, code.idx)
b = append(b, code.escapedKey...)
if p == 0 {
b = encodeNull(b)
} else {
b = append(b, '"')
b = appendInt(b, int64(e.ptrToInt32(p+code.offset)))
b = append(b, '"')
}
b = encodeComma(b)
code = code.next
case opStructFieldPtrHeadInt64:
store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx)))
fallthrough
@ -3572,51 +3885,6 @@ func (e *Encoder) runEscaped(ctx *encodeRuntimeContext, b []byte, code *opcode)
b = encodeComma(b)
code = code.next
}
case opStructFieldPtrHeadOmitEmptyInt32:
ptr := load(ctxptr, code.idx)
if ptr != 0 {
store(ctxptr, code.idx, e.ptrToPtr(ptr))
}
fallthrough
case opStructFieldHeadOmitEmptyInt32:
ptr := load(ctxptr, code.idx)
if ptr == 0 {
b = encodeNull(b)
b = encodeComma(b)
code = code.end.next
} else {
b = append(b, '{')
v := e.ptrToInt32(ptr + code.offset)
if v == 0 {
code = code.nextField
} else {
b = append(b, code.escapedKey...)
b = appendInt(b, int64(v))
b = encodeComma(b)
code = code.next
}
}
case opStructFieldPtrAnonymousHeadOmitEmptyInt32:
ptr := load(ctxptr, code.idx)
if ptr != 0 {
store(ctxptr, code.idx, e.ptrToPtr(ptr))
}
fallthrough
case opStructFieldAnonymousHeadOmitEmptyInt32:
ptr := load(ctxptr, code.idx)
if ptr == 0 {
code = code.end.next
} else {
v := e.ptrToInt32(ptr + code.offset)
if v == 0 {
code = code.nextField
} else {
b = append(b, code.escapedKey...)
b = appendInt(b, int64(v))
b = encodeComma(b)
code = code.next
}
}
case opStructFieldPtrHeadOmitEmptyInt64:
ptr := load(ctxptr, code.idx)
if ptr != 0 {
@ -4310,45 +4578,6 @@ func (e *Encoder) runEscaped(ctx *encodeRuntimeContext, b []byte, code *opcode)
code = code.next
store(ctxptr, code.idx, ptr+code.offset)
}
case opStructFieldPtrHeadStringTagInt32:
ptr := load(ctxptr, code.idx)
if ptr != 0 {
store(ctxptr, code.idx, e.ptrToPtr(ptr))
}
fallthrough
case opStructFieldHeadStringTagInt32:
ptr := load(ctxptr, code.idx)
if ptr == 0 {
b = encodeNull(b)
b = encodeComma(b)
code = code.end.next
} else {
b = append(b, '{')
b = append(b, code.escapedKey...)
b = append(b, '"')
b = appendInt(b, int64(e.ptrToInt32(ptr+code.offset)))
b = append(b, '"')
b = encodeComma(b)
code = code.next
}
case opStructFieldPtrAnonymousHeadStringTagInt32:
ptr := load(ctxptr, code.idx)
if ptr != 0 {
store(ctxptr, code.idx, e.ptrToPtr(ptr))
}
fallthrough
case opStructFieldAnonymousHeadStringTagInt32:
ptr := load(ctxptr, code.idx)
if ptr == 0 {
code = code.end.next
} else {
b = append(b, code.escapedKey...)
b = append(b, '"')
b = appendInt(b, int64(e.ptrToInt32(ptr+code.offset)))
b = append(b, '"')
b = encodeComma(b)
code = code.next
}
case opStructFieldPtrHeadStringTagInt64:
ptr := load(ctxptr, code.idx)
if ptr != 0 {
@ -5961,6 +6190,45 @@ func (e *Encoder) runEscaped(ctx *encodeRuntimeContext, b []byte, code *opcode)
}
b = appendStructEnd(b)
code = code.next
case opStructEndOmitEmptyInt32Ptr:
ptr := load(ctxptr, code.headIdx)
p := e.ptrToPtr(ptr + code.offset)
if p != 0 {
b = append(b, code.escapedKey...)
b = appendInt(b, int64(e.ptrToInt32(p)))
}
b = appendStructEnd(b)
code = code.next
case opStructEndStringTagInt32Ptr:
b = append(b, code.escapedKey...)
ptr := load(ctxptr, code.headIdx)
p := e.ptrToPtr(ptr + code.offset)
if p == 0 {
b = encodeNull(b)
} else {
b = append(b, '"')
b = appendInt(b, int64(e.ptrToInt32(p)))
b = append(b, '"')
}
b = appendStructEnd(b)
code = code.next
case opStructEndInt32NPtr:
b = append(b, code.escapedKey...)
ptr := load(ctxptr, code.headIdx)
p := e.ptrToPtr(ptr + code.offset)
for i := 0; i < code.ptrNum-1; i++ {
if p == 0 {
break
}
p = e.ptrToPtr(p)
}
if p == 0 {
b = encodeNull(b)
} else {
b = appendInt(b, int64(e.ptrToInt32(p)))
}
b = appendStructEnd(b)
code = code.next
case opStructEndInt64:
ptr := load(ctxptr, code.headIdx)
b = append(b, code.escapedKey...)

View File

@ -2123,6 +2123,54 @@ func (e *Encoder) runEscapedIndent(ctx *encodeRuntimeContext, b []byte, code *op
b = encodeIndentComma(b)
code = code.next
}
case opStructFieldPtrHeadOmitEmptyInt32:
ptr := load(ctxptr, code.idx)
if ptr != 0 {
store(ctxptr, code.idx, e.ptrToPtr(ptr))
}
fallthrough
case opStructFieldHeadOmitEmptyInt32:
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.ptrToInt32(ptr + code.offset)
if v == 0 {
code = code.nextField
} else {
b = e.encodeIndent(b, code.indent+1)
b = append(b, code.escapedKey...)
b = append(b, ' ')
b = appendInt(b, int64(v))
b = encodeIndentComma(b)
code = code.next
}
}
case opStructFieldPtrHeadStringTagInt32:
ptr := load(ctxptr, code.idx)
if ptr != 0 {
store(ctxptr, code.idx, e.ptrToPtr(ptr))
}
fallthrough
case opStructFieldHeadStringTagInt32:
ptr := load(ctxptr, code.idx)
if ptr == 0 {
b = encodeNull(b)
b = encodeIndentComma(b)
code = code.end.next
} else {
b = append(b, '{', '\n')
b = e.encodeIndent(b, code.indent+1)
b = append(b, code.escapedKey...)
b = append(b, ' ', '"')
b = appendInt(b, int64(e.ptrToInt32(ptr+code.offset)))
b = append(b, '"')
b = encodeIndentComma(b)
code = code.next
}
case opStructFieldPtrHeadInt32Only, opStructFieldHeadInt32Only:
p := load(ctxptr, code.idx)
b = append(b, '{', '\n')
@ -2132,6 +2180,28 @@ func (e *Encoder) runEscapedIndent(ctx *encodeRuntimeContext, b []byte, code *op
b = appendInt(b, int64(e.ptrToInt32(p)))
b = encodeIndentComma(b)
code = code.next
case opStructFieldPtrHeadOmitEmptyInt32Only, opStructFieldHeadOmitEmptyInt32Only:
p := load(ctxptr, code.idx)
b = append(b, '{', '\n')
v := int64(e.ptrToInt32(p))
if v != 0 {
b = e.encodeIndent(b, code.indent+1)
b = append(b, code.escapedKey...)
b = append(b, ' ')
b = appendInt(b, v)
b = encodeIndentComma(b)
}
code = code.next
case opStructFieldPtrHeadStringTagInt32Only, opStructFieldHeadStringTagInt32Only:
p := load(ctxptr, code.idx)
b = append(b, '{', '\n')
b = e.encodeIndent(b, code.indent+1)
b = append(b, code.escapedKey...)
b = append(b, ' ', '"')
b = appendInt(b, int64(e.ptrToInt32(p)))
b = append(b, '"')
b = encodeIndentComma(b)
code = code.next
case opStructFieldPtrHeadInt32Ptr:
store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx)))
fallthrough
@ -2156,6 +2226,53 @@ func (e *Encoder) runEscapedIndent(ctx *encodeRuntimeContext, b []byte, code *op
}
b = encodeIndentComma(b)
code = code.next
case opStructFieldPtrHeadOmitEmptyInt32Ptr:
store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx)))
fallthrough
case opStructFieldHeadOmitEmptyInt32Ptr:
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 = appendInt(b, int64(e.ptrToInt32(p)))
b = encodeIndentComma(b)
}
code = code.next
}
case opStructFieldPtrHeadStringTagInt32Ptr:
store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx)))
fallthrough
case opStructFieldHeadStringTagInt32Ptr:
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 = append(b, '"')
b = appendInt(b, int64(e.ptrToInt32(p+code.offset)))
b = append(b, '"')
}
}
b = encodeIndentComma(b)
code = code.next
case opStructFieldPtrHeadInt32PtrOnly:
p := load(ctxptr, code.idx)
if p == 0 {
@ -2179,6 +2296,52 @@ func (e *Encoder) runEscapedIndent(ctx *encodeRuntimeContext, b []byte, code *op
}
b = encodeIndentComma(b)
code = code.next
case opStructFieldPtrHeadOmitEmptyInt32PtrOnly:
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 opStructFieldHeadOmitEmptyInt32PtrOnly:
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 = appendInt(b, int64(e.ptrToInt32(p+code.offset)))
b = encodeIndentComma(b)
}
code = code.next
case opStructFieldPtrHeadStringTagInt32PtrOnly:
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 opStructFieldHeadStringTagInt32PtrOnly:
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 = append(b, '"')
b = appendInt(b, int64(e.ptrToInt32(p+code.offset)))
b = append(b, '"')
}
b = encodeIndentComma(b)
code = code.next
case opStructFieldHeadInt32NPtr:
p := load(ctxptr, code.idx)
if p == 0 {
@ -2217,6 +2380,43 @@ func (e *Encoder) runEscapedIndent(ctx *encodeRuntimeContext, b []byte, code *op
b = encodeIndentComma(b)
code = code.next
}
case opStructFieldPtrAnonymousHeadOmitEmptyInt32:
store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx)))
fallthrough
case opStructFieldAnonymousHeadOmitEmptyInt32:
ptr := load(ctxptr, code.idx)
if ptr == 0 {
code = code.end.next
} else {
v := e.ptrToInt32(ptr + code.offset)
if v == 0 {
code = code.nextField
} else {
b = e.encodeIndent(b, code.indent)
b = append(b, code.escapedKey...)
b = append(b, ' ')
b = appendInt(b, int64(v))
b = encodeIndentComma(b)
code = code.next
}
}
case opStructFieldPtrAnonymousHeadStringTagInt32:
store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx)))
fallthrough
case opStructFieldAnonymousHeadStringTagInt32:
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 = append(b, '"')
b = appendInt(b, int64(e.ptrToInt32(ptr+code.offset)))
b = append(b, '"')
b = encodeIndentComma(b)
code = code.next
}
case opStructFieldPtrAnonymousHeadInt32Only, opStructFieldAnonymousHeadInt32Only:
ptr := load(ctxptr, code.idx)
if ptr == 0 {
@ -2229,6 +2429,37 @@ func (e *Encoder) runEscapedIndent(ctx *encodeRuntimeContext, b []byte, code *op
b = encodeIndentComma(b)
code = code.next
}
case opStructFieldPtrAnonymousHeadOmitEmptyInt32Only, opStructFieldAnonymousHeadOmitEmptyInt32Only:
ptr := load(ctxptr, code.idx)
if ptr == 0 {
code = code.end.next
} else {
v := e.ptrToInt32(ptr + code.offset)
if v == 0 {
code = code.nextField
} else {
b = e.encodeIndent(b, code.indent)
b = append(b, code.escapedKey...)
b = append(b, ' ')
b = appendInt(b, int64(v))
b = encodeIndentComma(b)
code = code.next
}
}
case opStructFieldPtrAnonymousHeadStringTagInt32Only, opStructFieldAnonymousHeadStringTagInt32Only:
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 = append(b, '"')
b = appendInt(b, int64(e.ptrToInt32(ptr+code.offset)))
b = append(b, '"')
b = encodeIndentComma(b)
code = code.next
}
case opStructFieldPtrAnonymousHeadInt32Ptr:
store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx)))
fallthrough
@ -2249,6 +2480,48 @@ func (e *Encoder) runEscapedIndent(ctx *encodeRuntimeContext, b []byte, code *op
}
b = encodeIndentComma(b)
code = code.next
case opStructFieldPtrAnonymousHeadOmitEmptyInt32Ptr:
store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx)))
fallthrough
case opStructFieldAnonymousHeadOmitEmptyInt32Ptr:
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 = appendInt(b, int64(e.ptrToInt32(p)))
b = encodeIndentComma(b)
code = code.next
}
case opStructFieldPtrAnonymousHeadStringTagInt32Ptr:
store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx)))
fallthrough
case opStructFieldAnonymousHeadStringTagInt32Ptr:
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 = append(b, '"')
b = appendInt(b, int64(e.ptrToInt32(p+code.offset)))
b = append(b, '"')
}
b = encodeIndentComma(b)
code = code.next
case opStructFieldPtrAnonymousHeadInt32PtrOnly:
p := load(ctxptr, code.idx)
if p == 0 {
@ -2269,6 +2542,48 @@ func (e *Encoder) runEscapedIndent(ctx *encodeRuntimeContext, b []byte, code *op
}
b = encodeIndentComma(b)
code = code.next
case opStructFieldPtrAnonymousHeadOmitEmptyInt32PtrOnly:
p := load(ctxptr, code.idx)
if p == 0 {
code = code.end.next
break
}
store(ctxptr, code.idx, e.ptrToPtr(p))
fallthrough
case opStructFieldAnonymousHeadOmitEmptyInt32PtrOnly:
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 = appendInt(b, int64(e.ptrToInt32(p+code.offset)))
b = encodeIndentComma(b)
code = code.next
}
case opStructFieldPtrAnonymousHeadStringTagInt32PtrOnly:
p := load(ctxptr, code.idx)
if p == 0 {
code = code.end.next
break
}
store(ctxptr, code.idx, e.ptrToPtr(p))
fallthrough
case opStructFieldAnonymousHeadStringTagInt32PtrOnly:
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 = append(b, '"')
b = appendInt(b, int64(e.ptrToInt32(p+code.offset)))
b = append(b, '"')
}
b = encodeIndentComma(b)
code = code.next
case opStructFieldPtrHeadInt64:
store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx)))
fallthrough
@ -3677,34 +3992,6 @@ func (e *Encoder) runEscapedIndent(ctx *encodeRuntimeContext, b []byte, code *op
b = encodeIndentComma(b)
code = code.next
}
case opStructFieldPtrHeadOmitEmptyInt32:
ptr := load(ctxptr, code.idx)
if ptr != 0 {
store(ctxptr, code.idx, e.ptrToPtr(ptr))
}
fallthrough
case opStructFieldHeadOmitEmptyInt32:
ptr := load(ctxptr, code.idx)
if ptr == 0 {
b = e.encodeIndent(b, code.indent)
b = encodeNull(b)
b = encodeIndentComma(b)
code = code.end.next
} else {
b = e.encodeIndent(b, code.indent)
b = append(b, '{', '\n')
v := e.ptrToInt32(ptr + code.offset)
if v == 0 {
code = code.nextField
} else {
b = e.encodeIndent(b, code.indent+1)
b = append(b, code.escapedKey...)
b = append(b, ' ')
b = appendInt(b, int64(v))
b = encodeIndentComma(b)
code = code.next
}
}
case opStructFieldPtrHeadOmitEmptyInt64:
ptr := load(ctxptr, code.idx)
if ptr != 0 {
@ -4037,29 +4324,6 @@ func (e *Encoder) runEscapedIndent(ctx *encodeRuntimeContext, b []byte, code *op
code = code.next
store(ctxptr, code.idx, p)
}
case opStructFieldPtrHeadStringTagInt32:
ptr := load(ctxptr, code.idx)
if ptr != 0 {
store(ctxptr, code.idx, e.ptrToPtr(ptr))
}
fallthrough
case opStructFieldHeadStringTagInt32:
ptr := load(ctxptr, code.idx)
if ptr == 0 {
b = e.encodeIndent(b, code.indent)
b = encodeNull(b)
b = encodeIndentComma(b)
code = code.end.next
} else {
b = append(b, '{', '\n')
b = e.encodeIndent(b, code.indent+1)
b = append(b, code.escapedKey...)
b = append(b, ' ', '"')
b = appendInt(b, int64(e.ptrToInt32(ptr+code.offset)))
b = append(b, '"')
b = encodeIndentComma(b)
code = code.next
}
case opStructFieldPtrHeadStringTagInt64:
ptr := load(ctxptr, code.idx)
if ptr != 0 {
@ -5276,8 +5540,17 @@ func (e *Encoder) runEscapedIndent(ctx *encodeRuntimeContext, b []byte, code *op
b = append(b, code.escapedKey...)
b = append(b, ' ')
b = appendInt(b, int64(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 opStructEndStringTagInt32:
ptr := load(ctxptr, code.headIdx)
@ -5301,6 +5574,41 @@ func (e *Encoder) runEscapedIndent(ctx *encodeRuntimeContext, b []byte, code *op
}
b = e.appendStructEndIndent(b, code.indent-1)
code = code.next
case opStructEndOmitEmptyInt32Ptr:
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 = appendInt(b, int64(e.ptrToInt32(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 opStructEndStringTagInt32Ptr:
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 = append(b, '"')
b = appendInt(b, int64(e.ptrToInt32(p)))
b = append(b, '"')
}
b = e.appendStructEndIndent(b, code.indent-1)
code = code.next
case opStructEndInt64:
b = e.encodeIndent(b, code.indent)
b = append(b, code.escapedKey...)

View File

@ -2123,6 +2123,54 @@ func (e *Encoder) runIndent(ctx *encodeRuntimeContext, b []byte, code *opcode) (
b = encodeIndentComma(b)
code = code.next
}
case opStructFieldPtrHeadOmitEmptyInt32:
ptr := load(ctxptr, code.idx)
if ptr != 0 {
store(ctxptr, code.idx, e.ptrToPtr(ptr))
}
fallthrough
case opStructFieldHeadOmitEmptyInt32:
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.ptrToInt32(ptr + code.offset)
if v == 0 {
code = code.nextField
} else {
b = e.encodeIndent(b, code.indent+1)
b = append(b, code.key...)
b = append(b, ' ')
b = appendInt(b, int64(v))
b = encodeIndentComma(b)
code = code.next
}
}
case opStructFieldPtrHeadStringTagInt32:
ptr := load(ctxptr, code.idx)
if ptr != 0 {
store(ctxptr, code.idx, e.ptrToPtr(ptr))
}
fallthrough
case opStructFieldHeadStringTagInt32:
ptr := load(ctxptr, code.idx)
if ptr == 0 {
b = encodeNull(b)
b = encodeIndentComma(b)
code = code.end.next
} else {
b = append(b, '{', '\n')
b = e.encodeIndent(b, code.indent+1)
b = append(b, code.key...)
b = append(b, ' ', '"')
b = appendInt(b, int64(e.ptrToInt32(ptr+code.offset)))
b = append(b, '"')
b = encodeIndentComma(b)
code = code.next
}
case opStructFieldPtrHeadInt32Only, opStructFieldHeadInt32Only:
p := load(ctxptr, code.idx)
b = append(b, '{', '\n')
@ -2132,6 +2180,28 @@ func (e *Encoder) runIndent(ctx *encodeRuntimeContext, b []byte, code *opcode) (
b = appendInt(b, int64(e.ptrToInt32(p)))
b = encodeIndentComma(b)
code = code.next
case opStructFieldPtrHeadOmitEmptyInt32Only, opStructFieldHeadOmitEmptyInt32Only:
p := load(ctxptr, code.idx)
b = append(b, '{', '\n')
v := int64(e.ptrToInt32(p))
if v != 0 {
b = e.encodeIndent(b, code.indent+1)
b = append(b, code.key...)
b = append(b, ' ')
b = appendInt(b, v)
b = encodeIndentComma(b)
}
code = code.next
case opStructFieldPtrHeadStringTagInt32Only, opStructFieldHeadStringTagInt32Only:
p := load(ctxptr, code.idx)
b = append(b, '{', '\n')
b = e.encodeIndent(b, code.indent+1)
b = append(b, code.key...)
b = append(b, ' ', '"')
b = appendInt(b, int64(e.ptrToInt32(p)))
b = append(b, '"')
b = encodeIndentComma(b)
code = code.next
case opStructFieldPtrHeadInt32Ptr:
store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx)))
fallthrough
@ -2156,6 +2226,53 @@ func (e *Encoder) runIndent(ctx *encodeRuntimeContext, b []byte, code *opcode) (
}
b = encodeIndentComma(b)
code = code.next
case opStructFieldPtrHeadOmitEmptyInt32Ptr:
store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx)))
fallthrough
case opStructFieldHeadOmitEmptyInt32Ptr:
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 = appendInt(b, int64(e.ptrToInt32(p)))
b = encodeIndentComma(b)
}
code = code.next
}
case opStructFieldPtrHeadStringTagInt32Ptr:
store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx)))
fallthrough
case opStructFieldHeadStringTagInt32Ptr:
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 = append(b, '"')
b = appendInt(b, int64(e.ptrToInt32(p+code.offset)))
b = append(b, '"')
}
}
b = encodeIndentComma(b)
code = code.next
case opStructFieldPtrHeadInt32PtrOnly:
p := load(ctxptr, code.idx)
if p == 0 {
@ -2179,6 +2296,52 @@ func (e *Encoder) runIndent(ctx *encodeRuntimeContext, b []byte, code *opcode) (
}
b = encodeIndentComma(b)
code = code.next
case opStructFieldPtrHeadOmitEmptyInt32PtrOnly:
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 opStructFieldHeadOmitEmptyInt32PtrOnly:
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 = appendInt(b, int64(e.ptrToInt32(p+code.offset)))
b = encodeIndentComma(b)
}
code = code.next
case opStructFieldPtrHeadStringTagInt32PtrOnly:
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 opStructFieldHeadStringTagInt32PtrOnly:
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 = append(b, '"')
b = appendInt(b, int64(e.ptrToInt32(p+code.offset)))
b = append(b, '"')
}
b = encodeIndentComma(b)
code = code.next
case opStructFieldHeadInt32NPtr:
p := load(ctxptr, code.idx)
if p == 0 {
@ -2217,6 +2380,43 @@ func (e *Encoder) runIndent(ctx *encodeRuntimeContext, b []byte, code *opcode) (
b = encodeIndentComma(b)
code = code.next
}
case opStructFieldPtrAnonymousHeadOmitEmptyInt32:
store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx)))
fallthrough
case opStructFieldAnonymousHeadOmitEmptyInt32:
ptr := load(ctxptr, code.idx)
if ptr == 0 {
code = code.end.next
} else {
v := e.ptrToInt32(ptr + code.offset)
if v == 0 {
code = code.nextField
} else {
b = e.encodeIndent(b, code.indent)
b = append(b, code.key...)
b = append(b, ' ')
b = appendInt(b, int64(v))
b = encodeIndentComma(b)
code = code.next
}
}
case opStructFieldPtrAnonymousHeadStringTagInt32:
store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx)))
fallthrough
case opStructFieldAnonymousHeadStringTagInt32:
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 = append(b, '"')
b = appendInt(b, int64(e.ptrToInt32(ptr+code.offset)))
b = append(b, '"')
b = encodeIndentComma(b)
code = code.next
}
case opStructFieldPtrAnonymousHeadInt32Only, opStructFieldAnonymousHeadInt32Only:
ptr := load(ctxptr, code.idx)
if ptr == 0 {
@ -2229,6 +2429,37 @@ func (e *Encoder) runIndent(ctx *encodeRuntimeContext, b []byte, code *opcode) (
b = encodeIndentComma(b)
code = code.next
}
case opStructFieldPtrAnonymousHeadOmitEmptyInt32Only, opStructFieldAnonymousHeadOmitEmptyInt32Only:
ptr := load(ctxptr, code.idx)
if ptr == 0 {
code = code.end.next
} else {
v := e.ptrToInt32(ptr + code.offset)
if v == 0 {
code = code.nextField
} else {
b = e.encodeIndent(b, code.indent)
b = append(b, code.key...)
b = append(b, ' ')
b = appendInt(b, int64(v))
b = encodeIndentComma(b)
code = code.next
}
}
case opStructFieldPtrAnonymousHeadStringTagInt32Only, opStructFieldAnonymousHeadStringTagInt32Only:
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 = append(b, '"')
b = appendInt(b, int64(e.ptrToInt32(ptr+code.offset)))
b = append(b, '"')
b = encodeIndentComma(b)
code = code.next
}
case opStructFieldPtrAnonymousHeadInt32Ptr:
store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx)))
fallthrough
@ -2249,6 +2480,48 @@ func (e *Encoder) runIndent(ctx *encodeRuntimeContext, b []byte, code *opcode) (
}
b = encodeIndentComma(b)
code = code.next
case opStructFieldPtrAnonymousHeadOmitEmptyInt32Ptr:
store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx)))
fallthrough
case opStructFieldAnonymousHeadOmitEmptyInt32Ptr:
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 = appendInt(b, int64(e.ptrToInt32(p)))
b = encodeIndentComma(b)
code = code.next
}
case opStructFieldPtrAnonymousHeadStringTagInt32Ptr:
store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx)))
fallthrough
case opStructFieldAnonymousHeadStringTagInt32Ptr:
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 = append(b, '"')
b = appendInt(b, int64(e.ptrToInt32(p+code.offset)))
b = append(b, '"')
}
b = encodeIndentComma(b)
code = code.next
case opStructFieldPtrAnonymousHeadInt32PtrOnly:
p := load(ctxptr, code.idx)
if p == 0 {
@ -2269,6 +2542,48 @@ func (e *Encoder) runIndent(ctx *encodeRuntimeContext, b []byte, code *opcode) (
}
b = encodeIndentComma(b)
code = code.next
case opStructFieldPtrAnonymousHeadOmitEmptyInt32PtrOnly:
p := load(ctxptr, code.idx)
if p == 0 {
code = code.end.next
break
}
store(ctxptr, code.idx, e.ptrToPtr(p))
fallthrough
case opStructFieldAnonymousHeadOmitEmptyInt32PtrOnly:
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 = appendInt(b, int64(e.ptrToInt32(p+code.offset)))
b = encodeIndentComma(b)
code = code.next
}
case opStructFieldPtrAnonymousHeadStringTagInt32PtrOnly:
p := load(ctxptr, code.idx)
if p == 0 {
code = code.end.next
break
}
store(ctxptr, code.idx, e.ptrToPtr(p))
fallthrough
case opStructFieldAnonymousHeadStringTagInt32PtrOnly:
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 = append(b, '"')
b = appendInt(b, int64(e.ptrToInt32(p+code.offset)))
b = append(b, '"')
}
b = encodeIndentComma(b)
code = code.next
case opStructFieldPtrHeadInt64:
store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx)))
fallthrough
@ -3677,34 +3992,6 @@ func (e *Encoder) runIndent(ctx *encodeRuntimeContext, b []byte, code *opcode) (
b = encodeIndentComma(b)
code = code.next
}
case opStructFieldPtrHeadOmitEmptyInt32:
ptr := load(ctxptr, code.idx)
if ptr != 0 {
store(ctxptr, code.idx, e.ptrToPtr(ptr))
}
fallthrough
case opStructFieldHeadOmitEmptyInt32:
ptr := load(ctxptr, code.idx)
if ptr == 0 {
b = e.encodeIndent(b, code.indent)
b = encodeNull(b)
b = encodeIndentComma(b)
code = code.end.next
} else {
b = e.encodeIndent(b, code.indent)
b = append(b, '{', '\n')
v := e.ptrToInt32(ptr + code.offset)
if v == 0 {
code = code.nextField
} else {
b = e.encodeIndent(b, code.indent+1)
b = append(b, code.key...)
b = append(b, ' ')
b = appendInt(b, int64(v))
b = encodeIndentComma(b)
code = code.next
}
}
case opStructFieldPtrHeadOmitEmptyInt64:
ptr := load(ctxptr, code.idx)
if ptr != 0 {
@ -4037,29 +4324,6 @@ func (e *Encoder) runIndent(ctx *encodeRuntimeContext, b []byte, code *opcode) (
code = code.next
store(ctxptr, code.idx, p)
}
case opStructFieldPtrHeadStringTagInt32:
ptr := load(ctxptr, code.idx)
if ptr != 0 {
store(ctxptr, code.idx, e.ptrToPtr(ptr))
}
fallthrough
case opStructFieldHeadStringTagInt32:
ptr := load(ctxptr, code.idx)
if ptr == 0 {
b = e.encodeIndent(b, code.indent)
b = encodeNull(b)
b = encodeIndentComma(b)
code = code.end.next
} else {
b = append(b, '{', '\n')
b = e.encodeIndent(b, code.indent+1)
b = append(b, code.key...)
b = append(b, ' ', '"')
b = appendInt(b, int64(e.ptrToInt32(ptr+code.offset)))
b = append(b, '"')
b = encodeIndentComma(b)
code = code.next
}
case opStructFieldPtrHeadStringTagInt64:
ptr := load(ctxptr, code.idx)
if ptr != 0 {
@ -5276,8 +5540,17 @@ func (e *Encoder) runIndent(ctx *encodeRuntimeContext, b []byte, code *opcode) (
b = append(b, code.key...)
b = append(b, ' ')
b = appendInt(b, int64(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 opStructEndStringTagInt32:
ptr := load(ctxptr, code.headIdx)
@ -5301,6 +5574,41 @@ func (e *Encoder) runIndent(ctx *encodeRuntimeContext, b []byte, code *opcode) (
}
b = e.appendStructEndIndent(b, code.indent-1)
code = code.next
case opStructEndOmitEmptyInt32Ptr:
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 = appendInt(b, int64(e.ptrToInt32(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 opStructEndStringTagInt32Ptr:
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 = append(b, '"')
b = appendInt(b, int64(e.ptrToInt32(p)))
b = append(b, '"')
}
b = e.appendStructEndIndent(b, code.indent-1)
code = code.next
case opStructEndInt64:
b = e.encodeIndent(b, code.indent)
b = append(b, code.key...)