reflect: MapIter.Next() needs to allocate new keys/values every time
Этот коммит содержится в:
родитель
94a54bc105
коммит
ac36f232bc
1 изменённых файлов: 5 добавлений и 4 удалений
|
@ -852,8 +852,6 @@ func (v Value) MapRange() *MapIter {
|
||||||
return &MapIter{
|
return &MapIter{
|
||||||
m: v,
|
m: v,
|
||||||
it: hashmapNewIterator(),
|
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 {
|
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)
|
it.valid = hashmapNext(it.m.pointer(), it.it, it.key.value, it.val.value)
|
||||||
return it.valid
|
return it.valid
|
||||||
}
|
}
|
||||||
|
|
Загрузка…
Создание таблицы
Сослаться в новой задаче