mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-03 10:37:46 +00:00
reflect: MapIter.Next() needs to allocate new keys/values every time
This commit is contained in:
@@ -850,10 +850,8 @@ func (v Value) MapRange() *MapIter {
|
||||
}
|
||||
|
||||
return &MapIter{
|
||||
m: v,
|
||||
it: hashmapNewIterator(),
|
||||
key: New(v.typecode.Key()),
|
||||
val: New(v.typecode.Elem()),
|
||||
m: v,
|
||||
it: hashmapNewIterator(),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user