forked from mirror/go-json
Fix ptrIndex
This commit is contained in:
parent
4332d1353e
commit
5a8383f0d2
|
@ -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
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue