Pure attribute added, where applicable.

This commit is contained in:
mlemanczyk committed 2023-06-25 02:25:32 +02:00
1 parent 12f051c821
commit e57fa3d572
4 files changed
+15 -4

No files matched your search

@@ -1,4 +1,5 @@
using System.Collections;
using System.Diagnostics.Contracts;
using System.Runtime.InteropServices;
namespace Recyclable.Collections
@@ -14,9 +15,9 @@ namespace Recyclable.Collections
private readonly RecyclableList<T> _list;
#nullable disable
// [Pure]
[Pure]
public readonly T Current => _list._memoryBlock[_currentItemIndex - 1];
// [Pure]
[Pure]
readonly object IEnumerator.Current => _list._memoryBlock[_currentItemIndex - 1];
#nullable restore
@@ -37,6 +38,7 @@ namespace Recyclable.Collections
_list = list;
}
[Pure]
public readonly void Dispose()
{
}
@@ -16,9 +16,10 @@ namespace Recyclable.Collections
private readonly RecyclableList<T> _list;
#nullable disable
// [Pure]
[Pure]
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();
#nullable restore
@@ -47,6 +48,7 @@ namespace Recyclable.Collections
_enumeratorVersion = list._version;
}
[Pure]
public readonly void Dispose()
{
}
@@ -1,4 +1,5 @@
using System.Collections;
using System.Diagnostics.Contracts;
namespace Recyclable.Collections
{
@@ -19,6 +20,8 @@ namespace Recyclable.Collections
#nullable disable
private T _current;
#nullable restore
[Pure]
public readonly T Current => _current;
public bool MoveNext()
@@ -52,6 +55,7 @@ namespace Recyclable.Collections
}
#nullable disable
[Pure]
readonly object IEnumerator.Current => _current;
#nullable restore
@@ -24,6 +24,8 @@ public partial class RecyclableLongList<T> : IRecyclableVersionedLongList<T>
#nullable disable
private T _current;
#nullable restore
[Pure]
public readonly T Current => _enumeratorVersion == _list._version ? _current : throw new InvalidOperationException();
private readonly ulong _enumeratorVersion;
@@ -65,6 +67,7 @@ public partial class RecyclableLongList<T> : IRecyclableVersionedLongList<T>
}
#nullable disable
[Pure]
readonly object IEnumerator.Current => _enumeratorVersion == _list._version ? _current : throw new InvalidOperationException();
#nullable restore