|
@@ -240,23 +240,30 @@ namespace Jint.Collections
|
|
{
|
|
{
|
|
private readonly StringDictionarySlim<TValue> _dictionary;
|
|
private readonly StringDictionarySlim<TValue> _dictionary;
|
|
private int _index;
|
|
private int _index;
|
|
|
|
+ private int _count;
|
|
private KeyValuePair<string, TValue> _current;
|
|
private KeyValuePair<string, TValue> _current;
|
|
|
|
|
|
internal Enumerator(StringDictionarySlim<TValue> dictionary)
|
|
internal Enumerator(StringDictionarySlim<TValue> dictionary)
|
|
{
|
|
{
|
|
_dictionary = dictionary;
|
|
_dictionary = dictionary;
|
|
_index = 0;
|
|
_index = 0;
|
|
|
|
+ _count = _dictionary._count;
|
|
_current = default;
|
|
_current = default;
|
|
}
|
|
}
|
|
|
|
|
|
public bool MoveNext()
|
|
public bool MoveNext()
|
|
{
|
|
{
|
|
- if (_index == _dictionary._count)
|
|
|
|
|
|
+ if (_count == 0)
|
|
{
|
|
{
|
|
_current = default;
|
|
_current = default;
|
|
return false;
|
|
return false;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ _count--;
|
|
|
|
+
|
|
|
|
+ while (_dictionary._entries[_index].next < -1)
|
|
|
|
+ _index++;
|
|
|
|
+
|
|
_current = new KeyValuePair<string, TValue>(
|
|
_current = new KeyValuePair<string, TValue>(
|
|
_dictionary._entries[_index].key,
|
|
_dictionary._entries[_index].key,
|
|
_dictionary._entries[_index++].value);
|
|
_dictionary._entries[_index++].value);
|
|
@@ -270,6 +277,8 @@ namespace Jint.Collections
|
|
void IEnumerator.Reset()
|
|
void IEnumerator.Reset()
|
|
{
|
|
{
|
|
_index = 0;
|
|
_index = 0;
|
|
|
|
+ _count = _dictionary._count;
|
|
|
|
+ _current = default;
|
|
}
|
|
}
|
|
|
|
|
|
public void Dispose() { }
|
|
public void Dispose() { }
|