Fix struct end operation

This commit is contained in:
Masaaki Goshima 2021-01-22 20:06:20 +09:00
parent f8b2b03584
commit bf5220c3fb
4 changed files with 912 additions and 116 deletions

View File

@ -8028,8 +8028,16 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte
if v != 0 { if v != 0 {
b = append(b, code.key...) b = append(b, code.key...)
b = appendInt(b, int64(v)) b = appendInt(b, int64(v))
}
b = appendStructEnd(b) b = appendStructEnd(b)
} else {
last := len(b) - 1
if b[last] == ',' {
b[last] = '}'
b = encodeComma(b)
} else {
b = appendStructEnd(b)
}
}
code = code.next code = code.next
case opStructEndStringTagInt: case opStructEndStringTagInt:
ptr := load(ctxptr, code.headIdx) ptr := load(ctxptr, code.headIdx)
@ -8056,8 +8064,16 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte
if p != 0 { if p != 0 {
b = append(b, code.key...) b = append(b, code.key...)
b = appendInt(b, int64(e.ptrToInt(p))) b = appendInt(b, int64(e.ptrToInt(p)))
}
b = appendStructEnd(b) b = appendStructEnd(b)
} else {
last := len(b) - 1
if b[last] == ',' {
b[last] = '}'
b = encodeComma(b)
} else {
b = appendStructEnd(b)
}
}
code = code.next code = code.next
case opStructEndStringTagIntPtr: case opStructEndStringTagIntPtr:
b = append(b, code.key...) b = append(b, code.key...)
@ -8101,8 +8117,16 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte
if v != 0 { if v != 0 {
b = append(b, code.key...) b = append(b, code.key...)
b = appendInt(b, int64(v)) b = appendInt(b, int64(v))
}
b = appendStructEnd(b) b = appendStructEnd(b)
} else {
last := len(b) - 1
if b[last] == ',' {
b[last] = '}'
b = encodeComma(b)
} else {
b = appendStructEnd(b)
}
}
code = code.next code = code.next
case opStructEndStringTagInt8: case opStructEndStringTagInt8:
ptr := load(ctxptr, code.headIdx) ptr := load(ctxptr, code.headIdx)
@ -8129,8 +8153,16 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte
if p != 0 { if p != 0 {
b = append(b, code.key...) b = append(b, code.key...)
b = appendInt(b, int64(e.ptrToInt8(p))) b = appendInt(b, int64(e.ptrToInt8(p)))
}
b = appendStructEnd(b) b = appendStructEnd(b)
} else {
last := len(b) - 1
if b[last] == ',' {
b[last] = '}'
b = encodeComma(b)
} else {
b = appendStructEnd(b)
}
}
code = code.next code = code.next
case opStructEndStringTagInt8Ptr: case opStructEndStringTagInt8Ptr:
b = append(b, code.key...) b = append(b, code.key...)
@ -8174,8 +8206,16 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte
if v != 0 { if v != 0 {
b = append(b, code.key...) b = append(b, code.key...)
b = appendInt(b, int64(v)) b = appendInt(b, int64(v))
}
b = appendStructEnd(b) b = appendStructEnd(b)
} else {
last := len(b) - 1
if b[last] == ',' {
b[last] = '}'
b = encodeComma(b)
} else {
b = appendStructEnd(b)
}
}
code = code.next code = code.next
case opStructEndStringTagInt16: case opStructEndStringTagInt16:
ptr := load(ctxptr, code.headIdx) ptr := load(ctxptr, code.headIdx)
@ -8202,8 +8242,16 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte
if p != 0 { if p != 0 {
b = append(b, code.key...) b = append(b, code.key...)
b = appendInt(b, int64(e.ptrToInt16(p))) b = appendInt(b, int64(e.ptrToInt16(p)))
}
b = appendStructEnd(b) b = appendStructEnd(b)
} else {
last := len(b) - 1
if b[last] == ',' {
b[last] = '}'
b = encodeComma(b)
} else {
b = appendStructEnd(b)
}
}
code = code.next code = code.next
case opStructEndStringTagInt16Ptr: case opStructEndStringTagInt16Ptr:
b = append(b, code.key...) b = append(b, code.key...)
@ -8247,8 +8295,16 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte
if v != 0 { if v != 0 {
b = append(b, code.key...) b = append(b, code.key...)
b = appendInt(b, int64(v)) b = appendInt(b, int64(v))
}
b = appendStructEnd(b) b = appendStructEnd(b)
} else {
last := len(b) - 1
if b[last] == ',' {
b[last] = '}'
b = encodeComma(b)
} else {
b = appendStructEnd(b)
}
}
code = code.next code = code.next
case opStructEndStringTagInt32: case opStructEndStringTagInt32:
ptr := load(ctxptr, code.headIdx) ptr := load(ctxptr, code.headIdx)
@ -8275,8 +8331,16 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte
if p != 0 { if p != 0 {
b = append(b, code.key...) b = append(b, code.key...)
b = appendInt(b, int64(e.ptrToInt32(p))) b = appendInt(b, int64(e.ptrToInt32(p)))
}
b = appendStructEnd(b) b = appendStructEnd(b)
} else {
last := len(b) - 1
if b[last] == ',' {
b[last] = '}'
b = encodeComma(b)
} else {
b = appendStructEnd(b)
}
}
code = code.next code = code.next
case opStructEndStringTagInt32Ptr: case opStructEndStringTagInt32Ptr:
b = append(b, code.key...) b = append(b, code.key...)
@ -8320,8 +8384,16 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte
if v != 0 { if v != 0 {
b = append(b, code.key...) b = append(b, code.key...)
b = appendInt(b, v) b = appendInt(b, v)
}
b = appendStructEnd(b) b = appendStructEnd(b)
} else {
last := len(b) - 1
if b[last] == ',' {
b[last] = '}'
b = encodeComma(b)
} else {
b = appendStructEnd(b)
}
}
code = code.next code = code.next
case opStructEndStringTagInt64: case opStructEndStringTagInt64:
ptr := load(ctxptr, code.headIdx) ptr := load(ctxptr, code.headIdx)
@ -8348,8 +8420,16 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte
if p != 0 { if p != 0 {
b = append(b, code.key...) b = append(b, code.key...)
b = appendInt(b, e.ptrToInt64(p)) b = appendInt(b, e.ptrToInt64(p))
}
b = appendStructEnd(b) b = appendStructEnd(b)
} else {
last := len(b) - 1
if b[last] == ',' {
b[last] = '}'
b = encodeComma(b)
} else {
b = appendStructEnd(b)
}
}
code = code.next code = code.next
case opStructEndStringTagInt64Ptr: case opStructEndStringTagInt64Ptr:
b = append(b, code.key...) b = append(b, code.key...)
@ -8393,8 +8473,16 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte
if v != 0 { if v != 0 {
b = append(b, code.key...) b = append(b, code.key...)
b = appendUint(b, uint64(v)) b = appendUint(b, uint64(v))
}
b = appendStructEnd(b) b = appendStructEnd(b)
} else {
last := len(b) - 1
if b[last] == ',' {
b[last] = '}'
b = encodeComma(b)
} else {
b = appendStructEnd(b)
}
}
code = code.next code = code.next
case opStructEndStringTagUint: case opStructEndStringTagUint:
ptr := load(ctxptr, code.headIdx) ptr := load(ctxptr, code.headIdx)
@ -8421,8 +8509,16 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte
if p != 0 { if p != 0 {
b = append(b, code.key...) b = append(b, code.key...)
b = appendUint(b, uint64(e.ptrToUint(p))) b = appendUint(b, uint64(e.ptrToUint(p)))
}
b = appendStructEnd(b) b = appendStructEnd(b)
} else {
last := len(b) - 1
if b[last] == ',' {
b[last] = '}'
b = encodeComma(b)
} else {
b = appendStructEnd(b)
}
}
code = code.next code = code.next
case opStructEndStringTagUintPtr: case opStructEndStringTagUintPtr:
b = append(b, code.key...) b = append(b, code.key...)
@ -8466,8 +8562,16 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte
if v != 0 { if v != 0 {
b = append(b, code.key...) b = append(b, code.key...)
b = appendUint(b, uint64(v)) b = appendUint(b, uint64(v))
}
b = appendStructEnd(b) b = appendStructEnd(b)
} else {
last := len(b) - 1
if b[last] == ',' {
b[last] = '}'
b = encodeComma(b)
} else {
b = appendStructEnd(b)
}
}
code = code.next code = code.next
case opStructEndStringTagUint8: case opStructEndStringTagUint8:
ptr := load(ctxptr, code.headIdx) ptr := load(ctxptr, code.headIdx)
@ -8494,8 +8598,16 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte
if p != 0 { if p != 0 {
b = append(b, code.key...) b = append(b, code.key...)
b = appendUint(b, uint64(e.ptrToUint8(p))) b = appendUint(b, uint64(e.ptrToUint8(p)))
}
b = appendStructEnd(b) b = appendStructEnd(b)
} else {
last := len(b) - 1
if b[last] == ',' {
b[last] = '}'
b = encodeComma(b)
} else {
b = appendStructEnd(b)
}
}
code = code.next code = code.next
case opStructEndStringTagUint8Ptr: case opStructEndStringTagUint8Ptr:
b = append(b, code.key...) b = append(b, code.key...)
@ -8539,8 +8651,16 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte
if v != 0 { if v != 0 {
b = append(b, code.key...) b = append(b, code.key...)
b = appendUint(b, uint64(v)) b = appendUint(b, uint64(v))
}
b = appendStructEnd(b) b = appendStructEnd(b)
} else {
last := len(b) - 1
if b[last] == ',' {
b[last] = '}'
b = encodeComma(b)
} else {
b = appendStructEnd(b)
}
}
code = code.next code = code.next
case opStructEndStringTagUint16: case opStructEndStringTagUint16:
ptr := load(ctxptr, code.headIdx) ptr := load(ctxptr, code.headIdx)
@ -8567,8 +8687,16 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte
if p != 0 { if p != 0 {
b = append(b, code.key...) b = append(b, code.key...)
b = appendUint(b, uint64(e.ptrToUint16(p))) b = appendUint(b, uint64(e.ptrToUint16(p)))
}
b = appendStructEnd(b) b = appendStructEnd(b)
} else {
last := len(b) - 1
if b[last] == ',' {
b[last] = '}'
b = encodeComma(b)
} else {
b = appendStructEnd(b)
}
}
code = code.next code = code.next
case opStructEndStringTagUint16Ptr: case opStructEndStringTagUint16Ptr:
b = append(b, code.key...) b = append(b, code.key...)
@ -8612,8 +8740,16 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte
if v != 0 { if v != 0 {
b = append(b, code.key...) b = append(b, code.key...)
b = appendUint(b, uint64(v)) b = appendUint(b, uint64(v))
}
b = appendStructEnd(b) b = appendStructEnd(b)
} else {
last := len(b) - 1
if b[last] == ',' {
b[last] = '}'
b = encodeComma(b)
} else {
b = appendStructEnd(b)
}
}
code = code.next code = code.next
case opStructEndStringTagUint32: case opStructEndStringTagUint32:
ptr := load(ctxptr, code.headIdx) ptr := load(ctxptr, code.headIdx)
@ -8640,8 +8776,16 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte
if p != 0 { if p != 0 {
b = append(b, code.key...) b = append(b, code.key...)
b = appendUint(b, uint64(e.ptrToUint32(p))) b = appendUint(b, uint64(e.ptrToUint32(p)))
}
b = appendStructEnd(b) b = appendStructEnd(b)
} else {
last := len(b) - 1
if b[last] == ',' {
b[last] = '}'
b = encodeComma(b)
} else {
b = appendStructEnd(b)
}
}
code = code.next code = code.next
case opStructEndStringTagUint32Ptr: case opStructEndStringTagUint32Ptr:
b = append(b, code.key...) b = append(b, code.key...)
@ -8685,8 +8829,16 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte
if v != 0 { if v != 0 {
b = append(b, code.key...) b = append(b, code.key...)
b = appendUint(b, v) b = appendUint(b, v)
}
b = appendStructEnd(b) b = appendStructEnd(b)
} else {
last := len(b) - 1
if b[last] == ',' {
b[last] = '}'
b = encodeComma(b)
} else {
b = appendStructEnd(b)
}
}
code = code.next code = code.next
case opStructEndStringTagUint64: case opStructEndStringTagUint64:
ptr := load(ctxptr, code.headIdx) ptr := load(ctxptr, code.headIdx)
@ -8713,8 +8865,16 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte
if p != 0 { if p != 0 {
b = append(b, code.key...) b = append(b, code.key...)
b = appendUint(b, e.ptrToUint64(p)) b = appendUint(b, e.ptrToUint64(p))
}
b = appendStructEnd(b) b = appendStructEnd(b)
} else {
last := len(b) - 1
if b[last] == ',' {
b[last] = '}'
b = encodeComma(b)
} else {
b = appendStructEnd(b)
}
}
code = code.next code = code.next
case opStructEndStringTagUint64Ptr: case opStructEndStringTagUint64Ptr:
b = append(b, code.key...) b = append(b, code.key...)
@ -8758,8 +8918,16 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte
if v != 0 { if v != 0 {
b = append(b, code.key...) b = append(b, code.key...)
b = encodeFloat32(b, v) b = encodeFloat32(b, v)
}
b = appendStructEnd(b) b = appendStructEnd(b)
} else {
last := len(b) - 1
if b[last] == ',' {
b[last] = '}'
b = encodeComma(b)
} else {
b = appendStructEnd(b)
}
}
code = code.next code = code.next
case opStructEndStringTagFloat32: case opStructEndStringTagFloat32:
ptr := load(ctxptr, code.headIdx) ptr := load(ctxptr, code.headIdx)
@ -8786,8 +8954,16 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte
if p != 0 { if p != 0 {
b = append(b, code.key...) b = append(b, code.key...)
b = encodeFloat32(b, e.ptrToFloat32(p)) b = encodeFloat32(b, e.ptrToFloat32(p))
}
b = appendStructEnd(b) b = appendStructEnd(b)
} else {
last := len(b) - 1
if b[last] == ',' {
b[last] = '}'
b = encodeComma(b)
} else {
b = appendStructEnd(b)
}
}
code = code.next code = code.next
case opStructEndStringTagFloat32Ptr: case opStructEndStringTagFloat32Ptr:
b = append(b, code.key...) b = append(b, code.key...)
@ -8838,8 +9014,16 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte
} }
b = append(b, code.key...) b = append(b, code.key...)
b = encodeFloat64(b, v) b = encodeFloat64(b, v)
}
b = appendStructEnd(b) b = appendStructEnd(b)
} else {
last := len(b) - 1
if b[last] == ',' {
b[last] = '}'
b = encodeComma(b)
} else {
b = appendStructEnd(b)
}
}
code = code.next code = code.next
case opStructEndStringTagFloat64: case opStructEndStringTagFloat64:
ptr := load(ctxptr, code.headIdx) ptr := load(ctxptr, code.headIdx)
@ -8880,8 +9064,16 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte
return nil, errUnsupportedFloat(v) return nil, errUnsupportedFloat(v)
} }
b = encodeFloat64(b, v) b = encodeFloat64(b, v)
}
b = appendStructEnd(b) b = appendStructEnd(b)
} else {
last := len(b) - 1
if b[last] == ',' {
b[last] = '}'
b = encodeComma(b)
} else {
b = appendStructEnd(b)
}
}
code = code.next code = code.next
case opStructEndStringTagFloat64Ptr: case opStructEndStringTagFloat64Ptr:
b = append(b, code.key...) b = append(b, code.key...)
@ -8933,8 +9125,16 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte
if v != "" { if v != "" {
b = append(b, code.key...) b = append(b, code.key...)
b = encodeNoEscapedString(b, v) b = encodeNoEscapedString(b, v)
}
b = appendStructEnd(b) b = appendStructEnd(b)
} else {
last := len(b) - 1
if b[last] == ',' {
b[last] = '}'
b = encodeComma(b)
} else {
b = appendStructEnd(b)
}
}
code = code.next code = code.next
case opStructEndStringTagString: case opStructEndStringTagString:
ptr := load(ctxptr, code.headIdx) ptr := load(ctxptr, code.headIdx)
@ -8960,8 +9160,16 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte
if p != 0 { if p != 0 {
b = append(b, code.key...) b = append(b, code.key...)
b = encodeNoEscapedString(b, e.ptrToString(p)) b = encodeNoEscapedString(b, e.ptrToString(p))
}
b = appendStructEnd(b) b = appendStructEnd(b)
} else {
last := len(b) - 1
if b[last] == ',' {
b[last] = '}'
b = encodeComma(b)
} else {
b = appendStructEnd(b)
}
}
code = code.next code = code.next
case opStructEndStringTagStringPtr: case opStructEndStringTagStringPtr:
b = append(b, code.key...) b = append(b, code.key...)
@ -9004,8 +9212,16 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte
if v { if v {
b = append(b, code.key...) b = append(b, code.key...)
b = encodeBool(b, v) b = encodeBool(b, v)
}
b = appendStructEnd(b) b = appendStructEnd(b)
} else {
last := len(b) - 1
if b[last] == ',' {
b[last] = '}'
b = encodeComma(b)
} else {
b = appendStructEnd(b)
}
}
code = code.next code = code.next
case opStructEndStringTagBool: case opStructEndStringTagBool:
ptr := load(ctxptr, code.headIdx) ptr := load(ctxptr, code.headIdx)
@ -9038,8 +9254,16 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte
if len(v) > 0 { if len(v) > 0 {
b = append(b, code.key...) b = append(b, code.key...)
b = encodeByteSlice(b, v) b = encodeByteSlice(b, v)
}
b = appendStructEnd(b) b = appendStructEnd(b)
} else {
last := len(b) - 1
if b[last] == ',' {
b[last] = '}'
b = encodeComma(b)
} else {
b = appendStructEnd(b)
}
}
code = code.next code = code.next
case opStructEndStringTagBytes: case opStructEndStringTagBytes:
ptr := load(ctxptr, code.headIdx) ptr := load(ctxptr, code.headIdx)
@ -9079,8 +9303,16 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte
} }
b = append(b, code.key...) b = append(b, code.key...)
b = append(b, buf.Bytes()...) b = append(b, buf.Bytes()...)
}
b = appendStructEnd(b) b = appendStructEnd(b)
} else {
last := len(b) - 1
if b[last] == ',' {
b[last] = '}'
b = encodeComma(b)
} else {
b = appendStructEnd(b)
}
}
code = code.next code = code.next
case opStructEndStringTagMarshalJSON: case opStructEndStringTagMarshalJSON:
ptr := load(ctxptr, code.headIdx) ptr := load(ctxptr, code.headIdx)
@ -9121,8 +9353,16 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte
} }
b = append(b, code.key...) b = append(b, code.key...)
b = encodeNoEscapedString(b, *(*string)(unsafe.Pointer(&bytes))) b = encodeNoEscapedString(b, *(*string)(unsafe.Pointer(&bytes)))
}
b = appendStructEnd(b) b = appendStructEnd(b)
} else {
last := len(b) - 1
if b[last] == ',' {
b[last] = '}'
b = encodeComma(b)
} else {
b = appendStructEnd(b)
}
}
code = code.next code = code.next
case opStructEndStringTagMarshalText: case opStructEndStringTagMarshalText:
ptr := load(ctxptr, code.headIdx) ptr := load(ctxptr, code.headIdx)

View File

@ -8014,8 +8014,16 @@ func (e *Encoder) runEscaped(ctx *encodeRuntimeContext, b []byte, code *opcode)
if v != 0 { if v != 0 {
b = append(b, code.escapedKey...) b = append(b, code.escapedKey...)
b = appendInt(b, int64(v)) b = appendInt(b, int64(v))
}
b = appendStructEnd(b) b = appendStructEnd(b)
} else {
last := len(b) - 1
if b[last] == ',' {
b[last] = '}'
b = encodeComma(b)
} else {
b = appendStructEnd(b)
}
}
code = code.next code = code.next
case opStructEndStringTagInt: case opStructEndStringTagInt:
ptr := load(ctxptr, code.headIdx) ptr := load(ctxptr, code.headIdx)
@ -8042,8 +8050,16 @@ func (e *Encoder) runEscaped(ctx *encodeRuntimeContext, b []byte, code *opcode)
if p != 0 { if p != 0 {
b = append(b, code.escapedKey...) b = append(b, code.escapedKey...)
b = appendInt(b, int64(e.ptrToInt(p))) b = appendInt(b, int64(e.ptrToInt(p)))
}
b = appendStructEnd(b) b = appendStructEnd(b)
} else {
last := len(b) - 1
if b[last] == ',' {
b[last] = '}'
b = encodeComma(b)
} else {
b = appendStructEnd(b)
}
}
code = code.next code = code.next
case opStructEndStringTagIntPtr: case opStructEndStringTagIntPtr:
b = append(b, code.escapedKey...) b = append(b, code.escapedKey...)
@ -8087,8 +8103,16 @@ func (e *Encoder) runEscaped(ctx *encodeRuntimeContext, b []byte, code *opcode)
if v != 0 { if v != 0 {
b = append(b, code.escapedKey...) b = append(b, code.escapedKey...)
b = appendInt(b, int64(v)) b = appendInt(b, int64(v))
}
b = appendStructEnd(b) b = appendStructEnd(b)
} else {
last := len(b) - 1
if b[last] == ',' {
b[last] = '}'
b = encodeComma(b)
} else {
b = appendStructEnd(b)
}
}
code = code.next code = code.next
case opStructEndStringTagInt8: case opStructEndStringTagInt8:
ptr := load(ctxptr, code.headIdx) ptr := load(ctxptr, code.headIdx)
@ -8115,8 +8139,16 @@ func (e *Encoder) runEscaped(ctx *encodeRuntimeContext, b []byte, code *opcode)
if p != 0 { if p != 0 {
b = append(b, code.escapedKey...) b = append(b, code.escapedKey...)
b = appendInt(b, int64(e.ptrToInt8(p))) b = appendInt(b, int64(e.ptrToInt8(p)))
}
b = appendStructEnd(b) b = appendStructEnd(b)
} else {
last := len(b) - 1
if b[last] == ',' {
b[last] = '}'
b = encodeComma(b)
} else {
b = appendStructEnd(b)
}
}
code = code.next code = code.next
case opStructEndStringTagInt8Ptr: case opStructEndStringTagInt8Ptr:
b = append(b, code.escapedKey...) b = append(b, code.escapedKey...)
@ -8160,8 +8192,16 @@ func (e *Encoder) runEscaped(ctx *encodeRuntimeContext, b []byte, code *opcode)
if v != 0 { if v != 0 {
b = append(b, code.escapedKey...) b = append(b, code.escapedKey...)
b = appendInt(b, int64(v)) b = appendInt(b, int64(v))
}
b = appendStructEnd(b) b = appendStructEnd(b)
} else {
last := len(b) - 1
if b[last] == ',' {
b[last] = '}'
b = encodeComma(b)
} else {
b = appendStructEnd(b)
}
}
code = code.next code = code.next
case opStructEndStringTagInt16: case opStructEndStringTagInt16:
ptr := load(ctxptr, code.headIdx) ptr := load(ctxptr, code.headIdx)
@ -8188,8 +8228,16 @@ func (e *Encoder) runEscaped(ctx *encodeRuntimeContext, b []byte, code *opcode)
if p != 0 { if p != 0 {
b = append(b, code.escapedKey...) b = append(b, code.escapedKey...)
b = appendInt(b, int64(e.ptrToInt16(p))) b = appendInt(b, int64(e.ptrToInt16(p)))
}
b = appendStructEnd(b) b = appendStructEnd(b)
} else {
last := len(b) - 1
if b[last] == ',' {
b[last] = '}'
b = encodeComma(b)
} else {
b = appendStructEnd(b)
}
}
code = code.next code = code.next
case opStructEndStringTagInt16Ptr: case opStructEndStringTagInt16Ptr:
b = append(b, code.escapedKey...) b = append(b, code.escapedKey...)
@ -8233,8 +8281,16 @@ func (e *Encoder) runEscaped(ctx *encodeRuntimeContext, b []byte, code *opcode)
if v != 0 { if v != 0 {
b = append(b, code.escapedKey...) b = append(b, code.escapedKey...)
b = appendInt(b, int64(v)) b = appendInt(b, int64(v))
}
b = appendStructEnd(b) b = appendStructEnd(b)
} else {
last := len(b) - 1
if b[last] == ',' {
b[last] = '}'
b = encodeComma(b)
} else {
b = appendStructEnd(b)
}
}
code = code.next code = code.next
case opStructEndStringTagInt32: case opStructEndStringTagInt32:
ptr := load(ctxptr, code.headIdx) ptr := load(ctxptr, code.headIdx)
@ -8261,8 +8317,16 @@ func (e *Encoder) runEscaped(ctx *encodeRuntimeContext, b []byte, code *opcode)
if p != 0 { if p != 0 {
b = append(b, code.escapedKey...) b = append(b, code.escapedKey...)
b = appendInt(b, int64(e.ptrToInt32(p))) b = appendInt(b, int64(e.ptrToInt32(p)))
}
b = appendStructEnd(b) b = appendStructEnd(b)
} else {
last := len(b) - 1
if b[last] == ',' {
b[last] = '}'
b = encodeComma(b)
} else {
b = appendStructEnd(b)
}
}
code = code.next code = code.next
case opStructEndStringTagInt32Ptr: case opStructEndStringTagInt32Ptr:
b = append(b, code.escapedKey...) b = append(b, code.escapedKey...)
@ -8306,8 +8370,16 @@ func (e *Encoder) runEscaped(ctx *encodeRuntimeContext, b []byte, code *opcode)
if v != 0 { if v != 0 {
b = append(b, code.escapedKey...) b = append(b, code.escapedKey...)
b = appendInt(b, v) b = appendInt(b, v)
}
b = appendStructEnd(b) b = appendStructEnd(b)
} else {
last := len(b) - 1
if b[last] == ',' {
b[last] = '}'
b = encodeComma(b)
} else {
b = appendStructEnd(b)
}
}
code = code.next code = code.next
case opStructEndStringTagInt64: case opStructEndStringTagInt64:
ptr := load(ctxptr, code.headIdx) ptr := load(ctxptr, code.headIdx)
@ -8334,8 +8406,16 @@ func (e *Encoder) runEscaped(ctx *encodeRuntimeContext, b []byte, code *opcode)
if p != 0 { if p != 0 {
b = append(b, code.escapedKey...) b = append(b, code.escapedKey...)
b = appendInt(b, e.ptrToInt64(p)) b = appendInt(b, e.ptrToInt64(p))
}
b = appendStructEnd(b) b = appendStructEnd(b)
} else {
last := len(b) - 1
if b[last] == ',' {
b[last] = '}'
b = encodeComma(b)
} else {
b = appendStructEnd(b)
}
}
code = code.next code = code.next
case opStructEndStringTagInt64Ptr: case opStructEndStringTagInt64Ptr:
b = append(b, code.escapedKey...) b = append(b, code.escapedKey...)
@ -8379,8 +8459,16 @@ func (e *Encoder) runEscaped(ctx *encodeRuntimeContext, b []byte, code *opcode)
if v != 0 { if v != 0 {
b = append(b, code.escapedKey...) b = append(b, code.escapedKey...)
b = appendUint(b, uint64(v)) b = appendUint(b, uint64(v))
}
b = appendStructEnd(b) b = appendStructEnd(b)
} else {
last := len(b) - 1
if b[last] == ',' {
b[last] = '}'
b = encodeComma(b)
} else {
b = appendStructEnd(b)
}
}
code = code.next code = code.next
case opStructEndStringTagUint: case opStructEndStringTagUint:
ptr := load(ctxptr, code.headIdx) ptr := load(ctxptr, code.headIdx)
@ -8407,8 +8495,16 @@ func (e *Encoder) runEscaped(ctx *encodeRuntimeContext, b []byte, code *opcode)
if p != 0 { if p != 0 {
b = append(b, code.escapedKey...) b = append(b, code.escapedKey...)
b = appendUint(b, uint64(e.ptrToUint(p))) b = appendUint(b, uint64(e.ptrToUint(p)))
}
b = appendStructEnd(b) b = appendStructEnd(b)
} else {
last := len(b) - 1
if b[last] == ',' {
b[last] = '}'
b = encodeComma(b)
} else {
b = appendStructEnd(b)
}
}
code = code.next code = code.next
case opStructEndStringTagUintPtr: case opStructEndStringTagUintPtr:
b = append(b, code.escapedKey...) b = append(b, code.escapedKey...)
@ -8452,8 +8548,16 @@ func (e *Encoder) runEscaped(ctx *encodeRuntimeContext, b []byte, code *opcode)
if v != 0 { if v != 0 {
b = append(b, code.escapedKey...) b = append(b, code.escapedKey...)
b = appendUint(b, uint64(v)) b = appendUint(b, uint64(v))
}
b = appendStructEnd(b) b = appendStructEnd(b)
} else {
last := len(b) - 1
if b[last] == ',' {
b[last] = '}'
b = encodeComma(b)
} else {
b = appendStructEnd(b)
}
}
code = code.next code = code.next
case opStructEndStringTagUint8: case opStructEndStringTagUint8:
ptr := load(ctxptr, code.headIdx) ptr := load(ctxptr, code.headIdx)
@ -8480,8 +8584,16 @@ func (e *Encoder) runEscaped(ctx *encodeRuntimeContext, b []byte, code *opcode)
if p != 0 { if p != 0 {
b = append(b, code.escapedKey...) b = append(b, code.escapedKey...)
b = appendUint(b, uint64(e.ptrToUint8(p))) b = appendUint(b, uint64(e.ptrToUint8(p)))
}
b = appendStructEnd(b) b = appendStructEnd(b)
} else {
last := len(b) - 1
if b[last] == ',' {
b[last] = '}'
b = encodeComma(b)
} else {
b = appendStructEnd(b)
}
}
code = code.next code = code.next
case opStructEndStringTagUint8Ptr: case opStructEndStringTagUint8Ptr:
b = append(b, code.escapedKey...) b = append(b, code.escapedKey...)
@ -8525,8 +8637,16 @@ func (e *Encoder) runEscaped(ctx *encodeRuntimeContext, b []byte, code *opcode)
if v != 0 { if v != 0 {
b = append(b, code.escapedKey...) b = append(b, code.escapedKey...)
b = appendUint(b, uint64(v)) b = appendUint(b, uint64(v))
}
b = appendStructEnd(b) b = appendStructEnd(b)
} else {
last := len(b) - 1
if b[last] == ',' {
b[last] = '}'
b = encodeComma(b)
} else {
b = appendStructEnd(b)
}
}
code = code.next code = code.next
case opStructEndStringTagUint16: case opStructEndStringTagUint16:
ptr := load(ctxptr, code.headIdx) ptr := load(ctxptr, code.headIdx)
@ -8553,8 +8673,16 @@ func (e *Encoder) runEscaped(ctx *encodeRuntimeContext, b []byte, code *opcode)
if p != 0 { if p != 0 {
b = append(b, code.escapedKey...) b = append(b, code.escapedKey...)
b = appendUint(b, uint64(e.ptrToUint16(p))) b = appendUint(b, uint64(e.ptrToUint16(p)))
}
b = appendStructEnd(b) b = appendStructEnd(b)
} else {
last := len(b) - 1
if b[last] == ',' {
b[last] = '}'
b = encodeComma(b)
} else {
b = appendStructEnd(b)
}
}
code = code.next code = code.next
case opStructEndStringTagUint16Ptr: case opStructEndStringTagUint16Ptr:
b = append(b, code.escapedKey...) b = append(b, code.escapedKey...)
@ -8598,8 +8726,16 @@ func (e *Encoder) runEscaped(ctx *encodeRuntimeContext, b []byte, code *opcode)
if v != 0 { if v != 0 {
b = append(b, code.escapedKey...) b = append(b, code.escapedKey...)
b = appendUint(b, uint64(v)) b = appendUint(b, uint64(v))
}
b = appendStructEnd(b) b = appendStructEnd(b)
} else {
last := len(b) - 1
if b[last] == ',' {
b[last] = '}'
b = encodeComma(b)
} else {
b = appendStructEnd(b)
}
}
code = code.next code = code.next
case opStructEndStringTagUint32: case opStructEndStringTagUint32:
ptr := load(ctxptr, code.headIdx) ptr := load(ctxptr, code.headIdx)
@ -8626,8 +8762,16 @@ func (e *Encoder) runEscaped(ctx *encodeRuntimeContext, b []byte, code *opcode)
if p != 0 { if p != 0 {
b = append(b, code.escapedKey...) b = append(b, code.escapedKey...)
b = appendUint(b, uint64(e.ptrToUint32(p))) b = appendUint(b, uint64(e.ptrToUint32(p)))
}
b = appendStructEnd(b) b = appendStructEnd(b)
} else {
last := len(b) - 1
if b[last] == ',' {
b[last] = '}'
b = encodeComma(b)
} else {
b = appendStructEnd(b)
}
}
code = code.next code = code.next
case opStructEndStringTagUint32Ptr: case opStructEndStringTagUint32Ptr:
b = append(b, code.escapedKey...) b = append(b, code.escapedKey...)
@ -8671,8 +8815,16 @@ func (e *Encoder) runEscaped(ctx *encodeRuntimeContext, b []byte, code *opcode)
if v != 0 { if v != 0 {
b = append(b, code.escapedKey...) b = append(b, code.escapedKey...)
b = appendUint(b, v) b = appendUint(b, v)
}
b = appendStructEnd(b) b = appendStructEnd(b)
} else {
last := len(b) - 1
if b[last] == ',' {
b[last] = '}'
b = encodeComma(b)
} else {
b = appendStructEnd(b)
}
}
code = code.next code = code.next
case opStructEndStringTagUint64: case opStructEndStringTagUint64:
ptr := load(ctxptr, code.headIdx) ptr := load(ctxptr, code.headIdx)
@ -8699,8 +8851,16 @@ func (e *Encoder) runEscaped(ctx *encodeRuntimeContext, b []byte, code *opcode)
if p != 0 { if p != 0 {
b = append(b, code.escapedKey...) b = append(b, code.escapedKey...)
b = appendUint(b, e.ptrToUint64(p)) b = appendUint(b, e.ptrToUint64(p))
}
b = appendStructEnd(b) b = appendStructEnd(b)
} else {
last := len(b) - 1
if b[last] == ',' {
b[last] = '}'
b = encodeComma(b)
} else {
b = appendStructEnd(b)
}
}
code = code.next code = code.next
case opStructEndStringTagUint64Ptr: case opStructEndStringTagUint64Ptr:
b = append(b, code.escapedKey...) b = append(b, code.escapedKey...)
@ -8744,8 +8904,16 @@ func (e *Encoder) runEscaped(ctx *encodeRuntimeContext, b []byte, code *opcode)
if v != 0 { if v != 0 {
b = append(b, code.escapedKey...) b = append(b, code.escapedKey...)
b = encodeFloat32(b, v) b = encodeFloat32(b, v)
}
b = appendStructEnd(b) b = appendStructEnd(b)
} else {
last := len(b) - 1
if b[last] == ',' {
b[last] = '}'
b = encodeComma(b)
} else {
b = appendStructEnd(b)
}
}
code = code.next code = code.next
case opStructEndStringTagFloat32: case opStructEndStringTagFloat32:
ptr := load(ctxptr, code.headIdx) ptr := load(ctxptr, code.headIdx)
@ -8772,8 +8940,16 @@ func (e *Encoder) runEscaped(ctx *encodeRuntimeContext, b []byte, code *opcode)
if p != 0 { if p != 0 {
b = append(b, code.escapedKey...) b = append(b, code.escapedKey...)
b = encodeFloat32(b, e.ptrToFloat32(p)) b = encodeFloat32(b, e.ptrToFloat32(p))
}
b = appendStructEnd(b) b = appendStructEnd(b)
} else {
last := len(b) - 1
if b[last] == ',' {
b[last] = '}'
b = encodeComma(b)
} else {
b = appendStructEnd(b)
}
}
code = code.next code = code.next
case opStructEndStringTagFloat32Ptr: case opStructEndStringTagFloat32Ptr:
b = append(b, code.escapedKey...) b = append(b, code.escapedKey...)
@ -8824,8 +9000,16 @@ func (e *Encoder) runEscaped(ctx *encodeRuntimeContext, b []byte, code *opcode)
} }
b = append(b, code.escapedKey...) b = append(b, code.escapedKey...)
b = encodeFloat64(b, v) b = encodeFloat64(b, v)
}
b = appendStructEnd(b) b = appendStructEnd(b)
} else {
last := len(b) - 1
if b[last] == ',' {
b[last] = '}'
b = encodeComma(b)
} else {
b = appendStructEnd(b)
}
}
code = code.next code = code.next
case opStructEndStringTagFloat64: case opStructEndStringTagFloat64:
ptr := load(ctxptr, code.headIdx) ptr := load(ctxptr, code.headIdx)
@ -8866,8 +9050,16 @@ func (e *Encoder) runEscaped(ctx *encodeRuntimeContext, b []byte, code *opcode)
return nil, errUnsupportedFloat(v) return nil, errUnsupportedFloat(v)
} }
b = encodeFloat64(b, v) b = encodeFloat64(b, v)
}
b = appendStructEnd(b) b = appendStructEnd(b)
} else {
last := len(b) - 1
if b[last] == ',' {
b[last] = '}'
b = encodeComma(b)
} else {
b = appendStructEnd(b)
}
}
code = code.next code = code.next
case opStructEndStringTagFloat64Ptr: case opStructEndStringTagFloat64Ptr:
b = append(b, code.escapedKey...) b = append(b, code.escapedKey...)
@ -8919,8 +9111,16 @@ func (e *Encoder) runEscaped(ctx *encodeRuntimeContext, b []byte, code *opcode)
if v != "" { if v != "" {
b = append(b, code.escapedKey...) b = append(b, code.escapedKey...)
b = encodeEscapedString(b, v) b = encodeEscapedString(b, v)
}
b = appendStructEnd(b) b = appendStructEnd(b)
} else {
last := len(b) - 1
if b[last] == ',' {
b[last] = '}'
b = encodeComma(b)
} else {
b = appendStructEnd(b)
}
}
code = code.next code = code.next
case opStructEndStringTagString: case opStructEndStringTagString:
ptr := load(ctxptr, code.headIdx) ptr := load(ctxptr, code.headIdx)
@ -8946,8 +9146,16 @@ func (e *Encoder) runEscaped(ctx *encodeRuntimeContext, b []byte, code *opcode)
if p != 0 { if p != 0 {
b = append(b, code.escapedKey...) b = append(b, code.escapedKey...)
b = encodeEscapedString(b, e.ptrToString(p)) b = encodeEscapedString(b, e.ptrToString(p))
}
b = appendStructEnd(b) b = appendStructEnd(b)
} else {
last := len(b) - 1
if b[last] == ',' {
b[last] = '}'
b = encodeComma(b)
} else {
b = appendStructEnd(b)
}
}
code = code.next code = code.next
case opStructEndStringTagStringPtr: case opStructEndStringTagStringPtr:
b = append(b, code.escapedKey...) b = append(b, code.escapedKey...)
@ -8990,8 +9198,16 @@ func (e *Encoder) runEscaped(ctx *encodeRuntimeContext, b []byte, code *opcode)
if v { if v {
b = append(b, code.escapedKey...) b = append(b, code.escapedKey...)
b = encodeBool(b, v) b = encodeBool(b, v)
}
b = appendStructEnd(b) b = appendStructEnd(b)
} else {
last := len(b) - 1
if b[last] == ',' {
b[last] = '}'
b = encodeComma(b)
} else {
b = appendStructEnd(b)
}
}
code = code.next code = code.next
case opStructEndStringTagBool: case opStructEndStringTagBool:
ptr := load(ctxptr, code.headIdx) ptr := load(ctxptr, code.headIdx)
@ -9024,8 +9240,16 @@ func (e *Encoder) runEscaped(ctx *encodeRuntimeContext, b []byte, code *opcode)
if len(v) > 0 { if len(v) > 0 {
b = append(b, code.escapedKey...) b = append(b, code.escapedKey...)
b = encodeByteSlice(b, v) b = encodeByteSlice(b, v)
}
b = appendStructEnd(b) b = appendStructEnd(b)
} else {
last := len(b) - 1
if b[last] == ',' {
b[last] = '}'
b = encodeComma(b)
} else {
b = appendStructEnd(b)
}
}
code = code.next code = code.next
case opStructEndStringTagBytes: case opStructEndStringTagBytes:
ptr := load(ctxptr, code.headIdx) ptr := load(ctxptr, code.headIdx)
@ -9065,8 +9289,16 @@ func (e *Encoder) runEscaped(ctx *encodeRuntimeContext, b []byte, code *opcode)
} }
b = append(b, code.escapedKey...) b = append(b, code.escapedKey...)
b = append(b, buf.Bytes()...) b = append(b, buf.Bytes()...)
}
b = appendStructEnd(b) b = appendStructEnd(b)
} else {
last := len(b) - 1
if b[last] == ',' {
b[last] = '}'
b = encodeComma(b)
} else {
b = appendStructEnd(b)
}
}
code = code.next code = code.next
case opStructEndStringTagMarshalJSON: case opStructEndStringTagMarshalJSON:
ptr := load(ctxptr, code.headIdx) ptr := load(ctxptr, code.headIdx)
@ -9107,8 +9339,16 @@ func (e *Encoder) runEscaped(ctx *encodeRuntimeContext, b []byte, code *opcode)
} }
b = append(b, code.escapedKey...) b = append(b, code.escapedKey...)
b = encodeEscapedString(b, *(*string)(unsafe.Pointer(&bytes))) b = encodeEscapedString(b, *(*string)(unsafe.Pointer(&bytes)))
}
b = appendStructEnd(b) b = appendStructEnd(b)
} else {
last := len(b) - 1
if b[last] == ',' {
b[last] = '}'
b = encodeComma(b)
} else {
b = appendStructEnd(b)
}
}
code = code.next code = code.next
case opStructEndStringTagMarshalText: case opStructEndStringTagMarshalText:
ptr := load(ctxptr, code.headIdx) ptr := load(ctxptr, code.headIdx)

View File

@ -7895,9 +7895,14 @@ func (e *Encoder) runEscapedIndent(ctx *encodeRuntimeContext, b []byte, code *op
} else { } else {
last := len(b) - 1 last := len(b) - 1
if b[last-1] == '{' { if b[last-1] == '{' {
// doesn't exist any fields
b[last] = '}' b[last] = '}'
} else { } else {
if b[last] == '\n' {
// to remove ',' and '\n' characters
b = b[:len(b)-2]
}
b = append(b, '\n')
b = e.encodeIndent(b, code.indent)
b = append(b, '}') b = append(b, '}')
} }
b = encodeIndentComma(b) b = encodeIndentComma(b)
@ -7937,9 +7942,14 @@ func (e *Encoder) runEscapedIndent(ctx *encodeRuntimeContext, b []byte, code *op
} else { } else {
last := len(b) - 1 last := len(b) - 1
if b[last-1] == '{' { if b[last-1] == '{' {
// doesn't exist any fields
b[last] = '}' b[last] = '}'
} else { } else {
if b[last] == '\n' {
// to remove ',' and '\n' characters
b = b[:len(b)-2]
}
b = append(b, '\n')
b = e.encodeIndent(b, code.indent)
b = append(b, '}') b = append(b, '}')
} }
b = encodeIndentComma(b) b = encodeIndentComma(b)
@ -7980,9 +7990,14 @@ func (e *Encoder) runEscapedIndent(ctx *encodeRuntimeContext, b []byte, code *op
} else { } else {
last := len(b) - 1 last := len(b) - 1
if b[last-1] == '{' { if b[last-1] == '{' {
// doesn't exist any fields
b[last] = '}' b[last] = '}'
} else { } else {
if b[last] == '\n' {
// to remove ',' and '\n' characters
b = b[:len(b)-2]
}
b = append(b, '\n')
b = e.encodeIndent(b, code.indent)
b = append(b, '}') b = append(b, '}')
} }
b = encodeIndentComma(b) b = encodeIndentComma(b)
@ -8022,9 +8037,14 @@ func (e *Encoder) runEscapedIndent(ctx *encodeRuntimeContext, b []byte, code *op
} else { } else {
last := len(b) - 1 last := len(b) - 1
if b[last-1] == '{' { if b[last-1] == '{' {
// doesn't exist any fields
b[last] = '}' b[last] = '}'
} else { } else {
if b[last] == '\n' {
// to remove ',' and '\n' characters
b = b[:len(b)-2]
}
b = append(b, '\n')
b = e.encodeIndent(b, code.indent)
b = append(b, '}') b = append(b, '}')
} }
b = encodeIndentComma(b) b = encodeIndentComma(b)
@ -8065,9 +8085,14 @@ func (e *Encoder) runEscapedIndent(ctx *encodeRuntimeContext, b []byte, code *op
} else { } else {
last := len(b) - 1 last := len(b) - 1
if b[last-1] == '{' { if b[last-1] == '{' {
// doesn't exist any fields
b[last] = '}' b[last] = '}'
} else { } else {
if b[last] == '\n' {
// to remove ',' and '\n' characters
b = b[:len(b)-2]
}
b = append(b, '\n')
b = e.encodeIndent(b, code.indent)
b = append(b, '}') b = append(b, '}')
} }
b = encodeIndentComma(b) b = encodeIndentComma(b)
@ -8107,9 +8132,14 @@ func (e *Encoder) runEscapedIndent(ctx *encodeRuntimeContext, b []byte, code *op
} else { } else {
last := len(b) - 1 last := len(b) - 1
if b[last-1] == '{' { if b[last-1] == '{' {
// doesn't exist any fields
b[last] = '}' b[last] = '}'
} else { } else {
if b[last] == '\n' {
// to remove ',' and '\n' characters
b = b[:len(b)-2]
}
b = append(b, '\n')
b = e.encodeIndent(b, code.indent)
b = append(b, '}') b = append(b, '}')
} }
b = encodeIndentComma(b) b = encodeIndentComma(b)
@ -8150,9 +8180,14 @@ func (e *Encoder) runEscapedIndent(ctx *encodeRuntimeContext, b []byte, code *op
} else { } else {
last := len(b) - 1 last := len(b) - 1
if b[last-1] == '{' { if b[last-1] == '{' {
// doesn't exist any fields
b[last] = '}' b[last] = '}'
} else { } else {
if b[last] == '\n' {
// to remove ',' and '\n' characters
b = b[:len(b)-2]
}
b = append(b, '\n')
b = e.encodeIndent(b, code.indent)
b = append(b, '}') b = append(b, '}')
} }
b = encodeIndentComma(b) b = encodeIndentComma(b)
@ -8192,9 +8227,14 @@ func (e *Encoder) runEscapedIndent(ctx *encodeRuntimeContext, b []byte, code *op
} else { } else {
last := len(b) - 1 last := len(b) - 1
if b[last-1] == '{' { if b[last-1] == '{' {
// doesn't exist any fields
b[last] = '}' b[last] = '}'
} else { } else {
if b[last] == '\n' {
// to remove ',' and '\n' characters
b = b[:len(b)-2]
}
b = append(b, '\n')
b = e.encodeIndent(b, code.indent)
b = append(b, '}') b = append(b, '}')
} }
b = encodeIndentComma(b) b = encodeIndentComma(b)
@ -8235,9 +8275,14 @@ func (e *Encoder) runEscapedIndent(ctx *encodeRuntimeContext, b []byte, code *op
} else { } else {
last := len(b) - 1 last := len(b) - 1
if b[last-1] == '{' { if b[last-1] == '{' {
// doesn't exist any fields
b[last] = '}' b[last] = '}'
} else { } else {
if b[last] == '\n' {
// to remove ',' and '\n' characters
b = b[:len(b)-2]
}
b = append(b, '\n')
b = e.encodeIndent(b, code.indent)
b = append(b, '}') b = append(b, '}')
} }
b = encodeIndentComma(b) b = encodeIndentComma(b)
@ -8277,9 +8322,14 @@ func (e *Encoder) runEscapedIndent(ctx *encodeRuntimeContext, b []byte, code *op
} else { } else {
last := len(b) - 1 last := len(b) - 1
if b[last-1] == '{' { if b[last-1] == '{' {
// doesn't exist any fields
b[last] = '}' b[last] = '}'
} else { } else {
if b[last] == '\n' {
// to remove ',' and '\n' characters
b = b[:len(b)-2]
}
b = append(b, '\n')
b = e.encodeIndent(b, code.indent)
b = append(b, '}') b = append(b, '}')
} }
b = encodeIndentComma(b) b = encodeIndentComma(b)
@ -8320,9 +8370,14 @@ func (e *Encoder) runEscapedIndent(ctx *encodeRuntimeContext, b []byte, code *op
} else { } else {
last := len(b) - 1 last := len(b) - 1
if b[last-1] == '{' { if b[last-1] == '{' {
// doesn't exist any fields
b[last] = '}' b[last] = '}'
} else { } else {
if b[last] == '\n' {
// to remove ',' and '\n' characters
b = b[:len(b)-2]
}
b = append(b, '\n')
b = e.encodeIndent(b, code.indent)
b = append(b, '}') b = append(b, '}')
} }
b = encodeIndentComma(b) b = encodeIndentComma(b)
@ -8362,9 +8417,14 @@ func (e *Encoder) runEscapedIndent(ctx *encodeRuntimeContext, b []byte, code *op
} else { } else {
last := len(b) - 1 last := len(b) - 1
if b[last-1] == '{' { if b[last-1] == '{' {
// doesn't exist any fields
b[last] = '}' b[last] = '}'
} else { } else {
if b[last] == '\n' {
// to remove ',' and '\n' characters
b = b[:len(b)-2]
}
b = append(b, '\n')
b = e.encodeIndent(b, code.indent)
b = append(b, '}') b = append(b, '}')
} }
b = encodeIndentComma(b) b = encodeIndentComma(b)
@ -8405,9 +8465,14 @@ func (e *Encoder) runEscapedIndent(ctx *encodeRuntimeContext, b []byte, code *op
} else { } else {
last := len(b) - 1 last := len(b) - 1
if b[last-1] == '{' { if b[last-1] == '{' {
// doesn't exist any fields
b[last] = '}' b[last] = '}'
} else { } else {
if b[last] == '\n' {
// to remove ',' and '\n' characters
b = b[:len(b)-2]
}
b = append(b, '\n')
b = e.encodeIndent(b, code.indent)
b = append(b, '}') b = append(b, '}')
} }
b = encodeIndentComma(b) b = encodeIndentComma(b)
@ -8447,9 +8512,14 @@ func (e *Encoder) runEscapedIndent(ctx *encodeRuntimeContext, b []byte, code *op
} else { } else {
last := len(b) - 1 last := len(b) - 1
if b[last-1] == '{' { if b[last-1] == '{' {
// doesn't exist any fields
b[last] = '}' b[last] = '}'
} else { } else {
if b[last] == '\n' {
// to remove ',' and '\n' characters
b = b[:len(b)-2]
}
b = append(b, '\n')
b = e.encodeIndent(b, code.indent)
b = append(b, '}') b = append(b, '}')
} }
b = encodeIndentComma(b) b = encodeIndentComma(b)
@ -8490,9 +8560,14 @@ func (e *Encoder) runEscapedIndent(ctx *encodeRuntimeContext, b []byte, code *op
} else { } else {
last := len(b) - 1 last := len(b) - 1
if b[last-1] == '{' { if b[last-1] == '{' {
// doesn't exist any fields
b[last] = '}' b[last] = '}'
} else { } else {
if b[last] == '\n' {
// to remove ',' and '\n' characters
b = b[:len(b)-2]
}
b = append(b, '\n')
b = e.encodeIndent(b, code.indent)
b = append(b, '}') b = append(b, '}')
} }
b = encodeIndentComma(b) b = encodeIndentComma(b)
@ -8532,9 +8607,14 @@ func (e *Encoder) runEscapedIndent(ctx *encodeRuntimeContext, b []byte, code *op
} else { } else {
last := len(b) - 1 last := len(b) - 1
if b[last-1] == '{' { if b[last-1] == '{' {
// doesn't exist any fields
b[last] = '}' b[last] = '}'
} else { } else {
if b[last] == '\n' {
// to remove ',' and '\n' characters
b = b[:len(b)-2]
}
b = append(b, '\n')
b = e.encodeIndent(b, code.indent)
b = append(b, '}') b = append(b, '}')
} }
b = encodeIndentComma(b) b = encodeIndentComma(b)
@ -8575,9 +8655,14 @@ func (e *Encoder) runEscapedIndent(ctx *encodeRuntimeContext, b []byte, code *op
} else { } else {
last := len(b) - 1 last := len(b) - 1
if b[last-1] == '{' { if b[last-1] == '{' {
// doesn't exist any fields
b[last] = '}' b[last] = '}'
} else { } else {
if b[last] == '\n' {
// to remove ',' and '\n' characters
b = b[:len(b)-2]
}
b = append(b, '\n')
b = e.encodeIndent(b, code.indent)
b = append(b, '}') b = append(b, '}')
} }
b = encodeIndentComma(b) b = encodeIndentComma(b)
@ -8617,9 +8702,14 @@ func (e *Encoder) runEscapedIndent(ctx *encodeRuntimeContext, b []byte, code *op
} else { } else {
last := len(b) - 1 last := len(b) - 1
if b[last-1] == '{' { if b[last-1] == '{' {
// doesn't exist any fields
b[last] = '}' b[last] = '}'
} else { } else {
if b[last] == '\n' {
// to remove ',' and '\n' characters
b = b[:len(b)-2]
}
b = append(b, '\n')
b = e.encodeIndent(b, code.indent)
b = append(b, '}') b = append(b, '}')
} }
b = encodeIndentComma(b) b = encodeIndentComma(b)
@ -8660,9 +8750,14 @@ func (e *Encoder) runEscapedIndent(ctx *encodeRuntimeContext, b []byte, code *op
} else { } else {
last := len(b) - 1 last := len(b) - 1
if b[last-1] == '{' { if b[last-1] == '{' {
// doesn't exist any fields
b[last] = '}' b[last] = '}'
} else { } else {
if b[last] == '\n' {
// to remove ',' and '\n' characters
b = b[:len(b)-2]
}
b = append(b, '\n')
b = e.encodeIndent(b, code.indent)
b = append(b, '}') b = append(b, '}')
} }
b = encodeIndentComma(b) b = encodeIndentComma(b)
@ -8702,9 +8797,14 @@ func (e *Encoder) runEscapedIndent(ctx *encodeRuntimeContext, b []byte, code *op
} else { } else {
last := len(b) - 1 last := len(b) - 1
if b[last-1] == '{' { if b[last-1] == '{' {
// doesn't exist any fields
b[last] = '}' b[last] = '}'
} else { } else {
if b[last] == '\n' {
// to remove ',' and '\n' characters
b = b[:len(b)-2]
}
b = append(b, '\n')
b = e.encodeIndent(b, code.indent)
b = append(b, '}') b = append(b, '}')
} }
b = encodeIndentComma(b) b = encodeIndentComma(b)
@ -8745,9 +8845,14 @@ func (e *Encoder) runEscapedIndent(ctx *encodeRuntimeContext, b []byte, code *op
} else { } else {
last := len(b) - 1 last := len(b) - 1
if b[last-1] == '{' { if b[last-1] == '{' {
// doesn't exist any fields
b[last] = '}' b[last] = '}'
} else { } else {
if b[last] == '\n' {
// to remove ',' and '\n' characters
b = b[:len(b)-2]
}
b = append(b, '\n')
b = e.encodeIndent(b, code.indent)
b = append(b, '}') b = append(b, '}')
} }
b = encodeIndentComma(b) b = encodeIndentComma(b)
@ -8787,9 +8892,14 @@ func (e *Encoder) runEscapedIndent(ctx *encodeRuntimeContext, b []byte, code *op
} else { } else {
last := len(b) - 1 last := len(b) - 1
if b[last-1] == '{' { if b[last-1] == '{' {
// doesn't exist any fields
b[last] = '}' b[last] = '}'
} else { } else {
if b[last] == '\n' {
// to remove ',' and '\n' characters
b = b[:len(b)-2]
}
b = append(b, '\n')
b = e.encodeIndent(b, code.indent)
b = append(b, '}') b = append(b, '}')
} }
b = encodeIndentComma(b) b = encodeIndentComma(b)
@ -8837,9 +8947,14 @@ func (e *Encoder) runEscapedIndent(ctx *encodeRuntimeContext, b []byte, code *op
} else { } else {
last := len(b) - 1 last := len(b) - 1
if b[last-1] == '{' { if b[last-1] == '{' {
// doesn't exist any fields
b[last] = '}' b[last] = '}'
} else { } else {
if b[last] == '\n' {
// to remove ',' and '\n' characters
b = b[:len(b)-2]
}
b = append(b, '\n')
b = e.encodeIndent(b, code.indent)
b = append(b, '}') b = append(b, '}')
} }
b = encodeIndentComma(b) b = encodeIndentComma(b)
@ -8891,9 +9006,14 @@ func (e *Encoder) runEscapedIndent(ctx *encodeRuntimeContext, b []byte, code *op
} else { } else {
last := len(b) - 1 last := len(b) - 1
if b[last-1] == '{' { if b[last-1] == '{' {
// doesn't exist any fields
b[last] = '}' b[last] = '}'
} else { } else {
if b[last] == '\n' {
// to remove ',' and '\n' characters
b = b[:len(b)-2]
}
b = append(b, '\n')
b = e.encodeIndent(b, code.indent)
b = append(b, '}') b = append(b, '}')
} }
b = encodeIndentComma(b) b = encodeIndentComma(b)
@ -8938,9 +9058,14 @@ func (e *Encoder) runEscapedIndent(ctx *encodeRuntimeContext, b []byte, code *op
} else { } else {
last := len(b) - 1 last := len(b) - 1
if b[last-1] == '{' { if b[last-1] == '{' {
// doesn't exist any fields
b[last] = '}' b[last] = '}'
} else { } else {
if b[last] == '\n' {
// to remove ',' and '\n' characters
b = b[:len(b)-2]
}
b = append(b, '\n')
b = e.encodeIndent(b, code.indent)
b = append(b, '}') b = append(b, '}')
} }
b = encodeIndentComma(b) b = encodeIndentComma(b)
@ -8980,9 +9105,14 @@ func (e *Encoder) runEscapedIndent(ctx *encodeRuntimeContext, b []byte, code *op
} else { } else {
last := len(b) - 1 last := len(b) - 1
if b[last-1] == '{' { if b[last-1] == '{' {
// doesn't exist any fields
b[last] = '}' b[last] = '}'
} else { } else {
if b[last] == '\n' {
// to remove ',' and '\n' characters
b = b[:len(b)-2]
}
b = append(b, '\n')
b = e.encodeIndent(b, code.indent)
b = append(b, '}') b = append(b, '}')
} }
b = encodeIndentComma(b) b = encodeIndentComma(b)
@ -9017,8 +9147,22 @@ func (e *Encoder) runEscapedIndent(ctx *encodeRuntimeContext, b []byte, code *op
b = append(b, code.escapedKey...) b = append(b, code.escapedKey...)
b = append(b, ' ') b = append(b, ' ')
b = encodeBool(b, v) b = encodeBool(b, v)
}
b = e.appendStructEndIndent(b, code.indent-1) b = e.appendStructEndIndent(b, code.indent-1)
} else {
last := len(b) - 1
if b[last-1] == '{' {
b[last] = '}'
} else {
if b[last] == '\n' {
// to remove ',' and '\n' characters
b = b[:len(b)-2]
}
b = append(b, '\n')
b = e.encodeIndent(b, code.indent)
b = append(b, '}')
}
b = encodeIndentComma(b)
}
code = code.next code = code.next
case opStructEndStringTagBool: case opStructEndStringTagBool:
ptr := load(ctxptr, code.headIdx) ptr := load(ctxptr, code.headIdx)
@ -9045,8 +9189,22 @@ func (e *Encoder) runEscapedIndent(ctx *encodeRuntimeContext, b []byte, code *op
b = append(b, code.escapedKey...) b = append(b, code.escapedKey...)
b = append(b, ' ') b = append(b, ' ')
b = encodeByteSlice(b, v) b = encodeByteSlice(b, v)
}
b = e.appendStructEndIndent(b, code.indent-1) b = e.appendStructEndIndent(b, code.indent-1)
} else {
last := len(b) - 1
if b[last-1] == '{' {
b[last] = '}'
} else {
if b[last] == '\n' {
// to remove ',' and '\n' characters
b = b[:len(b)-2]
}
b = append(b, '\n')
b = e.encodeIndent(b, code.indent)
b = append(b, '}')
}
b = encodeIndentComma(b)
}
code = code.next code = code.next
case opStructEndStringTagBytes: case opStructEndStringTagBytes:
ptr := load(ctxptr, code.headIdx) ptr := load(ctxptr, code.headIdx)

View File

@ -7895,9 +7895,14 @@ func (e *Encoder) runIndent(ctx *encodeRuntimeContext, b []byte, code *opcode) (
} else { } else {
last := len(b) - 1 last := len(b) - 1
if b[last-1] == '{' { if b[last-1] == '{' {
// doesn't exist any fields
b[last] = '}' b[last] = '}'
} else { } else {
if b[last] == '\n' {
// to remove ',' and '\n' characters
b = b[:len(b)-2]
}
b = append(b, '\n')
b = e.encodeIndent(b, code.indent)
b = append(b, '}') b = append(b, '}')
} }
b = encodeIndentComma(b) b = encodeIndentComma(b)
@ -7937,9 +7942,14 @@ func (e *Encoder) runIndent(ctx *encodeRuntimeContext, b []byte, code *opcode) (
} else { } else {
last := len(b) - 1 last := len(b) - 1
if b[last-1] == '{' { if b[last-1] == '{' {
// doesn't exist any fields
b[last] = '}' b[last] = '}'
} else { } else {
if b[last] == '\n' {
// to remove ',' and '\n' characters
b = b[:len(b)-2]
}
b = append(b, '\n')
b = e.encodeIndent(b, code.indent)
b = append(b, '}') b = append(b, '}')
} }
b = encodeIndentComma(b) b = encodeIndentComma(b)
@ -7980,9 +7990,14 @@ func (e *Encoder) runIndent(ctx *encodeRuntimeContext, b []byte, code *opcode) (
} else { } else {
last := len(b) - 1 last := len(b) - 1
if b[last-1] == '{' { if b[last-1] == '{' {
// doesn't exist any fields
b[last] = '}' b[last] = '}'
} else { } else {
if b[last] == '\n' {
// to remove ',' and '\n' characters
b = b[:len(b)-2]
}
b = append(b, '\n')
b = e.encodeIndent(b, code.indent)
b = append(b, '}') b = append(b, '}')
} }
b = encodeIndentComma(b) b = encodeIndentComma(b)
@ -8022,9 +8037,14 @@ func (e *Encoder) runIndent(ctx *encodeRuntimeContext, b []byte, code *opcode) (
} else { } else {
last := len(b) - 1 last := len(b) - 1
if b[last-1] == '{' { if b[last-1] == '{' {
// doesn't exist any fields
b[last] = '}' b[last] = '}'
} else { } else {
if b[last] == '\n' {
// to remove ',' and '\n' characters
b = b[:len(b)-2]
}
b = append(b, '\n')
b = e.encodeIndent(b, code.indent)
b = append(b, '}') b = append(b, '}')
} }
b = encodeIndentComma(b) b = encodeIndentComma(b)
@ -8065,9 +8085,14 @@ func (e *Encoder) runIndent(ctx *encodeRuntimeContext, b []byte, code *opcode) (
} else { } else {
last := len(b) - 1 last := len(b) - 1
if b[last-1] == '{' { if b[last-1] == '{' {
// doesn't exist any fields
b[last] = '}' b[last] = '}'
} else { } else {
if b[last] == '\n' {
// to remove ',' and '\n' characters
b = b[:len(b)-2]
}
b = append(b, '\n')
b = e.encodeIndent(b, code.indent)
b = append(b, '}') b = append(b, '}')
} }
b = encodeIndentComma(b) b = encodeIndentComma(b)
@ -8107,9 +8132,14 @@ func (e *Encoder) runIndent(ctx *encodeRuntimeContext, b []byte, code *opcode) (
} else { } else {
last := len(b) - 1 last := len(b) - 1
if b[last-1] == '{' { if b[last-1] == '{' {
// doesn't exist any fields
b[last] = '}' b[last] = '}'
} else { } else {
if b[last] == '\n' {
// to remove ',' and '\n' characters
b = b[:len(b)-2]
}
b = append(b, '\n')
b = e.encodeIndent(b, code.indent)
b = append(b, '}') b = append(b, '}')
} }
b = encodeIndentComma(b) b = encodeIndentComma(b)
@ -8150,9 +8180,14 @@ func (e *Encoder) runIndent(ctx *encodeRuntimeContext, b []byte, code *opcode) (
} else { } else {
last := len(b) - 1 last := len(b) - 1
if b[last-1] == '{' { if b[last-1] == '{' {
// doesn't exist any fields
b[last] = '}' b[last] = '}'
} else { } else {
if b[last] == '\n' {
// to remove ',' and '\n' characters
b = b[:len(b)-2]
}
b = append(b, '\n')
b = e.encodeIndent(b, code.indent)
b = append(b, '}') b = append(b, '}')
} }
b = encodeIndentComma(b) b = encodeIndentComma(b)
@ -8192,9 +8227,14 @@ func (e *Encoder) runIndent(ctx *encodeRuntimeContext, b []byte, code *opcode) (
} else { } else {
last := len(b) - 1 last := len(b) - 1
if b[last-1] == '{' { if b[last-1] == '{' {
// doesn't exist any fields
b[last] = '}' b[last] = '}'
} else { } else {
if b[last] == '\n' {
// to remove ',' and '\n' characters
b = b[:len(b)-2]
}
b = append(b, '\n')
b = e.encodeIndent(b, code.indent)
b = append(b, '}') b = append(b, '}')
} }
b = encodeIndentComma(b) b = encodeIndentComma(b)
@ -8235,9 +8275,14 @@ func (e *Encoder) runIndent(ctx *encodeRuntimeContext, b []byte, code *opcode) (
} else { } else {
last := len(b) - 1 last := len(b) - 1
if b[last-1] == '{' { if b[last-1] == '{' {
// doesn't exist any fields
b[last] = '}' b[last] = '}'
} else { } else {
if b[last] == '\n' {
// to remove ',' and '\n' characters
b = b[:len(b)-2]
}
b = append(b, '\n')
b = e.encodeIndent(b, code.indent)
b = append(b, '}') b = append(b, '}')
} }
b = encodeIndentComma(b) b = encodeIndentComma(b)
@ -8277,9 +8322,14 @@ func (e *Encoder) runIndent(ctx *encodeRuntimeContext, b []byte, code *opcode) (
} else { } else {
last := len(b) - 1 last := len(b) - 1
if b[last-1] == '{' { if b[last-1] == '{' {
// doesn't exist any fields
b[last] = '}' b[last] = '}'
} else { } else {
if b[last] == '\n' {
// to remove ',' and '\n' characters
b = b[:len(b)-2]
}
b = append(b, '\n')
b = e.encodeIndent(b, code.indent)
b = append(b, '}') b = append(b, '}')
} }
b = encodeIndentComma(b) b = encodeIndentComma(b)
@ -8320,9 +8370,14 @@ func (e *Encoder) runIndent(ctx *encodeRuntimeContext, b []byte, code *opcode) (
} else { } else {
last := len(b) - 1 last := len(b) - 1
if b[last-1] == '{' { if b[last-1] == '{' {
// doesn't exist any fields
b[last] = '}' b[last] = '}'
} else { } else {
if b[last] == '\n' {
// to remove ',' and '\n' characters
b = b[:len(b)-2]
}
b = append(b, '\n')
b = e.encodeIndent(b, code.indent)
b = append(b, '}') b = append(b, '}')
} }
b = encodeIndentComma(b) b = encodeIndentComma(b)
@ -8362,9 +8417,14 @@ func (e *Encoder) runIndent(ctx *encodeRuntimeContext, b []byte, code *opcode) (
} else { } else {
last := len(b) - 1 last := len(b) - 1
if b[last-1] == '{' { if b[last-1] == '{' {
// doesn't exist any fields
b[last] = '}' b[last] = '}'
} else { } else {
if b[last] == '\n' {
// to remove ',' and '\n' characters
b = b[:len(b)-2]
}
b = append(b, '\n')
b = e.encodeIndent(b, code.indent)
b = append(b, '}') b = append(b, '}')
} }
b = encodeIndentComma(b) b = encodeIndentComma(b)
@ -8405,9 +8465,14 @@ func (e *Encoder) runIndent(ctx *encodeRuntimeContext, b []byte, code *opcode) (
} else { } else {
last := len(b) - 1 last := len(b) - 1
if b[last-1] == '{' { if b[last-1] == '{' {
// doesn't exist any fields
b[last] = '}' b[last] = '}'
} else { } else {
if b[last] == '\n' {
// to remove ',' and '\n' characters
b = b[:len(b)-2]
}
b = append(b, '\n')
b = e.encodeIndent(b, code.indent)
b = append(b, '}') b = append(b, '}')
} }
b = encodeIndentComma(b) b = encodeIndentComma(b)
@ -8447,9 +8512,14 @@ func (e *Encoder) runIndent(ctx *encodeRuntimeContext, b []byte, code *opcode) (
} else { } else {
last := len(b) - 1 last := len(b) - 1
if b[last-1] == '{' { if b[last-1] == '{' {
// doesn't exist any fields
b[last] = '}' b[last] = '}'
} else { } else {
if b[last] == '\n' {
// to remove ',' and '\n' characters
b = b[:len(b)-2]
}
b = append(b, '\n')
b = e.encodeIndent(b, code.indent)
b = append(b, '}') b = append(b, '}')
} }
b = encodeIndentComma(b) b = encodeIndentComma(b)
@ -8490,9 +8560,14 @@ func (e *Encoder) runIndent(ctx *encodeRuntimeContext, b []byte, code *opcode) (
} else { } else {
last := len(b) - 1 last := len(b) - 1
if b[last-1] == '{' { if b[last-1] == '{' {
// doesn't exist any fields
b[last] = '}' b[last] = '}'
} else { } else {
if b[last] == '\n' {
// to remove ',' and '\n' characters
b = b[:len(b)-2]
}
b = append(b, '\n')
b = e.encodeIndent(b, code.indent)
b = append(b, '}') b = append(b, '}')
} }
b = encodeIndentComma(b) b = encodeIndentComma(b)
@ -8532,9 +8607,14 @@ func (e *Encoder) runIndent(ctx *encodeRuntimeContext, b []byte, code *opcode) (
} else { } else {
last := len(b) - 1 last := len(b) - 1
if b[last-1] == '{' { if b[last-1] == '{' {
// doesn't exist any fields
b[last] = '}' b[last] = '}'
} else { } else {
if b[last] == '\n' {
// to remove ',' and '\n' characters
b = b[:len(b)-2]
}
b = append(b, '\n')
b = e.encodeIndent(b, code.indent)
b = append(b, '}') b = append(b, '}')
} }
b = encodeIndentComma(b) b = encodeIndentComma(b)
@ -8575,9 +8655,14 @@ func (e *Encoder) runIndent(ctx *encodeRuntimeContext, b []byte, code *opcode) (
} else { } else {
last := len(b) - 1 last := len(b) - 1
if b[last-1] == '{' { if b[last-1] == '{' {
// doesn't exist any fields
b[last] = '}' b[last] = '}'
} else { } else {
if b[last] == '\n' {
// to remove ',' and '\n' characters
b = b[:len(b)-2]
}
b = append(b, '\n')
b = e.encodeIndent(b, code.indent)
b = append(b, '}') b = append(b, '}')
} }
b = encodeIndentComma(b) b = encodeIndentComma(b)
@ -8617,9 +8702,14 @@ func (e *Encoder) runIndent(ctx *encodeRuntimeContext, b []byte, code *opcode) (
} else { } else {
last := len(b) - 1 last := len(b) - 1
if b[last-1] == '{' { if b[last-1] == '{' {
// doesn't exist any fields
b[last] = '}' b[last] = '}'
} else { } else {
if b[last] == '\n' {
// to remove ',' and '\n' characters
b = b[:len(b)-2]
}
b = append(b, '\n')
b = e.encodeIndent(b, code.indent)
b = append(b, '}') b = append(b, '}')
} }
b = encodeIndentComma(b) b = encodeIndentComma(b)
@ -8660,9 +8750,14 @@ func (e *Encoder) runIndent(ctx *encodeRuntimeContext, b []byte, code *opcode) (
} else { } else {
last := len(b) - 1 last := len(b) - 1
if b[last-1] == '{' { if b[last-1] == '{' {
// doesn't exist any fields
b[last] = '}' b[last] = '}'
} else { } else {
if b[last] == '\n' {
// to remove ',' and '\n' characters
b = b[:len(b)-2]
}
b = append(b, '\n')
b = e.encodeIndent(b, code.indent)
b = append(b, '}') b = append(b, '}')
} }
b = encodeIndentComma(b) b = encodeIndentComma(b)
@ -8702,9 +8797,14 @@ func (e *Encoder) runIndent(ctx *encodeRuntimeContext, b []byte, code *opcode) (
} else { } else {
last := len(b) - 1 last := len(b) - 1
if b[last-1] == '{' { if b[last-1] == '{' {
// doesn't exist any fields
b[last] = '}' b[last] = '}'
} else { } else {
if b[last] == '\n' {
// to remove ',' and '\n' characters
b = b[:len(b)-2]
}
b = append(b, '\n')
b = e.encodeIndent(b, code.indent)
b = append(b, '}') b = append(b, '}')
} }
b = encodeIndentComma(b) b = encodeIndentComma(b)
@ -8745,9 +8845,14 @@ func (e *Encoder) runIndent(ctx *encodeRuntimeContext, b []byte, code *opcode) (
} else { } else {
last := len(b) - 1 last := len(b) - 1
if b[last-1] == '{' { if b[last-1] == '{' {
// doesn't exist any fields
b[last] = '}' b[last] = '}'
} else { } else {
if b[last] == '\n' {
// to remove ',' and '\n' characters
b = b[:len(b)-2]
}
b = append(b, '\n')
b = e.encodeIndent(b, code.indent)
b = append(b, '}') b = append(b, '}')
} }
b = encodeIndentComma(b) b = encodeIndentComma(b)
@ -8787,9 +8892,14 @@ func (e *Encoder) runIndent(ctx *encodeRuntimeContext, b []byte, code *opcode) (
} else { } else {
last := len(b) - 1 last := len(b) - 1
if b[last-1] == '{' { if b[last-1] == '{' {
// doesn't exist any fields
b[last] = '}' b[last] = '}'
} else { } else {
if b[last] == '\n' {
// to remove ',' and '\n' characters
b = b[:len(b)-2]
}
b = append(b, '\n')
b = e.encodeIndent(b, code.indent)
b = append(b, '}') b = append(b, '}')
} }
b = encodeIndentComma(b) b = encodeIndentComma(b)
@ -8837,9 +8947,14 @@ func (e *Encoder) runIndent(ctx *encodeRuntimeContext, b []byte, code *opcode) (
} else { } else {
last := len(b) - 1 last := len(b) - 1
if b[last-1] == '{' { if b[last-1] == '{' {
// doesn't exist any fields
b[last] = '}' b[last] = '}'
} else { } else {
if b[last] == '\n' {
// to remove ',' and '\n' characters
b = b[:len(b)-2]
}
b = append(b, '\n')
b = e.encodeIndent(b, code.indent)
b = append(b, '}') b = append(b, '}')
} }
b = encodeIndentComma(b) b = encodeIndentComma(b)
@ -8891,9 +9006,14 @@ func (e *Encoder) runIndent(ctx *encodeRuntimeContext, b []byte, code *opcode) (
} else { } else {
last := len(b) - 1 last := len(b) - 1
if b[last-1] == '{' { if b[last-1] == '{' {
// doesn't exist any fields
b[last] = '}' b[last] = '}'
} else { } else {
if b[last] == '\n' {
// to remove ',' and '\n' characters
b = b[:len(b)-2]
}
b = append(b, '\n')
b = e.encodeIndent(b, code.indent)
b = append(b, '}') b = append(b, '}')
} }
b = encodeIndentComma(b) b = encodeIndentComma(b)
@ -8938,9 +9058,14 @@ func (e *Encoder) runIndent(ctx *encodeRuntimeContext, b []byte, code *opcode) (
} else { } else {
last := len(b) - 1 last := len(b) - 1
if b[last-1] == '{' { if b[last-1] == '{' {
// doesn't exist any fields
b[last] = '}' b[last] = '}'
} else { } else {
if b[last] == '\n' {
// to remove ',' and '\n' characters
b = b[:len(b)-2]
}
b = append(b, '\n')
b = e.encodeIndent(b, code.indent)
b = append(b, '}') b = append(b, '}')
} }
b = encodeIndentComma(b) b = encodeIndentComma(b)
@ -8980,9 +9105,14 @@ func (e *Encoder) runIndent(ctx *encodeRuntimeContext, b []byte, code *opcode) (
} else { } else {
last := len(b) - 1 last := len(b) - 1
if b[last-1] == '{' { if b[last-1] == '{' {
// doesn't exist any fields
b[last] = '}' b[last] = '}'
} else { } else {
if b[last] == '\n' {
// to remove ',' and '\n' characters
b = b[:len(b)-2]
}
b = append(b, '\n')
b = e.encodeIndent(b, code.indent)
b = append(b, '}') b = append(b, '}')
} }
b = encodeIndentComma(b) b = encodeIndentComma(b)
@ -9017,8 +9147,22 @@ func (e *Encoder) runIndent(ctx *encodeRuntimeContext, b []byte, code *opcode) (
b = append(b, code.key...) b = append(b, code.key...)
b = append(b, ' ') b = append(b, ' ')
b = encodeBool(b, v) b = encodeBool(b, v)
}
b = e.appendStructEndIndent(b, code.indent-1) b = e.appendStructEndIndent(b, code.indent-1)
} else {
last := len(b) - 1
if b[last-1] == '{' {
b[last] = '}'
} else {
if b[last] == '\n' {
// to remove ',' and '\n' characters
b = b[:len(b)-2]
}
b = append(b, '\n')
b = e.encodeIndent(b, code.indent)
b = append(b, '}')
}
b = encodeIndentComma(b)
}
code = code.next code = code.next
case opStructEndStringTagBool: case opStructEndStringTagBool:
ptr := load(ctxptr, code.headIdx) ptr := load(ctxptr, code.headIdx)
@ -9045,8 +9189,22 @@ func (e *Encoder) runIndent(ctx *encodeRuntimeContext, b []byte, code *opcode) (
b = append(b, code.key...) b = append(b, code.key...)
b = append(b, ' ') b = append(b, ' ')
b = encodeByteSlice(b, v) b = encodeByteSlice(b, v)
}
b = e.appendStructEndIndent(b, code.indent-1) b = e.appendStructEndIndent(b, code.indent-1)
} else {
last := len(b) - 1
if b[last-1] == '{' {
b[last] = '}'
} else {
if b[last] == '\n' {
// to remove ',' and '\n' characters
b = b[:len(b)-2]
}
b = append(b, '\n')
b = e.encodeIndent(b, code.indent)
b = append(b, '}')
}
b = encodeIndentComma(b)
}
code = code.next code = code.next
case opStructEndStringTagBytes: case opStructEndStringTagBytes:
ptr := load(ctxptr, code.headIdx) ptr := load(ctxptr, code.headIdx)