forked from mirror/go-json
Merge pull request #249 from goccy/feature/fix-issue247
Fix MarshalIndent
This commit is contained in:
commit
3c3226e0f4
|
@ -484,7 +484,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b
|
||||||
oldOffset := ptrOffset
|
oldOffset := ptrOffset
|
||||||
ptrOffset += code.Jmp.CurLen * uintptrSize
|
ptrOffset += code.Jmp.CurLen * uintptrSize
|
||||||
oldBaseIndent := ctx.BaseIndent
|
oldBaseIndent := ctx.BaseIndent
|
||||||
ctx.BaseIndent += code.Indent - 1
|
indentDiffFromTop := c.Indent - 1
|
||||||
|
ctx.BaseIndent += code.Indent - indentDiffFromTop
|
||||||
|
|
||||||
newLen := offsetNum + code.Jmp.CurLen + code.Jmp.NextLen
|
newLen := offsetNum + code.Jmp.CurLen + code.Jmp.NextLen
|
||||||
if curlen < newLen {
|
if curlen < newLen {
|
||||||
|
|
|
@ -269,8 +269,8 @@ func linkRecursiveCode(c *Opcode) {
|
||||||
lastCode.Length = lastCode.Idx + 2*uintptrSize
|
lastCode.Length = lastCode.Idx + 2*uintptrSize
|
||||||
|
|
||||||
// extend length to alloc slot for elemIdx + length
|
// extend length to alloc slot for elemIdx + length
|
||||||
totalLength := uintptr(code.TotalLength() + 2)
|
totalLength := uintptr(code.TotalLength() + 3)
|
||||||
nextTotalLength := uintptr(c.TotalLength() + 2)
|
nextTotalLength := uintptr(c.TotalLength() + 3)
|
||||||
|
|
||||||
c.End.Next.Op = OpRecursiveEnd
|
c.End.Next.Op = OpRecursiveEnd
|
||||||
|
|
||||||
|
|
|
@ -484,7 +484,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b
|
||||||
oldOffset := ptrOffset
|
oldOffset := ptrOffset
|
||||||
ptrOffset += code.Jmp.CurLen * uintptrSize
|
ptrOffset += code.Jmp.CurLen * uintptrSize
|
||||||
oldBaseIndent := ctx.BaseIndent
|
oldBaseIndent := ctx.BaseIndent
|
||||||
ctx.BaseIndent += code.Indent - 1
|
indentDiffFromTop := c.Indent - 1
|
||||||
|
ctx.BaseIndent += code.Indent - indentDiffFromTop
|
||||||
|
|
||||||
newLen := offsetNum + code.Jmp.CurLen + code.Jmp.NextLen
|
newLen := offsetNum + code.Jmp.CurLen + code.Jmp.NextLen
|
||||||
if curlen < newLen {
|
if curlen < newLen {
|
||||||
|
|
|
@ -484,7 +484,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b
|
||||||
oldOffset := ptrOffset
|
oldOffset := ptrOffset
|
||||||
ptrOffset += code.Jmp.CurLen * uintptrSize
|
ptrOffset += code.Jmp.CurLen * uintptrSize
|
||||||
oldBaseIndent := ctx.BaseIndent
|
oldBaseIndent := ctx.BaseIndent
|
||||||
ctx.BaseIndent += code.Indent - 1
|
indentDiffFromTop := c.Indent - 1
|
||||||
|
ctx.BaseIndent += code.Indent - indentDiffFromTop
|
||||||
|
|
||||||
newLen := offsetNum + code.Jmp.CurLen + code.Jmp.NextLen
|
newLen := offsetNum + code.Jmp.CurLen + code.Jmp.NextLen
|
||||||
if curlen < newLen {
|
if curlen < newLen {
|
||||||
|
|
|
@ -484,7 +484,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b
|
||||||
oldOffset := ptrOffset
|
oldOffset := ptrOffset
|
||||||
ptrOffset += code.Jmp.CurLen * uintptrSize
|
ptrOffset += code.Jmp.CurLen * uintptrSize
|
||||||
oldBaseIndent := ctx.BaseIndent
|
oldBaseIndent := ctx.BaseIndent
|
||||||
ctx.BaseIndent += code.Indent - 1
|
indentDiffFromTop := c.Indent - 1
|
||||||
|
ctx.BaseIndent += code.Indent - indentDiffFromTop
|
||||||
|
|
||||||
newLen := offsetNum + code.Jmp.CurLen + code.Jmp.NextLen
|
newLen := offsetNum + code.Jmp.CurLen + code.Jmp.NextLen
|
||||||
if curlen < newLen {
|
if curlen < newLen {
|
||||||
|
|
|
@ -484,7 +484,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b
|
||||||
oldOffset := ptrOffset
|
oldOffset := ptrOffset
|
||||||
ptrOffset += code.Jmp.CurLen * uintptrSize
|
ptrOffset += code.Jmp.CurLen * uintptrSize
|
||||||
oldBaseIndent := ctx.BaseIndent
|
oldBaseIndent := ctx.BaseIndent
|
||||||
ctx.BaseIndent += code.Indent - 1
|
indentDiffFromTop := c.Indent - 1
|
||||||
|
ctx.BaseIndent += code.Indent - indentDiffFromTop
|
||||||
|
|
||||||
newLen := offsetNum + code.Jmp.CurLen + code.Jmp.NextLen
|
newLen := offsetNum + code.Jmp.CurLen + code.Jmp.NextLen
|
||||||
if curlen < newLen {
|
if curlen < newLen {
|
||||||
|
|
Loading…
Reference in New Issue