reflect: MapIter.Next() needs to allocate new keys/values every time

Этот коммит содержится в:
Damian Gryski 2023-03-07 10:29:02 -08:00 коммит произвёл Ayke
родитель 94a54bc105
коммит ac36f232bc

Просмотреть файл

@ -852,8 +852,6 @@ func (v Value) MapRange() *MapIter {
return &MapIter{
m: v,
it: hashmapNewIterator(),
key: New(v.typecode.Key()),
val: New(v.typecode.Elem()),
}
}
@ -883,6 +881,9 @@ func (it *MapIter) Value() Value {
}
func (it *MapIter) Next() bool {
it.key = New(it.m.typecode.Key())
it.val = New(it.m.typecode.Elem())
it.valid = hashmapNext(it.m.pointer(), it.it, it.key.value, it.val.value)
return it.valid
}