Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update for recent compiler changes for ref fields #73466

Merged
merged 5 commits into from
Aug 13, 2022
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,7 @@ private static unsafe bool AllowHyphenDuringParsing(NumberFormatInfo info)
return ret;
}

private static unsafe bool ParseNumber(ref char* str, char* strEnd, NumberStyles options, ref NumberBuffer number, StringBuilder? sb, NumberFormatInfo numfmt, bool parseDecimal)
private static unsafe bool ParseNumber(ref char* str, char* strEnd, NumberStyles options, scoped ref NumberBuffer number, StringBuilder? sb, NumberFormatInfo numfmt, bool parseDecimal)
{
Debug.Assert(str != null);
Debug.Assert(strEnd != null);
Expand Down Expand Up @@ -589,7 +589,7 @@ private static bool TrailingZeros(ReadOnlySpan<char> s, int index) =>
// For compatibility, we need to allow trailing zeros at the end of a number string
s.Slice(index).IndexOfAnyExcept('\0') < 0;

internal static unsafe bool TryStringToNumber(ReadOnlySpan<char> str, NumberStyles options, ref NumberBuffer number, StringBuilder sb, NumberFormatInfo numfmt, bool parseDecimal)
internal static unsafe bool TryStringToNumber(ReadOnlySpan<char> str, NumberStyles options, scoped ref NumberBuffer number, StringBuilder sb, NumberFormatInfo numfmt, bool parseDecimal)
{
Debug.Assert(numfmt != null);

Expand Down Expand Up @@ -732,7 +732,7 @@ internal static char ParseFormatSpecifier(ReadOnlySpan<char> format, out int dig
'\0';
}

internal static unsafe void NumberToString(ref ValueStringBuilder sb, ref NumberBuffer number, char format, int nMaxDigits, NumberFormatInfo info, bool isDecimal)
internal static unsafe void NumberToString(ref ValueStringBuilder sb, scoped ref NumberBuffer number, char format, int nMaxDigits, NumberFormatInfo info, bool isDecimal)
{
int nMinDigits = -1;

Expand Down Expand Up @@ -892,7 +892,7 @@ internal static unsafe void NumberToString(ref ValueStringBuilder sb, ref Number
}
}

private static void FormatCurrency(ref ValueStringBuilder sb, ref NumberBuffer number, int nMinDigits, int nMaxDigits, NumberFormatInfo info)
private static void FormatCurrency(ref ValueStringBuilder sb, scoped ref NumberBuffer number, int nMinDigits, int nMaxDigits, NumberFormatInfo info)
{
string fmt = number.sign ?
s_negCurrencyFormats[info.CurrencyNegativePattern] :
Expand All @@ -918,7 +918,7 @@ private static void FormatCurrency(ref ValueStringBuilder sb, ref NumberBuffer n
}
}

private static unsafe void FormatFixed(ref ValueStringBuilder sb, ref NumberBuffer number, int nMinDigits, int nMaxDigits, NumberFormatInfo info, int[]? groupDigits, string sDecimal, string? sGroup)
private static unsafe void FormatFixed(ref ValueStringBuilder sb, scoped ref NumberBuffer number, int nMinDigits, int nMaxDigits, NumberFormatInfo info, int[]? groupDigits, string sDecimal, string? sGroup)
{
Debug.Assert(sGroup != null || groupDigits == null);

Expand Down Expand Up @@ -1039,7 +1039,7 @@ private static unsafe void FormatFixed(ref ValueStringBuilder sb, ref NumberBuff
}
}

private static void FormatNumber(ref ValueStringBuilder sb, ref NumberBuffer number, int nMinDigits, int nMaxDigits, NumberFormatInfo info)
private static void FormatNumber(ref ValueStringBuilder sb, scoped ref NumberBuffer number, int nMinDigits, int nMaxDigits, NumberFormatInfo info)
{
string fmt = number.sign ?
s_negNumberFormats[info.NumberNegativePattern] :
Expand All @@ -1062,7 +1062,7 @@ private static void FormatNumber(ref ValueStringBuilder sb, ref NumberBuffer num
}
}

private static unsafe void FormatScientific(ref ValueStringBuilder sb, ref NumberBuffer number, int nMinDigits, int nMaxDigits, NumberFormatInfo info, char expChar)
private static unsafe void FormatScientific(ref ValueStringBuilder sb, scoped ref NumberBuffer number, int nMinDigits, int nMaxDigits, NumberFormatInfo info, char expChar)
{
char* dig = number.digits;

Expand Down Expand Up @@ -1109,7 +1109,7 @@ private static unsafe void FormatExponent(ref ValueStringBuilder sb, NumberForma
}
}

private static unsafe void FormatGeneral(ref ValueStringBuilder sb, ref NumberBuffer number, int nMinDigits, int nMaxDigits, NumberFormatInfo info, char expChar, bool bSuppressScientific)
private static unsafe void FormatGeneral(ref ValueStringBuilder sb, scoped ref NumberBuffer number, int nMinDigits, int nMaxDigits, NumberFormatInfo info, char expChar, bool bSuppressScientific)
{
int digPos = number.scale;
bool scientific = false;
Expand Down Expand Up @@ -1160,7 +1160,7 @@ private static unsafe void FormatGeneral(ref ValueStringBuilder sb, ref NumberBu
}
}

private static void FormatPercent(ref ValueStringBuilder sb, ref NumberBuffer number, int nMinDigits, int nMaxDigits, NumberFormatInfo info)
private static void FormatPercent(ref ValueStringBuilder sb, scoped ref NumberBuffer number, int nMinDigits, int nMaxDigits, NumberFormatInfo info)
{
string fmt = number.sign ?
s_negPercentFormats[info.PercentNegativePattern] :
Expand Down Expand Up @@ -1280,7 +1280,7 @@ private static unsafe int FindSection(ReadOnlySpan<char> format, int section)
}
}

internal static unsafe void NumberToStringFormat(ref ValueStringBuilder sb, ref NumberBuffer number, ReadOnlySpan<char> format, NumberFormatInfo info)
internal static unsafe void NumberToStringFormat(ref ValueStringBuilder sb, scoped ref NumberBuffer number, ReadOnlySpan<char> format, NumberFormatInfo info)
{
int digitCount;
int decimalPos;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -883,7 +883,7 @@ public static unsafe SocketError Poll(SafeSocketHandle handle, int microseconds,
public static unsafe SocketError Select(IList? checkRead, IList? checkWrite, IList? checkError, int microseconds)
{
const int StackThreshold = 64; // arbitrary limit to avoid too much space on stack
static bool ShouldStackAlloc(IList? list, ref IntPtr[]? lease, out Span<IntPtr> span)
static bool ShouldStackAlloc(IList? list, scoped ref IntPtr[]? lease, out Span<IntPtr> span)
{
int count;
if (list == null || (count = list.Count) == 0)
Expand Down
Loading