From 5a8383f0d2967ddda8bbd1b6d0fc74add50e5591 Mon Sep 17 00:00:00 2001 From: Masaaki Goshima Date: Sun, 6 Dec 2020 19:59:39 +0900 Subject: [PATCH] Fix ptrIndex --- encode_compile.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/encode_compile.go b/encode_compile.go index dd41b56..7fc9915 100644 --- a/encode_compile.go +++ b/encode_compile.go @@ -134,6 +134,7 @@ func (e *Encoder) compileKey(ctx *encodeCompileContext) (*opcode, error) { func (e *Encoder) compilePtr(ctx *encodeCompileContext) (*opcode, error) { ptrOpcodeIndex := ctx.opcodeIndex + ptrIndex := ctx.ptrIndex ctx.incIndex() code, err := e.compile(ctx.withType(ctx.typ.Elem())) if err != nil { @@ -148,6 +149,7 @@ func (e *Encoder) compilePtr(ctx *encodeCompileContext) (*opcode, error) { } c := ctx.context() c.opcodeIndex = ptrOpcodeIndex + c.ptrIndex = ptrIndex return newOpCodeWithNext(c, opPtr, code), nil }