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