forked from mirror/go-json
Fix test
This commit is contained in:
parent
f57beb9841
commit
b78ca46c15
|
@ -488,7 +488,7 @@ func encodeRun(ctx *encodeRuntimeContext, b []byte, codeSet *opcodeSet, opt Enco
|
|||
fallthrough
|
||||
case opStructFieldHead:
|
||||
p := load(ctxptr, code.idx)
|
||||
if p == 0 && code.indirect {
|
||||
if p == 0 && (code.indirect || code.next.op == opStructEnd) {
|
||||
if !code.anonymousHead {
|
||||
b = encodeNull(b)
|
||||
b = encodeComma(b)
|
||||
|
@ -519,7 +519,7 @@ func encodeRun(ctx *encodeRuntimeContext, b []byte, codeSet *opcodeSet, opt Enco
|
|||
fallthrough
|
||||
case opStructFieldHeadOmitEmpty:
|
||||
p := load(ctxptr, code.idx)
|
||||
if p == 0 && code.indirect {
|
||||
if p == 0 && (code.indirect || code.next.op == opStructEnd) {
|
||||
if !code.anonymousHead {
|
||||
b = encodeNull(b)
|
||||
b = encodeComma(b)
|
||||
|
@ -552,7 +552,7 @@ func encodeRun(ctx *encodeRuntimeContext, b []byte, codeSet *opcodeSet, opt Enco
|
|||
fallthrough
|
||||
case opStructFieldHeadStringTag:
|
||||
p := load(ctxptr, code.idx)
|
||||
if p == 0 && code.indirect {
|
||||
if p == 0 && (code.indirect || code.next.op == opStructEnd) {
|
||||
if !code.anonymousHead {
|
||||
b = encodeNull(b)
|
||||
b = encodeComma(b)
|
||||
|
@ -3477,7 +3477,7 @@ func encodeRun(ctx *encodeRuntimeContext, b []byte, codeSet *opcodeSet, opt Enco
|
|||
case opStructFieldOmitEmptyMap:
|
||||
p := load(ctxptr, code.headIdx)
|
||||
p = ptrToPtr(p + code.offset)
|
||||
if p == 0 {
|
||||
if p == 0 || maplen(ptrToUnsafePtr(p)) == 0 {
|
||||
code = code.nextField
|
||||
} else {
|
||||
b = append(b, code.key...)
|
||||
|
|
|
@ -449,7 +449,7 @@ func encodeRunEscaped(ctx *encodeRuntimeContext, b []byte, codeSet *opcodeSet, o
|
|||
fallthrough
|
||||
case opStructFieldHead:
|
||||
p := load(ctxptr, code.idx)
|
||||
if p == 0 && code.indirect {
|
||||
if p == 0 && (code.indirect || code.next.op == opStructEnd) {
|
||||
if !code.anonymousHead {
|
||||
b = encodeNull(b)
|
||||
b = encodeComma(b)
|
||||
|
@ -480,7 +480,7 @@ func encodeRunEscaped(ctx *encodeRuntimeContext, b []byte, codeSet *opcodeSet, o
|
|||
fallthrough
|
||||
case opStructFieldHeadOmitEmpty:
|
||||
p := load(ctxptr, code.idx)
|
||||
if p == 0 && code.indirect {
|
||||
if p == 0 && (code.indirect || code.next.op == opStructEnd) {
|
||||
if !code.anonymousHead {
|
||||
b = encodeNull(b)
|
||||
b = encodeComma(b)
|
||||
|
@ -513,7 +513,7 @@ func encodeRunEscaped(ctx *encodeRuntimeContext, b []byte, codeSet *opcodeSet, o
|
|||
fallthrough
|
||||
case opStructFieldHeadStringTag:
|
||||
p := load(ctxptr, code.idx)
|
||||
if p == 0 && code.indirect {
|
||||
if p == 0 && (code.indirect || code.next.op == opStructEnd) {
|
||||
if !code.anonymousHead {
|
||||
b = encodeNull(b)
|
||||
b = encodeComma(b)
|
||||
|
@ -3453,7 +3453,7 @@ func encodeRunEscaped(ctx *encodeRuntimeContext, b []byte, codeSet *opcodeSet, o
|
|||
case opStructFieldOmitEmptyMap:
|
||||
p := load(ctxptr, code.headIdx)
|
||||
p = ptrToPtr(p + code.offset)
|
||||
if p == 0 {
|
||||
if p == 0 || maplen(ptrToUnsafePtr(p)) == 0 {
|
||||
code = code.nextField
|
||||
} else {
|
||||
b = append(b, code.escapedKey...)
|
||||
|
|
|
@ -346,7 +346,6 @@ func encodeRunEscapedIndent(ctx *encodeRuntimeContext, b []byte, codeSet *opcode
|
|||
store(ctxptr, code.next.idx, uintptr(key))
|
||||
code = code.next
|
||||
} else {
|
||||
b = appendIndent(ctx, b, code.indent)
|
||||
b = append(b, '{', '}', ',', '\n')
|
||||
code = code.end.next
|
||||
}
|
||||
|
@ -497,7 +496,7 @@ func encodeRunEscapedIndent(ctx *encodeRuntimeContext, b []byte, codeSet *opcode
|
|||
fallthrough
|
||||
case opStructFieldHead:
|
||||
p := load(ctxptr, code.idx)
|
||||
if p == 0 && code.indirect {
|
||||
if p == 0 && (code.indirect || code.next.op == opStructEnd) {
|
||||
if !code.anonymousHead {
|
||||
b = encodeNull(b)
|
||||
b = encodeIndentComma(b)
|
||||
|
@ -508,7 +507,7 @@ func encodeRunEscapedIndent(ctx *encodeRuntimeContext, b []byte, codeSet *opcode
|
|||
if !code.anonymousHead {
|
||||
b = append(b, '{', '\n')
|
||||
}
|
||||
if !code.anonymousKey {
|
||||
if !code.anonymousKey && len(code.escapedKey) > 0 {
|
||||
b = appendIndent(ctx, b, code.indent+1)
|
||||
b = append(b, code.escapedKey...)
|
||||
b = append(b, ' ')
|
||||
|
@ -530,7 +529,7 @@ func encodeRunEscapedIndent(ctx *encodeRuntimeContext, b []byte, codeSet *opcode
|
|||
fallthrough
|
||||
case opStructFieldHeadOmitEmpty:
|
||||
p := load(ctxptr, code.idx)
|
||||
if p == 0 && code.indirect {
|
||||
if p == 0 && (code.indirect || code.next.op == opStructEnd) {
|
||||
if !code.anonymousHead {
|
||||
b = encodeNull(b)
|
||||
b = encodeIndentComma(b)
|
||||
|
@ -565,7 +564,7 @@ func encodeRunEscapedIndent(ctx *encodeRuntimeContext, b []byte, codeSet *opcode
|
|||
fallthrough
|
||||
case opStructFieldHeadStringTag:
|
||||
p := load(ctxptr, code.idx)
|
||||
if p == 0 && code.indirect {
|
||||
if p == 0 && (code.indirect || code.next.op == opStructEnd) {
|
||||
if !code.anonymousHead {
|
||||
b = encodeNull(b)
|
||||
b = encodeIndentComma(b)
|
||||
|
@ -3744,7 +3743,7 @@ func encodeRunEscapedIndent(ctx *encodeRuntimeContext, b []byte, codeSet *opcode
|
|||
case opStructFieldOmitEmptyMap:
|
||||
p := load(ctxptr, code.headIdx)
|
||||
p = ptrToPtr(p + code.offset)
|
||||
if p == 0 {
|
||||
if p == 0 || maplen(ptrToUnsafePtr(p)) == 0 {
|
||||
code = code.nextField
|
||||
} else {
|
||||
b = appendIndent(ctx, b, code.indent)
|
||||
|
|
|
@ -346,7 +346,6 @@ func encodeRunIndent(ctx *encodeRuntimeContext, b []byte, codeSet *opcodeSet, op
|
|||
store(ctxptr, code.next.idx, uintptr(key))
|
||||
code = code.next
|
||||
} else {
|
||||
b = appendIndent(ctx, b, code.indent)
|
||||
b = append(b, '{', '}', ',', '\n')
|
||||
code = code.end.next
|
||||
}
|
||||
|
@ -497,7 +496,7 @@ func encodeRunIndent(ctx *encodeRuntimeContext, b []byte, codeSet *opcodeSet, op
|
|||
fallthrough
|
||||
case opStructFieldHead:
|
||||
p := load(ctxptr, code.idx)
|
||||
if p == 0 && code.indirect {
|
||||
if p == 0 && (code.indirect || code.next.op == opStructEnd) {
|
||||
if !code.anonymousHead {
|
||||
b = encodeNull(b)
|
||||
b = encodeIndentComma(b)
|
||||
|
@ -508,7 +507,7 @@ func encodeRunIndent(ctx *encodeRuntimeContext, b []byte, codeSet *opcodeSet, op
|
|||
if !code.anonymousHead {
|
||||
b = append(b, '{', '\n')
|
||||
}
|
||||
if !code.anonymousKey {
|
||||
if !code.anonymousKey && len(code.key) > 0 {
|
||||
b = appendIndent(ctx, b, code.indent+1)
|
||||
b = append(b, code.key...)
|
||||
b = append(b, ' ')
|
||||
|
@ -530,7 +529,7 @@ func encodeRunIndent(ctx *encodeRuntimeContext, b []byte, codeSet *opcodeSet, op
|
|||
fallthrough
|
||||
case opStructFieldHeadOmitEmpty:
|
||||
p := load(ctxptr, code.idx)
|
||||
if p == 0 && code.indirect {
|
||||
if p == 0 && (code.indirect || code.next.op == opStructEnd) {
|
||||
if !code.anonymousHead {
|
||||
b = encodeNull(b)
|
||||
b = encodeIndentComma(b)
|
||||
|
@ -565,7 +564,7 @@ func encodeRunIndent(ctx *encodeRuntimeContext, b []byte, codeSet *opcodeSet, op
|
|||
fallthrough
|
||||
case opStructFieldHeadStringTag:
|
||||
p := load(ctxptr, code.idx)
|
||||
if p == 0 && code.indirect {
|
||||
if p == 0 && (code.indirect || code.next.op == opStructEnd) {
|
||||
if !code.anonymousHead {
|
||||
b = encodeNull(b)
|
||||
b = encodeIndentComma(b)
|
||||
|
@ -3745,7 +3744,7 @@ func encodeRunIndent(ctx *encodeRuntimeContext, b []byte, codeSet *opcodeSet, op
|
|||
case opStructFieldOmitEmptyMap:
|
||||
p := load(ctxptr, code.headIdx)
|
||||
p = ptrToPtr(p + code.offset)
|
||||
if p == 0 {
|
||||
if p == 0 || maplen(ptrToUnsafePtr(p)) == 0 {
|
||||
code = code.nextField
|
||||
} else {
|
||||
b = appendIndent(ctx, b, code.indent)
|
||||
|
|
Loading…
Reference in New Issue