diff --git a/encode_compile.go b/encode_compile.go index 71cf9be..a152b44 100644 --- a/encode_compile.go +++ b/encode_compile.go @@ -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 } diff --git a/encode_compile_norace.go b/encode_compile_norace.go index 9726118..3305a5b 100644 --- a/encode_compile_norace.go +++ b/encode_compile_norace.go @@ -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 { diff --git a/encode_context.go b/encode_context.go index 83ceb12..9d45f1e 100644 --- a/encode_context.go +++ b/encode_context.go @@ -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, diff --git a/encode_opcode.go b/encode_opcode.go index d01e2e7..1278f12 100644 --- a/encode_opcode.go +++ b/encode_opcode.go @@ -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), } }