Imported Upstream version 5.10.0.47

Former-commit-id: d0813289fa2d35e1f8ed77530acb4fb1df441bc0
This commit is contained in:
Xamarin Public Jenkins (auto-signing)
2018-01-24 17:04:36 +00:00
parent 88ff76fe28
commit e46a49ecf1
5927 changed files with 226314 additions and 129848 deletions

View File

@ -68,7 +68,10 @@ namespace System
internal IEnumerator<T> InternalArray__IEnumerable_GetEnumerator<T> ()
{
return new InternalEnumerator<T> (this);
if (Length == 0)
return EmptyInternalEnumerator<T>.Value;
else
return new InternalEnumerator<T> (this);
}
internal void InternalArray__ICollection_Clear ()
@ -207,7 +210,7 @@ namespace System
// we just decr the size, so, 0 - 1 == FINISHED
const int FINISHED = -1;
Array array;
readonly Array array;
int idx;
internal InternalEnumerator (Array array)
@ -218,7 +221,6 @@ namespace System
public void Dispose ()
{
idx = NOT_STARTED;
}
public bool MoveNext ()
@ -272,6 +274,38 @@ namespace System
}
}
internal class EmptyInternalEnumerator<T> : IEnumerator<T>
{
public static readonly EmptyInternalEnumerator<T> Value = new EmptyInternalEnumerator<T> ();
public void Dispose ()
{
return;
}
public bool MoveNext ()
{
return false;
}
public T Current {
get {
throw new InvalidOperationException ("Enumeration has not started. Call MoveNext");
}
}
object IEnumerator.Current {
get {
return Current;
}
}
void IEnumerator.Reset ()
{
return;
}
}
// InternalCall Methods
[MethodImplAttribute (MethodImplOptions.InternalCall)]
extern int GetRank ();
@ -320,7 +354,7 @@ namespace System
"Index has to be between upper and lower bound of the array."));
if (GetType ().GetElementType ().IsPointer)
throw new NotSupportedException ("Type is not supported");
throw new NotSupportedException ("Type is not supported.");
return GetValueImpl (index - lb);
}
@ -348,7 +382,7 @@ namespace System
"Index has to be >= lower bound and <= upper bound of the array."));
if (GetType ().GetElementType ().IsPointer)
throw new NotSupportedException ("Type is not supported");
throw new NotSupportedException ("Type is not supported.");
SetValueImpl (value, index - lb);
}
@ -701,7 +735,7 @@ namespace System
get {
if (_index < 0) throw new InvalidOperationException (SR.InvalidOperation_EnumNotStarted);
if (_index >= _endIndex) throw new InvalidOperationException (SR.InvalidOperation_EnumEnded);
if (_index == 0 && _array.GetType ().GetElementType ().IsPointer) throw new NotSupportedException ("Type is not supported");
if (_index == 0 && _array.GetType ().GetElementType ().IsPointer) throw new NotSupportedException ("Type is not supported.");
return _array.GetValueImpl(_index);
}
}