Add test cases for int64 type

This commit is contained in:
Masaaki Goshima 2021-01-18 22:35:10 +09:00
parent 861236119a
commit 5eaa3c023c
5 changed files with 3379 additions and 322 deletions

File diff suppressed because it is too large Load Diff

View File

@ -2419,7 +2419,6 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte
}
b = encodeComma(b)
code = code.next
case opStructFieldPtrHeadInt64:
store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx)))
fallthrough
@ -2436,6 +2435,51 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte
b = encodeComma(b)
code = code.next
}
case opStructFieldPtrHeadOmitEmptyInt64:
ptr := load(ctxptr, code.idx)
if ptr != 0 {
store(ctxptr, code.idx, e.ptrToPtr(ptr))
}
fallthrough
case opStructFieldHeadOmitEmptyInt64:
ptr := load(ctxptr, code.idx)
if ptr == 0 {
b = encodeNull(b)
b = encodeComma(b)
code = code.end.next
} else {
b = append(b, '{')
v := e.ptrToInt64(ptr + code.offset)
if v == 0 {
code = code.nextField
} else {
b = append(b, code.key...)
b = appendInt(b, v)
b = encodeComma(b)
code = code.next
}
}
case opStructFieldPtrHeadStringTagInt64:
ptr := load(ctxptr, code.idx)
if ptr != 0 {
store(ctxptr, code.idx, e.ptrToPtr(ptr))
}
fallthrough
case opStructFieldHeadStringTagInt64:
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, e.ptrToInt64(ptr+code.offset))
b = append(b, '"')
b = encodeComma(b)
code = code.next
}
case opStructFieldPtrHeadInt64Only, opStructFieldHeadInt64Only:
p := load(ctxptr, code.idx)
b = append(b, '{')
@ -2443,6 +2487,25 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte
b = appendInt(b, e.ptrToInt64(p))
b = encodeComma(b)
code = code.next
case opStructFieldPtrHeadOmitEmptyInt64Only, opStructFieldHeadOmitEmptyInt64Only:
p := load(ctxptr, code.idx)
b = append(b, '{')
v := e.ptrToInt64(p)
if v != 0 {
b = append(b, code.key...)
b = appendInt(b, v)
b = encodeComma(b)
}
code = code.next
case opStructFieldPtrHeadStringTagInt64Only, opStructFieldHeadStringTagInt64Only:
p := load(ctxptr, code.idx)
b = append(b, '{')
b = append(b, code.key...)
b = append(b, '"')
b = appendInt(b, e.ptrToInt64(p))
b = append(b, '"')
b = encodeComma(b)
code = code.next
case opStructFieldPtrHeadInt64Ptr:
store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx)))
fallthrough
@ -2465,6 +2528,49 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte
}
b = encodeComma(b)
code = code.next
case opStructFieldPtrHeadOmitEmptyInt64Ptr:
store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx)))
fallthrough
case opStructFieldHeadOmitEmptyInt64Ptr:
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, e.ptrToInt64(p))
b = encodeComma(b)
}
code = code.next
}
case opStructFieldPtrHeadStringTagInt64Ptr:
store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx)))
fallthrough
case opStructFieldHeadStringTagInt64Ptr:
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, e.ptrToInt64(p+code.offset))
b = append(b, '"')
}
}
b = encodeComma(b)
code = code.next
case opStructFieldPtrHeadInt64PtrOnly:
p := load(ctxptr, code.idx)
if p == 0 {
@ -2486,6 +2592,69 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte
}
b = encodeComma(b)
code = code.next
case opStructFieldPtrHeadOmitEmptyInt64PtrOnly:
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 opStructFieldHeadOmitEmptyInt64PtrOnly:
b = append(b, '{')
p := load(ctxptr, code.idx)
if p != 0 {
b = append(b, code.key...)
b = appendInt(b, e.ptrToInt64(p+code.offset))
b = encodeComma(b)
}
code = code.next
case opStructFieldPtrHeadStringTagInt64PtrOnly:
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 opStructFieldHeadStringTagInt64PtrOnly:
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, e.ptrToInt64(p+code.offset))
b = append(b, '"')
}
b = encodeComma(b)
code = code.next
case opStructFieldHeadInt64NPtr:
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, e.ptrToInt64(p+code.offset))
}
}
b = encodeComma(b)
code = code.next
case opStructFieldPtrAnonymousHeadInt64:
store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx)))
fallthrough
@ -2499,6 +2668,45 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte
b = encodeComma(b)
code = code.next
}
case opStructFieldPtrAnonymousHeadOmitEmptyInt64:
ptr := load(ctxptr, code.idx)
if ptr != 0 {
store(ctxptr, code.idx, e.ptrToPtr(ptr))
}
fallthrough
case opStructFieldAnonymousHeadOmitEmptyInt64:
ptr := load(ctxptr, code.idx)
if ptr == 0 {
code = code.end.next
} else {
v := e.ptrToInt64(ptr + code.offset)
if v == 0 {
code = code.nextField
} else {
b = append(b, code.key...)
b = appendInt(b, v)
b = encodeComma(b)
code = code.next
}
}
case opStructFieldPtrAnonymousHeadStringTagInt64:
ptr := load(ctxptr, code.idx)
if ptr != 0 {
store(ctxptr, code.idx, e.ptrToPtr(ptr))
}
fallthrough
case opStructFieldAnonymousHeadStringTagInt64:
ptr := load(ctxptr, code.idx)
if ptr == 0 {
code = code.end.next
} else {
b = append(b, code.key...)
b = append(b, '"')
b = appendInt(b, e.ptrToInt64(ptr+code.offset))
b = append(b, '"')
b = encodeComma(b)
code = code.next
}
case opStructFieldPtrAnonymousHeadInt64Only, opStructFieldAnonymousHeadInt64Only:
ptr := load(ctxptr, code.idx)
if ptr == 0 {
@ -2509,6 +2717,33 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte
b = encodeComma(b)
code = code.next
}
case opStructFieldPtrAnonymousHeadOmitEmptyInt64Only, opStructFieldAnonymousHeadOmitEmptyInt64Only:
ptr := load(ctxptr, code.idx)
if ptr == 0 {
code = code.end.next
} else {
v := e.ptrToInt64(ptr + code.offset)
if v == 0 {
code = code.nextField
} else {
b = append(b, code.key...)
b = appendInt(b, v)
b = encodeComma(b)
code = code.next
}
}
case opStructFieldPtrAnonymousHeadStringTagInt64Only, opStructFieldAnonymousHeadStringTagInt64Only:
ptr := load(ctxptr, code.idx)
if ptr == 0 {
code = code.end.next
} else {
b = append(b, code.key...)
b = append(b, '"')
b = appendInt(b, e.ptrToInt64(ptr+code.offset))
b = append(b, '"')
b = encodeComma(b)
code = code.next
}
case opStructFieldPtrAnonymousHeadInt64Ptr:
store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx)))
fallthrough
@ -2527,6 +2762,44 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte
}
b = encodeComma(b)
code = code.next
case opStructFieldPtrAnonymousHeadOmitEmptyInt64Ptr:
store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx)))
fallthrough
case opStructFieldAnonymousHeadOmitEmptyInt64Ptr:
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, e.ptrToInt64(p))
b = encodeComma(b)
code = code.next
}
case opStructFieldPtrAnonymousHeadStringTagInt64Ptr:
store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx)))
fallthrough
case opStructFieldAnonymousHeadStringTagInt64Ptr:
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, e.ptrToInt64(p+code.offset))
b = append(b, '"')
}
b = encodeComma(b)
code = code.next
case opStructFieldPtrAnonymousHeadInt64PtrOnly:
p := load(ctxptr, code.idx)
if p == 0 {
@ -2545,6 +2818,45 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte
}
b = encodeComma(b)
code = code.next
case opStructFieldPtrAnonymousHeadOmitEmptyInt64PtrOnly:
p := load(ctxptr, code.idx)
if p == 0 {
code = code.end.next
break
}
store(ctxptr, code.idx, e.ptrToPtr(p))
fallthrough
case opStructFieldAnonymousHeadOmitEmptyInt64PtrOnly:
p := load(ctxptr, code.idx)
if p == 0 {
code = code.nextField
} else {
b = append(b, code.key...)
b = appendInt(b, e.ptrToInt64(p+code.offset))
b = encodeComma(b)
code = code.next
}
case opStructFieldPtrAnonymousHeadStringTagInt64PtrOnly:
p := load(ctxptr, code.idx)
if p == 0 {
code = code.end.next
break
}
store(ctxptr, code.idx, e.ptrToPtr(p))
fallthrough
case opStructFieldAnonymousHeadStringTagInt64PtrOnly:
p := load(ctxptr, code.idx)
b = append(b, code.key...)
if p == 0 {
b = encodeNull(b)
} else {
b = append(b, '"')
b = appendInt(b, e.ptrToInt64(p+code.offset))
b = append(b, '"')
}
b = encodeComma(b)
code = code.next
case opStructFieldPtrHeadUint:
store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx)))
fallthrough
@ -3918,51 +4230,6 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte
b = encodeComma(b)
code = code.next
}
case opStructFieldPtrHeadOmitEmptyInt64:
ptr := load(ctxptr, code.idx)
if ptr != 0 {
store(ctxptr, code.idx, e.ptrToPtr(ptr))
}
fallthrough
case opStructFieldHeadOmitEmptyInt64:
ptr := load(ctxptr, code.idx)
if ptr == 0 {
b = encodeNull(b)
b = encodeComma(b)
code = code.end.next
} else {
b = append(b, '{')
v := e.ptrToInt64(ptr + code.offset)
if v == 0 {
code = code.nextField
} else {
b = append(b, code.key...)
b = appendInt(b, v)
b = encodeComma(b)
code = code.next
}
}
case opStructFieldPtrAnonymousHeadOmitEmptyInt64:
ptr := load(ctxptr, code.idx)
if ptr != 0 {
store(ctxptr, code.idx, e.ptrToPtr(ptr))
}
fallthrough
case opStructFieldAnonymousHeadOmitEmptyInt64:
ptr := load(ctxptr, code.idx)
if ptr == 0 {
code = code.end.next
} else {
v := e.ptrToInt64(ptr + code.offset)
if v == 0 {
code = code.nextField
} else {
b = append(b, code.key...)
b = appendInt(b, v)
b = encodeComma(b)
code = code.next
}
}
case opStructFieldPtrHeadOmitEmptyUint:
ptr := load(ctxptr, code.idx)
if ptr != 0 {
@ -4611,45 +4878,6 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte
code = code.next
store(ctxptr, code.idx, ptr+code.offset)
}
case opStructFieldPtrHeadStringTagInt64:
ptr := load(ctxptr, code.idx)
if ptr != 0 {
store(ctxptr, code.idx, e.ptrToPtr(ptr))
}
fallthrough
case opStructFieldHeadStringTagInt64:
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, e.ptrToInt64(ptr+code.offset))
b = append(b, '"')
b = encodeComma(b)
code = code.next
}
case opStructFieldPtrAnonymousHeadStringTagInt64:
ptr := load(ctxptr, code.idx)
if ptr != 0 {
store(ctxptr, code.idx, e.ptrToPtr(ptr))
}
fallthrough
case opStructFieldAnonymousHeadStringTagInt64:
ptr := load(ctxptr, code.idx)
if ptr == 0 {
code = code.end.next
} else {
b = append(b, code.key...)
b = append(b, '"')
b = appendInt(b, e.ptrToInt64(ptr+code.offset))
b = append(b, '"')
b = encodeComma(b)
code = code.next
}
case opStructFieldPtrHeadStringTagUint:
ptr := load(ctxptr, code.idx)
if ptr != 0 {
@ -6237,6 +6465,45 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte
}
b = appendStructEnd(b)
code = code.next
case opStructEndOmitEmptyInt64Ptr:
ptr := load(ctxptr, code.headIdx)
p := e.ptrToPtr(ptr + code.offset)
if p != 0 {
b = append(b, code.key...)
b = appendInt(b, e.ptrToInt64(p))
}
b = appendStructEnd(b)
code = code.next
case opStructEndStringTagInt64Ptr:
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, e.ptrToInt64(p))
b = append(b, '"')
}
b = appendStructEnd(b)
code = code.next
case opStructEndInt64NPtr:
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, e.ptrToInt64(p))
}
b = appendStructEnd(b)
code = code.next
case opStructEndUint:
ptr := load(ctxptr, code.headIdx)
b = append(b, code.key...)

View File

@ -2379,7 +2379,6 @@ func (e *Encoder) runEscaped(ctx *encodeRuntimeContext, b []byte, code *opcode)
}
b = encodeComma(b)
code = code.next
case opStructFieldPtrHeadInt64:
store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx)))
fallthrough
@ -2396,6 +2395,51 @@ func (e *Encoder) runEscaped(ctx *encodeRuntimeContext, b []byte, code *opcode)
b = encodeComma(b)
code = code.next
}
case opStructFieldPtrHeadOmitEmptyInt64:
ptr := load(ctxptr, code.idx)
if ptr != 0 {
store(ctxptr, code.idx, e.ptrToPtr(ptr))
}
fallthrough
case opStructFieldHeadOmitEmptyInt64:
ptr := load(ctxptr, code.idx)
if ptr == 0 {
b = encodeNull(b)
b = encodeComma(b)
code = code.end.next
} else {
b = append(b, '{')
v := e.ptrToInt64(ptr + code.offset)
if v == 0 {
code = code.nextField
} else {
b = append(b, code.escapedKey...)
b = appendInt(b, v)
b = encodeComma(b)
code = code.next
}
}
case opStructFieldPtrHeadStringTagInt64:
ptr := load(ctxptr, code.idx)
if ptr != 0 {
store(ctxptr, code.idx, e.ptrToPtr(ptr))
}
fallthrough
case opStructFieldHeadStringTagInt64:
ptr := load(ctxptr, code.idx)
if ptr == 0 {
b = encodeNull(b)
b = encodeComma(b)
code = code.end.next
} else {
b = append(b, '{')
b = append(b, code.escapedKey...)
b = append(b, '"')
b = appendInt(b, e.ptrToInt64(ptr+code.offset))
b = append(b, '"')
b = encodeComma(b)
code = code.next
}
case opStructFieldPtrHeadInt64Only, opStructFieldHeadInt64Only:
p := load(ctxptr, code.idx)
b = append(b, '{')
@ -2403,6 +2447,25 @@ func (e *Encoder) runEscaped(ctx *encodeRuntimeContext, b []byte, code *opcode)
b = appendInt(b, e.ptrToInt64(p))
b = encodeComma(b)
code = code.next
case opStructFieldPtrHeadOmitEmptyInt64Only, opStructFieldHeadOmitEmptyInt64Only:
p := load(ctxptr, code.idx)
b = append(b, '{')
v := e.ptrToInt64(p)
if v != 0 {
b = append(b, code.escapedKey...)
b = appendInt(b, v)
b = encodeComma(b)
}
code = code.next
case opStructFieldPtrHeadStringTagInt64Only, opStructFieldHeadStringTagInt64Only:
p := load(ctxptr, code.idx)
b = append(b, '{')
b = append(b, code.escapedKey...)
b = append(b, '"')
b = appendInt(b, e.ptrToInt64(p))
b = append(b, '"')
b = encodeComma(b)
code = code.next
case opStructFieldPtrHeadInt64Ptr:
store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx)))
fallthrough
@ -2425,6 +2488,49 @@ func (e *Encoder) runEscaped(ctx *encodeRuntimeContext, b []byte, code *opcode)
}
b = encodeComma(b)
code = code.next
case opStructFieldPtrHeadOmitEmptyInt64Ptr:
store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx)))
fallthrough
case opStructFieldHeadOmitEmptyInt64Ptr:
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, e.ptrToInt64(p))
b = encodeComma(b)
}
code = code.next
}
case opStructFieldPtrHeadStringTagInt64Ptr:
store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx)))
fallthrough
case opStructFieldHeadStringTagInt64Ptr:
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, e.ptrToInt64(p+code.offset))
b = append(b, '"')
}
}
b = encodeComma(b)
code = code.next
case opStructFieldPtrHeadInt64PtrOnly:
p := load(ctxptr, code.idx)
if p == 0 {
@ -2446,6 +2552,69 @@ func (e *Encoder) runEscaped(ctx *encodeRuntimeContext, b []byte, code *opcode)
}
b = encodeComma(b)
code = code.next
case opStructFieldPtrHeadOmitEmptyInt64PtrOnly:
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 opStructFieldHeadOmitEmptyInt64PtrOnly:
b = append(b, '{')
p := load(ctxptr, code.idx)
if p != 0 {
b = append(b, code.escapedKey...)
b = appendInt(b, e.ptrToInt64(p+code.offset))
b = encodeComma(b)
}
code = code.next
case opStructFieldPtrHeadStringTagInt64PtrOnly:
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 opStructFieldHeadStringTagInt64PtrOnly:
p := load(ctxptr, code.idx)
b = append(b, '{')
b = append(b, code.escapedKey...)
if p == 0 {
b = encodeNull(b)
} else {
b = append(b, '"')
b = appendInt(b, e.ptrToInt64(p+code.offset))
b = append(b, '"')
}
b = encodeComma(b)
code = code.next
case opStructFieldHeadInt64NPtr:
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, e.ptrToInt64(p+code.offset))
}
}
b = encodeComma(b)
code = code.next
case opStructFieldPtrAnonymousHeadInt64:
store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx)))
fallthrough
@ -2459,6 +2628,45 @@ func (e *Encoder) runEscaped(ctx *encodeRuntimeContext, b []byte, code *opcode)
b = encodeComma(b)
code = code.next
}
case opStructFieldPtrAnonymousHeadOmitEmptyInt64:
ptr := load(ctxptr, code.idx)
if ptr != 0 {
store(ctxptr, code.idx, e.ptrToPtr(ptr))
}
fallthrough
case opStructFieldAnonymousHeadOmitEmptyInt64:
ptr := load(ctxptr, code.idx)
if ptr == 0 {
code = code.end.next
} else {
v := e.ptrToInt64(ptr + code.offset)
if v == 0 {
code = code.nextField
} else {
b = append(b, code.escapedKey...)
b = appendInt(b, v)
b = encodeComma(b)
code = code.next
}
}
case opStructFieldPtrAnonymousHeadStringTagInt64:
ptr := load(ctxptr, code.idx)
if ptr != 0 {
store(ctxptr, code.idx, e.ptrToPtr(ptr))
}
fallthrough
case opStructFieldAnonymousHeadStringTagInt64:
ptr := load(ctxptr, code.idx)
if ptr == 0 {
code = code.end.next
} else {
b = append(b, code.escapedKey...)
b = append(b, '"')
b = appendInt(b, e.ptrToInt64(ptr+code.offset))
b = append(b, '"')
b = encodeComma(b)
code = code.next
}
case opStructFieldPtrAnonymousHeadInt64Only, opStructFieldAnonymousHeadInt64Only:
ptr := load(ctxptr, code.idx)
if ptr == 0 {
@ -2469,6 +2677,33 @@ func (e *Encoder) runEscaped(ctx *encodeRuntimeContext, b []byte, code *opcode)
b = encodeComma(b)
code = code.next
}
case opStructFieldPtrAnonymousHeadOmitEmptyInt64Only, opStructFieldAnonymousHeadOmitEmptyInt64Only:
ptr := load(ctxptr, code.idx)
if ptr == 0 {
code = code.end.next
} else {
v := e.ptrToInt64(ptr + code.offset)
if v == 0 {
code = code.nextField
} else {
b = append(b, code.escapedKey...)
b = appendInt(b, v)
b = encodeComma(b)
code = code.next
}
}
case opStructFieldPtrAnonymousHeadStringTagInt64Only, opStructFieldAnonymousHeadStringTagInt64Only:
ptr := load(ctxptr, code.idx)
if ptr == 0 {
code = code.end.next
} else {
b = append(b, code.escapedKey...)
b = append(b, '"')
b = appendInt(b, e.ptrToInt64(ptr+code.offset))
b = append(b, '"')
b = encodeComma(b)
code = code.next
}
case opStructFieldPtrAnonymousHeadInt64Ptr:
store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx)))
fallthrough
@ -2487,6 +2722,44 @@ func (e *Encoder) runEscaped(ctx *encodeRuntimeContext, b []byte, code *opcode)
}
b = encodeComma(b)
code = code.next
case opStructFieldPtrAnonymousHeadOmitEmptyInt64Ptr:
store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx)))
fallthrough
case opStructFieldAnonymousHeadOmitEmptyInt64Ptr:
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, e.ptrToInt64(p))
b = encodeComma(b)
code = code.next
}
case opStructFieldPtrAnonymousHeadStringTagInt64Ptr:
store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx)))
fallthrough
case opStructFieldAnonymousHeadStringTagInt64Ptr:
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, e.ptrToInt64(p+code.offset))
b = append(b, '"')
}
b = encodeComma(b)
code = code.next
case opStructFieldPtrAnonymousHeadInt64PtrOnly:
p := load(ctxptr, code.idx)
if p == 0 {
@ -2505,6 +2778,44 @@ func (e *Encoder) runEscaped(ctx *encodeRuntimeContext, b []byte, code *opcode)
}
b = encodeComma(b)
code = code.next
case opStructFieldPtrAnonymousHeadOmitEmptyInt64PtrOnly:
p := load(ctxptr, code.idx)
if p == 0 {
code = code.end.next
break
}
store(ctxptr, code.idx, e.ptrToPtr(p))
fallthrough
case opStructFieldAnonymousHeadOmitEmptyInt64PtrOnly:
p := load(ctxptr, code.idx)
if p == 0 {
code = code.nextField
} else {
b = append(b, code.escapedKey...)
b = appendInt(b, e.ptrToInt64(p+code.offset))
b = encodeComma(b)
code = code.next
}
case opStructFieldPtrAnonymousHeadStringTagInt64PtrOnly:
p := load(ctxptr, code.idx)
if p == 0 {
code = code.end.next
break
}
store(ctxptr, code.idx, e.ptrToPtr(p))
fallthrough
case opStructFieldAnonymousHeadStringTagInt64PtrOnly:
p := load(ctxptr, code.idx)
b = append(b, code.escapedKey...)
if p == 0 {
b = encodeNull(b)
} else {
b = append(b, '"')
b = appendInt(b, e.ptrToInt64(p+code.offset))
b = append(b, '"')
}
b = encodeComma(b)
code = code.next
case opStructFieldPtrHeadUint:
store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx)))
fallthrough
@ -3885,51 +4196,6 @@ func (e *Encoder) runEscaped(ctx *encodeRuntimeContext, b []byte, code *opcode)
b = encodeComma(b)
code = code.next
}
case opStructFieldPtrHeadOmitEmptyInt64:
ptr := load(ctxptr, code.idx)
if ptr != 0 {
store(ctxptr, code.idx, e.ptrToPtr(ptr))
}
fallthrough
case opStructFieldHeadOmitEmptyInt64:
ptr := load(ctxptr, code.idx)
if ptr == 0 {
b = encodeNull(b)
b = encodeComma(b)
code = code.end.next
} else {
b = append(b, '{')
v := e.ptrToInt64(ptr + code.offset)
if v == 0 {
code = code.nextField
} else {
b = append(b, code.escapedKey...)
b = appendInt(b, v)
b = encodeComma(b)
code = code.next
}
}
case opStructFieldPtrAnonymousHeadOmitEmptyInt64:
ptr := load(ctxptr, code.idx)
if ptr != 0 {
store(ctxptr, code.idx, e.ptrToPtr(ptr))
}
fallthrough
case opStructFieldAnonymousHeadOmitEmptyInt64:
ptr := load(ctxptr, code.idx)
if ptr == 0 {
code = code.end.next
} else {
v := e.ptrToInt64(ptr + code.offset)
if v == 0 {
code = code.nextField
} else {
b = append(b, code.escapedKey...)
b = appendInt(b, v)
b = encodeComma(b)
code = code.next
}
}
case opStructFieldPtrHeadOmitEmptyUint:
ptr := load(ctxptr, code.idx)
if ptr != 0 {
@ -4578,85 +4844,6 @@ func (e *Encoder) runEscaped(ctx *encodeRuntimeContext, b []byte, code *opcode)
code = code.next
store(ctxptr, code.idx, ptr+code.offset)
}
case opStructFieldPtrHeadStringTagInt64:
ptr := load(ctxptr, code.idx)
if ptr != 0 {
store(ctxptr, code.idx, e.ptrToPtr(ptr))
}
fallthrough
case opStructFieldHeadStringTagInt64:
ptr := load(ctxptr, code.idx)
if ptr == 0 {
b = encodeNull(b)
b = encodeComma(b)
code = code.end.next
} else {
b = append(b, '{')
b = append(b, code.escapedKey...)
b = append(b, '"')
b = appendInt(b, e.ptrToInt64(ptr+code.offset))
b = append(b, '"')
b = encodeComma(b)
code = code.next
}
case opStructFieldPtrHeadStringTagInt64Only:
p := load(ctxptr, code.idx)
if p == 0 {
b = encodeNull(b)
b = encodeComma(b)
code = code.end.next
break
}
fallthrough
case opStructFieldHeadStringTagInt64Only:
p := load(ctxptr, code.idx)
b = append(b, '{')
b = append(b, code.escapedKey...)
b = append(b, '"')
b = appendInt(b, e.ptrToInt64(p+code.offset))
b = append(b, '"')
b = encodeComma(b)
code = code.next
case opStructFieldPtrHeadStringTagInt64PtrOnly:
p := load(ctxptr, code.idx)
if p == 0 {
b = encodeNull(b)
b = encodeComma(b)
code = code.end.next
break
}
fallthrough
case opStructFieldHeadStringTagInt64PtrOnly:
p := load(ctxptr, code.idx)
b = append(b, '{')
b = append(b, code.escapedKey...)
if p == 0 {
b = encodeNull(b)
} else {
b = append(b, '"')
b = appendInt(b, e.ptrToInt64(p+code.offset))
b = append(b, '"')
}
b = encodeComma(b)
code = code.next
case opStructFieldPtrAnonymousHeadStringTagInt64:
ptr := load(ctxptr, code.idx)
if ptr != 0 {
store(ctxptr, code.idx, e.ptrToPtr(ptr))
}
fallthrough
case opStructFieldAnonymousHeadStringTagInt64:
ptr := load(ctxptr, code.idx)
if ptr == 0 {
code = code.end.next
} else {
b = append(b, code.escapedKey...)
b = append(b, '"')
b = appendInt(b, e.ptrToInt64(ptr+code.offset))
b = append(b, '"')
b = encodeComma(b)
code = code.next
}
case opStructFieldPtrHeadStringTagUint:
ptr := load(ctxptr, code.idx)
if ptr != 0 {
@ -6263,6 +6450,45 @@ func (e *Encoder) runEscaped(ctx *encodeRuntimeContext, b []byte, code *opcode)
}
b = appendStructEnd(b)
code = code.next
case opStructEndOmitEmptyInt64Ptr:
ptr := load(ctxptr, code.headIdx)
p := e.ptrToPtr(ptr + code.offset)
if p != 0 {
b = append(b, code.escapedKey...)
b = appendInt(b, e.ptrToInt64(p))
}
b = appendStructEnd(b)
code = code.next
case opStructEndStringTagInt64Ptr:
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, e.ptrToInt64(p))
b = append(b, '"')
}
b = appendStructEnd(b)
code = code.next
case opStructEndInt64NPtr:
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, e.ptrToInt64(p))
}
b = appendStructEnd(b)
code = code.next
case opStructEndUint:
ptr := load(ctxptr, code.headIdx)
b = append(b, code.escapedKey...)

View File

@ -2602,6 +2602,54 @@ func (e *Encoder) runEscapedIndent(ctx *encodeRuntimeContext, b []byte, code *op
b = encodeIndentComma(b)
code = code.next
}
case opStructFieldPtrHeadOmitEmptyInt64:
ptr := load(ctxptr, code.idx)
if ptr != 0 {
store(ctxptr, code.idx, e.ptrToPtr(ptr))
}
fallthrough
case opStructFieldHeadOmitEmptyInt64:
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.ptrToInt64(ptr + code.offset)
if v == 0 {
code = code.nextField
} else {
b = e.encodeIndent(b, code.indent+1)
b = append(b, code.escapedKey...)
b = append(b, ' ')
b = appendInt(b, v)
b = encodeIndentComma(b)
code = code.next
}
}
case opStructFieldPtrHeadStringTagInt64:
ptr := load(ctxptr, code.idx)
if ptr != 0 {
store(ctxptr, code.idx, e.ptrToPtr(ptr))
}
fallthrough
case opStructFieldHeadStringTagInt64:
ptr := load(ctxptr, code.idx)
if ptr == 0 {
b = encodeNull(b)
b = encodeIndentComma(b)
code = code.end.next
} else {
b = append(b, '{', '\n')
b = e.encodeIndent(b, code.indent+1)
b = append(b, code.escapedKey...)
b = append(b, ' ', '"')
b = appendInt(b, e.ptrToInt64(ptr+code.offset))
b = append(b, '"')
b = encodeIndentComma(b)
code = code.next
}
case opStructFieldPtrHeadInt64Only, opStructFieldHeadInt64Only:
p := load(ctxptr, code.idx)
b = append(b, '{', '\n')
@ -2611,6 +2659,28 @@ func (e *Encoder) runEscapedIndent(ctx *encodeRuntimeContext, b []byte, code *op
b = appendInt(b, e.ptrToInt64(p))
b = encodeIndentComma(b)
code = code.next
case opStructFieldPtrHeadOmitEmptyInt64Only, opStructFieldHeadOmitEmptyInt64Only:
p := load(ctxptr, code.idx)
b = append(b, '{', '\n')
v := e.ptrToInt64(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 opStructFieldPtrHeadStringTagInt64Only, opStructFieldHeadStringTagInt64Only:
p := load(ctxptr, code.idx)
b = append(b, '{', '\n')
b = e.encodeIndent(b, code.indent+1)
b = append(b, code.escapedKey...)
b = append(b, ' ', '"')
b = appendInt(b, e.ptrToInt64(p))
b = append(b, '"')
b = encodeIndentComma(b)
code = code.next
case opStructFieldPtrHeadInt64Ptr:
store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx)))
fallthrough
@ -2635,6 +2705,53 @@ func (e *Encoder) runEscapedIndent(ctx *encodeRuntimeContext, b []byte, code *op
}
b = encodeIndentComma(b)
code = code.next
case opStructFieldPtrHeadOmitEmptyInt64Ptr:
store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx)))
fallthrough
case opStructFieldHeadOmitEmptyInt64Ptr:
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, e.ptrToInt64(p))
b = encodeIndentComma(b)
}
code = code.next
}
case opStructFieldPtrHeadStringTagInt64Ptr:
store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx)))
fallthrough
case opStructFieldHeadStringTagInt64Ptr:
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, e.ptrToInt64(p+code.offset))
b = append(b, '"')
}
}
b = encodeIndentComma(b)
code = code.next
case opStructFieldPtrHeadInt64PtrOnly:
p := load(ctxptr, code.idx)
if p == 0 {
@ -2658,6 +2775,52 @@ func (e *Encoder) runEscapedIndent(ctx *encodeRuntimeContext, b []byte, code *op
}
b = encodeIndentComma(b)
code = code.next
case opStructFieldPtrHeadOmitEmptyInt64PtrOnly:
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 opStructFieldHeadOmitEmptyInt64PtrOnly:
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, e.ptrToInt64(p+code.offset))
b = encodeIndentComma(b)
}
code = code.next
case opStructFieldPtrHeadStringTagInt64PtrOnly:
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 opStructFieldHeadStringTagInt64PtrOnly:
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, e.ptrToInt64(p+code.offset))
b = append(b, '"')
}
b = encodeIndentComma(b)
code = code.next
case opStructFieldHeadInt64NPtr:
p := load(ctxptr, code.idx)
if p == 0 {
@ -2696,6 +2859,43 @@ func (e *Encoder) runEscapedIndent(ctx *encodeRuntimeContext, b []byte, code *op
b = encodeIndentComma(b)
code = code.next
}
case opStructFieldPtrAnonymousHeadOmitEmptyInt64:
store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx)))
fallthrough
case opStructFieldAnonymousHeadOmitEmptyInt64:
ptr := load(ctxptr, code.idx)
if ptr == 0 {
code = code.end.next
} else {
v := e.ptrToInt64(ptr + code.offset)
if v == 0 {
code = code.nextField
} else {
b = e.encodeIndent(b, code.indent)
b = append(b, code.escapedKey...)
b = append(b, ' ')
b = appendInt(b, v)
b = encodeIndentComma(b)
code = code.next
}
}
case opStructFieldPtrAnonymousHeadStringTagInt64:
store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx)))
fallthrough
case opStructFieldAnonymousHeadStringTagInt64:
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, e.ptrToInt64(ptr+code.offset))
b = append(b, '"')
b = encodeIndentComma(b)
code = code.next
}
case opStructFieldPtrAnonymousHeadInt64Only, opStructFieldAnonymousHeadInt64Only:
ptr := load(ctxptr, code.idx)
if ptr == 0 {
@ -2708,6 +2908,37 @@ func (e *Encoder) runEscapedIndent(ctx *encodeRuntimeContext, b []byte, code *op
b = encodeIndentComma(b)
code = code.next
}
case opStructFieldPtrAnonymousHeadOmitEmptyInt64Only, opStructFieldAnonymousHeadOmitEmptyInt64Only:
ptr := load(ctxptr, code.idx)
if ptr == 0 {
code = code.end.next
} else {
v := e.ptrToInt64(ptr + code.offset)
if v == 0 {
code = code.nextField
} else {
b = e.encodeIndent(b, code.indent)
b = append(b, code.escapedKey...)
b = append(b, ' ')
b = appendInt(b, v)
b = encodeIndentComma(b)
code = code.next
}
}
case opStructFieldPtrAnonymousHeadStringTagInt64Only, opStructFieldAnonymousHeadStringTagInt64Only:
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, e.ptrToInt64(ptr+code.offset))
b = append(b, '"')
b = encodeIndentComma(b)
code = code.next
}
case opStructFieldPtrAnonymousHeadInt64Ptr:
store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx)))
fallthrough
@ -2728,6 +2959,48 @@ func (e *Encoder) runEscapedIndent(ctx *encodeRuntimeContext, b []byte, code *op
}
b = encodeIndentComma(b)
code = code.next
case opStructFieldPtrAnonymousHeadOmitEmptyInt64Ptr:
store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx)))
fallthrough
case opStructFieldAnonymousHeadOmitEmptyInt64Ptr:
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, e.ptrToInt64(p))
b = encodeIndentComma(b)
code = code.next
}
case opStructFieldPtrAnonymousHeadStringTagInt64Ptr:
store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx)))
fallthrough
case opStructFieldAnonymousHeadStringTagInt64Ptr:
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, e.ptrToInt64(p+code.offset))
b = append(b, '"')
}
b = encodeIndentComma(b)
code = code.next
case opStructFieldPtrAnonymousHeadInt64PtrOnly:
p := load(ctxptr, code.idx)
if p == 0 {
@ -2748,6 +3021,48 @@ func (e *Encoder) runEscapedIndent(ctx *encodeRuntimeContext, b []byte, code *op
}
b = encodeIndentComma(b)
code = code.next
case opStructFieldPtrAnonymousHeadOmitEmptyInt64PtrOnly:
p := load(ctxptr, code.idx)
if p == 0 {
code = code.end.next
break
}
store(ctxptr, code.idx, e.ptrToPtr(p))
fallthrough
case opStructFieldAnonymousHeadOmitEmptyInt64PtrOnly:
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, e.ptrToInt64(p+code.offset))
b = encodeIndentComma(b)
code = code.next
}
case opStructFieldPtrAnonymousHeadStringTagInt64PtrOnly:
p := load(ctxptr, code.idx)
if p == 0 {
code = code.end.next
break
}
store(ctxptr, code.idx, e.ptrToPtr(p))
fallthrough
case opStructFieldAnonymousHeadStringTagInt64PtrOnly:
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, e.ptrToInt64(p+code.offset))
b = append(b, '"')
}
b = encodeIndentComma(b)
code = code.next
case opStructFieldPtrHeadUint:
store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx)))
fallthrough
@ -3992,34 +4307,6 @@ func (e *Encoder) runEscapedIndent(ctx *encodeRuntimeContext, b []byte, code *op
b = encodeIndentComma(b)
code = code.next
}
case opStructFieldPtrHeadOmitEmptyInt64:
ptr := load(ctxptr, code.idx)
if ptr != 0 {
store(ctxptr, code.idx, e.ptrToPtr(ptr))
}
fallthrough
case opStructFieldHeadOmitEmptyInt64:
ptr := load(ctxptr, code.idx)
if ptr == 0 {
b = e.encodeIndent(b, code.indent)
b = encodeNull(b)
b = encodeIndentComma(b)
code = code.end.next
} else {
b = e.encodeIndent(b, code.indent)
b = append(b, '{', '\n')
v := e.ptrToInt64(ptr + code.offset)
if v == 0 {
code = code.nextField
} else {
b = e.encodeIndent(b, code.indent+1)
b = append(b, code.escapedKey...)
b = append(b, ' ')
b = appendInt(b, v)
b = encodeIndentComma(b)
code = code.next
}
}
case opStructFieldPtrHeadOmitEmptyUint:
ptr := load(ctxptr, code.idx)
if ptr != 0 {
@ -4324,29 +4611,6 @@ func (e *Encoder) runEscapedIndent(ctx *encodeRuntimeContext, b []byte, code *op
code = code.next
store(ctxptr, code.idx, p)
}
case opStructFieldPtrHeadStringTagInt64:
ptr := load(ctxptr, code.idx)
if ptr != 0 {
store(ctxptr, code.idx, e.ptrToPtr(ptr))
}
fallthrough
case opStructFieldHeadStringTagInt64:
ptr := load(ctxptr, code.idx)
if ptr == 0 {
b = e.encodeIndent(b, code.indent)
b = encodeNull(b)
b = encodeIndentComma(b)
code = code.end.next
} else {
b = append(b, '{', '\n')
b = e.encodeIndent(b, code.indent+1)
b = append(b, code.escapedKey...)
b = append(b, ' ', '"')
b = appendInt(b, e.ptrToInt64(ptr+code.offset))
b = append(b, '"')
b = encodeIndentComma(b)
code = code.next
}
case opStructFieldPtrHeadStringTagUint:
ptr := load(ctxptr, code.idx)
if ptr != 0 {
@ -5625,8 +5889,17 @@ func (e *Encoder) runEscapedIndent(ctx *encodeRuntimeContext, b []byte, code *op
b = append(b, code.escapedKey...)
b = append(b, ' ')
b = appendInt(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)
}
code = code.next
case opStructEndStringTagInt64:
ptr := load(ctxptr, code.headIdx)
@ -5650,6 +5923,41 @@ func (e *Encoder) runEscapedIndent(ctx *encodeRuntimeContext, b []byte, code *op
}
b = e.appendStructEndIndent(b, code.indent-1)
code = code.next
case opStructEndOmitEmptyInt64Ptr:
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, e.ptrToInt64(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 opStructEndStringTagInt64Ptr:
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, e.ptrToInt64(p))
b = append(b, '"')
}
b = e.appendStructEndIndent(b, code.indent-1)
code = code.next
case opStructEndUint:
b = e.encodeIndent(b, code.indent)
b = append(b, code.escapedKey...)

View File

@ -2602,6 +2602,54 @@ func (e *Encoder) runIndent(ctx *encodeRuntimeContext, b []byte, code *opcode) (
b = encodeIndentComma(b)
code = code.next
}
case opStructFieldPtrHeadOmitEmptyInt64:
ptr := load(ctxptr, code.idx)
if ptr != 0 {
store(ctxptr, code.idx, e.ptrToPtr(ptr))
}
fallthrough
case opStructFieldHeadOmitEmptyInt64:
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.ptrToInt64(ptr + code.offset)
if v == 0 {
code = code.nextField
} else {
b = e.encodeIndent(b, code.indent+1)
b = append(b, code.key...)
b = append(b, ' ')
b = appendInt(b, v)
b = encodeIndentComma(b)
code = code.next
}
}
case opStructFieldPtrHeadStringTagInt64:
ptr := load(ctxptr, code.idx)
if ptr != 0 {
store(ctxptr, code.idx, e.ptrToPtr(ptr))
}
fallthrough
case opStructFieldHeadStringTagInt64:
ptr := load(ctxptr, code.idx)
if ptr == 0 {
b = encodeNull(b)
b = encodeIndentComma(b)
code = code.end.next
} else {
b = append(b, '{', '\n')
b = e.encodeIndent(b, code.indent+1)
b = append(b, code.key...)
b = append(b, ' ', '"')
b = appendInt(b, e.ptrToInt64(ptr+code.offset))
b = append(b, '"')
b = encodeIndentComma(b)
code = code.next
}
case opStructFieldPtrHeadInt64Only, opStructFieldHeadInt64Only:
p := load(ctxptr, code.idx)
b = append(b, '{', '\n')
@ -2611,6 +2659,28 @@ func (e *Encoder) runIndent(ctx *encodeRuntimeContext, b []byte, code *opcode) (
b = appendInt(b, e.ptrToInt64(p))
b = encodeIndentComma(b)
code = code.next
case opStructFieldPtrHeadOmitEmptyInt64Only, opStructFieldHeadOmitEmptyInt64Only:
p := load(ctxptr, code.idx)
b = append(b, '{', '\n')
v := e.ptrToInt64(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 opStructFieldPtrHeadStringTagInt64Only, opStructFieldHeadStringTagInt64Only:
p := load(ctxptr, code.idx)
b = append(b, '{', '\n')
b = e.encodeIndent(b, code.indent+1)
b = append(b, code.key...)
b = append(b, ' ', '"')
b = appendInt(b, e.ptrToInt64(p))
b = append(b, '"')
b = encodeIndentComma(b)
code = code.next
case opStructFieldPtrHeadInt64Ptr:
store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx)))
fallthrough
@ -2635,6 +2705,53 @@ func (e *Encoder) runIndent(ctx *encodeRuntimeContext, b []byte, code *opcode) (
}
b = encodeIndentComma(b)
code = code.next
case opStructFieldPtrHeadOmitEmptyInt64Ptr:
store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx)))
fallthrough
case opStructFieldHeadOmitEmptyInt64Ptr:
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, e.ptrToInt64(p))
b = encodeIndentComma(b)
}
code = code.next
}
case opStructFieldPtrHeadStringTagInt64Ptr:
store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx)))
fallthrough
case opStructFieldHeadStringTagInt64Ptr:
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, e.ptrToInt64(p+code.offset))
b = append(b, '"')
}
}
b = encodeIndentComma(b)
code = code.next
case opStructFieldPtrHeadInt64PtrOnly:
p := load(ctxptr, code.idx)
if p == 0 {
@ -2658,6 +2775,52 @@ func (e *Encoder) runIndent(ctx *encodeRuntimeContext, b []byte, code *opcode) (
}
b = encodeIndentComma(b)
code = code.next
case opStructFieldPtrHeadOmitEmptyInt64PtrOnly:
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 opStructFieldHeadOmitEmptyInt64PtrOnly:
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, e.ptrToInt64(p+code.offset))
b = encodeIndentComma(b)
}
code = code.next
case opStructFieldPtrHeadStringTagInt64PtrOnly:
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 opStructFieldHeadStringTagInt64PtrOnly:
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, e.ptrToInt64(p+code.offset))
b = append(b, '"')
}
b = encodeIndentComma(b)
code = code.next
case opStructFieldHeadInt64NPtr:
p := load(ctxptr, code.idx)
if p == 0 {
@ -2696,6 +2859,43 @@ func (e *Encoder) runIndent(ctx *encodeRuntimeContext, b []byte, code *opcode) (
b = encodeIndentComma(b)
code = code.next
}
case opStructFieldPtrAnonymousHeadOmitEmptyInt64:
store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx)))
fallthrough
case opStructFieldAnonymousHeadOmitEmptyInt64:
ptr := load(ctxptr, code.idx)
if ptr == 0 {
code = code.end.next
} else {
v := e.ptrToInt64(ptr + code.offset)
if v == 0 {
code = code.nextField
} else {
b = e.encodeIndent(b, code.indent)
b = append(b, code.key...)
b = append(b, ' ')
b = appendInt(b, v)
b = encodeIndentComma(b)
code = code.next
}
}
case opStructFieldPtrAnonymousHeadStringTagInt64:
store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx)))
fallthrough
case opStructFieldAnonymousHeadStringTagInt64:
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, e.ptrToInt64(ptr+code.offset))
b = append(b, '"')
b = encodeIndentComma(b)
code = code.next
}
case opStructFieldPtrAnonymousHeadInt64Only, opStructFieldAnonymousHeadInt64Only:
ptr := load(ctxptr, code.idx)
if ptr == 0 {
@ -2708,6 +2908,37 @@ func (e *Encoder) runIndent(ctx *encodeRuntimeContext, b []byte, code *opcode) (
b = encodeIndentComma(b)
code = code.next
}
case opStructFieldPtrAnonymousHeadOmitEmptyInt64Only, opStructFieldAnonymousHeadOmitEmptyInt64Only:
ptr := load(ctxptr, code.idx)
if ptr == 0 {
code = code.end.next
} else {
v := e.ptrToInt64(ptr + code.offset)
if v == 0 {
code = code.nextField
} else {
b = e.encodeIndent(b, code.indent)
b = append(b, code.key...)
b = append(b, ' ')
b = appendInt(b, v)
b = encodeIndentComma(b)
code = code.next
}
}
case opStructFieldPtrAnonymousHeadStringTagInt64Only, opStructFieldAnonymousHeadStringTagInt64Only:
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, e.ptrToInt64(ptr+code.offset))
b = append(b, '"')
b = encodeIndentComma(b)
code = code.next
}
case opStructFieldPtrAnonymousHeadInt64Ptr:
store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx)))
fallthrough
@ -2728,6 +2959,48 @@ func (e *Encoder) runIndent(ctx *encodeRuntimeContext, b []byte, code *opcode) (
}
b = encodeIndentComma(b)
code = code.next
case opStructFieldPtrAnonymousHeadOmitEmptyInt64Ptr:
store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx)))
fallthrough
case opStructFieldAnonymousHeadOmitEmptyInt64Ptr:
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, e.ptrToInt64(p))
b = encodeIndentComma(b)
code = code.next
}
case opStructFieldPtrAnonymousHeadStringTagInt64Ptr:
store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx)))
fallthrough
case opStructFieldAnonymousHeadStringTagInt64Ptr:
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, e.ptrToInt64(p+code.offset))
b = append(b, '"')
}
b = encodeIndentComma(b)
code = code.next
case opStructFieldPtrAnonymousHeadInt64PtrOnly:
p := load(ctxptr, code.idx)
if p == 0 {
@ -2748,6 +3021,48 @@ func (e *Encoder) runIndent(ctx *encodeRuntimeContext, b []byte, code *opcode) (
}
b = encodeIndentComma(b)
code = code.next
case opStructFieldPtrAnonymousHeadOmitEmptyInt64PtrOnly:
p := load(ctxptr, code.idx)
if p == 0 {
code = code.end.next
break
}
store(ctxptr, code.idx, e.ptrToPtr(p))
fallthrough
case opStructFieldAnonymousHeadOmitEmptyInt64PtrOnly:
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, e.ptrToInt64(p+code.offset))
b = encodeIndentComma(b)
code = code.next
}
case opStructFieldPtrAnonymousHeadStringTagInt64PtrOnly:
p := load(ctxptr, code.idx)
if p == 0 {
code = code.end.next
break
}
store(ctxptr, code.idx, e.ptrToPtr(p))
fallthrough
case opStructFieldAnonymousHeadStringTagInt64PtrOnly:
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, e.ptrToInt64(p+code.offset))
b = append(b, '"')
}
b = encodeIndentComma(b)
code = code.next
case opStructFieldPtrHeadUint:
store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx)))
fallthrough
@ -3992,34 +4307,6 @@ func (e *Encoder) runIndent(ctx *encodeRuntimeContext, b []byte, code *opcode) (
b = encodeIndentComma(b)
code = code.next
}
case opStructFieldPtrHeadOmitEmptyInt64:
ptr := load(ctxptr, code.idx)
if ptr != 0 {
store(ctxptr, code.idx, e.ptrToPtr(ptr))
}
fallthrough
case opStructFieldHeadOmitEmptyInt64:
ptr := load(ctxptr, code.idx)
if ptr == 0 {
b = e.encodeIndent(b, code.indent)
b = encodeNull(b)
b = encodeIndentComma(b)
code = code.end.next
} else {
b = e.encodeIndent(b, code.indent)
b = append(b, '{', '\n')
v := e.ptrToInt64(ptr + code.offset)
if v == 0 {
code = code.nextField
} else {
b = e.encodeIndent(b, code.indent+1)
b = append(b, code.key...)
b = append(b, ' ')
b = appendInt(b, v)
b = encodeIndentComma(b)
code = code.next
}
}
case opStructFieldPtrHeadOmitEmptyUint:
ptr := load(ctxptr, code.idx)
if ptr != 0 {
@ -4324,29 +4611,6 @@ func (e *Encoder) runIndent(ctx *encodeRuntimeContext, b []byte, code *opcode) (
code = code.next
store(ctxptr, code.idx, p)
}
case opStructFieldPtrHeadStringTagInt64:
ptr := load(ctxptr, code.idx)
if ptr != 0 {
store(ctxptr, code.idx, e.ptrToPtr(ptr))
}
fallthrough
case opStructFieldHeadStringTagInt64:
ptr := load(ctxptr, code.idx)
if ptr == 0 {
b = e.encodeIndent(b, code.indent)
b = encodeNull(b)
b = encodeIndentComma(b)
code = code.end.next
} else {
b = append(b, '{', '\n')
b = e.encodeIndent(b, code.indent+1)
b = append(b, code.key...)
b = append(b, ' ', '"')
b = appendInt(b, e.ptrToInt64(ptr+code.offset))
b = append(b, '"')
b = encodeIndentComma(b)
code = code.next
}
case opStructFieldPtrHeadStringTagUint:
ptr := load(ctxptr, code.idx)
if ptr != 0 {
@ -5617,15 +5881,6 @@ func (e *Encoder) runIndent(ctx *encodeRuntimeContext, b []byte, code *opcode) (
b = appendInt(b, e.ptrToInt64(ptr+code.offset))
b = e.appendStructEndIndent(b, code.indent-1)
code = code.next
case opStructEndStringTagInt64:
ptr := load(ctxptr, code.headIdx)
b = e.encodeIndent(b, code.indent)
b = append(b, code.key...)
b = append(b, ' ', '"')
b = appendInt(b, e.ptrToInt64(ptr+code.offset))
b = append(b, '"')
b = e.appendStructEndIndent(b, code.indent-1)
code = code.next
case opStructEndOmitEmptyInt64:
ptr := load(ctxptr, code.headIdx)
v := e.ptrToInt64(ptr + code.offset)
@ -5634,7 +5889,25 @@ func (e *Encoder) runIndent(ctx *encodeRuntimeContext, b []byte, code *opcode) (
b = append(b, code.key...)
b = append(b, ' ')
b = appendInt(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)
}
code = code.next
case opStructEndStringTagInt64:
ptr := load(ctxptr, code.headIdx)
b = e.encodeIndent(b, code.indent)
b = append(b, code.key...)
b = append(b, ' ', '"')
b = appendInt(b, e.ptrToInt64(ptr+code.offset))
b = append(b, '"')
b = e.appendStructEndIndent(b, code.indent-1)
code = code.next
case opStructEndInt64Ptr:
@ -5650,6 +5923,41 @@ func (e *Encoder) runIndent(ctx *encodeRuntimeContext, b []byte, code *opcode) (
}
b = e.appendStructEndIndent(b, code.indent-1)
code = code.next
case opStructEndOmitEmptyInt64Ptr:
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, e.ptrToInt64(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 opStructEndStringTagInt64Ptr:
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, e.ptrToInt64(p))
b = append(b, '"')
}
b = e.appendStructEndIndent(b, code.indent-1)
code = code.next
case opStructEndUint:
b = e.encodeIndent(b, code.indent)
b = append(b, code.key...)