Pure attribute added, where applicable.
This commit is contained in:
1 parent
12f051c821
commit
e57fa3d572
4 files changed
+15
-4
No files matched your search
@@ -1,4 +1,5 @@
|
|||||||
using System.Collections;
|
using System.Collections;
|
||||||
|
using System.Diagnostics.Contracts;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
namespace Recyclable.Collections
|
namespace Recyclable.Collections
|
||||||
@@ -14,9 +15,9 @@ namespace Recyclable.Collections
|
|||||||
private readonly RecyclableList<T> _list;
|
private readonly RecyclableList<T> _list;
|
||||||
|
|
||||||
#nullable disable
|
#nullable disable
|
||||||
// [Pure]
|
[Pure]
|
||||||
public readonly T Current => _list._memoryBlock[_currentItemIndex - 1];
|
public readonly T Current => _list._memoryBlock[_currentItemIndex - 1];
|
||||||
// [Pure]
|
[Pure]
|
||||||
readonly object IEnumerator.Current => _list._memoryBlock[_currentItemIndex - 1];
|
readonly object IEnumerator.Current => _list._memoryBlock[_currentItemIndex - 1];
|
||||||
#nullable restore
|
#nullable restore
|
||||||
|
|
||||||
@@ -37,6 +38,7 @@ namespace Recyclable.Collections
|
|||||||
_list = list;
|
_list = list;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Pure]
|
||||||
public readonly void Dispose()
|
public readonly void Dispose()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,9 +16,10 @@ namespace Recyclable.Collections
|
|||||||
private readonly RecyclableList<T> _list;
|
private readonly RecyclableList<T> _list;
|
||||||
|
|
||||||
#nullable disable
|
#nullable disable
|
||||||
// [Pure]
|
[Pure]
|
||||||
public readonly T Current => _enumeratorVersion == _list._version ? _list._memoryBlock[_currentItemIndex - 1] : throw new InvalidOperationException();
|
public readonly T Current => _enumeratorVersion == _list._version ? _list._memoryBlock[_currentItemIndex - 1] : throw new InvalidOperationException();
|
||||||
// [Pure]
|
|
||||||
|
[Pure]
|
||||||
readonly object IEnumerator.Current => _enumeratorVersion == _list._version ? _list._memoryBlock[_currentItemIndex - 1] : throw new InvalidOperationException();
|
readonly object IEnumerator.Current => _enumeratorVersion == _list._version ? _list._memoryBlock[_currentItemIndex - 1] : throw new InvalidOperationException();
|
||||||
#nullable restore
|
#nullable restore
|
||||||
|
|
||||||
@@ -47,6 +48,7 @@ namespace Recyclable.Collections
|
|||||||
_enumeratorVersion = list._version;
|
_enumeratorVersion = list._version;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Pure]
|
||||||
public readonly void Dispose()
|
public readonly void Dispose()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
using System.Collections;
|
using System.Collections;
|
||||||
|
using System.Diagnostics.Contracts;
|
||||||
|
|
||||||
namespace Recyclable.Collections
|
namespace Recyclable.Collections
|
||||||
{
|
{
|
||||||
@@ -19,6 +20,8 @@ namespace Recyclable.Collections
|
|||||||
#nullable disable
|
#nullable disable
|
||||||
private T _current;
|
private T _current;
|
||||||
#nullable restore
|
#nullable restore
|
||||||
|
|
||||||
|
[Pure]
|
||||||
public readonly T Current => _current;
|
public readonly T Current => _current;
|
||||||
|
|
||||||
public bool MoveNext()
|
public bool MoveNext()
|
||||||
@@ -52,6 +55,7 @@ namespace Recyclable.Collections
|
|||||||
}
|
}
|
||||||
|
|
||||||
#nullable disable
|
#nullable disable
|
||||||
|
[Pure]
|
||||||
readonly object IEnumerator.Current => _current;
|
readonly object IEnumerator.Current => _current;
|
||||||
#nullable restore
|
#nullable restore
|
||||||
|
|
||||||
|
|||||||
@@ -24,6 +24,8 @@ public partial class RecyclableLongList<T> : IRecyclableVersionedLongList<T>
|
|||||||
#nullable disable
|
#nullable disable
|
||||||
private T _current;
|
private T _current;
|
||||||
#nullable restore
|
#nullable restore
|
||||||
|
|
||||||
|
[Pure]
|
||||||
public readonly T Current => _enumeratorVersion == _list._version ? _current : throw new InvalidOperationException();
|
public readonly T Current => _enumeratorVersion == _list._version ? _current : throw new InvalidOperationException();
|
||||||
|
|
||||||
private readonly ulong _enumeratorVersion;
|
private readonly ulong _enumeratorVersion;
|
||||||
@@ -65,6 +67,7 @@ public partial class RecyclableLongList<T> : IRecyclableVersionedLongList<T>
|
|||||||
}
|
}
|
||||||
|
|
||||||
#nullable disable
|
#nullable disable
|
||||||
|
[Pure]
|
||||||
readonly object IEnumerator.Current => _enumeratorVersion == _list._version ? _current : throw new InvalidOperationException();
|
readonly object IEnumerator.Current => _enumeratorVersion == _list._version ? _current : throw new InvalidOperationException();
|
||||||
#nullable restore
|
#nullable restore
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user