Fix unnecessary recursive operation

This commit is contained in:
Masaaki Goshima 2020-08-15 21:13:08 +09:00
parent 92ed6c6d7e
commit 65d954de3e
1 changed files with 7 additions and 0 deletions

View File

@ -602,5 +602,12 @@ func (e *Encoder) compileStruct(typ *rtype, root, withIndent bool) (*opcode, err
code.next = structEndCode code.next = structEndCode
ret := (*opcode)(unsafe.Pointer(head)) ret := (*opcode)(unsafe.Pointer(head))
compiled.code = ret compiled.code = ret
if withIndent {
delete(e.structTypeToCompiledIndentCode, typeptr)
} else {
delete(e.structTypeToCompiledCode, typeptr)
}
return ret, nil return ret, nil
} }