This commit is contained in:
Masaaki Goshima 2021-03-10 19:27:37 +09:00
parent d0fb2a9a4e
commit 55cfca3b0a
7 changed files with 343 additions and 258 deletions

View File

@ -367,8 +367,18 @@ func appendIndent(ctx *encodeRuntimeContext, b []byte, indent int) []byte {
return append(b, bytes.Repeat(ctx.indentStr, ctx.baseIndent+indent)...)
}
func encodeMarshalJSON(b []byte, v interface{}) ([]byte, error) {
v = reflect.ValueOf(v).Interface() // convert by dynamic interface type
func encodeMarshalJSON(code *opcode, b []byte, v interface{}, escape bool) ([]byte, error) {
rv := reflect.ValueOf(v) // convert by dynamic interface type
if code.addrForMarshaler {
if rv.CanAddr() {
rv = rv.Addr()
} else {
newV := reflect.New(rv.Type())
newV.Elem().Set(rv)
rv = newV
}
}
v = rv.Interface()
marshaler, ok := v.(Marshaler)
if !ok {
return encodeNull(b), nil
@ -385,14 +395,24 @@ func encodeMarshalJSON(b []byte, v interface{}) ([]byte, error) {
}
buf := bytes.NewBuffer(b)
//TODO: we should validate buffer with `compact`
if err := compact(buf, bb, false); err != nil {
if err := compact(buf, bb, escape); err != nil {
return nil, err
}
return buf.Bytes(), nil
}
func encodeMarshalJSONIndent(ctx *encodeRuntimeContext, b []byte, v interface{}, indent int) ([]byte, error) {
v = reflect.ValueOf(v).Interface() // convert by dynamic interface type
func encodeMarshalJSONIndent(ctx *encodeRuntimeContext, code *opcode, b []byte, v interface{}, indent int, escape bool) ([]byte, error) {
rv := reflect.ValueOf(v) // convert by dynamic interface type
if code.addrForMarshaler {
if rv.CanAddr() {
rv = rv.Addr()
} else {
newV := reflect.New(rv.Type())
newV.Elem().Set(rv)
rv = newV
}
}
v = rv.Interface()
marshaler, ok := v.(Marshaler)
if !ok {
return encodeNull(b), nil
@ -408,7 +428,7 @@ func encodeMarshalJSONIndent(ctx *encodeRuntimeContext, b []byte, v interface{},
)
}
var compactBuf bytes.Buffer
if err := compact(&compactBuf, bb, false); err != nil {
if err := compact(&compactBuf, bb, escape); err != nil {
return nil, err
}
var indentBuf bytes.Buffer
@ -423,8 +443,18 @@ func encodeMarshalJSONIndent(ctx *encodeRuntimeContext, b []byte, v interface{},
return append(b, indentBuf.Bytes()...), nil
}
func encodeMarshalText(b []byte, v interface{}) ([]byte, error) {
v = reflect.ValueOf(v).Interface() // convert by dynamic interface type
func encodeMarshalText(code *opcode, b []byte, v interface{}, escape bool) ([]byte, error) {
rv := reflect.ValueOf(v) // convert by dynamic interface type
if code.addrForMarshaler {
if rv.CanAddr() {
rv = rv.Addr()
} else {
newV := reflect.New(rv.Type())
newV.Elem().Set(rv)
rv = newV
}
}
v = rv.Interface()
marshaler, ok := v.(encoding.TextMarshaler)
if !ok {
return encodeNull(b), nil
@ -433,11 +463,24 @@ func encodeMarshalText(b []byte, v interface{}) ([]byte, error) {
if err != nil {
return nil, &MarshalerError{Type: reflect.TypeOf(v), Err: err}
}
if escape {
return encodeEscapedString(b, *(*string)(unsafe.Pointer(&bytes))), nil
}
return encodeNoEscapedString(b, *(*string)(unsafe.Pointer(&bytes))), nil
}
func encodeMarshalTextIndent(b []byte, v interface{}) ([]byte, error) {
v = reflect.ValueOf(v).Interface() // convert by dynamic interface type
func encodeMarshalTextIndent(code *opcode, b []byte, v interface{}, escape bool) ([]byte, error) {
rv := reflect.ValueOf(v) // convert by dynamic interface type
if code.addrForMarshaler {
if rv.CanAddr() {
rv = rv.Addr()
} else {
newV := reflect.New(rv.Type())
newV.Elem().Set(rv)
rv = newV
}
}
v = rv.Interface()
marshaler, ok := v.(encoding.TextMarshaler)
if !ok {
return encodeNull(b), nil
@ -446,5 +489,8 @@ func encodeMarshalTextIndent(b []byte, v interface{}) ([]byte, error) {
if err != nil {
return nil, &MarshalerError{Type: reflect.TypeOf(v), Err: err}
}
if escape {
return encodeEscapedString(b, *(*string)(unsafe.Pointer(&bytes))), nil
}
return encodeNoEscapedString(b, *(*string)(unsafe.Pointer(&bytes))), nil
}

View File

@ -810,8 +810,6 @@ func encodeTypeToFieldType(ctx *encodeCompileContext, code *opcode) opType {
case opSlicePtr:
code.op = opSlice
return opStructFieldSlicePtr
case opStructFieldHead:
return opStructFieldStruct
case opMarshalJSON:
return opStructFieldMarshalJSON
case opMarshalJSONPtr:
@ -820,6 +818,8 @@ func encodeTypeToFieldType(ctx *encodeCompileContext, code *opcode) opType {
return opStructFieldMarshalText
case opMarshalTextPtr:
return opStructFieldMarshalTextPtr
case opStructFieldRecursive:
return opStructFieldRecursive
}
return opStructField
}
@ -914,6 +914,7 @@ func encodeStructField(ctx *encodeCompileContext, fieldCode *opcode, valueCode *
fieldCode.ptrNum = valueCode.ptrNum
fieldCode.mask = valueCode.mask
fieldCode.rshiftNum = valueCode.rshiftNum
fieldCode.jmp = valueCode.jmp
switch op {
case opStructField,
opStructFieldSlice,
@ -949,6 +950,12 @@ func encodeIsNotExistsField(head *opcode) bool {
if head == nil {
return false
}
if head.op != opStructFieldHead {
return false
}
if !head.anonymousHead {
return false
}
if head.next == nil {
return false
}
@ -1008,8 +1015,18 @@ func encodeAnonymousStructFieldPairMap(tags structTags, named string, valueCode
removedFields := map[*opcode]struct{}{}
for {
existsKey := tags.existsKey(f.displayKey)
if existsKey && (f.next.op == opStructFieldPtrHeadRecursive || f.next.op == opStructFieldHeadRecursive) {
isHeadOp := strings.Contains(f.op.String(), "Head")
if existsKey && strings.Contains(f.op.String(), "Recursive") {
// through
} else if isHeadOp && !f.anonymousHead {
if existsKey {
// TODO: need to remove this head
f.op = opStructFieldHead
f.anonymousKey = true
f.anonymousHead = true
} else if named == "" {
f.anonymousHead = true
}
} else if named == "" && f.op == opStructEnd {
f.op = opStructAnonymousEnd
} else if existsKey {
@ -1054,7 +1071,7 @@ func encodeAnonymousFieldPairRecursively(named string, valueCode *opcode) map[st
f := valueCode
var prevAnonymousField *opcode
for {
if f.displayKey != "" && strings.Contains(f.op.String(), "Anonymous") {
if f.displayKey != "" && f.anonymousHead {
key := fmt.Sprintf("%s.%s", named, f.displayKey)
anonymousFields[key] = append(anonymousFields[key], structFieldPair{
prevField: prevAnonymousField,
@ -1092,6 +1109,8 @@ func encodeOptimizeConflictAnonymousFields(anonymousFields map[string][]structFi
if fieldPair.prevField == nil {
// head operation
fieldPair.curField.op = opStructFieldHead
fieldPair.curField.anonymousHead = true
fieldPair.curField.anonymousKey = true
} else {
diff := fieldPair.curField.nextField.displayIdx - fieldPair.curField.displayIdx
for i := 0; i < diff; i++ {
@ -1110,6 +1129,8 @@ func encodeOptimizeConflictAnonymousFields(anonymousFields map[string][]structFi
if fieldPair.prevField == nil {
// head operation
fieldPair.curField.op = opStructFieldHead
fieldPair.curField.anonymousHead = true
fieldPair.curField.anonymousKey = true
} else {
diff := fieldPair.curField.nextField.displayIdx - fieldPair.curField.displayIdx
removedFields[fieldPair.curField] = struct{}{}
@ -1169,8 +1190,8 @@ func encodeCompileStruct(ctx *encodeCompileContext, isPtr bool) (*opcode, error)
ctx.incIndex()
nilcheck := true
var valueCode *opcode
fmt.Println("fieldType.Kind() = ", fieldType.Kind())
isNilValue := fieldType.Kind() == reflect.Ptr || fieldType.Kind() == reflect.Interface
addrForMarshaler := false
if i == 0 && fieldNum == 1 && isPtr && !isNilValue && rtype_ptrTo(fieldType).Implements(marshalJSONType) && !fieldType.Implements(marshalJSONType) {
// *struct{ field T } => struct { field *T }
// func (*T) MarshalJSON() ([]byte, error)
@ -1198,19 +1219,21 @@ func encodeCompileStruct(ctx *encodeCompileContext, isPtr bool) (*opcode, error)
} else if isPtr && !isNilValue && !fieldType.Implements(marshalJSONType) && rtype_ptrTo(fieldType).Implements(marshalJSONType) {
// *struct{ field T }
// func (*T) MarshalJSON() ([]byte, error)
code, err := encodeCompileMarshalJSON(ctx.withType(rtype_ptrTo(fieldType)))
code, err := encodeCompileMarshalJSON(ctx.withType(fieldType))
if err != nil {
return nil, err
}
addrForMarshaler = true
nilcheck = false
valueCode = code
} else if isPtr && !isNilValue && !fieldType.Implements(marshalTextType) && rtype_ptrTo(fieldType).Implements(marshalTextType) {
// *struct{ field T }
// func (*T) MarshalText() ([]byte, error)
code, err := encodeCompileMarshalText(ctx.withType(rtype_ptrTo(fieldType)))
code, err := encodeCompileMarshalText(ctx.withType(fieldType))
if err != nil {
return nil, err
}
addrForMarshaler = true
nilcheck = false
valueCode = code
} else if fieldType.Implements(marshalJSONType) && fieldType.Kind() != reflect.Ptr {
@ -1259,9 +1282,6 @@ func encodeCompileStruct(ctx *encodeCompileContext, isPtr bool) (*opcode, error)
for k, v := range encodeAnonymousStructFieldPairMap(tags, tagKey, valueCode) {
anonymousFields[k] = append(anonymousFields[k], v...)
}
}
if field.Anonymous {
valueCode.anonymousHead = true
valueCode.decIndent()
}
key := fmt.Sprintf(`"%s":`, tag.key)
@ -1281,6 +1301,7 @@ func encodeCompileStruct(ctx *encodeCompileContext, isPtr bool) (*opcode, error)
offset: field.Offset,
indirect: indirect,
nilcheck: nilcheck,
addrForMarshaler: addrForMarshaler,
}
if fieldIdx == 0 {
fieldCode.headIdx = fieldCode.idx

View File

@ -22,6 +22,7 @@ type opcode struct {
root bool // whether root
indirect bool // whether indirect or not
nilcheck bool // whether needs to nilcheck or not
addrForMarshaler bool // whether needs to addr for marshaler or not
rshiftNum uint8 // use to take bit for judging whether negative integer or not
mask uint64 // mask for number
indent int // indent number
@ -97,6 +98,7 @@ func (c *opcode) copy(codeMap map[uintptr]*opcode) *opcode {
root: c.root,
indirect: c.indirect,
nilcheck: c.nilcheck,
addrForMarshaler: c.addrForMarshaler,
indent: c.indent,
idx: c.idx,
headIdx: c.headIdx,

View File

@ -1,12 +1,9 @@
package json
import (
"bytes"
"encoding"
"fmt"
"math"
"reflect"
"runtime"
"sort"
"strconv"
"strings"
@ -75,7 +72,6 @@ func encodeRun(ctx *encodeRuntimeContext, b []byte, codeSet *opcodeSet, opt Enco
ptrOffset := uintptr(0)
ctxptr := ctx.ptr()
code := codeSet.code
//fmt.Println(code.dump())
for {
switch code.op {
@ -191,52 +187,43 @@ func encodeRun(ctx *encodeRuntimeContext, b []byte, codeSet *opcodeSet, opt Enco
b = bb
code = code.next
case opMarshalJSON:
ptr := load(ctxptr, code.idx)
if ptr == 0 {
p := load(ctxptr, code.idx)
if p == 0 {
b = encodeNull(b)
b = encodeComma(b)
code = code.next
break
}
v := ptrToInterface(code, ptr)
bb, err := v.(Marshaler).MarshalJSON()
bb, err := encodeMarshalJSON(code, b, ptrToInterface(code, p), false)
if err != nil {
return nil, errMarshaler(code, err)
}
runtime.KeepAlive(v)
if len(bb) == 0 {
return nil, errUnexpectedEndOfJSON(
fmt.Sprintf("error calling MarshalJSON for type %s", code.typ),
0,
)
}
buf := bytes.NewBuffer(b)
//TODO: we should validate buffer with `compact`
if err := compact(buf, bb, false); err != nil {
return nil, err
}
b = buf.Bytes()
b = encodeComma(b)
b = encodeComma(bb)
code = code.next
case opMarshalText:
ptr := load(ctxptr, code.idx)
isPtr := code.typ.Kind() == reflect.Ptr
p := ptrToUnsafePtr(ptr)
if p == nil || isPtr && *(*unsafe.Pointer)(p) == nil {
b = append(b, '"', '"', ',')
} else {
v := *(*interface{})(unsafe.Pointer(&interfaceHeader{
typ: code.typ,
ptr: p,
}))
bytes, err := v.(encoding.TextMarshaler).MarshalText()
if err != nil {
return nil, errMarshaler(code, err)
}
b = encodeNoEscapedString(b, *(*string)(unsafe.Pointer(&bytes)))
p := load(ctxptr, code.idx)
if p == 0 {
b = append(b, `""`...)
b = encodeComma(b)
}
code = code.next
break
}
bb, err := encodeMarshalText(code, b, ptrToInterface(code, p), false)
if err != nil {
return nil, err
}
b = encodeComma(bb)
code = code.next
case opSlicePtr:
p := load(ctxptr, code.idx)
if p == 0 {
b = encodeNull(b)
b = encodeComma(b)
code = code.end.next
break
}
store(ctxptr, code.idx, ptrToPtr(p))
fallthrough
case opSlice:
p := load(ctxptr, code.idx)
slice := ptrToSlice(p)
@ -244,7 +231,8 @@ func encodeRun(ctx *encodeRuntimeContext, b []byte, codeSet *opcodeSet, opt Enco
b = encodeNull(b)
b = encodeComma(b)
code = code.end.next
} else {
break
}
store(ctxptr, code.elemIdx, 0)
store(ctxptr, code.length, uintptr(slice.len))
store(ctxptr, code.idx, uintptr(slice.data))
@ -256,7 +244,6 @@ func encodeRun(ctx *encodeRuntimeContext, b []byte, codeSet *opcodeSet, opt Enco
b = append(b, '[', ']', ',')
code = code.end.next
}
}
case opSliceElem:
idx := load(ctxptr, code.elemIdx)
length := load(ctxptr, code.length)
@ -305,14 +292,25 @@ func encodeRun(ctx *encodeRuntimeContext, b []byte, codeSet *opcodeSet, opt Enco
b = encodeComma(b)
code = code.end.next
}
case opMap:
ptr := load(ctxptr, code.idx)
if ptr == 0 {
case opMapPtr:
p := load(ctxptr, code.idx)
if p == 0 {
b = encodeNull(b)
b = encodeComma(b)
code = code.end.next
} else {
uptr := ptrToUnsafePtr(ptr)
break
}
store(ctxptr, code.idx, ptrToPtr(p))
fallthrough
case opMap:
p := load(ctxptr, code.idx)
if p == 0 {
b = encodeNull(b)
b = encodeComma(b)
code = code.end.next
break
}
uptr := ptrToUnsafePtr(p)
mlen := maplen(uptr)
if mlen > 0 {
b = append(b, '{')
@ -334,7 +332,6 @@ func encodeRun(ctx *encodeRuntimeContext, b []byte, codeSet *opcodeSet, opt Enco
b = append(b, '{', '}', ',')
code = code.end.next
}
}
case opMapKey:
idx := load(ctxptr, code.elemIdx)
length := load(ctxptr, code.length)
@ -2174,7 +2171,7 @@ func encodeRun(ctx *encodeRuntimeContext, b []byte, codeSet *opcodeSet, opt Enco
if code.nilcheck && p == 0 {
b = encodeNull(b)
} else {
bb, err := encodeMarshalJSON(b, ptrToInterface(code, p))
bb, err := encodeMarshalJSON(code, b, ptrToInterface(code, p), false)
if err != nil {
return nil, err
}
@ -2218,7 +2215,7 @@ func encodeRun(ctx *encodeRuntimeContext, b []byte, codeSet *opcodeSet, opt Enco
if code.nilcheck && p == 0 {
b = encodeNull(b)
} else {
bb, err := encodeMarshalJSON(b, ptrToInterface(code, p))
bb, err := encodeMarshalJSON(code, b, ptrToInterface(code, p), false)
if err != nil {
return nil, err
}
@ -2262,7 +2259,7 @@ func encodeRun(ctx *encodeRuntimeContext, b []byte, codeSet *opcodeSet, opt Enco
code = code.nextField
} else {
b = append(b, code.key...)
bb, err := encodeMarshalJSON(b, ptrToInterface(code, p))
bb, err := encodeMarshalJSON(code, b, ptrToInterface(code, p), false)
if err != nil {
return nil, err
}
@ -2302,7 +2299,7 @@ func encodeRun(ctx *encodeRuntimeContext, b []byte, codeSet *opcodeSet, opt Enco
if p == 0 {
b = encodeNull(b)
} else {
bb, err := encodeMarshalJSON(b, ptrToInterface(code, p))
bb, err := encodeMarshalJSON(code, b, ptrToInterface(code, p), false)
if err != nil {
return nil, err
}
@ -2342,7 +2339,7 @@ func encodeRun(ctx *encodeRuntimeContext, b []byte, codeSet *opcodeSet, opt Enco
code = code.nextField
} else {
b = append(b, code.key...)
bb, err := encodeMarshalJSON(b, ptrToInterface(code, p))
bb, err := encodeMarshalJSON(code, b, ptrToInterface(code, p), false)
if err != nil {
return nil, err
}
@ -2386,7 +2383,7 @@ func encodeRun(ctx *encodeRuntimeContext, b []byte, codeSet *opcodeSet, opt Enco
if code.nilcheck && p == 0 {
b = encodeNull(b)
} else {
bb, err := encodeMarshalText(b, ptrToInterface(code, p))
bb, err := encodeMarshalText(code, b, ptrToInterface(code, p), false)
if err != nil {
return nil, err
}
@ -2430,7 +2427,7 @@ func encodeRun(ctx *encodeRuntimeContext, b []byte, codeSet *opcodeSet, opt Enco
if code.nilcheck && p == 0 {
b = encodeNull(b)
} else {
bb, err := encodeMarshalText(b, ptrToInterface(code, p))
bb, err := encodeMarshalText(code, b, ptrToInterface(code, p), false)
if err != nil {
return nil, err
}
@ -2474,7 +2471,7 @@ func encodeRun(ctx *encodeRuntimeContext, b []byte, codeSet *opcodeSet, opt Enco
code = code.nextField
} else {
b = append(b, code.key...)
bb, err := encodeMarshalText(b, ptrToInterface(code, p))
bb, err := encodeMarshalText(code, b, ptrToInterface(code, p), false)
if err != nil {
return nil, err
}
@ -2514,7 +2511,7 @@ func encodeRun(ctx *encodeRuntimeContext, b []byte, codeSet *opcodeSet, opt Enco
if p == 0 {
b = encodeNull(b)
} else {
bb, err := encodeMarshalText(b, ptrToInterface(code, p))
bb, err := encodeMarshalText(code, b, ptrToInterface(code, p), false)
if err != nil {
return nil, err
}
@ -2554,7 +2551,7 @@ func encodeRun(ctx *encodeRuntimeContext, b []byte, codeSet *opcodeSet, opt Enco
code = code.nextField
} else {
b = append(b, code.key...)
bb, err := encodeMarshalText(b, ptrToInterface(code, p))
bb, err := encodeMarshalText(code, b, ptrToInterface(code, p), false)
if err != nil {
return nil, err
}
@ -3008,7 +3005,7 @@ func encodeRun(ctx *encodeRuntimeContext, b []byte, codeSet *opcodeSet, opt Enco
if p == 0 && code.nilcheck {
b = encodeNull(b)
} else {
bb, err := encodeMarshalJSON(b, ptrToInterface(code, p))
bb, err := encodeMarshalJSON(code, b, ptrToInterface(code, p), false)
if err != nil {
return nil, err
}
@ -3027,7 +3024,7 @@ func encodeRun(ctx *encodeRuntimeContext, b []byte, codeSet *opcodeSet, opt Enco
break
}
b = append(b, code.key...)
bb, err := encodeMarshalJSON(b, ptrToInterface(code, p))
bb, err := encodeMarshalJSON(code, b, ptrToInterface(code, p), false)
if err != nil {
return nil, err
}
@ -3040,7 +3037,7 @@ func encodeRun(ctx *encodeRuntimeContext, b []byte, codeSet *opcodeSet, opt Enco
if p == 0 {
b = encodeNull(b)
} else {
bb, err := encodeMarshalJSON(b, ptrToInterface(code, p))
bb, err := encodeMarshalJSON(code, b, ptrToInterface(code, p), false)
if err != nil {
return nil, err
}
@ -3053,7 +3050,7 @@ func encodeRun(ctx *encodeRuntimeContext, b []byte, codeSet *opcodeSet, opt Enco
p = ptrToPtr(p + code.offset)
if p != 0 {
b = append(b, code.key...)
bb, err := encodeMarshalJSON(b, ptrToInterface(code, p))
bb, err := encodeMarshalJSON(code, b, ptrToInterface(code, p), false)
if err != nil {
return nil, err
}
@ -3070,7 +3067,7 @@ func encodeRun(ctx *encodeRuntimeContext, b []byte, codeSet *opcodeSet, opt Enco
if p == 0 && code.nilcheck {
b = encodeNull(b)
} else {
bb, err := encodeMarshalText(b, ptrToInterface(code, p))
bb, err := encodeMarshalText(code, b, ptrToInterface(code, p), false)
if err != nil {
return nil, err
}
@ -3089,7 +3086,7 @@ func encodeRun(ctx *encodeRuntimeContext, b []byte, codeSet *opcodeSet, opt Enco
break
}
b = append(b, code.key...)
bb, err := encodeMarshalText(b, ptrToInterface(code, p))
bb, err := encodeMarshalText(code, b, ptrToInterface(code, p), false)
if err != nil {
return nil, err
}
@ -3102,7 +3099,7 @@ func encodeRun(ctx *encodeRuntimeContext, b []byte, codeSet *opcodeSet, opt Enco
if p == 0 {
b = encodeNull(b)
} else {
bb, err := encodeMarshalText(b, ptrToInterface(code, p))
bb, err := encodeMarshalText(code, b, ptrToInterface(code, p), false)
if err != nil {
return nil, err
}
@ -3115,7 +3112,7 @@ func encodeRun(ctx *encodeRuntimeContext, b []byte, codeSet *opcodeSet, opt Enco
p = ptrToPtr(p + code.offset)
if p != 0 {
b = append(b, code.key...)
bb, err := encodeMarshalText(b, ptrToInterface(code, p))
bb, err := encodeMarshalText(code, b, ptrToInterface(code, p), false)
if err != nil {
return nil, err
}

View File

@ -14,7 +14,7 @@ func encodeRunEscaped(ctx *encodeRuntimeContext, b []byte, codeSet *opcodeSet, o
ptrOffset := uintptr(0)
ctxptr := ctx.ptr()
code := codeSet.code
fmt.Println(code.dump())
//fmt.Println(code.dump())
for {
switch code.op {
@ -157,7 +157,7 @@ func encodeRunEscaped(ctx *encodeRuntimeContext, b []byte, codeSet *opcodeSet, o
code = code.next
break
}
bb, err := encodeMarshalJSON(b, ptrToInterface(code, p))
bb, err := encodeMarshalJSON(code, b, ptrToInterface(code, p), true)
if err != nil {
return nil, err
}
@ -180,12 +180,22 @@ func encodeRunEscaped(ctx *encodeRuntimeContext, b []byte, codeSet *opcodeSet, o
code = code.next
break
}
bb, err := encodeMarshalText(b, ptrToInterface(code, p))
bb, err := encodeMarshalText(code, b, ptrToInterface(code, p), true)
if err != nil {
return nil, err
}
b = encodeComma(bb)
code = code.next
case opSlicePtr:
p := load(ctxptr, code.idx)
if p == 0 {
b = encodeNull(b)
b = encodeComma(b)
code = code.end.next
break
}
store(ctxptr, code.idx, ptrToPtr(p))
fallthrough
case opSlice:
p := load(ctxptr, code.idx)
slice := ptrToSlice(p)
@ -193,7 +203,8 @@ func encodeRunEscaped(ctx *encodeRuntimeContext, b []byte, codeSet *opcodeSet, o
b = encodeNull(b)
b = encodeComma(b)
code = code.end.next
} else {
break
}
store(ctxptr, code.elemIdx, 0)
store(ctxptr, code.length, uintptr(slice.len))
store(ctxptr, code.idx, uintptr(slice.data))
@ -205,7 +216,6 @@ func encodeRunEscaped(ctx *encodeRuntimeContext, b []byte, codeSet *opcodeSet, o
b = append(b, '[', ']', ',')
code = code.end.next
}
}
case opSliceElem:
idx := load(ctxptr, code.elemIdx)
length := load(ctxptr, code.length)
@ -254,14 +264,25 @@ func encodeRunEscaped(ctx *encodeRuntimeContext, b []byte, codeSet *opcodeSet, o
b = encodeComma(b)
code = code.end.next
}
case opMap:
ptr := load(ctxptr, code.idx)
if ptr == 0 {
case opMapPtr:
p := load(ctxptr, code.idx)
if p == 0 {
b = encodeNull(b)
b = encodeComma(b)
code = code.end.next
} else {
uptr := ptrToUnsafePtr(ptr)
break
}
store(ctxptr, code.idx, ptrToPtr(p))
fallthrough
case opMap:
p := load(ctxptr, code.idx)
if p == 0 {
b = encodeNull(b)
b = encodeComma(b)
code = code.end.next
break
}
uptr := ptrToUnsafePtr(p)
mlen := maplen(uptr)
if mlen > 0 {
b = append(b, '{')
@ -283,7 +304,6 @@ func encodeRunEscaped(ctx *encodeRuntimeContext, b []byte, codeSet *opcodeSet, o
b = append(b, '{', '}', ',')
code = code.end.next
}
}
case opMapKey:
idx := load(ctxptr, code.elemIdx)
length := load(ctxptr, code.length)
@ -2137,7 +2157,7 @@ func encodeRunEscaped(ctx *encodeRuntimeContext, b []byte, codeSet *opcodeSet, o
if code.nilcheck && p == 0 {
b = encodeNull(b)
} else {
bb, err := encodeMarshalJSON(b, ptrToInterface(code, p))
bb, err := encodeMarshalJSON(code, b, ptrToInterface(code, p), true)
if err != nil {
return nil, err
}
@ -2181,7 +2201,7 @@ func encodeRunEscaped(ctx *encodeRuntimeContext, b []byte, codeSet *opcodeSet, o
if code.nilcheck && p == 0 {
b = encodeNull(b)
} else {
bb, err := encodeMarshalJSON(b, ptrToInterface(code, p))
bb, err := encodeMarshalJSON(code, b, ptrToInterface(code, p), true)
if err != nil {
return nil, err
}
@ -2225,7 +2245,7 @@ func encodeRunEscaped(ctx *encodeRuntimeContext, b []byte, codeSet *opcodeSet, o
code = code.nextField
} else {
b = append(b, code.escapedKey...)
bb, err := encodeMarshalJSON(b, ptrToInterface(code, p))
bb, err := encodeMarshalJSON(code, b, ptrToInterface(code, p), true)
if err != nil {
return nil, err
}
@ -2265,7 +2285,7 @@ func encodeRunEscaped(ctx *encodeRuntimeContext, b []byte, codeSet *opcodeSet, o
if p == 0 {
b = encodeNull(b)
} else {
bb, err := encodeMarshalJSON(b, ptrToInterface(code, p))
bb, err := encodeMarshalJSON(code, b, ptrToInterface(code, p), true)
if err != nil {
return nil, err
}
@ -2305,7 +2325,7 @@ func encodeRunEscaped(ctx *encodeRuntimeContext, b []byte, codeSet *opcodeSet, o
code = code.nextField
} else {
b = append(b, code.escapedKey...)
bb, err := encodeMarshalJSON(b, ptrToInterface(code, p))
bb, err := encodeMarshalJSON(code, b, ptrToInterface(code, p), true)
if err != nil {
return nil, err
}
@ -2349,7 +2369,7 @@ func encodeRunEscaped(ctx *encodeRuntimeContext, b []byte, codeSet *opcodeSet, o
if code.nilcheck && p == 0 {
b = encodeNull(b)
} else {
bb, err := encodeMarshalText(b, ptrToInterface(code, p))
bb, err := encodeMarshalText(code, b, ptrToInterface(code, p), true)
if err != nil {
return nil, err
}
@ -2393,7 +2413,7 @@ func encodeRunEscaped(ctx *encodeRuntimeContext, b []byte, codeSet *opcodeSet, o
if code.nilcheck && p == 0 {
b = encodeNull(b)
} else {
bb, err := encodeMarshalText(b, ptrToInterface(code, p))
bb, err := encodeMarshalText(code, b, ptrToInterface(code, p), true)
if err != nil {
return nil, err
}
@ -2437,7 +2457,7 @@ func encodeRunEscaped(ctx *encodeRuntimeContext, b []byte, codeSet *opcodeSet, o
code = code.nextField
} else {
b = append(b, code.escapedKey...)
bb, err := encodeMarshalText(b, ptrToInterface(code, p))
bb, err := encodeMarshalText(code, b, ptrToInterface(code, p), true)
if err != nil {
return nil, err
}
@ -2477,7 +2497,7 @@ func encodeRunEscaped(ctx *encodeRuntimeContext, b []byte, codeSet *opcodeSet, o
if p == 0 {
b = encodeNull(b)
} else {
bb, err := encodeMarshalText(b, ptrToInterface(code, p))
bb, err := encodeMarshalText(code, b, ptrToInterface(code, p), true)
if err != nil {
return nil, err
}
@ -2517,7 +2537,7 @@ func encodeRunEscaped(ctx *encodeRuntimeContext, b []byte, codeSet *opcodeSet, o
code = code.nextField
} else {
b = append(b, code.escapedKey...)
bb, err := encodeMarshalText(b, ptrToInterface(code, p))
bb, err := encodeMarshalText(code, b, ptrToInterface(code, p), true)
if err != nil {
return nil, err
}
@ -2971,7 +2991,7 @@ func encodeRunEscaped(ctx *encodeRuntimeContext, b []byte, codeSet *opcodeSet, o
if p == 0 && code.nilcheck {
b = encodeNull(b)
} else {
bb, err := encodeMarshalJSON(b, ptrToInterface(code, p))
bb, err := encodeMarshalJSON(code, b, ptrToInterface(code, p), true)
if err != nil {
return nil, err
}
@ -2990,7 +3010,7 @@ func encodeRunEscaped(ctx *encodeRuntimeContext, b []byte, codeSet *opcodeSet, o
break
}
b = append(b, code.escapedKey...)
bb, err := encodeMarshalJSON(b, ptrToInterface(code, p))
bb, err := encodeMarshalJSON(code, b, ptrToInterface(code, p), true)
if err != nil {
return nil, err
}
@ -3003,7 +3023,7 @@ func encodeRunEscaped(ctx *encodeRuntimeContext, b []byte, codeSet *opcodeSet, o
if p == 0 {
b = encodeNull(b)
} else {
bb, err := encodeMarshalJSON(b, ptrToInterface(code, p))
bb, err := encodeMarshalJSON(code, b, ptrToInterface(code, p), true)
if err != nil {
return nil, err
}
@ -3016,7 +3036,7 @@ func encodeRunEscaped(ctx *encodeRuntimeContext, b []byte, codeSet *opcodeSet, o
p = ptrToPtr(p + code.offset)
if p != 0 {
b = append(b, code.escapedKey...)
bb, err := encodeMarshalJSON(b, ptrToInterface(code, p))
bb, err := encodeMarshalJSON(code, b, ptrToInterface(code, p), true)
if err != nil {
return nil, err
}
@ -3033,7 +3053,7 @@ func encodeRunEscaped(ctx *encodeRuntimeContext, b []byte, codeSet *opcodeSet, o
if p == 0 && code.nilcheck {
b = encodeNull(b)
} else {
bb, err := encodeMarshalText(b, ptrToInterface(code, p))
bb, err := encodeMarshalText(code, b, ptrToInterface(code, p), true)
if err != nil {
return nil, err
}
@ -3052,7 +3072,7 @@ func encodeRunEscaped(ctx *encodeRuntimeContext, b []byte, codeSet *opcodeSet, o
break
}
b = append(b, code.escapedKey...)
bb, err := encodeMarshalText(b, ptrToInterface(code, p))
bb, err := encodeMarshalText(code, b, ptrToInterface(code, p), true)
if err != nil {
return nil, err
}
@ -3065,7 +3085,7 @@ func encodeRunEscaped(ctx *encodeRuntimeContext, b []byte, codeSet *opcodeSet, o
if p == 0 {
b = encodeNull(b)
} else {
bb, err := encodeMarshalText(b, ptrToInterface(code, p))
bb, err := encodeMarshalText(code, b, ptrToInterface(code, p), true)
if err != nil {
return nil, err
}
@ -3078,7 +3098,7 @@ func encodeRunEscaped(ctx *encodeRuntimeContext, b []byte, codeSet *opcodeSet, o
p = ptrToPtr(p + code.offset)
if p != 0 {
b = append(b, code.escapedKey...)
bb, err := encodeMarshalText(b, ptrToInterface(code, p))
bb, err := encodeMarshalText(code, b, ptrToInterface(code, p), true)
if err != nil {
return nil, err
}

View File

@ -17,7 +17,6 @@ func encodeRunEscapedIndent(ctx *encodeRuntimeContext, b []byte, codeSet *opcode
ptrOffset := uintptr(0)
ctxptr := ctx.ptr()
code := codeSet.code
fmt.Println(code.dump())
for {
switch code.op {
@ -2295,7 +2294,7 @@ func encodeRunEscapedIndent(ctx *encodeRuntimeContext, b []byte, codeSet *opcode
if code.nilcheck && p == 0 {
b = encodeNull(b)
} else {
bb, err := encodeMarshalJSONIndent(ctx, b, ptrToInterface(code, p), code.indent)
bb, err := encodeMarshalJSONIndent(ctx, code, b, ptrToInterface(code, p), code.indent, true)
if err != nil {
return nil, err
}
@ -2341,7 +2340,7 @@ func encodeRunEscapedIndent(ctx *encodeRuntimeContext, b []byte, codeSet *opcode
if code.nilcheck && p == 0 {
b = encodeNull(b)
} else {
bb, err := encodeMarshalJSONIndent(ctx, b, ptrToInterface(code, p), code.indent)
bb, err := encodeMarshalJSONIndent(ctx, code, b, ptrToInterface(code, p), code.indent, true)
if err != nil {
return nil, err
}
@ -2387,7 +2386,7 @@ func encodeRunEscapedIndent(ctx *encodeRuntimeContext, b []byte, codeSet *opcode
b = appendIndent(ctx, b, code.indent+1)
b = append(b, code.escapedKey...)
b = append(b, ' ')
bb, err := encodeMarshalJSONIndent(ctx, b, ptrToInterface(code, p), code.indent)
bb, err := encodeMarshalJSONIndent(ctx, code, b, ptrToInterface(code, p), code.indent, true)
if err != nil {
return nil, err
}
@ -2429,7 +2428,7 @@ func encodeRunEscapedIndent(ctx *encodeRuntimeContext, b []byte, codeSet *opcode
if p == 0 {
b = encodeNull(b)
} else {
bb, err := encodeMarshalJSONIndent(ctx, b, ptrToInterface(code, p), code.indent)
bb, err := encodeMarshalJSONIndent(ctx, code, b, ptrToInterface(code, p), code.indent, true)
if err != nil {
return nil, err
}
@ -2471,7 +2470,7 @@ func encodeRunEscapedIndent(ctx *encodeRuntimeContext, b []byte, codeSet *opcode
b = appendIndent(ctx, b, code.indent+1)
b = append(b, code.escapedKey...)
b = append(b, ' ')
bb, err := encodeMarshalJSONIndent(ctx, b, ptrToInterface(code, p), code.indent)
bb, err := encodeMarshalJSONIndent(ctx, code, b, ptrToInterface(code, p), code.indent, true)
if err != nil {
return nil, err
}
@ -2517,7 +2516,7 @@ func encodeRunEscapedIndent(ctx *encodeRuntimeContext, b []byte, codeSet *opcode
if code.nilcheck && p == 0 {
b = encodeNull(b)
} else {
bb, err := encodeMarshalTextIndent(b, ptrToInterface(code, p))
bb, err := encodeMarshalTextIndent(code, b, ptrToInterface(code, p), true)
if err != nil {
return nil, err
}
@ -2563,7 +2562,7 @@ func encodeRunEscapedIndent(ctx *encodeRuntimeContext, b []byte, codeSet *opcode
if code.nilcheck && p == 0 {
b = encodeNull(b)
} else {
bb, err := encodeMarshalTextIndent(b, ptrToInterface(code, p))
bb, err := encodeMarshalTextIndent(code, b, ptrToInterface(code, p), true)
if err != nil {
return nil, err
}
@ -2609,7 +2608,7 @@ func encodeRunEscapedIndent(ctx *encodeRuntimeContext, b []byte, codeSet *opcode
b = appendIndent(ctx, b, code.indent+1)
b = append(b, code.escapedKey...)
b = append(b, ' ')
bb, err := encodeMarshalTextIndent(b, ptrToInterface(code, p))
bb, err := encodeMarshalTextIndent(code, b, ptrToInterface(code, p), true)
if err != nil {
return nil, err
}
@ -2651,7 +2650,7 @@ func encodeRunEscapedIndent(ctx *encodeRuntimeContext, b []byte, codeSet *opcode
if p == 0 {
b = encodeNull(b)
} else {
bb, err := encodeMarshalTextIndent(b, ptrToInterface(code, p))
bb, err := encodeMarshalTextIndent(code, b, ptrToInterface(code, p), true)
if err != nil {
return nil, err
}
@ -2693,7 +2692,7 @@ func encodeRunEscapedIndent(ctx *encodeRuntimeContext, b []byte, codeSet *opcode
b = appendIndent(ctx, b, code.indent+1)
b = append(b, code.escapedKey...)
b = append(b, ' ')
bb, err := encodeMarshalTextIndent(b, ptrToInterface(code, p))
bb, err := encodeMarshalTextIndent(code, b, ptrToInterface(code, p), true)
if err != nil {
return nil, err
}
@ -3230,7 +3229,7 @@ func encodeRunEscapedIndent(ctx *encodeRuntimeContext, b []byte, codeSet *opcode
if p == 0 && code.nilcheck {
b = encodeNull(b)
} else {
bb, err := encodeMarshalJSONIndent(ctx, b, ptrToInterface(code, p), code.indent)
bb, err := encodeMarshalJSONIndent(ctx, code, b, ptrToInterface(code, p), code.indent, true)
if err != nil {
return nil, err
}
@ -3251,7 +3250,7 @@ func encodeRunEscapedIndent(ctx *encodeRuntimeContext, b []byte, codeSet *opcode
b = appendIndent(ctx, b, code.indent)
b = append(b, code.escapedKey...)
b = append(b, ' ')
bb, err := encodeMarshalJSONIndent(ctx, b, ptrToInterface(code, p), code.indent)
bb, err := encodeMarshalJSONIndent(ctx, code, b, ptrToInterface(code, p), code.indent, true)
if err != nil {
return nil, err
}
@ -3266,7 +3265,7 @@ func encodeRunEscapedIndent(ctx *encodeRuntimeContext, b []byte, codeSet *opcode
if p == 0 {
b = encodeNull(b)
} else {
bb, err := encodeMarshalJSONIndent(ctx, b, ptrToInterface(code, p), code.indent)
bb, err := encodeMarshalJSONIndent(ctx, code, b, ptrToInterface(code, p), code.indent, true)
if err != nil {
return nil, err
}
@ -3281,7 +3280,7 @@ func encodeRunEscapedIndent(ctx *encodeRuntimeContext, b []byte, codeSet *opcode
b = appendIndent(ctx, b, code.indent)
b = append(b, code.escapedKey...)
b = append(b, ' ')
bb, err := encodeMarshalJSONIndent(ctx, b, ptrToInterface(code, p), code.indent)
bb, err := encodeMarshalJSONIndent(ctx, code, b, ptrToInterface(code, p), code.indent, true)
if err != nil {
return nil, err
}
@ -3300,7 +3299,7 @@ func encodeRunEscapedIndent(ctx *encodeRuntimeContext, b []byte, codeSet *opcode
if p == 0 && code.nilcheck {
b = encodeNull(b)
} else {
bb, err := encodeMarshalTextIndent(b, ptrToInterface(code, p))
bb, err := encodeMarshalTextIndent(code, b, ptrToInterface(code, p), true)
if err != nil {
return nil, err
}
@ -3321,7 +3320,7 @@ func encodeRunEscapedIndent(ctx *encodeRuntimeContext, b []byte, codeSet *opcode
b = appendIndent(ctx, b, code.indent)
b = append(b, code.escapedKey...)
b = append(b, ' ')
bb, err := encodeMarshalTextIndent(b, ptrToInterface(code, p))
bb, err := encodeMarshalTextIndent(code, b, ptrToInterface(code, p), true)
if err != nil {
return nil, err
}
@ -3336,7 +3335,7 @@ func encodeRunEscapedIndent(ctx *encodeRuntimeContext, b []byte, codeSet *opcode
if p == 0 {
b = encodeNull(b)
} else {
bb, err := encodeMarshalTextIndent(b, ptrToInterface(code, p))
bb, err := encodeMarshalTextIndent(code, b, ptrToInterface(code, p), true)
if err != nil {
return nil, err
}
@ -3351,7 +3350,7 @@ func encodeRunEscapedIndent(ctx *encodeRuntimeContext, b []byte, codeSet *opcode
b = appendIndent(ctx, b, code.indent)
b = append(b, code.escapedKey...)
b = append(b, ' ')
bb, err := encodeMarshalTextIndent(b, ptrToInterface(code, p))
bb, err := encodeMarshalTextIndent(code, b, ptrToInterface(code, p), true)
if err != nil {
return nil, err
}

View File

@ -2295,7 +2295,7 @@ func encodeRunIndent(ctx *encodeRuntimeContext, b []byte, codeSet *opcodeSet, op
if code.nilcheck && p == 0 {
b = encodeNull(b)
} else {
bb, err := encodeMarshalJSONIndent(ctx, b, ptrToInterface(code, p), code.indent)
bb, err := encodeMarshalJSONIndent(ctx, code, b, ptrToInterface(code, p), code.indent, false)
if err != nil {
return nil, err
}
@ -2341,7 +2341,7 @@ func encodeRunIndent(ctx *encodeRuntimeContext, b []byte, codeSet *opcodeSet, op
if code.nilcheck && p == 0 {
b = encodeNull(b)
} else {
bb, err := encodeMarshalJSONIndent(ctx, b, ptrToInterface(code, p), code.indent)
bb, err := encodeMarshalJSONIndent(ctx, code, b, ptrToInterface(code, p), code.indent, false)
if err != nil {
return nil, err
}
@ -2387,7 +2387,7 @@ func encodeRunIndent(ctx *encodeRuntimeContext, b []byte, codeSet *opcodeSet, op
b = appendIndent(ctx, b, code.indent+1)
b = append(b, code.key...)
b = append(b, ' ')
bb, err := encodeMarshalJSONIndent(ctx, b, ptrToInterface(code, p), code.indent)
bb, err := encodeMarshalJSONIndent(ctx, code, b, ptrToInterface(code, p), code.indent, false)
if err != nil {
return nil, err
}
@ -2429,7 +2429,7 @@ func encodeRunIndent(ctx *encodeRuntimeContext, b []byte, codeSet *opcodeSet, op
if p == 0 {
b = encodeNull(b)
} else {
bb, err := encodeMarshalJSONIndent(ctx, b, ptrToInterface(code, p), code.indent)
bb, err := encodeMarshalJSONIndent(ctx, code, b, ptrToInterface(code, p), code.indent, false)
if err != nil {
return nil, err
}
@ -2471,7 +2471,7 @@ func encodeRunIndent(ctx *encodeRuntimeContext, b []byte, codeSet *opcodeSet, op
b = appendIndent(ctx, b, code.indent+1)
b = append(b, code.key...)
b = append(b, ' ')
bb, err := encodeMarshalJSONIndent(ctx, b, ptrToInterface(code, p), code.indent)
bb, err := encodeMarshalJSONIndent(ctx, code, b, ptrToInterface(code, p), code.indent, false)
if err != nil {
return nil, err
}
@ -2517,7 +2517,7 @@ func encodeRunIndent(ctx *encodeRuntimeContext, b []byte, codeSet *opcodeSet, op
if code.nilcheck && p == 0 {
b = encodeNull(b)
} else {
bb, err := encodeMarshalTextIndent(b, ptrToInterface(code, p))
bb, err := encodeMarshalTextIndent(code, b, ptrToInterface(code, p), false)
if err != nil {
return nil, err
}
@ -2563,7 +2563,7 @@ func encodeRunIndent(ctx *encodeRuntimeContext, b []byte, codeSet *opcodeSet, op
if code.nilcheck && p == 0 {
b = encodeNull(b)
} else {
bb, err := encodeMarshalTextIndent(b, ptrToInterface(code, p))
bb, err := encodeMarshalTextIndent(code, b, ptrToInterface(code, p), false)
if err != nil {
return nil, err
}
@ -2609,7 +2609,7 @@ func encodeRunIndent(ctx *encodeRuntimeContext, b []byte, codeSet *opcodeSet, op
b = appendIndent(ctx, b, code.indent+1)
b = append(b, code.key...)
b = append(b, ' ')
bb, err := encodeMarshalTextIndent(b, ptrToInterface(code, p))
bb, err := encodeMarshalTextIndent(code, b, ptrToInterface(code, p), false)
if err != nil {
return nil, err
}
@ -2651,7 +2651,7 @@ func encodeRunIndent(ctx *encodeRuntimeContext, b []byte, codeSet *opcodeSet, op
if p == 0 {
b = encodeNull(b)
} else {
bb, err := encodeMarshalTextIndent(b, ptrToInterface(code, p))
bb, err := encodeMarshalTextIndent(code, b, ptrToInterface(code, p), false)
if err != nil {
return nil, err
}
@ -2693,7 +2693,7 @@ func encodeRunIndent(ctx *encodeRuntimeContext, b []byte, codeSet *opcodeSet, op
b = appendIndent(ctx, b, code.indent+1)
b = append(b, code.key...)
b = append(b, ' ')
bb, err := encodeMarshalTextIndent(b, ptrToInterface(code, p))
bb, err := encodeMarshalTextIndent(code, b, ptrToInterface(code, p), false)
if err != nil {
return nil, err
}
@ -3230,7 +3230,7 @@ func encodeRunIndent(ctx *encodeRuntimeContext, b []byte, codeSet *opcodeSet, op
if p == 0 && code.nilcheck {
b = encodeNull(b)
} else {
bb, err := encodeMarshalJSONIndent(ctx, b, ptrToInterface(code, p), code.indent)
bb, err := encodeMarshalJSONIndent(ctx, code, b, ptrToInterface(code, p), code.indent, false)
if err != nil {
return nil, err
}
@ -3251,7 +3251,7 @@ func encodeRunIndent(ctx *encodeRuntimeContext, b []byte, codeSet *opcodeSet, op
b = appendIndent(ctx, b, code.indent)
b = append(b, code.key...)
b = append(b, ' ')
bb, err := encodeMarshalJSONIndent(ctx, b, ptrToInterface(code, p), code.indent)
bb, err := encodeMarshalJSONIndent(ctx, code, b, ptrToInterface(code, p), code.indent, false)
if err != nil {
return nil, err
}
@ -3266,7 +3266,7 @@ func encodeRunIndent(ctx *encodeRuntimeContext, b []byte, codeSet *opcodeSet, op
if p == 0 {
b = encodeNull(b)
} else {
bb, err := encodeMarshalJSONIndent(ctx, b, ptrToInterface(code, p), code.indent)
bb, err := encodeMarshalJSONIndent(ctx, code, b, ptrToInterface(code, p), code.indent, false)
if err != nil {
return nil, err
}
@ -3281,7 +3281,7 @@ func encodeRunIndent(ctx *encodeRuntimeContext, b []byte, codeSet *opcodeSet, op
b = appendIndent(ctx, b, code.indent)
b = append(b, code.key...)
b = append(b, ' ')
bb, err := encodeMarshalJSONIndent(ctx, b, ptrToInterface(code, p), code.indent)
bb, err := encodeMarshalJSONIndent(ctx, code, b, ptrToInterface(code, p), code.indent, false)
if err != nil {
return nil, err
}
@ -3300,7 +3300,7 @@ func encodeRunIndent(ctx *encodeRuntimeContext, b []byte, codeSet *opcodeSet, op
if p == 0 && code.nilcheck {
b = encodeNull(b)
} else {
bb, err := encodeMarshalTextIndent(b, ptrToInterface(code, p))
bb, err := encodeMarshalTextIndent(code, b, ptrToInterface(code, p), false)
if err != nil {
return nil, err
}
@ -3321,7 +3321,7 @@ func encodeRunIndent(ctx *encodeRuntimeContext, b []byte, codeSet *opcodeSet, op
b = appendIndent(ctx, b, code.indent)
b = append(b, code.key...)
b = append(b, ' ')
bb, err := encodeMarshalTextIndent(b, ptrToInterface(code, p))
bb, err := encodeMarshalTextIndent(code, b, ptrToInterface(code, p), false)
if err != nil {
return nil, err
}
@ -3336,7 +3336,7 @@ func encodeRunIndent(ctx *encodeRuntimeContext, b []byte, codeSet *opcodeSet, op
if p == 0 {
b = encodeNull(b)
} else {
bb, err := encodeMarshalTextIndent(b, ptrToInterface(code, p))
bb, err := encodeMarshalTextIndent(code, b, ptrToInterface(code, p), false)
if err != nil {
return nil, err
}
@ -3351,7 +3351,7 @@ func encodeRunIndent(ctx *encodeRuntimeContext, b []byte, codeSet *opcodeSet, op
b = appendIndent(ctx, b, code.indent)
b = append(b, code.key...)
b = append(b, ' ')
bb, err := encodeMarshalTextIndent(b, ptrToInterface(code, p))
bb, err := encodeMarshalTextIndent(code, b, ptrToInterface(code, p), false)
if err != nil {
return nil, err
}