mirror of https://github.com/goccy/go-json.git
Add test cases for int16 type
This commit is contained in:
parent
87882a9111
commit
a5c43958f9
1948
cover_int16_test.go
1948
cover_int16_test.go
File diff suppressed because it is too large
Load Diff
|
@ -1521,6 +1521,51 @@ func (e *Encoder) runEscaped(ctx *encodeRuntimeContext, b []byte, code *opcode)
|
|||
b = encodeComma(b)
|
||||
code = code.next
|
||||
}
|
||||
case opStructFieldPtrHeadOmitEmptyInt16:
|
||||
ptr := load(ctxptr, code.idx)
|
||||
if ptr != 0 {
|
||||
store(ctxptr, code.idx, e.ptrToPtr(ptr))
|
||||
}
|
||||
fallthrough
|
||||
case opStructFieldHeadOmitEmptyInt16:
|
||||
ptr := load(ctxptr, code.idx)
|
||||
if ptr == 0 {
|
||||
b = encodeNull(b)
|
||||
b = encodeComma(b)
|
||||
code = code.end.next
|
||||
} else {
|
||||
b = append(b, '{')
|
||||
v := e.ptrToInt16(ptr + code.offset)
|
||||
if v == 0 {
|
||||
code = code.nextField
|
||||
} else {
|
||||
b = append(b, code.escapedKey...)
|
||||
b = appendInt(b, int64(v))
|
||||
b = encodeComma(b)
|
||||
code = code.next
|
||||
}
|
||||
}
|
||||
case opStructFieldPtrHeadStringTagInt16:
|
||||
ptr := load(ctxptr, code.idx)
|
||||
if ptr != 0 {
|
||||
store(ctxptr, code.idx, e.ptrToPtr(ptr))
|
||||
}
|
||||
fallthrough
|
||||
case opStructFieldHeadStringTagInt16:
|
||||
ptr := load(ctxptr, code.idx)
|
||||
if ptr == 0 {
|
||||
b = encodeNull(b)
|
||||
b = encodeComma(b)
|
||||
code = code.end.next
|
||||
} else {
|
||||
b = append(b, '{')
|
||||
b = append(b, code.escapedKey...)
|
||||
b = append(b, '"')
|
||||
b = appendInt(b, int64(e.ptrToInt16(ptr+code.offset)))
|
||||
b = append(b, '"')
|
||||
b = encodeComma(b)
|
||||
code = code.next
|
||||
}
|
||||
case opStructFieldPtrHeadInt16Only, opStructFieldHeadInt16Only:
|
||||
p := load(ctxptr, code.idx)
|
||||
b = append(b, '{')
|
||||
|
@ -1528,6 +1573,25 @@ func (e *Encoder) runEscaped(ctx *encodeRuntimeContext, b []byte, code *opcode)
|
|||
b = appendInt(b, int64(e.ptrToInt16(p)))
|
||||
b = encodeComma(b)
|
||||
code = code.next
|
||||
case opStructFieldPtrHeadOmitEmptyInt16Only, opStructFieldHeadOmitEmptyInt16Only:
|
||||
p := load(ctxptr, code.idx)
|
||||
b = append(b, '{')
|
||||
v := int64(e.ptrToInt16(p))
|
||||
if v != 0 {
|
||||
b = append(b, code.escapedKey...)
|
||||
b = appendInt(b, v)
|
||||
b = encodeComma(b)
|
||||
}
|
||||
code = code.next
|
||||
case opStructFieldPtrHeadStringTagInt16Only, opStructFieldHeadStringTagInt16Only:
|
||||
p := load(ctxptr, code.idx)
|
||||
b = append(b, '{')
|
||||
b = append(b, code.escapedKey...)
|
||||
b = append(b, '"')
|
||||
b = appendInt(b, int64(e.ptrToInt16(p)))
|
||||
b = append(b, '"')
|
||||
b = encodeComma(b)
|
||||
code = code.next
|
||||
case opStructFieldPtrHeadInt16Ptr:
|
||||
store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx)))
|
||||
fallthrough
|
||||
|
@ -1550,6 +1614,49 @@ func (e *Encoder) runEscaped(ctx *encodeRuntimeContext, b []byte, code *opcode)
|
|||
}
|
||||
b = encodeComma(b)
|
||||
code = code.next
|
||||
case opStructFieldPtrHeadOmitEmptyInt16Ptr:
|
||||
store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx)))
|
||||
fallthrough
|
||||
case opStructFieldHeadOmitEmptyInt16Ptr:
|
||||
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.ptrToInt16(p)))
|
||||
b = encodeComma(b)
|
||||
}
|
||||
code = code.next
|
||||
}
|
||||
case opStructFieldPtrHeadStringTagInt16Ptr:
|
||||
store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx)))
|
||||
fallthrough
|
||||
case opStructFieldHeadStringTagInt16Ptr:
|
||||
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.ptrToInt16(p+code.offset)))
|
||||
b = append(b, '"')
|
||||
}
|
||||
}
|
||||
b = encodeComma(b)
|
||||
code = code.next
|
||||
case opStructFieldPtrHeadInt16PtrOnly:
|
||||
p := load(ctxptr, code.idx)
|
||||
if p == 0 {
|
||||
|
@ -1571,6 +1678,69 @@ func (e *Encoder) runEscaped(ctx *encodeRuntimeContext, b []byte, code *opcode)
|
|||
}
|
||||
b = encodeComma(b)
|
||||
code = code.next
|
||||
case opStructFieldPtrHeadOmitEmptyInt16PtrOnly:
|
||||
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 opStructFieldHeadOmitEmptyInt16PtrOnly:
|
||||
b = append(b, '{')
|
||||
p := load(ctxptr, code.idx)
|
||||
if p != 0 {
|
||||
b = append(b, code.escapedKey...)
|
||||
b = appendInt(b, int64(e.ptrToInt16(p+code.offset)))
|
||||
b = encodeComma(b)
|
||||
}
|
||||
code = code.next
|
||||
case opStructFieldPtrHeadStringTagInt16PtrOnly:
|
||||
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 opStructFieldHeadStringTagInt16PtrOnly:
|
||||
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.ptrToInt16(p+code.offset)))
|
||||
b = append(b, '"')
|
||||
}
|
||||
b = encodeComma(b)
|
||||
code = code.next
|
||||
case opStructFieldHeadInt16NPtr:
|
||||
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.ptrToInt16(p+code.offset)))
|
||||
}
|
||||
}
|
||||
b = encodeComma(b)
|
||||
code = code.next
|
||||
case opStructFieldPtrAnonymousHeadInt16:
|
||||
store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx)))
|
||||
fallthrough
|
||||
|
@ -1584,6 +1754,45 @@ func (e *Encoder) runEscaped(ctx *encodeRuntimeContext, b []byte, code *opcode)
|
|||
b = encodeComma(b)
|
||||
code = code.next
|
||||
}
|
||||
case opStructFieldPtrAnonymousHeadOmitEmptyInt16:
|
||||
ptr := load(ctxptr, code.idx)
|
||||
if ptr != 0 {
|
||||
store(ctxptr, code.idx, e.ptrToPtr(ptr))
|
||||
}
|
||||
fallthrough
|
||||
case opStructFieldAnonymousHeadOmitEmptyInt16:
|
||||
ptr := load(ctxptr, code.idx)
|
||||
if ptr == 0 {
|
||||
code = code.end.next
|
||||
} else {
|
||||
v := e.ptrToInt16(ptr + code.offset)
|
||||
if v == 0 {
|
||||
code = code.nextField
|
||||
} else {
|
||||
b = append(b, code.escapedKey...)
|
||||
b = appendInt(b, int64(v))
|
||||
b = encodeComma(b)
|
||||
code = code.next
|
||||
}
|
||||
}
|
||||
case opStructFieldPtrAnonymousHeadStringTagInt16:
|
||||
ptr := load(ctxptr, code.idx)
|
||||
if ptr != 0 {
|
||||
store(ctxptr, code.idx, e.ptrToPtr(ptr))
|
||||
}
|
||||
fallthrough
|
||||
case opStructFieldAnonymousHeadStringTagInt16:
|
||||
ptr := load(ctxptr, code.idx)
|
||||
if ptr == 0 {
|
||||
code = code.end.next
|
||||
} else {
|
||||
b = append(b, code.escapedKey...)
|
||||
b = append(b, '"')
|
||||
b = appendInt(b, int64(e.ptrToInt16(ptr+code.offset)))
|
||||
b = append(b, '"')
|
||||
b = encodeComma(b)
|
||||
code = code.next
|
||||
}
|
||||
case opStructFieldPtrAnonymousHeadInt16Only, opStructFieldAnonymousHeadInt16Only:
|
||||
ptr := load(ctxptr, code.idx)
|
||||
if ptr == 0 {
|
||||
|
@ -1594,6 +1803,33 @@ func (e *Encoder) runEscaped(ctx *encodeRuntimeContext, b []byte, code *opcode)
|
|||
b = encodeComma(b)
|
||||
code = code.next
|
||||
}
|
||||
case opStructFieldPtrAnonymousHeadOmitEmptyInt16Only, opStructFieldAnonymousHeadOmitEmptyInt16Only:
|
||||
ptr := load(ctxptr, code.idx)
|
||||
if ptr == 0 {
|
||||
code = code.end.next
|
||||
} else {
|
||||
v := e.ptrToInt16(ptr + code.offset)
|
||||
if v == 0 {
|
||||
code = code.nextField
|
||||
} else {
|
||||
b = append(b, code.escapedKey...)
|
||||
b = appendInt(b, int64(v))
|
||||
b = encodeComma(b)
|
||||
code = code.next
|
||||
}
|
||||
}
|
||||
case opStructFieldPtrAnonymousHeadStringTagInt16Only, opStructFieldAnonymousHeadStringTagInt16Only:
|
||||
ptr := load(ctxptr, code.idx)
|
||||
if ptr == 0 {
|
||||
code = code.end.next
|
||||
} else {
|
||||
b = append(b, code.escapedKey...)
|
||||
b = append(b, '"')
|
||||
b = appendInt(b, int64(e.ptrToInt16(ptr+code.offset)))
|
||||
b = append(b, '"')
|
||||
b = encodeComma(b)
|
||||
code = code.next
|
||||
}
|
||||
case opStructFieldPtrAnonymousHeadInt16Ptr:
|
||||
store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx)))
|
||||
fallthrough
|
||||
|
@ -1612,6 +1848,44 @@ func (e *Encoder) runEscaped(ctx *encodeRuntimeContext, b []byte, code *opcode)
|
|||
}
|
||||
b = encodeComma(b)
|
||||
code = code.next
|
||||
case opStructFieldPtrAnonymousHeadOmitEmptyInt16Ptr:
|
||||
store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx)))
|
||||
fallthrough
|
||||
case opStructFieldAnonymousHeadOmitEmptyInt16Ptr:
|
||||
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.ptrToInt16(p)))
|
||||
b = encodeComma(b)
|
||||
code = code.next
|
||||
}
|
||||
case opStructFieldPtrAnonymousHeadStringTagInt16Ptr:
|
||||
store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx)))
|
||||
fallthrough
|
||||
case opStructFieldAnonymousHeadStringTagInt16Ptr:
|
||||
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.ptrToInt16(p+code.offset)))
|
||||
b = append(b, '"')
|
||||
}
|
||||
b = encodeComma(b)
|
||||
code = code.next
|
||||
case opStructFieldPtrAnonymousHeadInt16PtrOnly:
|
||||
p := load(ctxptr, code.idx)
|
||||
if p == 0 {
|
||||
|
@ -1630,6 +1904,44 @@ func (e *Encoder) runEscaped(ctx *encodeRuntimeContext, b []byte, code *opcode)
|
|||
}
|
||||
b = encodeComma(b)
|
||||
code = code.next
|
||||
case opStructFieldPtrAnonymousHeadOmitEmptyInt16PtrOnly:
|
||||
p := load(ctxptr, code.idx)
|
||||
if p == 0 {
|
||||
code = code.end.next
|
||||
break
|
||||
}
|
||||
store(ctxptr, code.idx, e.ptrToPtr(p))
|
||||
fallthrough
|
||||
case opStructFieldAnonymousHeadOmitEmptyInt16PtrOnly:
|
||||
p := load(ctxptr, code.idx)
|
||||
if p == 0 {
|
||||
code = code.nextField
|
||||
} else {
|
||||
b = append(b, code.escapedKey...)
|
||||
b = appendInt(b, int64(e.ptrToInt16(p+code.offset)))
|
||||
b = encodeComma(b)
|
||||
code = code.next
|
||||
}
|
||||
case opStructFieldPtrAnonymousHeadStringTagInt16PtrOnly:
|
||||
p := load(ctxptr, code.idx)
|
||||
if p == 0 {
|
||||
code = code.end.next
|
||||
break
|
||||
}
|
||||
store(ctxptr, code.idx, e.ptrToPtr(p))
|
||||
fallthrough
|
||||
case opStructFieldAnonymousHeadStringTagInt16PtrOnly:
|
||||
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.ptrToInt16(p+code.offset)))
|
||||
b = append(b, '"')
|
||||
}
|
||||
b = encodeComma(b)
|
||||
code = code.next
|
||||
case opStructFieldPtrHeadInt32:
|
||||
store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx)))
|
||||
fallthrough
|
||||
|
@ -3260,51 +3572,6 @@ func (e *Encoder) runEscaped(ctx *encodeRuntimeContext, b []byte, code *opcode)
|
|||
b = encodeComma(b)
|
||||
code = code.next
|
||||
}
|
||||
case opStructFieldPtrHeadOmitEmptyInt16:
|
||||
ptr := load(ctxptr, code.idx)
|
||||
if ptr != 0 {
|
||||
store(ctxptr, code.idx, e.ptrToPtr(ptr))
|
||||
}
|
||||
fallthrough
|
||||
case opStructFieldHeadOmitEmptyInt16:
|
||||
ptr := load(ctxptr, code.idx)
|
||||
if ptr == 0 {
|
||||
b = encodeNull(b)
|
||||
b = encodeComma(b)
|
||||
code = code.end.next
|
||||
} else {
|
||||
b = append(b, '{')
|
||||
v := e.ptrToInt16(ptr + code.offset)
|
||||
if v == 0 {
|
||||
code = code.nextField
|
||||
} else {
|
||||
b = append(b, code.escapedKey...)
|
||||
b = appendInt(b, int64(v))
|
||||
b = encodeComma(b)
|
||||
code = code.next
|
||||
}
|
||||
}
|
||||
case opStructFieldPtrAnonymousHeadOmitEmptyInt16:
|
||||
ptr := load(ctxptr, code.idx)
|
||||
if ptr != 0 {
|
||||
store(ctxptr, code.idx, e.ptrToPtr(ptr))
|
||||
}
|
||||
fallthrough
|
||||
case opStructFieldAnonymousHeadOmitEmptyInt16:
|
||||
ptr := load(ctxptr, code.idx)
|
||||
if ptr == 0 {
|
||||
code = code.end.next
|
||||
} else {
|
||||
v := e.ptrToInt16(ptr + code.offset)
|
||||
if v == 0 {
|
||||
code = code.nextField
|
||||
} else {
|
||||
b = append(b, code.escapedKey...)
|
||||
b = appendInt(b, int64(v))
|
||||
b = encodeComma(b)
|
||||
code = code.next
|
||||
}
|
||||
}
|
||||
case opStructFieldPtrHeadOmitEmptyInt32:
|
||||
ptr := load(ctxptr, code.idx)
|
||||
if ptr != 0 {
|
||||
|
@ -4043,45 +4310,6 @@ func (e *Encoder) runEscaped(ctx *encodeRuntimeContext, b []byte, code *opcode)
|
|||
code = code.next
|
||||
store(ctxptr, code.idx, ptr+code.offset)
|
||||
}
|
||||
case opStructFieldPtrHeadStringTagInt16:
|
||||
ptr := load(ctxptr, code.idx)
|
||||
if ptr != 0 {
|
||||
store(ctxptr, code.idx, e.ptrToPtr(ptr))
|
||||
}
|
||||
fallthrough
|
||||
case opStructFieldHeadStringTagInt16:
|
||||
ptr := load(ctxptr, code.idx)
|
||||
if ptr == 0 {
|
||||
b = encodeNull(b)
|
||||
b = encodeComma(b)
|
||||
code = code.end.next
|
||||
} else {
|
||||
b = append(b, '{')
|
||||
b = append(b, code.escapedKey...)
|
||||
b = append(b, '"')
|
||||
b = appendInt(b, int64(e.ptrToInt16(ptr+code.offset)))
|
||||
b = append(b, '"')
|
||||
b = encodeComma(b)
|
||||
code = code.next
|
||||
}
|
||||
case opStructFieldPtrAnonymousHeadStringTagInt16:
|
||||
ptr := load(ctxptr, code.idx)
|
||||
if ptr != 0 {
|
||||
store(ctxptr, code.idx, e.ptrToPtr(ptr))
|
||||
}
|
||||
fallthrough
|
||||
case opStructFieldAnonymousHeadStringTagInt16:
|
||||
ptr := load(ctxptr, code.idx)
|
||||
if ptr == 0 {
|
||||
code = code.end.next
|
||||
} else {
|
||||
b = append(b, code.escapedKey...)
|
||||
b = append(b, '"')
|
||||
b = appendInt(b, int64(e.ptrToInt16(ptr+code.offset)))
|
||||
b = append(b, '"')
|
||||
b = encodeComma(b)
|
||||
code = code.next
|
||||
}
|
||||
case opStructFieldPtrHeadStringTagInt32:
|
||||
ptr := load(ctxptr, code.idx)
|
||||
if ptr != 0 {
|
||||
|
@ -5660,6 +5888,45 @@ func (e *Encoder) runEscaped(ctx *encodeRuntimeContext, b []byte, code *opcode)
|
|||
}
|
||||
b = appendStructEnd(b)
|
||||
code = code.next
|
||||
case opStructEndOmitEmptyInt16Ptr:
|
||||
ptr := load(ctxptr, code.headIdx)
|
||||
p := e.ptrToPtr(ptr + code.offset)
|
||||
if p != 0 {
|
||||
b = append(b, code.escapedKey...)
|
||||
b = appendInt(b, int64(e.ptrToInt16(p)))
|
||||
}
|
||||
b = appendStructEnd(b)
|
||||
code = code.next
|
||||
case opStructEndStringTagInt16Ptr:
|
||||
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.ptrToInt16(p)))
|
||||
b = append(b, '"')
|
||||
}
|
||||
b = appendStructEnd(b)
|
||||
code = code.next
|
||||
case opStructEndInt16NPtr:
|
||||
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.ptrToInt16(p)))
|
||||
}
|
||||
b = appendStructEnd(b)
|
||||
code = code.next
|
||||
case opStructEndInt32:
|
||||
ptr := load(ctxptr, code.headIdx)
|
||||
b = append(b, code.escapedKey...)
|
||||
|
|
|
@ -1644,6 +1644,54 @@ func (e *Encoder) runEscapedIndent(ctx *encodeRuntimeContext, b []byte, code *op
|
|||
b = encodeIndentComma(b)
|
||||
code = code.next
|
||||
}
|
||||
case opStructFieldPtrHeadOmitEmptyInt16:
|
||||
ptr := load(ctxptr, code.idx)
|
||||
if ptr != 0 {
|
||||
store(ctxptr, code.idx, e.ptrToPtr(ptr))
|
||||
}
|
||||
fallthrough
|
||||
case opStructFieldHeadOmitEmptyInt16:
|
||||
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.ptrToInt16(ptr + code.offset)
|
||||
if v == 0 {
|
||||
code = code.nextField
|
||||
} else {
|
||||
b = e.encodeIndent(b, code.indent+1)
|
||||
b = append(b, code.escapedKey...)
|
||||
b = append(b, ' ')
|
||||
b = appendInt(b, int64(v))
|
||||
b = encodeIndentComma(b)
|
||||
code = code.next
|
||||
}
|
||||
}
|
||||
case opStructFieldPtrHeadStringTagInt16:
|
||||
ptr := load(ctxptr, code.idx)
|
||||
if ptr != 0 {
|
||||
store(ctxptr, code.idx, e.ptrToPtr(ptr))
|
||||
}
|
||||
fallthrough
|
||||
case opStructFieldHeadStringTagInt16:
|
||||
ptr := load(ctxptr, code.idx)
|
||||
if ptr == 0 {
|
||||
b = encodeNull(b)
|
||||
b = encodeIndentComma(b)
|
||||
code = code.end.next
|
||||
} else {
|
||||
b = append(b, '{', '\n')
|
||||
b = e.encodeIndent(b, code.indent+1)
|
||||
b = append(b, code.escapedKey...)
|
||||
b = append(b, ' ', '"')
|
||||
b = appendInt(b, int64(e.ptrToInt16(ptr+code.offset)))
|
||||
b = append(b, '"')
|
||||
b = encodeIndentComma(b)
|
||||
code = code.next
|
||||
}
|
||||
case opStructFieldPtrHeadInt16Only, opStructFieldHeadInt16Only:
|
||||
p := load(ctxptr, code.idx)
|
||||
b = append(b, '{', '\n')
|
||||
|
@ -1653,6 +1701,28 @@ func (e *Encoder) runEscapedIndent(ctx *encodeRuntimeContext, b []byte, code *op
|
|||
b = appendInt(b, int64(e.ptrToInt16(p)))
|
||||
b = encodeIndentComma(b)
|
||||
code = code.next
|
||||
case opStructFieldPtrHeadOmitEmptyInt16Only, opStructFieldHeadOmitEmptyInt16Only:
|
||||
p := load(ctxptr, code.idx)
|
||||
b = append(b, '{', '\n')
|
||||
v := int64(e.ptrToInt16(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 opStructFieldPtrHeadStringTagInt16Only, opStructFieldHeadStringTagInt16Only:
|
||||
p := load(ctxptr, code.idx)
|
||||
b = append(b, '{', '\n')
|
||||
b = e.encodeIndent(b, code.indent+1)
|
||||
b = append(b, code.escapedKey...)
|
||||
b = append(b, ' ', '"')
|
||||
b = appendInt(b, int64(e.ptrToInt16(p)))
|
||||
b = append(b, '"')
|
||||
b = encodeIndentComma(b)
|
||||
code = code.next
|
||||
case opStructFieldPtrHeadInt16Ptr:
|
||||
store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx)))
|
||||
fallthrough
|
||||
|
@ -1677,6 +1747,53 @@ func (e *Encoder) runEscapedIndent(ctx *encodeRuntimeContext, b []byte, code *op
|
|||
}
|
||||
b = encodeIndentComma(b)
|
||||
code = code.next
|
||||
case opStructFieldPtrHeadOmitEmptyInt16Ptr:
|
||||
store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx)))
|
||||
fallthrough
|
||||
case opStructFieldHeadOmitEmptyInt16Ptr:
|
||||
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.ptrToInt16(p)))
|
||||
b = encodeIndentComma(b)
|
||||
}
|
||||
code = code.next
|
||||
}
|
||||
case opStructFieldPtrHeadStringTagInt16Ptr:
|
||||
store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx)))
|
||||
fallthrough
|
||||
case opStructFieldHeadStringTagInt16Ptr:
|
||||
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.ptrToInt16(p+code.offset)))
|
||||
b = append(b, '"')
|
||||
}
|
||||
}
|
||||
b = encodeIndentComma(b)
|
||||
code = code.next
|
||||
case opStructFieldPtrHeadInt16PtrOnly:
|
||||
p := load(ctxptr, code.idx)
|
||||
if p == 0 {
|
||||
|
@ -1700,6 +1817,52 @@ func (e *Encoder) runEscapedIndent(ctx *encodeRuntimeContext, b []byte, code *op
|
|||
}
|
||||
b = encodeIndentComma(b)
|
||||
code = code.next
|
||||
case opStructFieldPtrHeadOmitEmptyInt16PtrOnly:
|
||||
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 opStructFieldHeadOmitEmptyInt16PtrOnly:
|
||||
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.ptrToInt16(p+code.offset)))
|
||||
b = encodeIndentComma(b)
|
||||
}
|
||||
code = code.next
|
||||
case opStructFieldPtrHeadStringTagInt16PtrOnly:
|
||||
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 opStructFieldHeadStringTagInt16PtrOnly:
|
||||
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.ptrToInt16(p+code.offset)))
|
||||
b = append(b, '"')
|
||||
}
|
||||
b = encodeIndentComma(b)
|
||||
code = code.next
|
||||
case opStructFieldHeadInt16NPtr:
|
||||
p := load(ctxptr, code.idx)
|
||||
if p == 0 {
|
||||
|
@ -1738,6 +1901,43 @@ func (e *Encoder) runEscapedIndent(ctx *encodeRuntimeContext, b []byte, code *op
|
|||
b = encodeIndentComma(b)
|
||||
code = code.next
|
||||
}
|
||||
case opStructFieldPtrAnonymousHeadOmitEmptyInt16:
|
||||
store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx)))
|
||||
fallthrough
|
||||
case opStructFieldAnonymousHeadOmitEmptyInt16:
|
||||
ptr := load(ctxptr, code.idx)
|
||||
if ptr == 0 {
|
||||
code = code.end.next
|
||||
} else {
|
||||
v := e.ptrToInt16(ptr + code.offset)
|
||||
if v == 0 {
|
||||
code = code.nextField
|
||||
} else {
|
||||
b = 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 opStructFieldPtrAnonymousHeadStringTagInt16:
|
||||
store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx)))
|
||||
fallthrough
|
||||
case opStructFieldAnonymousHeadStringTagInt16:
|
||||
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.ptrToInt16(ptr+code.offset)))
|
||||
b = append(b, '"')
|
||||
b = encodeIndentComma(b)
|
||||
code = code.next
|
||||
}
|
||||
case opStructFieldPtrAnonymousHeadInt16Only, opStructFieldAnonymousHeadInt16Only:
|
||||
ptr := load(ctxptr, code.idx)
|
||||
if ptr == 0 {
|
||||
|
@ -1750,6 +1950,37 @@ func (e *Encoder) runEscapedIndent(ctx *encodeRuntimeContext, b []byte, code *op
|
|||
b = encodeIndentComma(b)
|
||||
code = code.next
|
||||
}
|
||||
case opStructFieldPtrAnonymousHeadOmitEmptyInt16Only, opStructFieldAnonymousHeadOmitEmptyInt16Only:
|
||||
ptr := load(ctxptr, code.idx)
|
||||
if ptr == 0 {
|
||||
code = code.end.next
|
||||
} else {
|
||||
v := e.ptrToInt16(ptr + code.offset)
|
||||
if v == 0 {
|
||||
code = code.nextField
|
||||
} else {
|
||||
b = 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 opStructFieldPtrAnonymousHeadStringTagInt16Only, opStructFieldAnonymousHeadStringTagInt16Only:
|
||||
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.ptrToInt16(ptr+code.offset)))
|
||||
b = append(b, '"')
|
||||
b = encodeIndentComma(b)
|
||||
code = code.next
|
||||
}
|
||||
case opStructFieldPtrAnonymousHeadInt16Ptr:
|
||||
store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx)))
|
||||
fallthrough
|
||||
|
@ -1770,6 +2001,48 @@ func (e *Encoder) runEscapedIndent(ctx *encodeRuntimeContext, b []byte, code *op
|
|||
}
|
||||
b = encodeIndentComma(b)
|
||||
code = code.next
|
||||
case opStructFieldPtrAnonymousHeadOmitEmptyInt16Ptr:
|
||||
store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx)))
|
||||
fallthrough
|
||||
case opStructFieldAnonymousHeadOmitEmptyInt16Ptr:
|
||||
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.ptrToInt16(p)))
|
||||
b = encodeIndentComma(b)
|
||||
code = code.next
|
||||
}
|
||||
case opStructFieldPtrAnonymousHeadStringTagInt16Ptr:
|
||||
store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx)))
|
||||
fallthrough
|
||||
case opStructFieldAnonymousHeadStringTagInt16Ptr:
|
||||
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.ptrToInt16(p+code.offset)))
|
||||
b = append(b, '"')
|
||||
}
|
||||
b = encodeIndentComma(b)
|
||||
code = code.next
|
||||
case opStructFieldPtrAnonymousHeadInt16PtrOnly:
|
||||
p := load(ctxptr, code.idx)
|
||||
if p == 0 {
|
||||
|
@ -1790,6 +2063,48 @@ func (e *Encoder) runEscapedIndent(ctx *encodeRuntimeContext, b []byte, code *op
|
|||
}
|
||||
b = encodeIndentComma(b)
|
||||
code = code.next
|
||||
case opStructFieldPtrAnonymousHeadOmitEmptyInt16PtrOnly:
|
||||
p := load(ctxptr, code.idx)
|
||||
if p == 0 {
|
||||
code = code.end.next
|
||||
break
|
||||
}
|
||||
store(ctxptr, code.idx, e.ptrToPtr(p))
|
||||
fallthrough
|
||||
case opStructFieldAnonymousHeadOmitEmptyInt16PtrOnly:
|
||||
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.ptrToInt16(p+code.offset)))
|
||||
b = encodeIndentComma(b)
|
||||
code = code.next
|
||||
}
|
||||
case opStructFieldPtrAnonymousHeadStringTagInt16PtrOnly:
|
||||
p := load(ctxptr, code.idx)
|
||||
if p == 0 {
|
||||
code = code.end.next
|
||||
break
|
||||
}
|
||||
store(ctxptr, code.idx, e.ptrToPtr(p))
|
||||
fallthrough
|
||||
case opStructFieldAnonymousHeadStringTagInt16PtrOnly:
|
||||
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.ptrToInt16(p+code.offset)))
|
||||
b = append(b, '"')
|
||||
}
|
||||
b = encodeIndentComma(b)
|
||||
code = code.next
|
||||
case opStructFieldPtrHeadInt32:
|
||||
store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx)))
|
||||
fallthrough
|
||||
|
@ -3362,34 +3677,6 @@ func (e *Encoder) runEscapedIndent(ctx *encodeRuntimeContext, b []byte, code *op
|
|||
b = encodeIndentComma(b)
|
||||
code = code.next
|
||||
}
|
||||
case opStructFieldPtrHeadOmitEmptyInt16:
|
||||
ptr := load(ctxptr, code.idx)
|
||||
if ptr != 0 {
|
||||
store(ctxptr, code.idx, e.ptrToPtr(ptr))
|
||||
}
|
||||
fallthrough
|
||||
case opStructFieldHeadOmitEmptyInt16:
|
||||
ptr := load(ctxptr, code.idx)
|
||||
if ptr == 0 {
|
||||
b = e.encodeIndent(b, code.indent)
|
||||
b = encodeNull(b)
|
||||
b = encodeIndentComma(b)
|
||||
code = code.end.next
|
||||
} else {
|
||||
b = e.encodeIndent(b, code.indent)
|
||||
b = append(b, '{', '\n')
|
||||
v := e.ptrToInt16(ptr + code.offset)
|
||||
if v == 0 {
|
||||
code = code.nextField
|
||||
} else {
|
||||
b = e.encodeIndent(b, code.indent+1)
|
||||
b = append(b, code.escapedKey...)
|
||||
b = append(b, ' ')
|
||||
b = appendInt(b, int64(v))
|
||||
b = encodeIndentComma(b)
|
||||
code = code.next
|
||||
}
|
||||
}
|
||||
case opStructFieldPtrHeadOmitEmptyInt32:
|
||||
ptr := load(ctxptr, code.idx)
|
||||
if ptr != 0 {
|
||||
|
@ -3750,29 +4037,6 @@ func (e *Encoder) runEscapedIndent(ctx *encodeRuntimeContext, b []byte, code *op
|
|||
code = code.next
|
||||
store(ctxptr, code.idx, p)
|
||||
}
|
||||
case opStructFieldPtrHeadStringTagInt16:
|
||||
ptr := load(ctxptr, code.idx)
|
||||
if ptr != 0 {
|
||||
store(ctxptr, code.idx, e.ptrToPtr(ptr))
|
||||
}
|
||||
fallthrough
|
||||
case opStructFieldHeadStringTagInt16:
|
||||
ptr := load(ctxptr, code.idx)
|
||||
if ptr == 0 {
|
||||
b = e.encodeIndent(b, code.indent)
|
||||
b = encodeNull(b)
|
||||
b = encodeIndentComma(b)
|
||||
code = code.end.next
|
||||
} else {
|
||||
b = append(b, '{', '\n')
|
||||
b = e.encodeIndent(b, code.indent+1)
|
||||
b = append(b, code.escapedKey...)
|
||||
b = append(b, ' ', '"')
|
||||
b = appendInt(b, int64(e.ptrToInt16(ptr+code.offset)))
|
||||
b = append(b, '"')
|
||||
b = encodeIndentComma(b)
|
||||
code = code.next
|
||||
}
|
||||
case opStructFieldPtrHeadStringTagInt32:
|
||||
ptr := load(ctxptr, code.idx)
|
||||
if ptr != 0 {
|
||||
|
@ -4927,8 +5191,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 opStructEndStringTagInt16:
|
||||
ptr := load(ctxptr, code.headIdx)
|
||||
|
@ -4952,6 +5225,41 @@ func (e *Encoder) runEscapedIndent(ctx *encodeRuntimeContext, b []byte, code *op
|
|||
}
|
||||
b = e.appendStructEndIndent(b, code.indent-1)
|
||||
code = code.next
|
||||
case opStructEndOmitEmptyInt16Ptr:
|
||||
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.ptrToInt16(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 opStructEndStringTagInt16Ptr:
|
||||
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.ptrToInt16(p)))
|
||||
b = append(b, '"')
|
||||
}
|
||||
b = e.appendStructEndIndent(b, code.indent-1)
|
||||
code = code.next
|
||||
case opStructEndInt32:
|
||||
b = e.encodeIndent(b, code.indent)
|
||||
b = append(b, code.escapedKey...)
|
||||
|
|
|
@ -1644,6 +1644,54 @@ func (e *Encoder) runIndent(ctx *encodeRuntimeContext, b []byte, code *opcode) (
|
|||
b = encodeIndentComma(b)
|
||||
code = code.next
|
||||
}
|
||||
case opStructFieldPtrHeadOmitEmptyInt16:
|
||||
ptr := load(ctxptr, code.idx)
|
||||
if ptr != 0 {
|
||||
store(ctxptr, code.idx, e.ptrToPtr(ptr))
|
||||
}
|
||||
fallthrough
|
||||
case opStructFieldHeadOmitEmptyInt16:
|
||||
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.ptrToInt16(ptr + code.offset)
|
||||
if v == 0 {
|
||||
code = code.nextField
|
||||
} else {
|
||||
b = e.encodeIndent(b, code.indent+1)
|
||||
b = append(b, code.key...)
|
||||
b = append(b, ' ')
|
||||
b = appendInt(b, int64(v))
|
||||
b = encodeIndentComma(b)
|
||||
code = code.next
|
||||
}
|
||||
}
|
||||
case opStructFieldPtrHeadStringTagInt16:
|
||||
ptr := load(ctxptr, code.idx)
|
||||
if ptr != 0 {
|
||||
store(ctxptr, code.idx, e.ptrToPtr(ptr))
|
||||
}
|
||||
fallthrough
|
||||
case opStructFieldHeadStringTagInt16:
|
||||
ptr := load(ctxptr, code.idx)
|
||||
if ptr == 0 {
|
||||
b = encodeNull(b)
|
||||
b = encodeIndentComma(b)
|
||||
code = code.end.next
|
||||
} else {
|
||||
b = append(b, '{', '\n')
|
||||
b = e.encodeIndent(b, code.indent+1)
|
||||
b = append(b, code.key...)
|
||||
b = append(b, ' ', '"')
|
||||
b = appendInt(b, int64(e.ptrToInt16(ptr+code.offset)))
|
||||
b = append(b, '"')
|
||||
b = encodeIndentComma(b)
|
||||
code = code.next
|
||||
}
|
||||
case opStructFieldPtrHeadInt16Only, opStructFieldHeadInt16Only:
|
||||
p := load(ctxptr, code.idx)
|
||||
b = append(b, '{', '\n')
|
||||
|
@ -1653,6 +1701,28 @@ func (e *Encoder) runIndent(ctx *encodeRuntimeContext, b []byte, code *opcode) (
|
|||
b = appendInt(b, int64(e.ptrToInt16(p)))
|
||||
b = encodeIndentComma(b)
|
||||
code = code.next
|
||||
case opStructFieldPtrHeadOmitEmptyInt16Only, opStructFieldHeadOmitEmptyInt16Only:
|
||||
p := load(ctxptr, code.idx)
|
||||
b = append(b, '{', '\n')
|
||||
v := int64(e.ptrToInt16(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 opStructFieldPtrHeadStringTagInt16Only, opStructFieldHeadStringTagInt16Only:
|
||||
p := load(ctxptr, code.idx)
|
||||
b = append(b, '{', '\n')
|
||||
b = e.encodeIndent(b, code.indent+1)
|
||||
b = append(b, code.key...)
|
||||
b = append(b, ' ', '"')
|
||||
b = appendInt(b, int64(e.ptrToInt16(p)))
|
||||
b = append(b, '"')
|
||||
b = encodeIndentComma(b)
|
||||
code = code.next
|
||||
case opStructFieldPtrHeadInt16Ptr:
|
||||
store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx)))
|
||||
fallthrough
|
||||
|
@ -1677,6 +1747,53 @@ func (e *Encoder) runIndent(ctx *encodeRuntimeContext, b []byte, code *opcode) (
|
|||
}
|
||||
b = encodeIndentComma(b)
|
||||
code = code.next
|
||||
case opStructFieldPtrHeadOmitEmptyInt16Ptr:
|
||||
store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx)))
|
||||
fallthrough
|
||||
case opStructFieldHeadOmitEmptyInt16Ptr:
|
||||
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.ptrToInt16(p)))
|
||||
b = encodeIndentComma(b)
|
||||
}
|
||||
code = code.next
|
||||
}
|
||||
case opStructFieldPtrHeadStringTagInt16Ptr:
|
||||
store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx)))
|
||||
fallthrough
|
||||
case opStructFieldHeadStringTagInt16Ptr:
|
||||
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.ptrToInt16(p+code.offset)))
|
||||
b = append(b, '"')
|
||||
}
|
||||
}
|
||||
b = encodeIndentComma(b)
|
||||
code = code.next
|
||||
case opStructFieldPtrHeadInt16PtrOnly:
|
||||
p := load(ctxptr, code.idx)
|
||||
if p == 0 {
|
||||
|
@ -1700,6 +1817,52 @@ func (e *Encoder) runIndent(ctx *encodeRuntimeContext, b []byte, code *opcode) (
|
|||
}
|
||||
b = encodeIndentComma(b)
|
||||
code = code.next
|
||||
case opStructFieldPtrHeadOmitEmptyInt16PtrOnly:
|
||||
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 opStructFieldHeadOmitEmptyInt16PtrOnly:
|
||||
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.ptrToInt16(p+code.offset)))
|
||||
b = encodeIndentComma(b)
|
||||
}
|
||||
code = code.next
|
||||
case opStructFieldPtrHeadStringTagInt16PtrOnly:
|
||||
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 opStructFieldHeadStringTagInt16PtrOnly:
|
||||
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.ptrToInt16(p+code.offset)))
|
||||
b = append(b, '"')
|
||||
}
|
||||
b = encodeIndentComma(b)
|
||||
code = code.next
|
||||
case opStructFieldHeadInt16NPtr:
|
||||
p := load(ctxptr, code.idx)
|
||||
if p == 0 {
|
||||
|
@ -1738,6 +1901,43 @@ func (e *Encoder) runIndent(ctx *encodeRuntimeContext, b []byte, code *opcode) (
|
|||
b = encodeIndentComma(b)
|
||||
code = code.next
|
||||
}
|
||||
case opStructFieldPtrAnonymousHeadOmitEmptyInt16:
|
||||
store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx)))
|
||||
fallthrough
|
||||
case opStructFieldAnonymousHeadOmitEmptyInt16:
|
||||
ptr := load(ctxptr, code.idx)
|
||||
if ptr == 0 {
|
||||
code = code.end.next
|
||||
} else {
|
||||
v := e.ptrToInt16(ptr + code.offset)
|
||||
if v == 0 {
|
||||
code = code.nextField
|
||||
} else {
|
||||
b = 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 opStructFieldPtrAnonymousHeadStringTagInt16:
|
||||
store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx)))
|
||||
fallthrough
|
||||
case opStructFieldAnonymousHeadStringTagInt16:
|
||||
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.ptrToInt16(ptr+code.offset)))
|
||||
b = append(b, '"')
|
||||
b = encodeIndentComma(b)
|
||||
code = code.next
|
||||
}
|
||||
case opStructFieldPtrAnonymousHeadInt16Only, opStructFieldAnonymousHeadInt16Only:
|
||||
ptr := load(ctxptr, code.idx)
|
||||
if ptr == 0 {
|
||||
|
@ -1750,6 +1950,37 @@ func (e *Encoder) runIndent(ctx *encodeRuntimeContext, b []byte, code *opcode) (
|
|||
b = encodeIndentComma(b)
|
||||
code = code.next
|
||||
}
|
||||
case opStructFieldPtrAnonymousHeadOmitEmptyInt16Only, opStructFieldAnonymousHeadOmitEmptyInt16Only:
|
||||
ptr := load(ctxptr, code.idx)
|
||||
if ptr == 0 {
|
||||
code = code.end.next
|
||||
} else {
|
||||
v := e.ptrToInt16(ptr + code.offset)
|
||||
if v == 0 {
|
||||
code = code.nextField
|
||||
} else {
|
||||
b = 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 opStructFieldPtrAnonymousHeadStringTagInt16Only, opStructFieldAnonymousHeadStringTagInt16Only:
|
||||
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.ptrToInt16(ptr+code.offset)))
|
||||
b = append(b, '"')
|
||||
b = encodeIndentComma(b)
|
||||
code = code.next
|
||||
}
|
||||
case opStructFieldPtrAnonymousHeadInt16Ptr:
|
||||
store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx)))
|
||||
fallthrough
|
||||
|
@ -1770,6 +2001,48 @@ func (e *Encoder) runIndent(ctx *encodeRuntimeContext, b []byte, code *opcode) (
|
|||
}
|
||||
b = encodeIndentComma(b)
|
||||
code = code.next
|
||||
case opStructFieldPtrAnonymousHeadOmitEmptyInt16Ptr:
|
||||
store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx)))
|
||||
fallthrough
|
||||
case opStructFieldAnonymousHeadOmitEmptyInt16Ptr:
|
||||
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.ptrToInt16(p)))
|
||||
b = encodeIndentComma(b)
|
||||
code = code.next
|
||||
}
|
||||
case opStructFieldPtrAnonymousHeadStringTagInt16Ptr:
|
||||
store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx)))
|
||||
fallthrough
|
||||
case opStructFieldAnonymousHeadStringTagInt16Ptr:
|
||||
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.ptrToInt16(p+code.offset)))
|
||||
b = append(b, '"')
|
||||
}
|
||||
b = encodeIndentComma(b)
|
||||
code = code.next
|
||||
case opStructFieldPtrAnonymousHeadInt16PtrOnly:
|
||||
p := load(ctxptr, code.idx)
|
||||
if p == 0 {
|
||||
|
@ -1790,6 +2063,48 @@ func (e *Encoder) runIndent(ctx *encodeRuntimeContext, b []byte, code *opcode) (
|
|||
}
|
||||
b = encodeIndentComma(b)
|
||||
code = code.next
|
||||
case opStructFieldPtrAnonymousHeadOmitEmptyInt16PtrOnly:
|
||||
p := load(ctxptr, code.idx)
|
||||
if p == 0 {
|
||||
code = code.end.next
|
||||
break
|
||||
}
|
||||
store(ctxptr, code.idx, e.ptrToPtr(p))
|
||||
fallthrough
|
||||
case opStructFieldAnonymousHeadOmitEmptyInt16PtrOnly:
|
||||
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.ptrToInt16(p+code.offset)))
|
||||
b = encodeIndentComma(b)
|
||||
code = code.next
|
||||
}
|
||||
case opStructFieldPtrAnonymousHeadStringTagInt16PtrOnly:
|
||||
p := load(ctxptr, code.idx)
|
||||
if p == 0 {
|
||||
code = code.end.next
|
||||
break
|
||||
}
|
||||
store(ctxptr, code.idx, e.ptrToPtr(p))
|
||||
fallthrough
|
||||
case opStructFieldAnonymousHeadStringTagInt16PtrOnly:
|
||||
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.ptrToInt16(p+code.offset)))
|
||||
b = append(b, '"')
|
||||
}
|
||||
b = encodeIndentComma(b)
|
||||
code = code.next
|
||||
case opStructFieldPtrHeadInt32:
|
||||
store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx)))
|
||||
fallthrough
|
||||
|
@ -3362,34 +3677,6 @@ func (e *Encoder) runIndent(ctx *encodeRuntimeContext, b []byte, code *opcode) (
|
|||
b = encodeIndentComma(b)
|
||||
code = code.next
|
||||
}
|
||||
case opStructFieldPtrHeadOmitEmptyInt16:
|
||||
ptr := load(ctxptr, code.idx)
|
||||
if ptr != 0 {
|
||||
store(ctxptr, code.idx, e.ptrToPtr(ptr))
|
||||
}
|
||||
fallthrough
|
||||
case opStructFieldHeadOmitEmptyInt16:
|
||||
ptr := load(ctxptr, code.idx)
|
||||
if ptr == 0 {
|
||||
b = e.encodeIndent(b, code.indent)
|
||||
b = encodeNull(b)
|
||||
b = encodeIndentComma(b)
|
||||
code = code.end.next
|
||||
} else {
|
||||
b = e.encodeIndent(b, code.indent)
|
||||
b = append(b, '{', '\n')
|
||||
v := e.ptrToInt16(ptr + code.offset)
|
||||
if v == 0 {
|
||||
code = code.nextField
|
||||
} else {
|
||||
b = e.encodeIndent(b, code.indent+1)
|
||||
b = append(b, code.key...)
|
||||
b = append(b, ' ')
|
||||
b = appendInt(b, int64(v))
|
||||
b = encodeIndentComma(b)
|
||||
code = code.next
|
||||
}
|
||||
}
|
||||
case opStructFieldPtrHeadOmitEmptyInt32:
|
||||
ptr := load(ctxptr, code.idx)
|
||||
if ptr != 0 {
|
||||
|
@ -3750,29 +4037,6 @@ func (e *Encoder) runIndent(ctx *encodeRuntimeContext, b []byte, code *opcode) (
|
|||
code = code.next
|
||||
store(ctxptr, code.idx, p)
|
||||
}
|
||||
case opStructFieldPtrHeadStringTagInt16:
|
||||
ptr := load(ctxptr, code.idx)
|
||||
if ptr != 0 {
|
||||
store(ctxptr, code.idx, e.ptrToPtr(ptr))
|
||||
}
|
||||
fallthrough
|
||||
case opStructFieldHeadStringTagInt16:
|
||||
ptr := load(ctxptr, code.idx)
|
||||
if ptr == 0 {
|
||||
b = e.encodeIndent(b, code.indent)
|
||||
b = encodeNull(b)
|
||||
b = encodeIndentComma(b)
|
||||
code = code.end.next
|
||||
} else {
|
||||
b = append(b, '{', '\n')
|
||||
b = e.encodeIndent(b, code.indent+1)
|
||||
b = append(b, code.key...)
|
||||
b = append(b, ' ', '"')
|
||||
b = appendInt(b, int64(e.ptrToInt16(ptr+code.offset)))
|
||||
b = append(b, '"')
|
||||
b = encodeIndentComma(b)
|
||||
code = code.next
|
||||
}
|
||||
case opStructFieldPtrHeadStringTagInt32:
|
||||
ptr := load(ctxptr, code.idx)
|
||||
if ptr != 0 {
|
||||
|
@ -4927,8 +5191,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 opStructEndStringTagInt16:
|
||||
ptr := load(ctxptr, code.headIdx)
|
||||
|
@ -4952,6 +5225,41 @@ func (e *Encoder) runIndent(ctx *encodeRuntimeContext, b []byte, code *opcode) (
|
|||
}
|
||||
b = e.appendStructEndIndent(b, code.indent-1)
|
||||
code = code.next
|
||||
case opStructEndOmitEmptyInt16Ptr:
|
||||
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.ptrToInt16(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 opStructEndStringTagInt16Ptr:
|
||||
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.ptrToInt16(p)))
|
||||
b = append(b, '"')
|
||||
}
|
||||
b = e.appendStructEndIndent(b, code.indent-1)
|
||||
code = code.next
|
||||
case opStructEndInt32:
|
||||
b = e.encodeIndent(b, code.indent)
|
||||
b = append(b, code.key...)
|
||||
|
|
Loading…
Reference in New Issue