forked from mirror/go-json
Remove root property from encodeCompileContext and opcode
This commit is contained in:
parent
4cdbd4e962
commit
bb3086c375
|
@ -38,7 +38,6 @@ func encodeCompileToGetCodeSetSlowPath(typeptr uintptr) (*opcodeSet, error) {
|
|||
|
||||
code, err := encodeCompileHead(&encodeCompileContext{
|
||||
typ: copiedType,
|
||||
root: true,
|
||||
structTypeToCompiledCode: map[uintptr]*compiledCode{},
|
||||
})
|
||||
if err != nil {
|
||||
|
@ -619,7 +618,6 @@ func encodeCompileInterface(ctx *encodeCompileContext) (*opcode, error) {
|
|||
}
|
||||
|
||||
func encodeCompileSlice(ctx *encodeCompileContext) (*opcode, error) {
|
||||
ctx.root = false
|
||||
elem := ctx.typ.Elem()
|
||||
size := elem.Size()
|
||||
|
||||
|
@ -663,7 +661,6 @@ func encodeCompileSliceElem(ctx *encodeCompileContext) (*opcode, error) {
|
|||
}
|
||||
|
||||
func encodeCompileArray(ctx *encodeCompileContext) (*opcode, error) {
|
||||
ctx.root = false
|
||||
typ := ctx.typ
|
||||
elem := typ.Elem()
|
||||
alen := typ.Len()
|
||||
|
@ -1215,7 +1212,6 @@ func encodeIsNilableType(typ *rtype) bool {
|
|||
}
|
||||
|
||||
func encodeCompileStruct(ctx *encodeCompileContext, isPtr bool) (*opcode, error) {
|
||||
ctx.root = false
|
||||
if code := encodeCompiledCode(ctx); code != nil {
|
||||
return code, nil
|
||||
}
|
||||
|
|
|
@ -18,7 +18,6 @@ func encodeCompileToGetCodeSet(typeptr uintptr) (*opcodeSet, error) {
|
|||
|
||||
code, err := encodeCompileHead(&encodeCompileContext{
|
||||
typ: copiedType,
|
||||
root: true,
|
||||
structTypeToCompiledCode: map[uintptr]*compiledCode{},
|
||||
})
|
||||
if err != nil {
|
||||
|
|
|
@ -63,7 +63,6 @@ func releaseMapContext(c *encodeMapContext) {
|
|||
|
||||
type encodeCompileContext struct {
|
||||
typ *rtype
|
||||
root bool
|
||||
opcodeIndex int
|
||||
ptrIndex int
|
||||
indent int
|
||||
|
@ -75,7 +74,6 @@ type encodeCompileContext struct {
|
|||
func (c *encodeCompileContext) context() *encodeCompileContext {
|
||||
return &encodeCompileContext{
|
||||
typ: c.typ,
|
||||
root: c.root,
|
||||
opcodeIndex: c.opcodeIndex,
|
||||
ptrIndex: c.ptrIndex,
|
||||
indent: c.indent,
|
||||
|
|
|
@ -19,7 +19,6 @@ type opcode struct {
|
|||
isTaggedKey bool // whether tagged key
|
||||
anonymousKey bool // whether anonymous key
|
||||
anonymousHead bool // whether anonymous head or not
|
||||
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
|
||||
|
@ -95,7 +94,6 @@ func (c *opcode) copy(codeMap map[uintptr]*opcode) *opcode {
|
|||
isTaggedKey: c.isTaggedKey,
|
||||
anonymousKey: c.anonymousKey,
|
||||
anonymousHead: c.anonymousHead,
|
||||
root: c.root,
|
||||
indirect: c.indirect,
|
||||
nilcheck: c.nilcheck,
|
||||
addrForMarshaler: c.addrForMarshaler,
|
||||
|
@ -497,7 +495,6 @@ func newInterfaceCode(ctx *encodeCompileContext) *opcode {
|
|||
displayIdx: ctx.opcodeIndex,
|
||||
idx: opcodeOffset(ctx.ptrIndex),
|
||||
indent: ctx.indent,
|
||||
root: ctx.root,
|
||||
next: newEndOp(ctx),
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue