43 lines
893 B
C#
43 lines
893 B
C#
using System.Collections.Generic;
|
|
using AspClassic.Scripting.Utils;
|
|
|
|
namespace AspClassic.Scripting.Runtime;
|
|
|
|
internal class TransformDictionaryEnumerator : CheckedDictionaryEnumerator
|
|
{
|
|
private const int ObjectKeysId = -2;
|
|
|
|
private IEnumerator<KeyValuePair<SymbolId, object>> _backing;
|
|
|
|
internal static readonly SymbolId ObjectKeys = new SymbolId(-2);
|
|
|
|
public TransformDictionaryEnumerator(IDictionary<SymbolId, object> backing)
|
|
{
|
|
_backing = backing.GetEnumerator();
|
|
}
|
|
|
|
protected override object GetKey()
|
|
{
|
|
return SymbolTable.IdToString(_backing.Current.Key);
|
|
}
|
|
|
|
protected override object GetValue()
|
|
{
|
|
return _backing.Current.Value;
|
|
}
|
|
|
|
protected override bool DoMoveNext()
|
|
{
|
|
bool flag = _backing.MoveNext();
|
|
if (flag && _backing.Current.Key == ObjectKeys)
|
|
{
|
|
flag = MoveNext();
|
|
}
|
|
return flag;
|
|
}
|
|
|
|
protected override void DoReset()
|
|
{
|
|
_backing.Reset();
|
|
}
|
|
}
|