mirror of https://github.com/goccy/go-json.git
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) {
|
func (e *Encoder) compilePtr(ctx *encodeCompileContext) (*opcode, error) {
|
||||||
ptrOpcodeIndex := ctx.opcodeIndex
|
ptrOpcodeIndex := ctx.opcodeIndex
|
||||||
|
ptrIndex := ctx.ptrIndex
|
||||||
ctx.incIndex()
|
ctx.incIndex()
|
||||||
code, err := e.compile(ctx.withType(ctx.typ.Elem()))
|
code, err := e.compile(ctx.withType(ctx.typ.Elem()))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -148,6 +149,7 @@ func (e *Encoder) compilePtr(ctx *encodeCompileContext) (*opcode, error) {
|
||||||
}
|
}
|
||||||
c := ctx.context()
|
c := ctx.context()
|
||||||
c.opcodeIndex = ptrOpcodeIndex
|
c.opcodeIndex = ptrOpcodeIndex
|
||||||
|
c.ptrIndex = ptrIndex
|
||||||
return newOpCodeWithNext(c, opPtr, code), nil
|
return newOpCodeWithNext(c, opPtr, code), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue