Fix ptrIndex

This commit is contained in:
Masaaki Goshima 2020-12-06 19:59:39 +09:00
parent 4332d1353e
commit 5a8383f0d2
1 changed files with 2 additions and 0 deletions

View File

@ -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
}