mirror of
https://github.com/BepInEx/mono.git
synced 2026-11-16 01:41:18 -10:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6a0d1e6c2f | ||
|
|
25c255e84e | ||
|
|
287f8facef | ||
|
|
59d09f31d4 | ||
|
|
4dbfdc81d9 | ||
|
|
7d8e9c0dab | ||
|
|
a0fc6ba35b | ||
|
|
297dd55e8f | ||
|
|
71f3133533 | ||
|
|
8926d0d648 | ||
|
|
0c0f9d2bb4 | ||
|
|
5720291db0 | ||
|
|
aa05566b97 | ||
|
|
2f15aea45b | ||
|
|
b5a82acc07 | ||
|
|
ab6ff1f921 | ||
|
|
fe1fe75fbd | ||
|
|
4d71db0672 | ||
|
|
f7ad68bc13 | ||
|
|
eb66a378dc | ||
|
|
9087958e24 | ||
|
|
314dfb37d5 | ||
|
|
43cfbb97b3 | ||
|
|
71858945c3 | ||
|
|
d98dfc7ff9 | ||
|
|
092cd532d5 | ||
|
|
4a1716693f | ||
|
|
8594ecdc47 | ||
|
|
601b9d8ff5 | ||
|
|
fe6ec850fb | ||
|
|
851563a2ee | ||
|
|
0d5681b488 | ||
|
|
ab1ffd462c | ||
|
|
01d52f9de4 | ||
|
|
fc4074b399 | ||
|
|
06c3be2f7f | ||
|
|
f9e6a8d043 | ||
|
|
14b2c98a04 | ||
|
|
b8c6612c28 | ||
|
|
ffefa2dd78 | ||
|
|
ac5cd0ecc8 | ||
|
|
777c482461 | ||
|
|
c29b148609 | ||
|
|
4ac15ac2b5 | ||
|
|
4cb023eb7f | ||
|
|
71af84713e | ||
|
|
331b2cdb1e | ||
|
|
96f89ed2e5 | ||
|
|
74639ebf72 | ||
|
|
588d52e205 | ||
|
|
a2ba6c3973 | ||
|
|
007e816592 | ||
|
|
5d38f94238 | ||
|
|
c02b7ff194 | ||
|
|
5f877073e0 | ||
|
|
5219618357 | ||
|
|
9f4d1dc49f | ||
|
|
fbfd2ab406 | ||
|
|
9601199486 | ||
|
|
bed040e520 | ||
|
|
5804e12677 | ||
|
|
c07cb682b7 | ||
|
|
7c084530b0 | ||
|
|
8b3e6c0526 | ||
|
|
7fbce79900 | ||
|
|
13e536a659 |
No files matched your search
Regular → Executable
+12
-18
@@ -1,7 +1,7 @@
|
||||
# Process this file with autoconf to produce a configure script.
|
||||
#AC_PREREQ([2.62])
|
||||
|
||||
AC_INIT(mono, [3.1.0],
|
||||
AC_INIT(mono, [3.2.2],
|
||||
[http://bugzilla.xamarin.com/enter_bug.cgi?classification=Mono])
|
||||
|
||||
AC_CONFIG_SRCDIR([README])
|
||||
@@ -105,22 +105,6 @@ case "$host" in
|
||||
if test "x$host" == "x$build" -a "x$host" == "x$target"; then
|
||||
AC_DEFINE(TARGET_WIN32,1,[Target OS is Win32])
|
||||
fi
|
||||
#
|
||||
# gcc-3/g++-3 are from the gcc-core/gcc-g++ cygwin packages.
|
||||
# Other gcc packages will not work:
|
||||
# - the gcc-4 packages no longer support -mno-cygwin
|
||||
# - the mingw-gcc packages produce executables which depends on a libgcc<...>
|
||||
# dll, which means we would have to distribute that file too.
|
||||
#
|
||||
if test "x$CC" != "x"; then
|
||||
AC_ERROR(Don't set CC. mono can only be compiled with gcc-3 from the 'gcc-core' package)
|
||||
fi
|
||||
CC="gcc-3.exe -mno-cygwin -g"
|
||||
CXX="g++-3.exe -mno-cygwin -g"
|
||||
# So libgc configure gets -mno-cygwin
|
||||
export CC
|
||||
export CXX
|
||||
CFLAGS_FOR_EGLIB="$CFLAGS_FOR_EGLIB -mno-cygwin"
|
||||
else
|
||||
target_win32=yes
|
||||
AC_DEFINE(TARGET_WIN32,1,[Target OS is Win32/MinGW])
|
||||
@@ -491,6 +475,12 @@ AC_TRY_LINK([#include <math.h>], [
|
||||
# We'll have to use signals
|
||||
AC_MSG_RESULT(no)
|
||||
])
|
||||
# mingw
|
||||
AC_CHECK_FUNCS(_finite, , AC_MSG_CHECKING(for _finite in math.h)
|
||||
AC_TRY_LINK([#include <math.h>],
|
||||
[ _finite(0.0); ],
|
||||
AC_DEFINE(HAVE__FINITE, 1, [Have _finite in -lm]) AC_MSG_RESULT(yes),
|
||||
AC_MSG_RESULT(no)))
|
||||
|
||||
# for Linux statfs support
|
||||
AC_CHECK_HEADERS(linux/magic.h)
|
||||
@@ -1583,6 +1573,10 @@ if test x$target_win32 = xno; then
|
||||
AC_MSG_RESULT(disabled)
|
||||
else
|
||||
AC_TRY_RUN([
|
||||
#ifdef __clang__
|
||||
#error "__thread does not currently work with clang"
|
||||
#endif
|
||||
|
||||
#include <pthread.h>
|
||||
__thread int i;
|
||||
static int res1, res2;
|
||||
@@ -2486,7 +2480,7 @@ case "$host" in
|
||||
have_visibility_hidden=no
|
||||
sgen_supported=true
|
||||
;;
|
||||
cygwin*)
|
||||
mingw*|cygwin*)
|
||||
sgen_supported=true
|
||||
have_visibility_hidden=no
|
||||
;;
|
||||
|
||||
+58
-28
@@ -174,14 +174,34 @@ gsize
|
||||
g_iconv (GIConv cd, gchar **inbytes, gsize *inbytesleft,
|
||||
gchar **outbytes, gsize *outbytesleft)
|
||||
{
|
||||
size_t inleft, outleft;
|
||||
gsize inleft, outleft;
|
||||
char *inptr, *outptr;
|
||||
gunichar c;
|
||||
int rc = 0;
|
||||
|
||||
#ifdef HAVE_ICONV
|
||||
if (cd->cd != (iconv_t) -1)
|
||||
return iconv (cd->cd, inbytes, inbytesleft, outbytes, outbytesleft);
|
||||
if (cd->cd != (iconv_t) -1) {
|
||||
/* Note: gsize may have a different size than size_t, so we need to
|
||||
remap inbytesleft and outbytesleft to size_t's. */
|
||||
size_t *outleftptr, *inleftptr;
|
||||
size_t n_outleft, n_inleft;
|
||||
|
||||
if (inbytesleft) {
|
||||
n_inleft = *inbytesleft;
|
||||
inleftptr = &n_inleft;
|
||||
} else {
|
||||
inleftptr = NULL;
|
||||
}
|
||||
|
||||
if (outbytesleft) {
|
||||
n_outleft = *outbytesleft;
|
||||
outleftptr = &n_outleft;
|
||||
} else {
|
||||
outleftptr = NULL;
|
||||
}
|
||||
|
||||
return iconv (cd->cd, inbytes, inleftptr, outbytes, outleftptr);
|
||||
}
|
||||
#endif
|
||||
|
||||
if (outbytes == NULL || outbytesleft == NULL) {
|
||||
@@ -640,7 +660,7 @@ gchar *
|
||||
g_convert (const gchar *str, gssize len, const gchar *to_charset, const gchar *from_charset,
|
||||
gsize *bytes_read, gsize *bytes_written, GError **err)
|
||||
{
|
||||
size_t outsize, outused, outleft, inleft, grow, rc;
|
||||
gsize outsize, outused, outleft, inleft, grow, rc;
|
||||
char *result, *outbuf, *inbuf;
|
||||
gboolean flush = FALSE;
|
||||
gboolean done = FALSE;
|
||||
@@ -676,7 +696,7 @@ g_convert (const gchar *str, gssize len, const gchar *to_charset, const gchar *f
|
||||
else
|
||||
rc = g_iconv (cd, NULL, NULL, &outbuf, &outleft);
|
||||
|
||||
if (rc == (size_t) -1) {
|
||||
if (rc == (gsize) -1) {
|
||||
switch (errno) {
|
||||
case E2BIG:
|
||||
/* grow our result buffer */
|
||||
@@ -901,7 +921,7 @@ eg_utf8_to_utf16_general (const gchar *str, glong len, glong *items_read, glong
|
||||
size_t inleft;
|
||||
char *inptr;
|
||||
gunichar c;
|
||||
int n;
|
||||
int u, n;
|
||||
|
||||
g_return_val_if_fail (str != NULL, NULL);
|
||||
|
||||
@@ -910,6 +930,7 @@ eg_utf8_to_utf16_general (const gchar *str, glong len, glong *items_read, glong
|
||||
g_set_error (err, G_CONVERT_ERROR, G_CONVERT_ERROR_FAILED, "Conversions with embedded nulls must pass the string length");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
len = strlen (str);
|
||||
}
|
||||
|
||||
@@ -917,29 +938,18 @@ eg_utf8_to_utf16_general (const gchar *str, glong len, glong *items_read, glong
|
||||
inleft = len;
|
||||
|
||||
while (inleft > 0) {
|
||||
if ((n = decode_utf8 (inptr, inleft, &c)) < 0) {
|
||||
if (errno == EILSEQ) {
|
||||
g_set_error (err, G_CONVERT_ERROR, G_CONVERT_ERROR_ILLEGAL_SEQUENCE,
|
||||
"Illegal byte sequence encounted in the input.");
|
||||
} else if (items_read) {
|
||||
/* partial input is ok if we can let our caller know... */
|
||||
break;
|
||||
} else {
|
||||
g_set_error (err, G_CONVERT_ERROR, G_CONVERT_ERROR_PARTIAL_INPUT,
|
||||
"Partial byte sequence encountered in the input.");
|
||||
}
|
||||
|
||||
if (items_read)
|
||||
*items_read = inptr - str;
|
||||
|
||||
if (items_written)
|
||||
*items_written = 0;
|
||||
|
||||
return NULL;
|
||||
} else if (c == 0 && !include_nuls)
|
||||
if ((n = decode_utf8 (inptr, inleft, &c)) < 0)
|
||||
goto error;
|
||||
|
||||
if (c == 0 && !include_nuls)
|
||||
break;
|
||||
|
||||
outlen += g_unichar_to_utf16 (c, NULL);
|
||||
if ((u = g_unichar_to_utf16 (c, NULL)) < 0) {
|
||||
errno = EILSEQ;
|
||||
goto error;
|
||||
}
|
||||
|
||||
outlen += u;
|
||||
inleft -= n;
|
||||
inptr += n;
|
||||
}
|
||||
@@ -957,7 +967,8 @@ eg_utf8_to_utf16_general (const gchar *str, glong len, glong *items_read, glong
|
||||
while (inleft > 0) {
|
||||
if ((n = decode_utf8 (inptr, inleft, &c)) < 0)
|
||||
break;
|
||||
else if (c == 0 && !include_nuls)
|
||||
|
||||
if (c == 0 && !include_nuls)
|
||||
break;
|
||||
|
||||
outptr += g_unichar_to_utf16 (c, outptr);
|
||||
@@ -968,6 +979,25 @@ eg_utf8_to_utf16_general (const gchar *str, glong len, glong *items_read, glong
|
||||
*outptr = '\0';
|
||||
|
||||
return outbuf;
|
||||
|
||||
error:
|
||||
if (errno == EILSEQ) {
|
||||
g_set_error (err, G_CONVERT_ERROR, G_CONVERT_ERROR_ILLEGAL_SEQUENCE,
|
||||
"Illegal byte sequence encounted in the input.");
|
||||
} else if (items_read) {
|
||||
/* partial input is ok if we can let our caller know... */
|
||||
} else {
|
||||
g_set_error (err, G_CONVERT_ERROR, G_CONVERT_ERROR_PARTIAL_INPUT,
|
||||
"Partial byte sequence encountered in the input.");
|
||||
}
|
||||
|
||||
if (items_read)
|
||||
*items_read = inptr - str;
|
||||
|
||||
if (items_written)
|
||||
*items_written = 0;
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
gunichar2 *
|
||||
|
||||
+1
-2
@@ -235,9 +235,8 @@ g_string_truncate (GString *string, gsize len)
|
||||
g_return_val_if_fail (string != NULL, string);
|
||||
|
||||
/* Silent return */
|
||||
if (len < 0 || len >= string->len) {
|
||||
if (len >= string->len)
|
||||
return string;
|
||||
}
|
||||
|
||||
string->len = len;
|
||||
string->str[len] = 0;
|
||||
|
||||
+1
-1
@@ -969,7 +969,7 @@ word n;
|
||||
}
|
||||
# endif
|
||||
expansion_slop = WORDS_TO_BYTES(min_words_allocd()) + 4*MAXHINCR*HBLKSIZE;
|
||||
if (GC_last_heap_addr == 0 && !((word)space & SIGNB)
|
||||
if ((GC_last_heap_addr == 0 && !((word)space & SIGNB))
|
||||
|| (GC_last_heap_addr != 0 && GC_last_heap_addr < (ptr_t)space)) {
|
||||
/* Assume the heap is growing up */
|
||||
GC_greatest_plausible_heap_addr =
|
||||
|
||||
+1
-1
@@ -22,7 +22,7 @@
|
||||
# include "private/gc_priv.h"
|
||||
|
||||
map_entry_type * GC_invalid_map = 0;
|
||||
static max_valid_offset = 0;
|
||||
static word max_valid_offset = 0;
|
||||
|
||||
/* Invalidate the object map associated with a block. Free blocks */
|
||||
/* are identified by invalid maps. */
|
||||
|
||||
+1
-1
@@ -165,7 +165,7 @@ void (*GC_is_valid_displacement_print_proc) GC_PROTO((GC_PTR)) =
|
||||
pdispl = HBLKDISPL(p);
|
||||
map_entry = MAP_ENTRY((hhdr -> hb_map), pdispl);
|
||||
if (map_entry == OBJ_INVALID
|
||||
|| sz > MAXOBJBYTES && (ptr_t)p >= (ptr_t)h + sz) {
|
||||
|| (sz > MAXOBJBYTES && (ptr_t)p >= (ptr_t)h + sz)) {
|
||||
goto fail;
|
||||
}
|
||||
return(p);
|
||||
|
||||
@@ -139,5 +139,16 @@ namespace MonoTests.EvaluatorTest
|
||||
Evaluator.Run ("d.GetType ();");
|
||||
}
|
||||
#endif
|
||||
|
||||
#if NET_4_5
|
||||
[Test]
|
||||
public void AwaitExpression ()
|
||||
{
|
||||
Evaluator.WaitOnTask = true;
|
||||
var res = Evaluator.Evaluate("var res = await System.Threading.Tasks.Task.FromResult (1) + await System.Threading.Tasks.Task.FromResult (2);");
|
||||
res = Evaluator.Evaluate ("res;");
|
||||
Assert.AreEqual (3, res, "#1");
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
@@ -236,8 +236,18 @@ namespace System.IO.MemoryMappedFiles
|
||||
[DllImport ("libc", SetLastError=true)]
|
||||
static extern int open (string path, int flags, int access);
|
||||
|
||||
#if MONODROID
|
||||
[DllImport ("__Internal")]
|
||||
static extern int monodroid_getpagesize ();
|
||||
|
||||
static int getpagesize ()
|
||||
{
|
||||
return monodroid_getpagesize ();
|
||||
}
|
||||
#else
|
||||
[DllImport ("libc")]
|
||||
static extern int getpagesize ();
|
||||
#endif
|
||||
|
||||
[MethodImplAttribute (MethodImplOptions.InternalCall)]
|
||||
static extern long mono_filesize_from_path (string str);
|
||||
|
||||
@@ -29,10 +29,231 @@ using System.Text;
|
||||
|
||||
namespace System {
|
||||
|
||||
interface IAndroidTimeZoneDB {
|
||||
IEnumerable<string> GetAvailableIds ();
|
||||
byte[] GetTimeZoneData (string id);
|
||||
}
|
||||
|
||||
[StructLayout (LayoutKind.Sequential, Pack=1)]
|
||||
unsafe struct AndroidTzDataHeader {
|
||||
public fixed byte signature [12];
|
||||
public int indexOffset;
|
||||
public int dataOffset;
|
||||
public int zoneTabOffset;
|
||||
}
|
||||
|
||||
[StructLayout (LayoutKind.Sequential, Pack=1)]
|
||||
unsafe struct AndroidTzDataEntry {
|
||||
public fixed byte id [40];
|
||||
public int byteOffset;
|
||||
public int length;
|
||||
public int rawUtcOffset;
|
||||
}
|
||||
|
||||
/*
|
||||
* Android v4.3 Timezone support infrastructure.
|
||||
*
|
||||
* This is a C# port of libcore.util.ZoneInfoDB:
|
||||
*
|
||||
* https://android.googlesource.com/platform/libcore/+/master/luni/src/main/java/libcore/util/ZoneInfoDB.java
|
||||
*
|
||||
* This is needed in order to read Android v4.3 tzdata files.
|
||||
*/
|
||||
sealed class AndroidTzData : IAndroidTimeZoneDB {
|
||||
|
||||
internal static readonly string[] Paths = new string[]{
|
||||
Environment.GetEnvironmentVariable ("ANDROID_DATA") + "/misc/zoneinfo/tzdata",
|
||||
Environment.GetEnvironmentVariable ("ANDROID_ROOT") + "/usr/share/zoneinfo/tzdata",
|
||||
};
|
||||
|
||||
string tzdataPath;
|
||||
Stream data;
|
||||
string version;
|
||||
string zoneTab;
|
||||
|
||||
string[] ids;
|
||||
int[] byteOffsets;
|
||||
int[] lengths;
|
||||
|
||||
public AndroidTzData (params string[] paths)
|
||||
{
|
||||
foreach (var path in paths)
|
||||
if (LoadData (path)) {
|
||||
tzdataPath = path;
|
||||
return;
|
||||
}
|
||||
|
||||
Console.Error.WriteLine ("Couldn't find any tzdata!");
|
||||
tzdataPath = "/";
|
||||
version = "missing";
|
||||
zoneTab = "# Emergency fallback data.\n";
|
||||
ids = new[]{ "GMT" };
|
||||
}
|
||||
|
||||
public string Version {
|
||||
get {return version;}
|
||||
}
|
||||
|
||||
public string ZoneTab {
|
||||
get {return zoneTab;}
|
||||
}
|
||||
|
||||
bool LoadData (string path)
|
||||
{
|
||||
if (!File.Exists (path))
|
||||
return false;
|
||||
try {
|
||||
data = File.OpenRead (path);
|
||||
} catch (IOException) {
|
||||
return false;
|
||||
} catch (UnauthorizedAccessException) {
|
||||
return false;
|
||||
}
|
||||
|
||||
try {
|
||||
ReadHeader ();
|
||||
return true;
|
||||
} catch (Exception e) {
|
||||
Console.Error.WriteLine ("tzdata file \"{0}\" was present but invalid: {1}", path, e);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
unsafe void ReadHeader ()
|
||||
{
|
||||
int size = System.Math.Max (Marshal.SizeOf (typeof (AndroidTzDataHeader)), Marshal.SizeOf (typeof (AndroidTzDataEntry)));
|
||||
var buffer = new byte [size];
|
||||
var header = ReadAt<AndroidTzDataHeader>(0, buffer);
|
||||
|
||||
header.indexOffset = NetworkToHostOrder (header.indexOffset);
|
||||
header.dataOffset = NetworkToHostOrder (header.dataOffset);
|
||||
header.zoneTabOffset = NetworkToHostOrder (header.zoneTabOffset);
|
||||
|
||||
sbyte* s = (sbyte*) header.signature;
|
||||
string magic = new string (s, 0, 6, Encoding.ASCII);
|
||||
if (magic != "tzdata" || header.signature [11] != 0) {
|
||||
var b = new StringBuilder ();
|
||||
b.Append ("bad tzdata magic:");
|
||||
for (int i = 0; i < 12; ++i) {
|
||||
b.Append (" ").Append (((byte) s [i]).ToString ("x2"));
|
||||
}
|
||||
throw new InvalidOperationException ("bad tzdata magic: " + b.ToString ());
|
||||
}
|
||||
|
||||
version = new string (s, 6, 5, Encoding.ASCII);
|
||||
|
||||
ReadIndex (header.indexOffset, header.dataOffset, buffer);
|
||||
ReadZoneTab (header.zoneTabOffset, checked ((int) data.Length) - header.zoneTabOffset);
|
||||
}
|
||||
|
||||
unsafe T ReadAt<T> (long position, byte[] buffer)
|
||||
where T : struct
|
||||
{
|
||||
int size = Marshal.SizeOf (typeof (T));
|
||||
if (buffer.Length < size)
|
||||
throw new InvalidOperationException ("Internal error: buffer too small");
|
||||
|
||||
data.Position = position;
|
||||
int r;
|
||||
if ((r = data.Read (buffer, 0, size)) < size)
|
||||
throw new InvalidOperationException (
|
||||
string.Format ("Error reading '{0}': read {1} bytes, expected {2}", tzdataPath, r, size));
|
||||
|
||||
fixed (byte* b = buffer)
|
||||
return (T) Marshal.PtrToStructure ((IntPtr) b, typeof (T));
|
||||
}
|
||||
|
||||
static int NetworkToHostOrder (int value)
|
||||
{
|
||||
if (!BitConverter.IsLittleEndian)
|
||||
return value;
|
||||
|
||||
return
|
||||
(((value >> 24) & 0xFF) |
|
||||
((value >> 08) & 0xFF00) |
|
||||
((value << 08) & 0xFF0000) |
|
||||
((value << 24)));
|
||||
}
|
||||
|
||||
unsafe void ReadIndex (int indexOffset, int dataOffset, byte[] buffer)
|
||||
{
|
||||
int indexSize = dataOffset - indexOffset;
|
||||
int entryCount = indexSize / Marshal.SizeOf (typeof (AndroidTzDataEntry));
|
||||
int entrySize = Marshal.SizeOf (typeof (AndroidTzDataEntry));
|
||||
|
||||
byteOffsets = new int [entryCount];
|
||||
ids = new string [entryCount];
|
||||
lengths = new int [entryCount];
|
||||
|
||||
for (int i = 0; i < entryCount; ++i) {
|
||||
var entry = ReadAt<AndroidTzDataEntry>(indexOffset + (entrySize*i), buffer);
|
||||
var p = (sbyte*) entry.id;
|
||||
|
||||
byteOffsets [i] = NetworkToHostOrder (entry.byteOffset) + dataOffset;
|
||||
ids [i] = new string (p, 0, GetStringLength (p, 40), Encoding.ASCII);
|
||||
lengths [i] = NetworkToHostOrder (entry.length);
|
||||
|
||||
if (lengths [i] < Marshal.SizeOf (typeof (AndroidTzDataHeader)))
|
||||
throw new InvalidOperationException ("Length in index file < sizeof(tzhead)");
|
||||
}
|
||||
}
|
||||
|
||||
static unsafe int GetStringLength (sbyte* s, int maxLength)
|
||||
{
|
||||
int len;
|
||||
for (len = 0; len < maxLength; len++, s++) {
|
||||
if (*s == 0)
|
||||
break;
|
||||
}
|
||||
return len;
|
||||
}
|
||||
|
||||
unsafe void ReadZoneTab (int zoneTabOffset, int zoneTabSize)
|
||||
{
|
||||
byte[] zoneTab = new byte [zoneTabSize];
|
||||
|
||||
data.Position = zoneTabOffset;
|
||||
|
||||
int r;
|
||||
if ((r = data.Read (zoneTab, 0, zoneTab.Length)) < zoneTab.Length)
|
||||
throw new InvalidOperationException (
|
||||
string.Format ("Error reading zonetab: read {0} bytes, expected {1}", r, zoneTabSize));
|
||||
|
||||
this.zoneTab = Encoding.ASCII.GetString (zoneTab, 0, zoneTab.Length);
|
||||
}
|
||||
|
||||
public IEnumerable<string> GetAvailableIds ()
|
||||
{
|
||||
return ids;
|
||||
}
|
||||
|
||||
public byte[] GetTimeZoneData (string id)
|
||||
{
|
||||
int i = Array.BinarySearch (ids, id, StringComparer.Ordinal);
|
||||
if (i < 0)
|
||||
return null;
|
||||
|
||||
int offset = byteOffsets [i];
|
||||
int length = lengths [i];
|
||||
var buffer = new byte [length];
|
||||
|
||||
lock (data) {
|
||||
data.Position = offset;
|
||||
int r;
|
||||
if ((r = data.Read (buffer, 0, buffer.Length)) < buffer.Length)
|
||||
throw new InvalidOperationException (
|
||||
string.Format ("Unable to fully read from file '{0}' at offset {1} length {2}; read {3} bytes expected {4}.",
|
||||
tzdataPath, offset, length, r, buffer.Length));
|
||||
}
|
||||
|
||||
return buffer;
|
||||
}
|
||||
}
|
||||
|
||||
partial class TimeZoneInfo {
|
||||
|
||||
/*
|
||||
* Android Timezone support infrastructure.
|
||||
* Android < v4.3 Timezone support infrastructure.
|
||||
*
|
||||
* This is a C# port of org.apache.harmony.luni.internal.util.ZoneInfoDB:
|
||||
*
|
||||
@@ -48,34 +269,35 @@ namespace System {
|
||||
* which succinctly describes why we can't just use the LIBC implementation in
|
||||
* TimeZoneInfo.cs -- the "standard Unixy" directory structure is NOT used.
|
||||
*/
|
||||
static class ZoneInfoDB {
|
||||
sealed class ZoneInfoDB : IAndroidTimeZoneDB {
|
||||
const int TimeZoneNameLength = 40;
|
||||
const int TimeZoneIntSize = 4;
|
||||
|
||||
static readonly string ZoneDirectoryName = Environment.GetEnvironmentVariable ("ANDROID_ROOT") + "/usr/share/zoneinfo/";
|
||||
static readonly string ZoneFileName = ZoneDirectoryName + "zoneinfo.dat";
|
||||
static readonly string IndexFileName = ZoneDirectoryName + "zoneinfo.idx";
|
||||
const string DefaultVersion = "2007h";
|
||||
static readonly string VersionFileName = ZoneDirectoryName + "zoneinfo.version";
|
||||
internal static readonly string ZoneDirectoryName = Environment.GetEnvironmentVariable ("ANDROID_ROOT") + "/usr/share/zoneinfo/";
|
||||
|
||||
static readonly object _lock = new object ();
|
||||
const string ZoneFileName = "zoneinfo.dat";
|
||||
const string IndexFileName = "zoneinfo.idx";
|
||||
const string DefaultVersion = "2007h";
|
||||
const string VersionFileName = "zoneinfo.version";
|
||||
|
||||
static readonly string version;
|
||||
static readonly string[] names;
|
||||
static readonly int[] starts;
|
||||
static readonly int[] lengths;
|
||||
static readonly int[] offsets;
|
||||
readonly string zoneRoot;
|
||||
readonly string version;
|
||||
readonly string[] names;
|
||||
readonly int[] starts;
|
||||
readonly int[] lengths;
|
||||
readonly int[] offsets;
|
||||
|
||||
static ZoneInfoDB ()
|
||||
public ZoneInfoDB (string zoneInfoDB = null)
|
||||
{
|
||||
zoneRoot = zoneInfoDB ?? ZoneDirectoryName;
|
||||
try {
|
||||
version = ReadVersion ();
|
||||
version = ReadVersion (Path.Combine (zoneRoot, VersionFileName));
|
||||
} catch {
|
||||
version = DefaultVersion;
|
||||
}
|
||||
|
||||
try {
|
||||
ReadDatabase (out names, out starts, out lengths, out offsets);
|
||||
ReadDatabase (Path.Combine (zoneRoot, IndexFileName), out names, out starts, out lengths, out offsets);
|
||||
} catch {
|
||||
names = new string [0];
|
||||
starts = new int [0];
|
||||
@@ -84,16 +306,16 @@ namespace System {
|
||||
}
|
||||
}
|
||||
|
||||
static string ReadVersion ()
|
||||
static string ReadVersion (string path)
|
||||
{
|
||||
using (var file = new StreamReader (VersionFileName, Encoding.GetEncoding ("iso-8859-1"))) {
|
||||
using (var file = new StreamReader (path, Encoding.GetEncoding ("iso-8859-1"))) {
|
||||
return file.ReadToEnd ().Trim ();
|
||||
}
|
||||
}
|
||||
|
||||
static void ReadDatabase (out string[] names, out int[] starts, out int[] lengths, out int[] offsets)
|
||||
void ReadDatabase (string path, out string[] names, out int[] starts, out int[] lengths, out int[] offsets)
|
||||
{
|
||||
using (var file = File.OpenRead (IndexFileName)) {
|
||||
using (var file = File.OpenRead (path)) {
|
||||
var nbuf = new byte [TimeZoneNameLength];
|
||||
|
||||
int numEntries = (int) (file.Length / (TimeZoneNameLength + 3*TimeZoneIntSize));
|
||||
@@ -140,21 +362,21 @@ namespace System {
|
||||
((nbuf [2] & 0xff) << 8) + (nbuf [3] & 0xff);
|
||||
}
|
||||
|
||||
internal static string Version {
|
||||
internal string Version {
|
||||
get {return version;}
|
||||
}
|
||||
|
||||
internal static IEnumerable<string> GetAvailableIds ()
|
||||
public IEnumerable<string> GetAvailableIds ()
|
||||
{
|
||||
return GetAvailableIds (0, false);
|
||||
}
|
||||
|
||||
internal static IEnumerable<string> GetAvailableIds (int rawOffset)
|
||||
IEnumerable<string> GetAvailableIds (int rawOffset)
|
||||
{
|
||||
return GetAvailableIds (rawOffset, true);
|
||||
}
|
||||
|
||||
static IEnumerable<string> GetAvailableIds (int rawOffset, bool checkOffset)
|
||||
IEnumerable<string> GetAvailableIds (int rawOffset, bool checkOffset)
|
||||
{
|
||||
for (int i = 0; i < offsets.Length; ++i) {
|
||||
if (!checkOffset || offsets [i] == rawOffset)
|
||||
@@ -162,21 +384,21 @@ namespace System {
|
||||
}
|
||||
}
|
||||
|
||||
static TimeZoneInfo _GetTimeZone (string name)
|
||||
public byte[] GetTimeZoneData (string id)
|
||||
{
|
||||
int start, length;
|
||||
using (var stream = GetTimeZoneData (name, out start, out length)) {
|
||||
using (var stream = GetTimeZoneData (id, out start, out length)) {
|
||||
if (stream == null)
|
||||
return null;
|
||||
byte[] buf = new byte [length];
|
||||
Fill (stream, buf, buf.Length);
|
||||
return TimeZoneInfo.ParseTZBuffer (name, buf, length);
|
||||
return buf;
|
||||
}
|
||||
}
|
||||
|
||||
static FileStream GetTimeZoneData (string name, out int start, out int length)
|
||||
FileStream GetTimeZoneData (string name, out int start, out int length)
|
||||
{
|
||||
var f = new FileInfo (Path.Combine (ZoneDirectoryName, name));
|
||||
var f = new FileInfo (Path.Combine (zoneRoot, name));
|
||||
if (f.Exists) {
|
||||
start = 0;
|
||||
length = (int) f.Length;
|
||||
@@ -192,11 +414,48 @@ namespace System {
|
||||
start = starts [i];
|
||||
length = lengths [i];
|
||||
|
||||
var stream = File.OpenRead (ZoneFileName);
|
||||
var stream = File.OpenRead (Path.Combine (zoneRoot, ZoneFileName));
|
||||
stream.Seek (start, SeekOrigin.Begin);
|
||||
|
||||
return stream;
|
||||
}
|
||||
}
|
||||
|
||||
static class AndroidTimeZones {
|
||||
|
||||
static IAndroidTimeZoneDB db;
|
||||
|
||||
static AndroidTimeZones ()
|
||||
{
|
||||
db = GetDefaultTimeZoneDB ();
|
||||
}
|
||||
|
||||
static IAndroidTimeZoneDB GetDefaultTimeZoneDB ()
|
||||
{
|
||||
foreach (var p in AndroidTzData.Paths)
|
||||
if (File.Exists (p))
|
||||
return new AndroidTzData (AndroidTzData.Paths);
|
||||
if (Directory.Exists (ZoneInfoDB.ZoneDirectoryName))
|
||||
return new ZoneInfoDB ();
|
||||
return null;
|
||||
}
|
||||
|
||||
internal static IEnumerable<string> GetAvailableIds ()
|
||||
{
|
||||
return db == null
|
||||
? new string [0]
|
||||
: db.GetAvailableIds ();
|
||||
}
|
||||
|
||||
static TimeZoneInfo _GetTimeZone (string name)
|
||||
{
|
||||
if (db == null)
|
||||
return null;
|
||||
byte[] buffer = db.GetTimeZoneData (name);
|
||||
if (buffer == null)
|
||||
return null;
|
||||
return TimeZoneInfo.ParseTZBuffer (name, buffer, buffer.Length);
|
||||
}
|
||||
|
||||
internal static TimeZoneInfo GetTimeZone (string id)
|
||||
{
|
||||
@@ -211,7 +470,7 @@ namespace System {
|
||||
|
||||
try {
|
||||
return _GetTimeZone (id);
|
||||
} catch (Exception e) {
|
||||
} catch (Exception) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -265,6 +524,8 @@ namespace System {
|
||||
return sign * (hour * 60) * 60;
|
||||
}
|
||||
|
||||
static readonly object _lock = new object ();
|
||||
|
||||
static TimeZoneInfo defaultZone;
|
||||
internal static TimeZoneInfo Default {
|
||||
get {
|
||||
@@ -295,7 +556,7 @@ namespace System {
|
||||
#if SELF_TEST
|
||||
/*
|
||||
* Compile:
|
||||
* mcs /out:tzi.exe "/d:INSIDE_CORLIB;MONODROID;NET_4_0;LIBC;SELF_TEST" System/TimeZone*.cs ../../build/common/Consts.cs
|
||||
* mcs /out:tzi.exe /unsafe "/d:INSIDE_CORLIB;MONODROID;NET_4_0;LIBC;SELF_TEST" System/TimeZone*.cs ../../build/common/Consts.cs ../Mono.Options/Mono.Options/Options.cs
|
||||
* Prep:
|
||||
* mkdir -p usr/share/zoneinfo
|
||||
* android_root=`adb shell echo '$ANDROID_ROOT' | tr -d "\r"`
|
||||
@@ -305,17 +566,31 @@ namespace System {
|
||||
*/
|
||||
static void Main (string[] args)
|
||||
{
|
||||
Console.WriteLine ("Version: {0}", version);
|
||||
for (int i = 0; i < names.Length; ++i) {
|
||||
Console.Write ("{0,3}\tname={1,-40} start={2,-10} length={3,-4} offset=0x{4,8}",
|
||||
i, names [i], starts [i], lengths [i], offsets [i].ToString ("x8"));
|
||||
Func<IAndroidTimeZoneDB> c = () => GetDefaultTimeZoneDB ();
|
||||
Mono.Options.OptionSet p = null;
|
||||
p = new Mono.Options.OptionSet () {
|
||||
{ "T=", "Create AndroidTzData from {PATH}.", v => {
|
||||
c = () => new AndroidTzData (v);
|
||||
} },
|
||||
{ "Z=", "Create ZoneInfoDB from {DIR}.", v => {
|
||||
c = () => new ZoneInfoDB (v);
|
||||
} },
|
||||
{ "help", "Show this message and exit", v => {
|
||||
p.WriteOptionDescriptions (Console.Out);
|
||||
Environment.Exit (0);
|
||||
} },
|
||||
};
|
||||
p.Parse (args);
|
||||
AndroidTimeZones.db = c ();
|
||||
Console.WriteLine ("DB type: {0}", AndroidTimeZones.db.GetType ().FullName);
|
||||
foreach (var id in GetAvailableIds ()) {
|
||||
Console.Write ("name={0,-40}", id);
|
||||
try {
|
||||
TimeZoneInfo zone = _GetTimeZone (names [i]);
|
||||
TimeZoneInfo zone = _GetTimeZone (id);
|
||||
if (zone != null)
|
||||
Console.Write (" {0}", zone);
|
||||
else {
|
||||
Console.Write (" ERROR:null Index? {0}",
|
||||
Array.BinarySearch (names, names [i], StringComparer.Ordinal));
|
||||
Console.Write (" ERROR:null");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Console.WriteLine ();
|
||||
|
||||
@@ -86,7 +86,7 @@ namespace System
|
||||
get {
|
||||
if (local == null) {
|
||||
#if MONODROID
|
||||
local = ZoneInfoDB.Default;
|
||||
local = AndroidTimeZones.Default;
|
||||
#elif MONOTOUCH
|
||||
using (Stream stream = GetMonoTouchData (null)) {
|
||||
local = BuildFromStream ("Local", stream);
|
||||
@@ -394,7 +394,7 @@ namespace System
|
||||
}
|
||||
#endif
|
||||
#if MONODROID
|
||||
var timeZoneInfo = ZoneInfoDB.GetTimeZone (id);
|
||||
var timeZoneInfo = AndroidTimeZones.GetTimeZone (id);
|
||||
if (timeZoneInfo == null)
|
||||
throw new TimeZoneNotFoundException ();
|
||||
return timeZoneInfo;
|
||||
@@ -619,8 +619,8 @@ namespace System
|
||||
}
|
||||
#endif
|
||||
#if MONODROID
|
||||
foreach (string id in ZoneInfoDB.GetAvailableIds ()) {
|
||||
var tz = ZoneInfoDB.GetTimeZone (id);
|
||||
foreach (string id in AndroidTimeZones.GetAvailableIds ()) {
|
||||
var tz = AndroidTimeZones.GetTimeZone (id);
|
||||
if (tz != null)
|
||||
systemTimeZones.Add (tz);
|
||||
}
|
||||
|
||||
@@ -163,6 +163,8 @@ namespace MonoTests.System.Linq.Expressions
|
||||
}
|
||||
|
||||
[Test]
|
||||
// #12987
|
||||
[Category ("MobileNotWorking")]
|
||||
public void CoalesceNullableSlotIntoInteger ()
|
||||
{
|
||||
var s = Expression.Parameter (typeof (Slot?), "s");
|
||||
|
||||
@@ -394,7 +394,7 @@ namespace System.Net.Http.Headers
|
||||
|
||||
switch (t.Kind) {
|
||||
case Token.Type.SeparatorSemicolon:
|
||||
if (!NameValueHeaderValue.ParseParameters (lexer, out parameters))
|
||||
if (!NameValueHeaderValue.TryParseParameters (lexer, out parameters))
|
||||
return false;
|
||||
break;
|
||||
case Token.Type.End:
|
||||
|
||||
@@ -50,7 +50,12 @@ namespace System.Net.Http.Headers
|
||||
Debug.Assert (AllowsMany);
|
||||
|
||||
var c = (HttpHeaderValueCollection<U>) collection;
|
||||
c.Add ((U) value);
|
||||
|
||||
var list = value as List<U>;
|
||||
if (list != null)
|
||||
c.AddRange (list);
|
||||
else
|
||||
c.Add ((U) value);
|
||||
}
|
||||
|
||||
protected override object CreateCollection (HttpHeaders headers, HeaderInfo headerInfo)
|
||||
@@ -106,6 +111,13 @@ namespace System.Net.Http.Headers
|
||||
};
|
||||
}
|
||||
|
||||
public static HeaderInfo CreateMultiList<T> (string name, TryParseDelegate<List<T>> parser, HttpHeaderKind headerKind) where T : class
|
||||
{
|
||||
return new HeaderTypeInfo<List<T>, T> (name, parser, headerKind) {
|
||||
AllowsMany = true,
|
||||
};
|
||||
}
|
||||
|
||||
public object CreateCollection (HttpHeaders headers)
|
||||
{
|
||||
return CreateCollection (headers, this);
|
||||
|
||||
@@ -61,6 +61,11 @@ namespace System.Net.Http.Headers
|
||||
list.Add (item);
|
||||
}
|
||||
|
||||
internal void AddRange (List<T> values)
|
||||
{
|
||||
list.AddRange (values);
|
||||
}
|
||||
|
||||
public void Clear ()
|
||||
{
|
||||
list.Clear ();
|
||||
|
||||
@@ -117,7 +117,7 @@ namespace System.Net.Http.Headers
|
||||
HeaderInfo.CreateSingle<DateTimeOffset> ("Last-Modified", Parser.DateTime.TryParse, HttpHeaderKind.Content),
|
||||
HeaderInfo.CreateSingle<Uri> ("Location", Parser.Uri.TryParse, HttpHeaderKind.Response),
|
||||
HeaderInfo.CreateSingle<int> ("Max-Forwards", Parser.Int.TryParse, HttpHeaderKind.Request),
|
||||
HeaderInfo.CreateMulti<NameValueHeaderValue> ("Pragma", NameValueHeaderValue.TryParse, HttpHeaderKind.Request | HttpHeaderKind.Response),
|
||||
HeaderInfo.CreateMultiList<NameValueHeaderValue> ("Pragma", NameValueHeaderValue.TryParsePragma, HttpHeaderKind.Request | HttpHeaderKind.Response),
|
||||
HeaderInfo.CreateMulti<AuthenticationHeaderValue> ("Proxy-Authenticate", AuthenticationHeaderValue.TryParse, HttpHeaderKind.Response),
|
||||
HeaderInfo.CreateSingle<AuthenticationHeaderValue> ("Proxy-Authorization", AuthenticationHeaderValue.TryParse, HttpHeaderKind.Request),
|
||||
HeaderInfo.CreateSingle<RangeHeaderValue> ("Range", RangeHeaderValue.TryParse, HttpHeaderKind.Request),
|
||||
|
||||
@@ -150,7 +150,7 @@ namespace System.Net.Http.Headers
|
||||
|
||||
switch (token.Value.Kind) {
|
||||
case Token.Type.SeparatorSemicolon:
|
||||
if (!NameValueHeaderValue.ParseParameters (lexer, out parameters))
|
||||
if (!NameValueHeaderValue.TryParseParameters (lexer, out parameters))
|
||||
return false;
|
||||
break;
|
||||
case Token.Type.End:
|
||||
@@ -181,7 +181,7 @@ namespace System.Net.Http.Headers
|
||||
|
||||
switch (token.Value.Kind) {
|
||||
case Token.Type.SeparatorSemicolon:
|
||||
if (!NameValueHeaderValue.ParseParameters (lexer, out parameters))
|
||||
if (!NameValueHeaderValue.TryParseParameters (lexer, out parameters))
|
||||
return false;
|
||||
break;
|
||||
case Token.Type.End:
|
||||
|
||||
@@ -121,8 +121,18 @@ namespace System.Net.Http.Headers
|
||||
throw new FormatException (input);
|
||||
}
|
||||
|
||||
internal static bool ParseParameters (Lexer lexer, out List<NameValueHeaderValue> result)
|
||||
internal static bool TryParseParameters (Lexer lexer, out List<NameValueHeaderValue> result)
|
||||
{
|
||||
return TryParseCollection (lexer, out result, Token.Type.SeparatorSemicolon);
|
||||
}
|
||||
|
||||
internal static bool TryParsePragma (string input, out List<NameValueHeaderValue> result)
|
||||
{
|
||||
return TryParseCollection (new Lexer (input), out result, Token.Type.SeparatorComma);
|
||||
}
|
||||
|
||||
static bool TryParseCollection (Lexer lexer, out List<NameValueHeaderValue> result, Token.Type separator)
|
||||
{
|
||||
var list = new List<NameValueHeaderValue> ();
|
||||
result = null;
|
||||
|
||||
@@ -146,7 +156,7 @@ namespace System.Net.Http.Headers
|
||||
t = lexer.Scan ();
|
||||
}
|
||||
|
||||
if (t == Token.Type.SeparatorSemicolon || t == Token.Type.End) {
|
||||
if (t == separator|| t == Token.Type.End) {
|
||||
list.Add (new NameValueHeaderValue () {
|
||||
Name = lexer.GetStringValue (attr),
|
||||
value = value
|
||||
@@ -155,7 +165,7 @@ namespace System.Net.Http.Headers
|
||||
return false;
|
||||
}
|
||||
|
||||
} while (t == Token.Type.SeparatorSemicolon);
|
||||
} while (t == separator);
|
||||
|
||||
result = list;
|
||||
return true;
|
||||
|
||||
+1
-1
@@ -103,7 +103,7 @@ namespace System.Net.Http.Headers
|
||||
public static bool TryParse (string input, out NameValueWithParametersHeaderValue parsedValue)
|
||||
{
|
||||
List<NameValueHeaderValue> values;
|
||||
if (!ParseParameters (new Lexer (input), out values)) {
|
||||
if (!TryParseParameters (new Lexer (input), out values)) {
|
||||
parsedValue = null;
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -125,7 +125,7 @@ namespace System.Net.Http.Headers
|
||||
|
||||
// Parameters parsing
|
||||
if (t == Token.Type.SeparatorSemicolon) {
|
||||
if (!NameValueHeaderValue.ParseParameters (lexer, out result.parameters))
|
||||
if (!NameValueHeaderValue.TryParseParameters (lexer, out result.parameters))
|
||||
return false;
|
||||
} else if (t != Token.Type.End) {
|
||||
return false;
|
||||
|
||||
@@ -312,8 +312,22 @@ namespace System.Net.Http
|
||||
await request.Content.CopyToAsync (stream).ConfigureAwait (false);
|
||||
}
|
||||
|
||||
// FIXME: GetResponseAsync does not accept cancellationToken
|
||||
var wresponse = (HttpWebResponse) await wrequest.GetResponseAsync ().ConfigureAwait (false);
|
||||
HttpWebResponse wresponse = null;
|
||||
using (cancellationToken.Register (l => ((HttpWebRequest) l).Abort (), wrequest)) {
|
||||
try {
|
||||
wresponse = (HttpWebResponse) await wrequest.GetResponseAsync ().ConfigureAwait (false);
|
||||
} catch (WebException we) {
|
||||
if (we.Status != WebExceptionStatus.RequestCanceled)
|
||||
throw;
|
||||
}
|
||||
|
||||
if (cancellationToken.IsCancellationRequested) {
|
||||
var cancelled = new TaskCompletionSource<HttpResponseMessage> ();
|
||||
cancelled.SetCanceled ();
|
||||
return await cancelled.Task;
|
||||
}
|
||||
}
|
||||
|
||||
return CreateResponseMessage (wresponse, request);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -119,7 +119,7 @@ namespace System.Net.Http
|
||||
|
||||
public Task LoadIntoBufferAsync ()
|
||||
{
|
||||
return LoadIntoBufferAsync (65536);
|
||||
return LoadIntoBufferAsync (int.MaxValue);
|
||||
}
|
||||
|
||||
public async Task LoadIntoBufferAsync (long maxBufferSize)
|
||||
|
||||
@@ -219,6 +219,12 @@ namespace MonoTests.System.Net.Http
|
||||
} catch (FormatException) {
|
||||
}
|
||||
|
||||
try {
|
||||
headers.Add ("pragma", "nocache,RequestID=1,g=");
|
||||
Assert.Fail ("pragma");
|
||||
} catch (FormatException) {
|
||||
}
|
||||
|
||||
headers.Add ("accept", "audio/y");
|
||||
headers.Add ("accept-charset", "achs");
|
||||
headers.Add ("accept-encoding", "aenc");
|
||||
@@ -226,7 +232,6 @@ namespace MonoTests.System.Net.Http
|
||||
headers.Add ("expect", "exp");
|
||||
headers.Add ("if-match", "\"v\"");
|
||||
headers.Add ("if-none-match", "\"v2\"");
|
||||
headers.Add ("pragma", "p");
|
||||
headers.Add ("TE", "0.8");
|
||||
headers.Add ("trailer", "value2");
|
||||
headers.Add ("transfer-encoding", "ttt");
|
||||
@@ -234,6 +239,7 @@ namespace MonoTests.System.Net.Http
|
||||
headers.Add ("user-agent", "uaua");
|
||||
headers.Add ("via", "prot v");
|
||||
headers.Add ("warning", "4 ww \"t\"");
|
||||
headers.Add ("pragma", "nocache,R=1,g");
|
||||
|
||||
Assert.IsTrue (headers.Accept.SequenceEqual (
|
||||
new[] {
|
||||
@@ -296,7 +302,6 @@ namespace MonoTests.System.Net.Http
|
||||
Assert.IsTrue (headers.IfNoneMatch.SequenceEqual (new EntityTagHeaderValue[] { new EntityTagHeaderValue ("\"tag2\"", true), new EntityTagHeaderValue ("\"v2\"", false) }));
|
||||
Assert.AreEqual (new DateTimeOffset (DateTime.Today), headers.IfRange.Date);
|
||||
Assert.AreEqual (headers.MaxForwards, 0x15b3);
|
||||
Assert.IsTrue (headers.Pragma.SequenceEqual (new NameValueHeaderValue[] { new NameValueHeaderValue ("name", "value"), new NameValueHeaderValue ("p", null) }));
|
||||
Assert.AreEqual ("p", headers.ProxyAuthorization.Parameter);
|
||||
Assert.AreEqual ("s", headers.ProxyAuthorization.Scheme);
|
||||
Assert.AreEqual (5, headers.Range.Ranges.First ().From);
|
||||
@@ -345,6 +350,14 @@ namespace MonoTests.System.Net.Http
|
||||
}
|
||||
));
|
||||
|
||||
Assert.IsTrue (headers.Pragma.SequenceEqual (
|
||||
new[] {
|
||||
new NameValueHeaderValue ("name", "value"),
|
||||
new NameValueHeaderValue ("nocache", null),
|
||||
new NameValueHeaderValue ("R", "1"),
|
||||
new NameValueHeaderValue ("g", null)
|
||||
}
|
||||
));
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
||||
@@ -549,7 +549,12 @@ namespace System.Net
|
||||
if (local_path [0] == '/')
|
||||
local_path = local_path.Substring (1);
|
||||
|
||||
Uri initial = new Uri ("ftp://dummy-host" + initial_path);
|
||||
UriBuilder initialBuilder = new UriBuilder () {
|
||||
Scheme = "ftp",
|
||||
Host = "dummy-host",
|
||||
Path = initial_path,
|
||||
};
|
||||
Uri initial = initialBuilder.Uri;
|
||||
result = new Uri (initial, local_path).LocalPath;
|
||||
}
|
||||
|
||||
|
||||
@@ -58,24 +58,17 @@ namespace System.Net
|
||||
static HybridDictionary prefixes = new HybridDictionary ();
|
||||
static bool isDefaultWebProxySet;
|
||||
static IWebProxy defaultWebProxy;
|
||||
|
||||
#if !NET_2_1
|
||||
static RequestCachePolicy defaultCachePolicy;
|
||||
#endif
|
||||
// Constructors
|
||||
|
||||
|
||||
static WebRequest ()
|
||||
{
|
||||
#if NET_2_1
|
||||
#if MOBILE
|
||||
IWebRequestCreate http = new HttpRequestCreator ();
|
||||
RegisterPrefix ("http", http);
|
||||
RegisterPrefix ("https", http);
|
||||
#if MOBILE
|
||||
RegisterPrefix ("file", new FileWebRequestCreator ());
|
||||
RegisterPrefix ("ftp", new FtpRequestCreator ());
|
||||
#endif
|
||||
#else
|
||||
defaultCachePolicy = new HttpRequestCachePolicy (HttpRequestCacheLevel.NoCacheNoStore);
|
||||
#if CONFIGURATION_DEP
|
||||
object cfg = ConfigurationManager.GetSection ("system.net/webRequestModules");
|
||||
WebRequestModulesSection s = cfg as WebRequestModulesSection;
|
||||
@@ -137,7 +130,6 @@ namespace System.Net
|
||||
set { throw GetMustImplement (); }
|
||||
}
|
||||
|
||||
#if !NET_2_1
|
||||
[MonoTODO ("Implement the caching system. Currently always returns a policy with the NoCacheNoStore level")]
|
||||
public virtual RequestCachePolicy CachePolicy
|
||||
{
|
||||
@@ -146,14 +138,14 @@ namespace System.Net
|
||||
}
|
||||
}
|
||||
|
||||
public static RequestCachePolicy DefaultCachePolicy
|
||||
{
|
||||
get { return defaultCachePolicy; }
|
||||
public static RequestCachePolicy DefaultCachePolicy {
|
||||
get {
|
||||
return defaultCachePolicy ?? (defaultCachePolicy = new HttpRequestCachePolicy (HttpRequestCacheLevel.NoCacheNoStore));
|
||||
}
|
||||
set {
|
||||
throw GetMustImplement ();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
public virtual WebHeaderCollection Headers {
|
||||
get { throw GetMustImplement (); }
|
||||
|
||||
@@ -203,7 +203,11 @@ namespace MonoTests.System.Net
|
||||
[Test]
|
||||
public void DownloadFile1 ()
|
||||
{
|
||||
ServerDownload sp = new ServerDownload ();
|
||||
DownloadFile (new ServerDownload ());
|
||||
}
|
||||
|
||||
void DownloadFile (ServerDownload sp)
|
||||
{
|
||||
sp.Start ();
|
||||
string uri = String.Format ("ftp://{0}:{1}/file.txt", sp.IPAddress, sp.Port);
|
||||
try {
|
||||
@@ -228,6 +232,14 @@ namespace MonoTests.System.Net
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void DownloadFile2 ()
|
||||
{
|
||||
// Some embedded FTP servers in Industrial Automation Hardware report
|
||||
// the PWD using backslashes, but allow forward slashes for CWD.
|
||||
DownloadFile (new ServerDownload (@"\Users\someuser", "/Users/someuser/"));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void DeleteFile1 ()
|
||||
{
|
||||
@@ -377,6 +389,20 @@ namespace MonoTests.System.Net
|
||||
}
|
||||
|
||||
class ServerDownload : FtpServer {
|
||||
|
||||
string Pwd, Cwd;
|
||||
|
||||
public ServerDownload ()
|
||||
: this (null, null)
|
||||
{
|
||||
}
|
||||
|
||||
public ServerDownload (string pwd, string cwd)
|
||||
{
|
||||
Pwd = pwd ?? "/home/someuser";
|
||||
Cwd = cwd ?? "/home/someuser/";
|
||||
}
|
||||
|
||||
protected override void Run ()
|
||||
{
|
||||
Socket client = control.Accept ();
|
||||
@@ -388,7 +414,7 @@ namespace MonoTests.System.Net
|
||||
return;
|
||||
}
|
||||
|
||||
if (!DoInitialDialog (writer, reader, "/home/someuser", "/home/someuser/")) {
|
||||
if (!DoInitialDialog (writer, reader, Pwd, Cwd)) {
|
||||
client.Close ();
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -45,7 +45,7 @@ namespace System.Collections
|
||||
|
||||
int IEqualityComparer.GetHashCode (object obj)
|
||||
{
|
||||
var comparer = obj as IEqualityComparer;
|
||||
var comparer = obj as IStructuralEquatable;
|
||||
if (comparer != null)
|
||||
return comparer.GetHashCode (this);
|
||||
|
||||
@@ -54,7 +54,7 @@ namespace System.Collections
|
||||
|
||||
bool IEqualityComparer.Equals (object x, object y)
|
||||
{
|
||||
var comparer = x as IEqualityComparer;
|
||||
var comparer = x as IStructuralEquatable;
|
||||
if (comparer != null)
|
||||
return comparer.Equals (y, this);
|
||||
|
||||
|
||||
@@ -235,7 +235,7 @@ namespace System.Security.Cryptography {
|
||||
|
||||
HashAlgorithm hash = null;
|
||||
if (halg is String)
|
||||
hash = HashAlgorithm.Create ((String)halg);
|
||||
hash = GetHashFromString ((string) halg);
|
||||
else if (halg is HashAlgorithm)
|
||||
hash = (HashAlgorithm) halg;
|
||||
else if (halg is Type)
|
||||
@@ -243,8 +243,25 @@ namespace System.Security.Cryptography {
|
||||
else
|
||||
throw new ArgumentException ("halg");
|
||||
|
||||
if (hash == null)
|
||||
throw new ArgumentException (
|
||||
"Could not find provider for halg='" + halg + "'.",
|
||||
"halg");
|
||||
|
||||
return hash;
|
||||
}
|
||||
|
||||
private HashAlgorithm GetHashFromString (string name)
|
||||
{
|
||||
HashAlgorithm hash = HashAlgorithm.Create (name);
|
||||
if (hash != null)
|
||||
return hash;
|
||||
try {
|
||||
return HashAlgorithm.Create (GetHashNameFromOID (name));
|
||||
} catch (CryptographicException e) {
|
||||
throw new ArgumentException (e.Message, "halg", e);
|
||||
}
|
||||
}
|
||||
|
||||
// NOTE: this method can work with ANY configured (OID in machine.config)
|
||||
// HashAlgorithm descendant
|
||||
|
||||
@@ -108,10 +108,11 @@ public abstract class Decoder
|
||||
CheckArguments (chars, charCount, bytes, byteCount);
|
||||
|
||||
char [] carr = new char [charCount];
|
||||
Marshal.Copy ((IntPtr) chars, carr, 0, charCount);
|
||||
byte [] barr = new byte [byteCount];
|
||||
Marshal.Copy ((IntPtr) bytes, barr, 0, byteCount);
|
||||
return GetChars (barr, 0, byteCount, carr, 0, flush);
|
||||
int charsUsed = GetChars (barr, 0, byteCount, carr, 0, flush);
|
||||
Marshal.Copy (carr, 0, (IntPtr) chars, charsUsed);
|
||||
return charsUsed;
|
||||
}
|
||||
|
||||
[ComVisible (false)]
|
||||
|
||||
@@ -225,7 +225,7 @@ namespace System.Threading.Tasks
|
||||
}
|
||||
|
||||
Status = saveStatus;
|
||||
Start (scheduler);
|
||||
Schedule ();
|
||||
Wait ();
|
||||
}
|
||||
#endregion
|
||||
|
||||
@@ -1694,9 +1694,9 @@ namespace System
|
||||
case StringComparison.InvariantCultureIgnoreCase:
|
||||
return CultureInfo.InvariantCulture.CompareInfo.IsSuffix (this, value, CompareOptions.IgnoreCase);
|
||||
case StringComparison.Ordinal:
|
||||
return CultureInfo.CurrentCulture.CompareInfo.IsSuffix (this, value, CompareOptions.Ordinal);
|
||||
return CultureInfo.InvariantCulture.CompareInfo.IsSuffix (this, value, CompareOptions.Ordinal);
|
||||
case StringComparison.OrdinalIgnoreCase:
|
||||
return CultureInfo.CurrentCulture.CompareInfo.IsSuffix (this, value, CompareOptions.OrdinalIgnoreCase);
|
||||
return CultureInfo.InvariantCulture.CompareInfo.IsSuffix (this, value, CompareOptions.OrdinalIgnoreCase);
|
||||
default:
|
||||
string msg = Locale.GetText ("Invalid value '{0}' for StringComparison", comparisonType);
|
||||
throw new ArgumentException (msg, "comparisonType");
|
||||
|
||||
@@ -0,0 +1,55 @@
|
||||
//
|
||||
// StructuralComparisonsTest.cs
|
||||
//
|
||||
// Authors:
|
||||
// Marek Safar <[email protected]>
|
||||
//
|
||||
// Copyright (C) 2013 Xamarin Inc (http://www.xamarin.com)
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining
|
||||
// a copy of this software and associated documentation files (the
|
||||
// "Software"), to deal in the Software without restriction, including
|
||||
// without limitation the rights to use, copy, modify, merge, publish,
|
||||
// distribute, sublicense, and/or sell copies of the Software, and to
|
||||
// permit persons to whom the Software is furnished to do so, subject to
|
||||
// the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be
|
||||
// included in all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
#if NET_4_0
|
||||
|
||||
using System.Collections;
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace MonoTests.System.Collections
|
||||
{
|
||||
[TestFixture]
|
||||
public class StructuralComparisonsTest
|
||||
{
|
||||
[Test]
|
||||
public void EqualsTest ()
|
||||
{
|
||||
int[] a1 = new[] { 9, 1, 3, 4 };
|
||||
int[] a2 = new[] { 9, 1, 3, 4 };
|
||||
|
||||
Assert.IsTrue (StructuralComparisons.StructuralEqualityComparer.Equals (a1, a2), "#1");
|
||||
Assert.IsFalse (StructuralComparisons.StructuralEqualityComparer.Equals (null, a2), "#2");
|
||||
Assert.IsFalse (StructuralComparisons.StructuralEqualityComparer.Equals (a1, null), "#3");
|
||||
Assert.IsTrue (StructuralComparisons.StructuralEqualityComparer.Equals (null, null), "#4");
|
||||
Assert.IsTrue (StructuralComparisons.StructuralEqualityComparer.Equals (4, 4), "#5");
|
||||
Assert.IsFalse (StructuralComparisons.StructuralEqualityComparer.Equals (4, 5), "#6");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -262,6 +262,26 @@ public class RSACryptoServiceProviderTest {
|
||||
rsa.SignData (data, MD5.Create ());
|
||||
}
|
||||
|
||||
[Test]
|
||||
[ExpectedException (typeof (ArgumentException))]
|
||||
public void SignDataWithInvalidOid ()
|
||||
{
|
||||
byte[] data = new byte [5];
|
||||
rsa = new RSACryptoServiceProvider (minKeySize);
|
||||
|
||||
rsa.SignData (data, "1.2.3");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void SignDataWithOid ()
|
||||
{
|
||||
string oid = CryptoConfig.MapNameToOID ("SHA256");
|
||||
byte[] data = new byte [5];
|
||||
rsa = new RSACryptoServiceProvider (minKeySize);
|
||||
|
||||
rsa.SignData (data, oid);
|
||||
}
|
||||
|
||||
[Test]
|
||||
[ExpectedException (typeof (ArgumentNullException))]
|
||||
public void SignHashNullValue ()
|
||||
|
||||
@@ -67,6 +67,25 @@ namespace MonoTests.System.Threading.Tasks
|
||||
}
|
||||
}
|
||||
|
||||
class NonInlineableScheduler : TaskScheduler
|
||||
{
|
||||
protected override IEnumerable<Task> GetScheduledTasks ()
|
||||
{
|
||||
throw new NotImplementedException ();
|
||||
}
|
||||
|
||||
protected override void QueueTask (Task task)
|
||||
{
|
||||
if (!base.TryExecuteTask (task))
|
||||
throw new ApplicationException ();
|
||||
}
|
||||
|
||||
protected override bool TryExecuteTaskInline (Task task, bool taskWasPreviouslyQueued)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Task[] tasks;
|
||||
const int max = 6;
|
||||
@@ -1638,6 +1657,16 @@ namespace MonoTests.System.Threading.Tasks
|
||||
Assert.AreEqual ('d', d.Result, "#3r");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void ContinueWith_CustomScheduleRejected ()
|
||||
{
|
||||
var scheduler = new NonInlineableScheduler ();
|
||||
var t = Task.Factory.StartNew (delegate { }).
|
||||
ContinueWith (r => {}, CancellationToken.None, TaskContinuationOptions.ExecuteSynchronously, scheduler);
|
||||
|
||||
Assert.IsTrue (t.Wait (5000));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void FromResult ()
|
||||
{
|
||||
|
||||
@@ -39,6 +39,7 @@ System.Collections/QueueTest.cs
|
||||
System.Collections/ReadOnlyCollectionBaseTest.cs
|
||||
System.Collections/SortedListTest.cs
|
||||
System.Collections/StackTest.cs
|
||||
System.Collections/StructuralComparisonsTest.cs
|
||||
System.Collections.Generic/ComparerTest.cs
|
||||
System.Collections.Generic/DictionaryTest.cs
|
||||
System.Collections.Generic/EqualityComparerTest.cs
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
.assembly extern mscorlib
|
||||
{
|
||||
}
|
||||
|
||||
.assembly extern 'CS0012-lib-missing'
|
||||
{
|
||||
}
|
||||
|
||||
.assembly 'CS0012-21-lib'
|
||||
{
|
||||
.hash algorithm 0x00008004
|
||||
.ver 0:0:0:0
|
||||
}
|
||||
|
||||
.module 'CS0012-21-lib.dll'
|
||||
|
||||
|
||||
.class public auto ansi beforefieldinit B
|
||||
extends class ['CS0012-lib-missing']X`1/Y/Z/W<int32>
|
||||
{
|
||||
.method public hidebysig specialname rtspecialname
|
||||
instance void .ctor() cil managed
|
||||
{
|
||||
// Code size 7 (0x7)
|
||||
.maxstack 8
|
||||
IL_0000: ldarg.0
|
||||
IL_0001: call instance void class ['CS0012-lib-missing']X`1/Y/Z/W<int32>::.ctor()
|
||||
IL_0006: ret
|
||||
}
|
||||
|
||||
}
|
||||
+1
-1
@@ -21,7 +21,7 @@ DISTFILES = \
|
||||
$(wildcard dlls/second/*.cs)
|
||||
|
||||
TEST_SUPPORT_FILES = \
|
||||
CS0012-lib.dll CS0012-2-lib.dll CS0012-3-lib.dll CS0012-4-lib.dll CS0012-5-lib.dll CS0012-6-lib.dll CS0012-9-lib.dll CS0012-10-lib.dll CS0012-11-lib.dll CS0012-12-lib.dll CS0012-13-lib.dll CS0012-14-lib.dll CS0012-15-lib.dll CS0012-16-lib.dll CS0012-17-lib.dll CS0012-18-lib.dll CS0029-26-lib.dll \
|
||||
CS0012-lib.dll CS0012-2-lib.dll CS0012-3-lib.dll CS0012-4-lib.dll CS0012-5-lib.dll CS0012-6-lib.dll CS0012-9-lib.dll CS0012-10-lib.dll CS0012-11-lib.dll CS0012-12-lib.dll CS0012-13-lib.dll CS0012-14-lib.dll CS0012-15-lib.dll CS0012-16-lib.dll CS0012-17-lib.dll CS0012-18-lib.dll CS0012-21-lib.dll CS0029-26-lib.dll \
|
||||
CS0103-2-lib.dll CS0118-2-lib.dll CS0122-8-lib.dll CS0122-10-lib.dll CS0122-14-lib.dll CS0122-15-lib.dll CS0122-19-lib.dll CS0122-35-lib.dll CS0122-36-lib.dll CS0143-lib.dll CS0144-3-lib.dll CS0165-19-lib.dll \
|
||||
CS0205-3-lib.dll CS0229-3-lib.dll CS0229-4-lib.dll CS0266-25-lib.dll \
|
||||
CS0315-2-lib.dll \
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
// CS0012: The type `X`1.Y.Z.W' is defined in an assembly that is not referenced. Consider adding a reference to assembly `CS0012-lib-missing, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'
|
||||
// Line: 9
|
||||
// Compiler options: -r:CS0012-21-lib.dll
|
||||
|
||||
public class C
|
||||
{
|
||||
public static void Main ()
|
||||
{
|
||||
new B ();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
// CS0150: A constant value is expected
|
||||
// Line : 14
|
||||
|
||||
using System;
|
||||
|
||||
public class Blah
|
||||
{
|
||||
static readonly string Test;
|
||||
|
||||
public static void Main ()
|
||||
{
|
||||
string s = null;
|
||||
switch (s) {
|
||||
case Blah.Test:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
// CS0472: The result of comparing value type `byte' with null is always `false'
|
||||
// Line: 9
|
||||
// Compiler options: -warnaserror -warn:2
|
||||
|
||||
class C
|
||||
{
|
||||
public static bool Test (byte value)
|
||||
{
|
||||
if (value == null)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
+36
-28
@@ -195,7 +195,9 @@ namespace Mono.CSharp
|
||||
|
||||
protected override void DoEmit (EmitContext ec)
|
||||
{
|
||||
GetResultExpression (ec).Emit (ec);
|
||||
using (ec.With (BuilderContext.Options.OmitDebugInfo, true)) {
|
||||
GetResultExpression (ec).Emit (ec);
|
||||
}
|
||||
}
|
||||
|
||||
public Expression GetResultExpression (EmitContext ec)
|
||||
@@ -224,34 +226,34 @@ namespace Mono.CSharp
|
||||
var fe_awaiter = new FieldExpr (awaiter, loc);
|
||||
fe_awaiter.InstanceExpression = new CompilerGeneratedThis (ec.CurrentType, loc);
|
||||
|
||||
//
|
||||
// awaiter = expr.GetAwaiter ();
|
||||
//
|
||||
Label skip_continuation = ec.DefineLabel ();
|
||||
|
||||
using (ec.With (BuilderContext.Options.OmitDebugInfo, true)) {
|
||||
//
|
||||
// awaiter = expr.GetAwaiter ();
|
||||
//
|
||||
fe_awaiter.EmitAssign (ec, expr, false, false);
|
||||
|
||||
Expression completed_expr;
|
||||
if (IsDynamic) {
|
||||
var rc = new ResolveContext (ec.MemberContext);
|
||||
|
||||
Arguments dargs = new Arguments (1);
|
||||
dargs.Add (new Argument (fe_awaiter));
|
||||
completed_expr = new DynamicMemberBinder ("IsCompleted", dargs, loc).Resolve (rc);
|
||||
|
||||
dargs = new Arguments (1);
|
||||
dargs.Add (new Argument (completed_expr));
|
||||
completed_expr = new DynamicConversion (ec.Module.Compiler.BuiltinTypes.Bool, 0, dargs, loc).Resolve (rc);
|
||||
} else {
|
||||
var pe = PropertyExpr.CreatePredefined (awaiter_definition.IsCompleted, loc);
|
||||
pe.InstanceExpression = fe_awaiter;
|
||||
completed_expr = pe;
|
||||
}
|
||||
|
||||
completed_expr.EmitBranchable (ec, skip_continuation, true);
|
||||
}
|
||||
|
||||
Label skip_continuation = ec.DefineLabel ();
|
||||
|
||||
Expression completed_expr;
|
||||
if (IsDynamic) {
|
||||
var rc = new ResolveContext (ec.MemberContext);
|
||||
|
||||
Arguments dargs = new Arguments (1);
|
||||
dargs.Add (new Argument (fe_awaiter));
|
||||
completed_expr = new DynamicMemberBinder ("IsCompleted", dargs, loc).Resolve (rc);
|
||||
|
||||
dargs = new Arguments (1);
|
||||
dargs.Add (new Argument (completed_expr));
|
||||
completed_expr = new DynamicConversion (ec.Module.Compiler.BuiltinTypes.Bool, 0, dargs, loc).Resolve (rc);
|
||||
} else {
|
||||
var pe = PropertyExpr.CreatePredefined (awaiter_definition.IsCompleted, loc);
|
||||
pe.InstanceExpression = fe_awaiter;
|
||||
completed_expr = pe;
|
||||
}
|
||||
|
||||
completed_expr.EmitBranchable (ec, skip_continuation, true);
|
||||
|
||||
base.DoEmit (ec);
|
||||
|
||||
//
|
||||
@@ -741,7 +743,9 @@ namespace Mono.CSharp
|
||||
var args = new Arguments (2);
|
||||
args.Add (new Argument (awaiter, Argument.AType.Ref));
|
||||
args.Add (new Argument (new CompilerGeneratedThis (CurrentType, Location), Argument.AType.Ref));
|
||||
mg.EmitCall (ec, args);
|
||||
using (ec.With (BuilderContext.Options.OmitDebugInfo, true)) {
|
||||
mg.EmitCall (ec, args);
|
||||
}
|
||||
}
|
||||
|
||||
public void EmitInitializer (EmitContext ec)
|
||||
@@ -817,7 +821,9 @@ namespace Mono.CSharp
|
||||
Arguments args = new Arguments (1);
|
||||
args.Add (new Argument (exceptionVariable));
|
||||
|
||||
mg.EmitCall (ec, args);
|
||||
using (ec.With (BuilderContext.Options.OmitDebugInfo, true)) {
|
||||
mg.EmitCall (ec, args);
|
||||
}
|
||||
}
|
||||
|
||||
public void EmitSetResult (EmitContext ec)
|
||||
@@ -839,7 +845,9 @@ namespace Mono.CSharp
|
||||
args.Add (new Argument (new LocalVariableReference (hoisted_return, Location)));
|
||||
}
|
||||
|
||||
mg.EmitCall (ec, args);
|
||||
using (ec.With (BuilderContext.Options.OmitDebugInfo, true)) {
|
||||
mg.EmitCall (ec, args);
|
||||
}
|
||||
}
|
||||
|
||||
protected override TypeSpec[] ResolveBaseTypes (out FullNamedExpression base_class)
|
||||
|
||||
+5
-5
@@ -356,7 +356,6 @@ namespace Mono.CSharp
|
||||
|
||||
public string GetSignatureForMetadata ()
|
||||
{
|
||||
#if STATIC
|
||||
if (Parent is TypeDefinition) {
|
||||
return Parent.GetSignatureForMetadata () + "+" + TypeNameParser.Escape (MemberName.Basename);
|
||||
}
|
||||
@@ -364,9 +363,6 @@ namespace Mono.CSharp
|
||||
var sb = new StringBuilder ();
|
||||
CreateMetadataName (sb);
|
||||
return sb.ToString ();
|
||||
#else
|
||||
throw new NotImplementedException ();
|
||||
#endif
|
||||
}
|
||||
|
||||
public virtual void RemoveContainer (TypeContainer cont)
|
||||
@@ -3334,7 +3330,11 @@ namespace Mono.CSharp
|
||||
Parent.PartialContainer.VerifyImplements (this);
|
||||
}
|
||||
|
||||
ModifiersExtensions.Check (Modifiers.AllowedExplicitImplFlags, explicit_mod_flags, 0, Location, Report);
|
||||
Modifiers allowed_explicit = Modifiers.AllowedExplicitImplFlags;
|
||||
if (this is Method)
|
||||
allowed_explicit |= Modifiers.ASYNC;
|
||||
|
||||
ModifiersExtensions.Check (allowed_explicit, explicit_mod_flags, 0, Location, Report);
|
||||
}
|
||||
|
||||
return base.Define ();
|
||||
|
||||
+16
-5
@@ -248,6 +248,21 @@ namespace Mono.CSharp
|
||||
return true;
|
||||
}
|
||||
|
||||
public void MarkCallEntry (Location loc)
|
||||
{
|
||||
if (!EmitAccurateDebugInfo)
|
||||
return;
|
||||
|
||||
//
|
||||
// TODO: This should emit different kind of sequence point to make
|
||||
// step-over work for statement over multiple lines
|
||||
//
|
||||
// Debugging experience for Foo (A () + B ()) where A and B are
|
||||
// on separate lines is not great
|
||||
//
|
||||
Mark (loc);
|
||||
}
|
||||
|
||||
public void DefineLocalVariable (string name, LocalBuilder builder)
|
||||
{
|
||||
if ((flags & Options.OmitDebugInfo) != 0)
|
||||
@@ -1014,11 +1029,7 @@ namespace Mono.CSharp
|
||||
// Emit explicit sequence point for expressions like Foo.Bar () to help debugger to
|
||||
// break at right place when LHS expression can be stepped-into
|
||||
//
|
||||
// TODO: The list is probably not comprehensive, need to do more testing
|
||||
//
|
||||
if (InstanceExpression is PropertyExpr || InstanceExpression is Invocation || InstanceExpression is IndexerExpr ||
|
||||
InstanceExpression is New || InstanceExpression is DelegateInvocation)
|
||||
ec.Mark (loc.Value);
|
||||
ec.MarkCallEntry (loc.Value);
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
+2
-2
@@ -34,7 +34,7 @@ namespace Mono.CSharp {
|
||||
//
|
||||
static bool ArrayToIList (ArrayContainer array, TypeSpec list, bool isExplicit)
|
||||
{
|
||||
if (array.Rank != 1 || !list.IsGenericIterateInterface)
|
||||
if (array.Rank != 1 || !list.IsArrayGenericInterface)
|
||||
return false;
|
||||
|
||||
var arg_type = list.TypeArguments[0];
|
||||
@@ -55,7 +55,7 @@ namespace Mono.CSharp {
|
||||
|
||||
static bool IList_To_Array(TypeSpec list, ArrayContainer array)
|
||||
{
|
||||
if (array.Rank != 1 || !list.IsGenericIterateInterface)
|
||||
if (array.Rank != 1 || !list.IsArrayGenericInterface)
|
||||
return false;
|
||||
|
||||
var arg_type = list.TypeArguments[0];
|
||||
|
||||
+16
-11
@@ -116,6 +116,8 @@ namespace Mono.CSharp
|
||||
// Keeps track of global data changes to undo on parser error
|
||||
//
|
||||
public Undo undo;
|
||||
|
||||
bool? interactive_async;
|
||||
|
||||
Stack<Linq.QueryBlock> linq_clause_blocks;
|
||||
|
||||
@@ -3926,6 +3928,9 @@ unary_expression
|
||||
} else if (current_anonymous_method is AnonymousMethodExpression) {
|
||||
report.Error (4035, GetLocation ($1),
|
||||
"The `await' operator can only be used when its containing anonymous method is marked with the `async' modifier");
|
||||
} else if (interactive_async != null) {
|
||||
current_block.Explicit.RegisterAsyncAwait ();
|
||||
interactive_async = true;
|
||||
} else {
|
||||
report.Error (4033, GetLocation ($1),
|
||||
"The `await' operator can only be used when its containing method is marked with the `async' modifier");
|
||||
@@ -5377,10 +5382,7 @@ interactive_statement_expression
|
||||
: expression
|
||||
{
|
||||
Expression expr = (Expression) $1;
|
||||
ExpressionStatement s;
|
||||
|
||||
s = new OptionalAssign (new SimpleName ("$retval", lexer.Location), expr, lexer.Location);
|
||||
$$ = new StatementExpression (s);
|
||||
$$ = new StatementExpression (new OptionalAssign (expr, lexer.Location));
|
||||
}
|
||||
| error
|
||||
{
|
||||
@@ -6653,27 +6655,30 @@ interactive_parsing
|
||||
mods |= Modifiers.UNSAFE;
|
||||
|
||||
current_local_parameters = pars;
|
||||
Method method = new Method (
|
||||
var method = new InteractiveMethod (
|
||||
current_type,
|
||||
new TypeExpression (compiler.BuiltinTypes.Void, Location.Null),
|
||||
mods,
|
||||
new MemberName ("Host"),
|
||||
pars,
|
||||
null /* attributes */);
|
||||
pars);
|
||||
|
||||
current_type.AddMember (method);
|
||||
|
||||
oob_stack.Push (method);
|
||||
|
||||
interactive_async = false;
|
||||
|
||||
++lexer.parsing_block;
|
||||
start_block (lexer.Location);
|
||||
}
|
||||
interactive_statement_list opt_COMPLETE_COMPLETION
|
||||
{
|
||||
--lexer.parsing_block;
|
||||
Method method = (Method) oob_stack.Pop ();
|
||||
|
||||
var method = (InteractiveMethod) oob_stack.Pop ();
|
||||
method.Block = (ToplevelBlock) end_block(lexer.Location);
|
||||
|
||||
if (interactive_async == true) {
|
||||
method.ChangeToAsync ();
|
||||
}
|
||||
|
||||
InteractiveResult = (Class) pop_current_class ();
|
||||
current_local_parameters = null;
|
||||
}
|
||||
|
||||
+10
-5
@@ -1085,7 +1085,12 @@ namespace Mono.CSharp {
|
||||
// will contain types only but it can have numerous values for members
|
||||
// like methods where both return type and all parameters are checked
|
||||
//
|
||||
public List<TypeSpec> GetMissingDependencies ()
|
||||
public List<MissingTypeSpecReference> GetMissingDependencies ()
|
||||
{
|
||||
return GetMissingDependencies (this);
|
||||
}
|
||||
|
||||
public List<MissingTypeSpecReference> GetMissingDependencies (MemberSpec caller)
|
||||
{
|
||||
if ((state & (StateFlags.MissingDependency | StateFlags.MissingDependency_Undetected)) == 0)
|
||||
return null;
|
||||
@@ -1093,11 +1098,11 @@ namespace Mono.CSharp {
|
||||
state &= ~StateFlags.MissingDependency_Undetected;
|
||||
|
||||
var imported = definition as ImportedDefinition;
|
||||
List<TypeSpec> missing;
|
||||
List<MissingTypeSpecReference> missing;
|
||||
if (imported != null) {
|
||||
missing = ResolveMissingDependencies ();
|
||||
missing = ResolveMissingDependencies (caller);
|
||||
} else if (this is ElementTypeSpec) {
|
||||
missing = ((ElementTypeSpec) this).Element.GetMissingDependencies ();
|
||||
missing = ((ElementTypeSpec) this).Element.GetMissingDependencies (caller);
|
||||
} else {
|
||||
missing = null;
|
||||
}
|
||||
@@ -1109,7 +1114,7 @@ namespace Mono.CSharp {
|
||||
return missing;
|
||||
}
|
||||
|
||||
public abstract List<TypeSpec> ResolveMissingDependencies ();
|
||||
public abstract List<MissingTypeSpecReference> ResolveMissingDependencies (MemberSpec caller);
|
||||
|
||||
protected virtual bool IsNotCLSCompliant (out bool attrValue)
|
||||
{
|
||||
|
||||
+1
-1
@@ -857,7 +857,7 @@ namespace Mono.CSharp {
|
||||
//
|
||||
var call = new CallEmitter ();
|
||||
call.InstanceExpression = InstanceExpr;
|
||||
call.EmitPredefined (ec, method, arguments);
|
||||
call.EmitPredefined (ec, method, arguments, loc);
|
||||
}
|
||||
|
||||
public override void EmitStatement (EmitContext ec)
|
||||
|
||||
+66
-3
@@ -519,8 +519,8 @@ namespace Mono.CSharp {
|
||||
|
||||
Constant c = expr as Constant;
|
||||
if (c == null) {
|
||||
if (c.type != InternalType.ErrorType)
|
||||
rc.Report.Error (150, StartLocation, "A constant value is expected");
|
||||
if (expr.type != InternalType.ErrorType)
|
||||
rc.Report.Error (150, expr.StartLocation, "A constant value is expected");
|
||||
|
||||
return null;
|
||||
}
|
||||
@@ -778,8 +778,18 @@ namespace Mono.CSharp {
|
||||
}
|
||||
|
||||
if ((restrictions & MemberLookupRestrictions.InvocableOnly) != 0) {
|
||||
if (member is MethodSpec)
|
||||
if (member is MethodSpec) {
|
||||
//
|
||||
// Interface members that are hidden by class members are removed from the set. This
|
||||
// step only has an effect if T is a type parameter and T has both an effective base
|
||||
// class other than object and a non-empty effective interface set
|
||||
//
|
||||
var tps = queried_type as TypeParameterSpec;
|
||||
if (tps != null && tps.HasTypeConstraint)
|
||||
members = RemoveHiddenTypeParameterMethods (members);
|
||||
|
||||
return new MethodGroupExpr (members, queried_type, loc);
|
||||
}
|
||||
|
||||
if (!Invocation.IsMemberInvocable (member))
|
||||
continue;
|
||||
@@ -834,6 +844,54 @@ namespace Mono.CSharp {
|
||||
return null;
|
||||
}
|
||||
|
||||
static IList<MemberSpec> RemoveHiddenTypeParameterMethods (IList<MemberSpec> members)
|
||||
{
|
||||
if (members.Count < 2)
|
||||
return members;
|
||||
|
||||
//
|
||||
// If M is a method, then all non-method members declared in an interface declaration
|
||||
// are removed from the set, and all methods with the same signature as M declared in
|
||||
// an interface declaration are removed from the set
|
||||
//
|
||||
|
||||
bool copied = false;
|
||||
for (int i = 0; i < members.Count; ++i) {
|
||||
var method = members[i] as MethodSpec;
|
||||
if (method == null) {
|
||||
if (!copied) {
|
||||
copied = true;
|
||||
members = new List<MemberSpec> (members);
|
||||
}
|
||||
|
||||
members.RemoveAt (i--);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!method.DeclaringType.IsInterface)
|
||||
continue;
|
||||
|
||||
for (int ii = 0; ii < members.Count; ++ii) {
|
||||
var candidate = members[ii] as MethodSpec;
|
||||
if (candidate == null || !candidate.DeclaringType.IsClass)
|
||||
continue;
|
||||
|
||||
if (!TypeSpecComparer.Override.IsEqual (candidate.Parameters, method.Parameters))
|
||||
continue;
|
||||
|
||||
if (!copied) {
|
||||
copied = true;
|
||||
members = new List<MemberSpec> (members);
|
||||
}
|
||||
|
||||
members.RemoveAt (i--);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return members;
|
||||
}
|
||||
|
||||
protected virtual void Error_NegativeArrayIndex (ResolveContext ec, Location loc)
|
||||
{
|
||||
throw new NotImplementedException ();
|
||||
@@ -4397,6 +4455,11 @@ namespace Mono.CSharp {
|
||||
arg_moved = true;
|
||||
}
|
||||
|
||||
if (arguments == orig_args) {
|
||||
arguments = new Arguments (orig_args.Count);
|
||||
arguments.AddRange (orig_args);
|
||||
}
|
||||
|
||||
arguments[index] = arguments[i];
|
||||
arguments[i] = temp;
|
||||
|
||||
|
||||
+98
-8
@@ -131,6 +131,12 @@ namespace Mono.CSharp
|
||||
Location.Initialize (ctx.SourceFiles);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// When set evaluator will automatically wait on Task of async methods. When not
|
||||
/// set it's called responsibility to handle Task execution
|
||||
/// </summary>
|
||||
public bool WaitOnTask { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// If true, turns type expressions into valid expressions
|
||||
/// and calls the describe method on it
|
||||
@@ -429,7 +435,7 @@ namespace Mono.CSharp
|
||||
throw new ArgumentException ("Syntax error on input: partial input");
|
||||
|
||||
if (result_set == false)
|
||||
throw new ArgumentException ("The expression did not set a result");
|
||||
throw new ArgumentException ("The expression failed to resolve");
|
||||
|
||||
return result;
|
||||
}
|
||||
@@ -657,11 +663,47 @@ namespace Mono.CSharp
|
||||
|
||||
host.SetBaseTypes (baseclass_list);
|
||||
|
||||
host.CreateContainer ();
|
||||
host.DefineContainer ();
|
||||
host.Define ();
|
||||
|
||||
expression_method = (Method) host.Members[0];
|
||||
|
||||
if ((expression_method.ModFlags & Modifiers.ASYNC) != 0) {
|
||||
//
|
||||
// Host method is async. When WaitOnTask is set we wrap it with wait
|
||||
//
|
||||
// void AsyncWait (ref object $retval) {
|
||||
// $retval = Host();
|
||||
// ((Task)$retval).Wait(); // When WaitOnTask is set
|
||||
// }
|
||||
//
|
||||
var p = new ParametersCompiled (
|
||||
new Parameter (new TypeExpression (module.Compiler.BuiltinTypes.Object, Location.Null), "$retval", Parameter.Modifier.REF, null, Location.Null)
|
||||
);
|
||||
|
||||
var method = new Method(host, new TypeExpression(module.Compiler.BuiltinTypes.Void, Location.Null),
|
||||
Modifiers.PUBLIC | Modifiers.STATIC, new MemberName("AsyncWait"), p, null);
|
||||
|
||||
method.Block = new ToplevelBlock(method.Compiler, p, Location.Null);
|
||||
method.Block.AddStatement(new StatementExpression (new SimpleAssign(
|
||||
new SimpleName(p [0].Name, Location.Null),
|
||||
new Invocation(new SimpleName(expression_method.MemberName.Name, Location.Null), new Arguments(0)),
|
||||
Location.Null), Location.Null));
|
||||
|
||||
if (WaitOnTask) {
|
||||
var task = new Cast (expression_method.TypeExpression, new SimpleName (p [0].Name, Location.Null), Location.Null);
|
||||
|
||||
method.Block.AddStatement (new StatementExpression (new Invocation (
|
||||
new MemberAccess (task, "Wait", Location.Null),
|
||||
new Arguments (0)), Location.Null));
|
||||
}
|
||||
|
||||
host.AddMember(method);
|
||||
|
||||
expression_method = method;
|
||||
}
|
||||
|
||||
host.CreateContainer();
|
||||
host.DefineContainer();
|
||||
host.Define();
|
||||
|
||||
} else {
|
||||
expression_method = null;
|
||||
}
|
||||
@@ -1056,6 +1098,27 @@ namespace Mono.CSharp
|
||||
#endif
|
||||
}
|
||||
|
||||
class InteractiveMethod : Method
|
||||
{
|
||||
public InteractiveMethod(TypeDefinition parent, FullNamedExpression returnType, Modifiers mod, ParametersCompiled parameters)
|
||||
: base(parent, returnType, mod, new MemberName("Host"), parameters, null)
|
||||
{
|
||||
}
|
||||
|
||||
public void ChangeToAsync ()
|
||||
{
|
||||
ModFlags |= Modifiers.ASYNC;
|
||||
ModFlags &= ~Modifiers.UNSAFE;
|
||||
type_expr = new TypeExpression(Module.PredefinedTypes.Task.TypeSpec, Location);
|
||||
parameters = ParametersCompiled.EmptyReadOnlyParameters;
|
||||
}
|
||||
|
||||
public override string GetSignatureForError()
|
||||
{
|
||||
return "InteractiveHost";
|
||||
}
|
||||
}
|
||||
|
||||
class HoistedEvaluatorVariable : HoistedVariable
|
||||
{
|
||||
public HoistedEvaluatorVariable (Field field)
|
||||
@@ -1076,11 +1139,17 @@ namespace Mono.CSharp
|
||||
/// the return value for an invocation.
|
||||
/// </summary>
|
||||
class OptionalAssign : SimpleAssign {
|
||||
public OptionalAssign (Expression t, Expression s, Location loc)
|
||||
: base (t, s, loc)
|
||||
public OptionalAssign (Expression s, Location loc)
|
||||
: base (null, s, loc)
|
||||
{
|
||||
}
|
||||
|
||||
public override Location StartLocation {
|
||||
get {
|
||||
return Location.Null;
|
||||
}
|
||||
}
|
||||
|
||||
protected override Expression DoResolve (ResolveContext ec)
|
||||
{
|
||||
Expression clone = source.Clone (new CloneContext ());
|
||||
@@ -1093,7 +1162,7 @@ namespace Mono.CSharp
|
||||
// A useful feature for the REPL: if we can resolve the expression
|
||||
// as a type, Describe the type;
|
||||
//
|
||||
if (ec.Module.Evaluator.DescribeTypeExpressions){
|
||||
if (ec.Module.Evaluator.DescribeTypeExpressions && !(ec.CurrentAnonymousMethod is AsyncInitializer)) {
|
||||
var old_printer = ec.Report.SetPrinter (new SessionReportPrinter ());
|
||||
Expression tclone;
|
||||
try {
|
||||
@@ -1119,8 +1188,29 @@ namespace Mono.CSharp
|
||||
}
|
||||
|
||||
source = clone;
|
||||
|
||||
var host = (Method) ec.MemberContext.CurrentMemberDefinition;
|
||||
|
||||
if (host.ParameterInfo.IsEmpty) {
|
||||
eclass = ExprClass.Value;
|
||||
type = InternalType.FakeInternalType;
|
||||
return this;
|
||||
}
|
||||
|
||||
target = new SimpleName (host.ParameterInfo[0].Name, Location);
|
||||
|
||||
return base.DoResolve (ec);
|
||||
}
|
||||
|
||||
public override void EmitStatement(EmitContext ec)
|
||||
{
|
||||
if (target == null) {
|
||||
source.Emit (ec);
|
||||
return;
|
||||
}
|
||||
|
||||
base.EmitStatement(ec);
|
||||
}
|
||||
}
|
||||
|
||||
public class Undo
|
||||
|
||||
+31
-14
@@ -80,7 +80,7 @@ namespace Mono.CSharp
|
||||
public override void Emit (EmitContext ec)
|
||||
{
|
||||
var call = new CallEmitter ();
|
||||
call.EmitPredefined (ec, oper, arguments);
|
||||
call.EmitPredefined (ec, oper, arguments, loc);
|
||||
}
|
||||
|
||||
public override SLE.Expression MakeExpression (BuilderContext ctx)
|
||||
@@ -1930,8 +1930,8 @@ namespace Mono.CSharp
|
||||
|
||||
if (right_expr.IsNull) {
|
||||
if ((b.oper & Operator.EqualityMask) != 0) {
|
||||
if (!left_expr.Type.IsNullableType && left_expr.Type == left_unwrap)
|
||||
return b.CreateLiftedValueTypeResult (rc, left_unwrap);
|
||||
if (!left_expr.Type.IsNullableType && BuiltinTypeSpec.IsPrimitiveType (left_expr.Type))
|
||||
return b.CreateLiftedValueTypeResult (rc, left_expr.Type);
|
||||
} else if ((b.oper & Operator.BitwiseMask) != 0) {
|
||||
if (left_unwrap.BuiltinType != BuiltinTypeSpec.Type.Bool)
|
||||
return Nullable.LiftedNull.CreateFromExpression (rc, b);
|
||||
@@ -1946,8 +1946,8 @@ namespace Mono.CSharp
|
||||
}
|
||||
} else if (left_expr.IsNull) {
|
||||
if ((b.oper & Operator.EqualityMask) != 0) {
|
||||
if (!right_expr.Type.IsNullableType && right_expr.Type == right_unwrap)
|
||||
return b.CreateLiftedValueTypeResult (rc, right_unwrap);
|
||||
if (!right_expr.Type.IsNullableType && BuiltinTypeSpec.IsPrimitiveType (right_expr.Type))
|
||||
return b.CreateLiftedValueTypeResult (rc, right_expr.Type);
|
||||
} else if ((b.oper & Operator.BitwiseMask) != 0) {
|
||||
if (right_unwrap.BuiltinType != BuiltinTypeSpec.Type.Bool)
|
||||
return Nullable.LiftedNull.CreateFromExpression (rc, b);
|
||||
@@ -2752,6 +2752,12 @@ namespace Mono.CSharp
|
||||
if (l.IsPointer || r.IsPointer)
|
||||
return ResolveOperatorPointer (rc, l, r);
|
||||
|
||||
// User operators
|
||||
expr = ResolveUserOperator (rc, left, right);
|
||||
if (expr != null)
|
||||
return expr;
|
||||
|
||||
|
||||
bool lenum = l.IsEnum;
|
||||
bool renum = r.IsEnum;
|
||||
if ((oper & (Operator.ComparisonMask | Operator.BitwiseMask)) != 0) {
|
||||
@@ -2805,11 +2811,6 @@ namespace Mono.CSharp
|
||||
return expr;
|
||||
}
|
||||
}
|
||||
|
||||
// User operators
|
||||
expr = ResolveUserOperator (rc, left, right);
|
||||
if (expr != null)
|
||||
return expr;
|
||||
}
|
||||
|
||||
//
|
||||
@@ -3718,10 +3719,15 @@ namespace Mono.CSharp
|
||||
Nullable.NullableInfo.GetEnumUnderlyingType (rc.Module, left.Type) :
|
||||
EnumSpec.GetUnderlyingType (left.Type);
|
||||
}
|
||||
} else if (IsEnumOrNullableEnum (left.Type)) {
|
||||
result_type = left.Type;
|
||||
} else {
|
||||
result_type = right.Type;
|
||||
if (IsEnumOrNullableEnum (left.Type)) {
|
||||
result_type = left.Type;
|
||||
} else {
|
||||
result_type = right.Type;
|
||||
}
|
||||
|
||||
if (expr is Nullable.LiftedBinaryOperator && !result_type.IsNullableType)
|
||||
result_type = rc.Module.PredefinedTypes.Nullable.TypeSpec.MakeGenericType (rc.Module, new[] { result_type });
|
||||
}
|
||||
|
||||
return EmptyCast.Create (expr, result_type);
|
||||
@@ -4330,6 +4336,14 @@ namespace Mono.CSharp
|
||||
/// </remarks>
|
||||
public override void EmitBranchable (EmitContext ec, Label target, bool on_true)
|
||||
{
|
||||
if (ec.HasSet (BuilderContext.Options.AsyncBody) && right.ContainsEmitWithAwait ()) {
|
||||
left = left.EmitToField (ec);
|
||||
|
||||
if ((oper & Operator.LogicalMask) == 0) {
|
||||
right = right.EmitToField (ec);
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// This is more complicated than it looks, but its just to avoid
|
||||
// duplicated tests: basically, we allow ==, !=, >, <, >= and <=
|
||||
@@ -6533,14 +6547,16 @@ namespace Mono.CSharp
|
||||
}
|
||||
|
||||
if (vr != null) {
|
||||
ec.MarkCallEntry (loc);
|
||||
ec.Emit (OpCodes.Call, method);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (type is TypeParameterSpec)
|
||||
return DoEmitTypeParameter (ec);
|
||||
return DoEmitTypeParameter (ec);
|
||||
|
||||
ec.MarkCallEntry (loc);
|
||||
ec.Emit (OpCodes.Newobj, method);
|
||||
return true;
|
||||
}
|
||||
@@ -10037,6 +10053,7 @@ namespace Mono.CSharp
|
||||
public override void Emit (EmitContext ec)
|
||||
{
|
||||
source.Emit (ec);
|
||||
ec.MarkCallEntry (loc);
|
||||
ec.Emit (OpCodes.Call, method);
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -358,9 +358,9 @@ namespace Mono.CSharp
|
||||
return fs;
|
||||
}
|
||||
|
||||
public override List<TypeSpec> ResolveMissingDependencies ()
|
||||
public override List<MissingTypeSpecReference> ResolveMissingDependencies (MemberSpec caller)
|
||||
{
|
||||
return memberType.ResolveMissingDependencies ();
|
||||
return memberType.ResolveMissingDependencies (this);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -800,7 +800,7 @@ namespace Mono.CSharp
|
||||
}
|
||||
}
|
||||
|
||||
public class FlowBranchingAsync : FlowBranchingBlock
|
||||
public class FlowBranchingAsync : FlowBranchingBlock
|
||||
{
|
||||
readonly AsyncInitializer async_init;
|
||||
|
||||
|
||||
+2
-2
@@ -1665,7 +1665,7 @@ namespace Mono.CSharp {
|
||||
}
|
||||
}
|
||||
|
||||
public override bool IsGenericIterateInterface {
|
||||
public override bool IsArrayGenericInterface {
|
||||
get {
|
||||
return (open_type.state & StateFlags.GenericIterateInterface) != 0;
|
||||
}
|
||||
@@ -3349,7 +3349,7 @@ namespace Mono.CSharp {
|
||||
return LowerBoundInference (u_ac.Element, v_ac.Element, inversed);
|
||||
}
|
||||
|
||||
if (u_ac.Rank != 1 || !v.IsGenericIterateInterface)
|
||||
if (u_ac.Rank != 1 || !v.IsArrayGenericInterface)
|
||||
return 0;
|
||||
|
||||
var v_i = TypeManager.GetTypeArguments (v) [0];
|
||||
|
||||
+27
-13
@@ -774,24 +774,34 @@ namespace Mono.CSharp
|
||||
|
||||
for (int i = nested_hierarchy.Count; i != 0; --i) {
|
||||
var t = nested_hierarchy [i - 1];
|
||||
spec = MemberCache.FindNestedType (spec, t.Name, t.Arity);
|
||||
if (t.Kind == MemberKind.MissingType)
|
||||
spec = t;
|
||||
else
|
||||
spec = MemberCache.FindNestedType (spec, t.Name, t.Arity);
|
||||
|
||||
if (t.Arity > 0) {
|
||||
spec = spec.MakeGenericType (module, targs.Skip (targs_pos).Take (spec.Arity).ToArray ());
|
||||
targs_pos += t.Arity;
|
||||
}
|
||||
}
|
||||
|
||||
string name = type.Name;
|
||||
int index = name.IndexOf ('`');
|
||||
if (index > 0)
|
||||
name = name.Substring (0, index);
|
||||
if (spec.Kind == MemberKind.MissingType) {
|
||||
spec = new TypeSpec (MemberKind.MissingType, spec, new ImportedTypeDefinition (type_def, this), type_def, Modifiers.PUBLIC);
|
||||
spec.MemberCache = MemberCache.Empty;
|
||||
} else {
|
||||
if ((type_def.Attributes & TypeAttributes.VisibilityMask) == TypeAttributes.NestedPrivate && IgnorePrivateMembers)
|
||||
return null;
|
||||
|
||||
spec = MemberCache.FindNestedType (spec, name, targs.Length - targs_pos);
|
||||
if (spec == null)
|
||||
return null;
|
||||
string name = type.Name;
|
||||
int index = name.IndexOf ('`');
|
||||
if (index > 0)
|
||||
name = name.Substring (0, index);
|
||||
|
||||
if (spec.Arity > 0) {
|
||||
spec = spec.MakeGenericType (module, targs.Skip (targs_pos).ToArray ());
|
||||
spec = MemberCache.FindNestedType (spec, name, targs.Length - targs_pos);
|
||||
|
||||
if (spec.Arity > 0) {
|
||||
spec = spec.MakeGenericType (module, targs.Skip (targs_pos).ToArray ());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1883,7 +1893,7 @@ namespace Mono.CSharp
|
||||
|
||||
}
|
||||
|
||||
public static void Error_MissingDependency (IMemberContext ctx, List<TypeSpec> types, Location loc)
|
||||
public static void Error_MissingDependency (IMemberContext ctx, List<MissingTypeSpecReference> missing, Location loc)
|
||||
{
|
||||
//
|
||||
// Report details about missing type and most likely cause of the problem.
|
||||
@@ -1894,8 +1904,8 @@ namespace Mono.CSharp
|
||||
|
||||
var report = ctx.Module.Compiler.Report;
|
||||
|
||||
for (int i = 0; i < types.Count; ++i) {
|
||||
var t = types [i];
|
||||
for (int i = 0; i < missing.Count; ++i) {
|
||||
var t = missing [i].Type;
|
||||
|
||||
//
|
||||
// Report missing types only once
|
||||
@@ -1905,6 +1915,10 @@ namespace Mono.CSharp
|
||||
|
||||
string name = t.GetSignatureForError ();
|
||||
|
||||
var caller = missing[i].Caller;
|
||||
if (caller.Kind != MemberKind.MissingType)
|
||||
report.SymbolRelatedToPreviousError (missing[i].Caller);
|
||||
|
||||
if (t.MemberDefinition.DeclaringAssembly == ctx.Module.DeclaringAssembly) {
|
||||
report.Error (1683, loc,
|
||||
"Reference to type `{0}' claims it is defined in this assembly, but it is not defined in source or any added modules",
|
||||
|
||||
+6
-6
@@ -493,29 +493,29 @@ namespace Mono.CSharp {
|
||||
return ms;
|
||||
}
|
||||
|
||||
public override List<TypeSpec> ResolveMissingDependencies ()
|
||||
public override List<MissingTypeSpecReference> ResolveMissingDependencies (MemberSpec caller)
|
||||
{
|
||||
var missing = returnType.ResolveMissingDependencies ();
|
||||
var missing = returnType.ResolveMissingDependencies (this);
|
||||
foreach (var pt in parameters.Types) {
|
||||
var m = pt.GetMissingDependencies ();
|
||||
var m = pt.GetMissingDependencies (this);
|
||||
if (m == null)
|
||||
continue;
|
||||
|
||||
if (missing == null)
|
||||
missing = new List<TypeSpec> ();
|
||||
missing = new List<MissingTypeSpecReference> ();
|
||||
|
||||
missing.AddRange (m);
|
||||
}
|
||||
|
||||
if (Arity > 0) {
|
||||
foreach (var tp in GenericDefinition.TypeParameters) {
|
||||
var m = tp.GetMissingDependencies ();
|
||||
var m = tp.GetMissingDependencies (this);
|
||||
|
||||
if (m == null)
|
||||
continue;
|
||||
|
||||
if (missing == null)
|
||||
missing = new List<TypeSpec> ();
|
||||
missing = new List<MissingTypeSpecReference> ();
|
||||
|
||||
missing.AddRange (m);
|
||||
}
|
||||
|
||||
+9
-8
@@ -174,9 +174,9 @@ namespace Mono.CSharp
|
||||
return ps;
|
||||
}
|
||||
|
||||
public override List<TypeSpec> ResolveMissingDependencies ()
|
||||
public override List<MissingTypeSpecReference> ResolveMissingDependencies (MemberSpec caller)
|
||||
{
|
||||
return memberType.ResolveMissingDependencies ();
|
||||
return memberType.ResolveMissingDependencies (this);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1427,9 +1427,9 @@ namespace Mono.CSharp
|
||||
return es;
|
||||
}
|
||||
|
||||
public override List<TypeSpec> ResolveMissingDependencies ()
|
||||
public override List<MissingTypeSpecReference> ResolveMissingDependencies (MemberSpec caller)
|
||||
{
|
||||
return MemberType.ResolveMissingDependencies ();
|
||||
return MemberType.ResolveMissingDependencies (this);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1701,16 +1701,17 @@ namespace Mono.CSharp
|
||||
return spec;
|
||||
}
|
||||
|
||||
public override List<TypeSpec> ResolveMissingDependencies ()
|
||||
public override List<MissingTypeSpecReference> ResolveMissingDependencies (MemberSpec caller)
|
||||
{
|
||||
var missing = base.ResolveMissingDependencies ();
|
||||
var missing = base.ResolveMissingDependencies (caller);
|
||||
|
||||
foreach (var pt in parameters.Types) {
|
||||
var m = pt.GetMissingDependencies ();
|
||||
var m = pt.GetMissingDependencies (caller);
|
||||
if (m == null)
|
||||
continue;
|
||||
|
||||
if (missing == null)
|
||||
missing = new List<TypeSpec> ();
|
||||
missing = new List<MissingTypeSpecReference> ();
|
||||
|
||||
missing.AddRange (m);
|
||||
}
|
||||
|
||||
+1
-1
@@ -576,7 +576,7 @@ namespace Mono.CSharp {
|
||||
public bool ProcessWarningsList (string text, Action<int> action)
|
||||
{
|
||||
bool valid = true;
|
||||
foreach (string wid in text.Split (numeric_value_separator)) {
|
||||
foreach (string wid in text.Split (numeric_value_separator, StringSplitOptions.RemoveEmptyEntries)) {
|
||||
int id;
|
||||
if (!int.TryParse (wid, NumberStyles.AllowLeadingWhite, CultureInfo.InvariantCulture, out id)) {
|
||||
report.Error (1904, "`{0}' is not a valid warning number", wid);
|
||||
|
||||
@@ -702,7 +702,7 @@ namespace Mono.CSharp {
|
||||
|
||||
public class StatementErrorExpression : Statement
|
||||
{
|
||||
readonly Expression expr;
|
||||
Expression expr;
|
||||
|
||||
public StatementErrorExpression (Expression expr)
|
||||
{
|
||||
@@ -729,7 +729,9 @@ namespace Mono.CSharp {
|
||||
|
||||
protected override void CloneTo (CloneContext clonectx, Statement target)
|
||||
{
|
||||
throw new NotImplementedException ();
|
||||
var t = (StatementErrorExpression) target;
|
||||
|
||||
t.expr = expr.Clone (clonectx);
|
||||
}
|
||||
|
||||
public override object Accept (StructuralVisitor visitor)
|
||||
|
||||
@@ -322,4 +322,38 @@ namespace Mono.CSharp {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
struct TypeNameParser
|
||||
{
|
||||
internal static string Escape(string name)
|
||||
{
|
||||
if (name == null) {
|
||||
return null;
|
||||
}
|
||||
StringBuilder sb = null;
|
||||
for (int pos = 0; pos < name.Length; pos++) {
|
||||
char c = name[pos];
|
||||
switch (c) {
|
||||
case '\\':
|
||||
case '+':
|
||||
case ',':
|
||||
case '[':
|
||||
case ']':
|
||||
case '*':
|
||||
case '&':
|
||||
if (sb == null) {
|
||||
sb = new StringBuilder(name, 0, pos, name.Length + 3);
|
||||
}
|
||||
sb.Append("\\").Append(c);
|
||||
break;
|
||||
default:
|
||||
if (sb != null) {
|
||||
sb.Append(c);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
return sb != null ? sb.ToString() : name;
|
||||
}
|
||||
}
|
||||
}
|
||||
+13
-3
@@ -186,7 +186,9 @@ namespace Mono.CSharp
|
||||
public readonly PredefinedType IsVolatile;
|
||||
public readonly PredefinedType IEnumeratorGeneric;
|
||||
public readonly PredefinedType IListGeneric;
|
||||
public readonly PredefinedType IReadOnlyListGeneric;
|
||||
public readonly PredefinedType ICollectionGeneric;
|
||||
public readonly PredefinedType IReadOnlyCollectionGeneric;
|
||||
public readonly PredefinedType IEnumerableGeneric;
|
||||
public readonly PredefinedType Nullable;
|
||||
public readonly PredefinedType Activator;
|
||||
@@ -246,7 +248,9 @@ namespace Mono.CSharp
|
||||
IsVolatile = new PredefinedType (module, MemberKind.Class, "System.Runtime.CompilerServices", "IsVolatile");
|
||||
IEnumeratorGeneric = new PredefinedType (module, MemberKind.Interface, "System.Collections.Generic", "IEnumerator", 1);
|
||||
IListGeneric = new PredefinedType (module, MemberKind.Interface, "System.Collections.Generic", "IList", 1);
|
||||
IReadOnlyListGeneric = new PredefinedType (module, MemberKind.Interface, "System.Collections.Generic", "IReadOnlyList", 1);
|
||||
ICollectionGeneric = new PredefinedType (module, MemberKind.Interface, "System.Collections.Generic", "ICollection", 1);
|
||||
IReadOnlyCollectionGeneric = new PredefinedType (module, MemberKind.Interface, "System.Collections.Generic", "IReadOnlyCollection", 1);
|
||||
IEnumerableGeneric = new PredefinedType (module, MemberKind.Interface, "System.Collections.Generic", "IEnumerable", 1);
|
||||
Nullable = new PredefinedType (module, MemberKind.Struct, "System", "Nullable", 1);
|
||||
Activator = new PredefinedType (module, MemberKind.Class, "System", "Activator");
|
||||
@@ -294,13 +298,19 @@ namespace Mono.CSharp
|
||||
ArgIterator.TypeSpec.IsSpecialRuntimeType = true;
|
||||
|
||||
if (IEnumerableGeneric.Define ())
|
||||
IEnumerableGeneric.TypeSpec.IsGenericIterateInterface = true;
|
||||
IEnumerableGeneric.TypeSpec.IsArrayGenericInterface = true;
|
||||
|
||||
if (IListGeneric.Define ())
|
||||
IListGeneric.TypeSpec.IsGenericIterateInterface = true;
|
||||
IListGeneric.TypeSpec.IsArrayGenericInterface = true;
|
||||
|
||||
if (IReadOnlyListGeneric.Define ())
|
||||
IReadOnlyListGeneric.TypeSpec.IsArrayGenericInterface = true;
|
||||
|
||||
if (ICollectionGeneric.Define ())
|
||||
ICollectionGeneric.TypeSpec.IsGenericIterateInterface = true;
|
||||
ICollectionGeneric.TypeSpec.IsArrayGenericInterface = true;
|
||||
|
||||
if (IReadOnlyCollectionGeneric.Define ())
|
||||
IReadOnlyCollectionGeneric.TypeSpec.IsArrayGenericInterface = true;
|
||||
|
||||
if (Nullable.Define ())
|
||||
Nullable.TypeSpec.IsNullableType = true;
|
||||
|
||||
+24
-12
@@ -211,7 +211,7 @@ namespace Mono.CSharp
|
||||
//
|
||||
// Returns true for instances of IList<T>, IEnumerable<T>, ICollection<T>
|
||||
//
|
||||
public virtual bool IsGenericIterateInterface {
|
||||
public virtual bool IsArrayGenericInterface {
|
||||
get {
|
||||
return false;
|
||||
}
|
||||
@@ -738,22 +738,22 @@ namespace Mono.CSharp
|
||||
return this;
|
||||
}
|
||||
|
||||
public override List<TypeSpec> ResolveMissingDependencies ()
|
||||
public override List<MissingTypeSpecReference> ResolveMissingDependencies (MemberSpec caller)
|
||||
{
|
||||
List<TypeSpec> missing = null;
|
||||
List<MissingTypeSpecReference> missing = null;
|
||||
|
||||
if (Kind == MemberKind.MissingType) {
|
||||
missing = new List<TypeSpec> ();
|
||||
missing.Add (this);
|
||||
missing = new List<MissingTypeSpecReference> ();
|
||||
missing.Add (new MissingTypeSpecReference (this, caller));
|
||||
return missing;
|
||||
}
|
||||
|
||||
foreach (var targ in TypeArguments) {
|
||||
if (targ.Kind == MemberKind.MissingType) {
|
||||
if (missing == null)
|
||||
missing = new List<TypeSpec> ();
|
||||
missing = new List<MissingTypeSpecReference> ();
|
||||
|
||||
missing.Add (targ);
|
||||
missing.Add (new MissingTypeSpecReference (targ, caller));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -761,19 +761,19 @@ namespace Mono.CSharp
|
||||
foreach (var iface in Interfaces) {
|
||||
if (iface.Kind == MemberKind.MissingType) {
|
||||
if (missing == null)
|
||||
missing = new List<TypeSpec> ();
|
||||
missing = new List<MissingTypeSpecReference> ();
|
||||
|
||||
missing.Add (iface);
|
||||
missing.Add (new MissingTypeSpecReference (iface, caller));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (MemberDefinition.TypeParametersCount > 0) {
|
||||
foreach (var tp in MemberDefinition.TypeParameters) {
|
||||
var tp_missing = tp.GetMissingDependencies ();
|
||||
var tp_missing = tp.GetMissingDependencies (this);
|
||||
if (tp_missing != null) {
|
||||
if (missing == null)
|
||||
missing = new List<TypeSpec> ();
|
||||
missing = new List<MissingTypeSpecReference> ();
|
||||
|
||||
missing.AddRange (tp_missing);
|
||||
}
|
||||
@@ -783,7 +783,7 @@ namespace Mono.CSharp
|
||||
if (missing != null || BaseType == null)
|
||||
return missing;
|
||||
|
||||
return BaseType.ResolveMissingDependencies ();
|
||||
return BaseType.ResolveMissingDependencies (this);
|
||||
}
|
||||
|
||||
public void SetMetaInfo (MetaType info)
|
||||
@@ -1950,4 +1950,16 @@ namespace Mono.CSharp
|
||||
return pc;
|
||||
}
|
||||
}
|
||||
|
||||
public class MissingTypeSpecReference
|
||||
{
|
||||
public MissingTypeSpecReference (TypeSpec type, MemberSpec caller)
|
||||
{
|
||||
Type = type;
|
||||
Caller = caller;
|
||||
}
|
||||
|
||||
public TypeSpec Type { get; private set; }
|
||||
public MemberSpec Caller { get; private set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
using System;
|
||||
|
||||
public class Z : IGenericInterface<Z>
|
||||
{
|
||||
public Z Start ()
|
||||
{
|
||||
return this;
|
||||
}
|
||||
|
||||
Z IGenericInterface<Z>.Start ()
|
||||
{
|
||||
throw new ApplicationException ();
|
||||
}
|
||||
}
|
||||
|
||||
public interface IGenericInterface<T>
|
||||
{
|
||||
T Start ();
|
||||
}
|
||||
|
||||
public class A<T> where T : Z, IGenericInterface<int>
|
||||
{
|
||||
public void SomeOperation (T t)
|
||||
{
|
||||
t.Start ();
|
||||
}
|
||||
}
|
||||
|
||||
public class C : Z, IGenericInterface<int>
|
||||
{
|
||||
int IGenericInterface<int>.Start ()
|
||||
{
|
||||
throw new NotImplementedException ();
|
||||
}
|
||||
|
||||
public static void Main ()
|
||||
{
|
||||
new A<C> ().SomeOperation (new C ());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
using System;
|
||||
|
||||
enum E
|
||||
{
|
||||
V
|
||||
}
|
||||
|
||||
class C
|
||||
{
|
||||
public static void Main ()
|
||||
{
|
||||
byte? foo = 0;
|
||||
E e = 0;
|
||||
var res = foo - e;
|
||||
Console.WriteLine (res);
|
||||
var res2 = e - foo;
|
||||
Console.WriteLine (res2);
|
||||
res = null;
|
||||
res2 = null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
public class Tests
|
||||
{
|
||||
static void A<T>(IReadOnlyCollection<T> otherList)
|
||||
{
|
||||
}
|
||||
|
||||
static void B<T>(IReadOnlyList<T> otherList)
|
||||
{
|
||||
}
|
||||
|
||||
public static void Main ()
|
||||
{
|
||||
var ifacers = typeof(int[]).GetInterfaces ();
|
||||
|
||||
var args = new string [0];
|
||||
A (args);
|
||||
B (args);
|
||||
|
||||
IReadOnlyList<int> e1 = new int[0];
|
||||
IReadOnlyCollection<int> e2 = new int[0];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
using System;
|
||||
|
||||
public class C
|
||||
{
|
||||
public static readonly C Token = new C ();
|
||||
|
||||
public static C operator & (C set, E value)
|
||||
{
|
||||
return Token;
|
||||
}
|
||||
|
||||
public static implicit operator E (C c)
|
||||
{
|
||||
throw new ApplicationException ();
|
||||
}
|
||||
}
|
||||
|
||||
public enum E
|
||||
{
|
||||
Item = 2
|
||||
}
|
||||
|
||||
class FooClass
|
||||
{
|
||||
public static int Main ()
|
||||
{
|
||||
C m = new C ();
|
||||
var x = E.Item;
|
||||
var res = m & x;
|
||||
if (res != C.Token)
|
||||
return 1;
|
||||
|
||||
res = m & E.Item;
|
||||
if (res != C.Token)
|
||||
return 2;
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@@ -353,6 +353,15 @@ class Tester : Base
|
||||
return 0;
|
||||
}
|
||||
|
||||
async Task<bool> BinaryTest_6 ()
|
||||
{
|
||||
var t = Task.Delay (1);
|
||||
if (t == await Task.WhenAny(new [] { t }))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
async Task<int> CallTest_1 ()
|
||||
{
|
||||
return Call (
|
||||
|
||||
@@ -2,8 +2,7 @@ using System;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
// contextual async, parser tests
|
||||
|
||||
class A
|
||||
class A : Iasync
|
||||
{
|
||||
async Task<int> async ()
|
||||
{
|
||||
@@ -21,6 +20,10 @@ class A
|
||||
var res = (int) await async ();
|
||||
var res2 = (Int32) await async ();
|
||||
}
|
||||
|
||||
async void Iasync.async ()
|
||||
{
|
||||
}
|
||||
|
||||
public static int Main ()
|
||||
{
|
||||
@@ -28,6 +31,11 @@ class A
|
||||
}
|
||||
}
|
||||
|
||||
interface Iasync
|
||||
{
|
||||
void async ();
|
||||
}
|
||||
|
||||
class B
|
||||
{
|
||||
class async
|
||||
|
||||
@@ -44,6 +44,7 @@
|
||||
<sequencepoints>
|
||||
<entry il="0x0" row="4" col="2" file_ref="1" hidden="false" />
|
||||
<entry il="0x1" row="5" col="3" file_ref="1" hidden="false" />
|
||||
<entry il="0x2" row="5" col="3" file_ref="1" hidden="false" />
|
||||
<entry il="0x7" row="6" col="2" file_ref="1" hidden="false" />
|
||||
</sequencepoints>
|
||||
<locals />
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
<method token="0x6000002">
|
||||
<sequencepoints>
|
||||
<entry il="0x0" row="12" col="2" file_ref="1" hidden="false" />
|
||||
<entry il="0x1" row="13" col="3" file_ref="1" hidden="false" />
|
||||
<entry il="0x1" row="13" col="10" file_ref="1" hidden="false" />
|
||||
<entry il="0x6" row="13" col="26" file_ref="1" hidden="false" />
|
||||
<entry il="0x16" row="14" col="2" file_ref="1" hidden="false" />
|
||||
</sequencepoints>
|
||||
@@ -41,6 +41,7 @@
|
||||
<entry il="0x1" row="25" col="10" file_ref="1" hidden="false" />
|
||||
<entry il="0x9" row="26" col="3" file_ref="1" hidden="false" />
|
||||
<entry il="0xa" row="27" col="3" file_ref="1" hidden="false" />
|
||||
<entry il="0x18" row="25" col="14" file_ref="1" hidden="false" />
|
||||
<entry il="0x1e" row="28" col="2" file_ref="1" hidden="false" />
|
||||
</sequencepoints>
|
||||
<locals>
|
||||
@@ -58,6 +59,8 @@
|
||||
<entry il="0x9" row="32" col="26" file_ref="1" hidden="false" />
|
||||
<entry il="0x11" row="33" col="3" file_ref="1" hidden="false" />
|
||||
<entry il="0x12" row="34" col="3" file_ref="1" hidden="false" />
|
||||
<entry il="0x20" row="32" col="26" file_ref="1" hidden="false" />
|
||||
<entry il="0x33" row="32" col="12" file_ref="1" hidden="false" />
|
||||
<entry il="0x39" row="35" col="2" file_ref="1" hidden="false" />
|
||||
</sequencepoints>
|
||||
<locals>
|
||||
@@ -75,6 +78,7 @@
|
||||
<entry il="0x1" row="39" col="10" file_ref="1" hidden="false" />
|
||||
<entry il="0x10" row="40" col="3" file_ref="1" hidden="false" />
|
||||
<entry il="0x11" row="41" col="3" file_ref="1" hidden="false" />
|
||||
<entry il="0x2e" row="39" col="13" file_ref="1" hidden="false" />
|
||||
<entry il="0x34" row="42" col="2" file_ref="1" hidden="false" />
|
||||
</sequencepoints>
|
||||
<locals>
|
||||
@@ -88,10 +92,12 @@
|
||||
<method token="0x6000008">
|
||||
<sequencepoints>
|
||||
<entry il="0x0" row="45" col="2" file_ref="1" hidden="false" />
|
||||
<entry il="0x1" row="46" col="10" file_ref="1" hidden="false" />
|
||||
<entry il="0x1" row="46" col="19" file_ref="1" hidden="false" />
|
||||
<entry il="0x7" row="47" col="3" file_ref="1" hidden="false" />
|
||||
<entry il="0x8" row="48" col="4" file_ref="1" hidden="false" />
|
||||
<entry il="0xd" row="48" col="12" file_ref="1" hidden="false" />
|
||||
<entry il="0x12" row="49" col="3" file_ref="1" hidden="false" />
|
||||
<entry il="0x1f" row="46" col="14" file_ref="1" hidden="false" />
|
||||
<entry il="0x25" row="50" col="2" file_ref="1" hidden="false" />
|
||||
</sequencepoints>
|
||||
<locals>
|
||||
@@ -167,6 +173,7 @@
|
||||
<sequencepoints>
|
||||
<entry il="0x0" row="103" col="2" file_ref="1" hidden="false" />
|
||||
<entry il="0x1" row="105" col="3" file_ref="1" hidden="false" />
|
||||
<entry il="0x86" row="104" col="3" file_ref="1" hidden="false" />
|
||||
<entry il="0xb3" row="107" col="5" file_ref="1" hidden="false" />
|
||||
<entry il="0xb8" row="109" col="4" file_ref="1" hidden="false" />
|
||||
<entry il="0xb9" row="110" col="5" file_ref="1" hidden="false" />
|
||||
@@ -255,6 +262,7 @@
|
||||
<entry il="0x1" row="175" col="3" file_ref="1" hidden="false" />
|
||||
<entry il="0x2" row="176" col="3" file_ref="1" hidden="false" />
|
||||
<entry il="0x3" row="177" col="4" file_ref="1" hidden="false" />
|
||||
<entry il="0x8" row="177" col="12" file_ref="1" hidden="false" />
|
||||
<entry il="0xd" row="178" col="3" file_ref="1" hidden="false" />
|
||||
</sequencepoints>
|
||||
<locals />
|
||||
@@ -266,6 +274,7 @@
|
||||
<sequencepoints>
|
||||
<entry il="0x0" row="182" col="2" file_ref="1" hidden="false" />
|
||||
<entry il="0x1" row="183" col="3" file_ref="1" hidden="false" />
|
||||
<entry il="0x7" row="183" col="7" file_ref="1" hidden="false" />
|
||||
<entry il="0x11" row="184" col="3" file_ref="1" hidden="false" />
|
||||
<entry il="0x12" row="185" col="3" file_ref="1" hidden="false" />
|
||||
<entry il="0x18" row="187" col="3" file_ref="1" hidden="false" />
|
||||
@@ -282,9 +291,11 @@
|
||||
<sequencepoints>
|
||||
<entry il="0x0" row="192" col="2" file_ref="1" hidden="false" />
|
||||
<entry il="0x1" row="193" col="3" file_ref="1" hidden="false" />
|
||||
<entry il="0x7" row="193" col="7" file_ref="1" hidden="false" />
|
||||
<entry il="0x11" row="194" col="3" file_ref="1" hidden="false" />
|
||||
<entry il="0x12" row="195" col="3" file_ref="1" hidden="false" />
|
||||
<entry il="0x18" row="196" col="8" file_ref="1" hidden="false" />
|
||||
<entry il="0x1e" row="196" col="12" file_ref="1" hidden="false" />
|
||||
<entry il="0x28" row="197" col="3" file_ref="1" hidden="false" />
|
||||
<entry il="0x29" row="198" col="3" file_ref="1" hidden="false" />
|
||||
<entry il="0x2f" row="200" col="3" file_ref="1" hidden="false" />
|
||||
@@ -375,9 +386,13 @@
|
||||
<entry il="0x0" row="246" col="2" file_ref="1" hidden="false" />
|
||||
<entry il="0x1" row="247" col="3" file_ref="1" hidden="false" />
|
||||
<entry il="0x2" row="250" col="3" file_ref="1" hidden="false" />
|
||||
<entry il="0x3" row="250" col="3" file_ref="1" hidden="false" />
|
||||
<entry il="0xe" row="248" col="4" file_ref="1" hidden="false" />
|
||||
<entry il="0x10" row="250" col="3" file_ref="1" hidden="false" />
|
||||
<entry il="0x16" row="251" col="3" file_ref="1" hidden="false" />
|
||||
<entry il="0x17" row="252" col="3" file_ref="1" hidden="false" />
|
||||
<entry il="0x1a" row="250" col="3" file_ref="1" hidden="false" />
|
||||
<entry il="0x31" row="250" col="3" file_ref="1" hidden="false" />
|
||||
<entry il="0x37" row="253" col="2" file_ref="1" hidden="false" />
|
||||
</sequencepoints>
|
||||
<locals>
|
||||
@@ -393,9 +408,12 @@
|
||||
<entry il="0x0" row="256" col="2" file_ref="1" hidden="false" />
|
||||
<entry il="0x1" row="257" col="3" file_ref="1" hidden="false" />
|
||||
<entry il="0x2" row="260" col="3" file_ref="1" hidden="false" />
|
||||
<entry il="0x4" row="260" col="3" file_ref="1" hidden="false" />
|
||||
<entry il="0xf" row="258" col="4" file_ref="1" hidden="false" />
|
||||
<entry il="0x10" row="260" col="3" file_ref="1" hidden="false" />
|
||||
<entry il="0x16" row="261" col="3" file_ref="1" hidden="false" />
|
||||
<entry il="0x17" row="262" col="3" file_ref="1" hidden="false" />
|
||||
<entry il="0x19" row="260" col="3" file_ref="1" hidden="false" />
|
||||
<entry il="0x3c" row="263" col="2" file_ref="1" hidden="false" />
|
||||
</sequencepoints>
|
||||
<locals>
|
||||
@@ -411,6 +429,8 @@
|
||||
<entry il="0x0" row="266" col="2" file_ref="1" hidden="false" />
|
||||
<entry il="0x1" row="267" col="3" file_ref="1" hidden="false" />
|
||||
<entry il="0x2" row="269" col="6" file_ref="1" hidden="false" />
|
||||
<entry il="0x6" row="269" col="6" file_ref="1" hidden="false" />
|
||||
<entry il="0xe" row="269" col="6" file_ref="1" hidden="false" />
|
||||
<entry il="0x24" row="268" col="3" file_ref="1" hidden="false" />
|
||||
<entry il="0x2f" row="270" col="3" file_ref="1" hidden="false" />
|
||||
<entry il="0x30" row="271" col="3" file_ref="1" hidden="false" />
|
||||
|
||||
@@ -52,6 +52,7 @@
|
||||
</method>
|
||||
<method token="0x6000006">
|
||||
<sequencepoints>
|
||||
<entry il="0x0" row="34" col="2" file_ref="1" hidden="false" />
|
||||
<entry il="0xd" row="34" col="2" file_ref="1" hidden="false" />
|
||||
<entry il="0xe" row="35" col="3" file_ref="1" hidden="false" />
|
||||
<entry il="0x1b" row="37" col="2" file_ref="1" hidden="false" />
|
||||
@@ -63,7 +64,7 @@
|
||||
</method>
|
||||
<method token="0x6000007">
|
||||
<sequencepoints>
|
||||
<entry il="0x0" row="13" col="3" file_ref="1" hidden="false" />
|
||||
<entry il="0x0" row="13" col="11" file_ref="1" hidden="false" />
|
||||
</sequencepoints>
|
||||
<locals />
|
||||
<scopes />
|
||||
@@ -71,7 +72,7 @@
|
||||
<method token="0x6000008">
|
||||
<sequencepoints>
|
||||
<entry il="0x0" row="20" col="3" file_ref="1" hidden="false" />
|
||||
<entry il="0x1" row="21" col="4" file_ref="1" hidden="false" />
|
||||
<entry il="0x1" row="21" col="12" file_ref="1" hidden="false" />
|
||||
<entry il="0x6" row="22" col="3" file_ref="1" hidden="false" />
|
||||
</sequencepoints>
|
||||
<locals />
|
||||
@@ -80,7 +81,7 @@
|
||||
<method token="0x6000009">
|
||||
<sequencepoints>
|
||||
<entry il="0x0" row="28" col="3" file_ref="1" hidden="false" />
|
||||
<entry il="0x1" row="29" col="4" file_ref="1" hidden="false" />
|
||||
<entry il="0x1" row="29" col="12" file_ref="1" hidden="false" />
|
||||
<entry il="0x6" row="30" col="3" file_ref="1" hidden="false" />
|
||||
</sequencepoints>
|
||||
<locals />
|
||||
|
||||
@@ -13,6 +13,8 @@
|
||||
<sequencepoints>
|
||||
<entry il="0x0" row="6" col="2" file_ref="1" hidden="false" />
|
||||
<entry il="0x1" row="7" col="3" file_ref="1" hidden="false" />
|
||||
<entry il="0xb" row="7" col="21" file_ref="1" hidden="false" />
|
||||
<entry il="0x16" row="5" col="6" file_ref="1" hidden="false" />
|
||||
<entry il="0x1c" row="8" col="5" file_ref="1" hidden="false" />
|
||||
</sequencepoints>
|
||||
<locals />
|
||||
|
||||
@@ -20,9 +20,11 @@
|
||||
<method token="0x6000003">
|
||||
<sequencepoints>
|
||||
<entry il="0x0" row="14" col="2" file_ref="1" hidden="false" />
|
||||
<entry il="0x1" row="15" col="3" file_ref="1" hidden="false" />
|
||||
<entry il="0x1" row="15" col="11" file_ref="1" hidden="false" />
|
||||
<entry il="0x7" row="17" col="4" file_ref="1" hidden="false" />
|
||||
<entry il="0xe" row="17" col="4" file_ref="1" hidden="false" />
|
||||
<entry il="0x13" row="20" col="4" file_ref="1" hidden="false" />
|
||||
<entry il="0x1a" row="20" col="4" file_ref="1" hidden="false" />
|
||||
<entry il="0x21" row="24" col="2" file_ref="1" hidden="false" />
|
||||
</sequencepoints>
|
||||
<locals>
|
||||
@@ -33,7 +35,7 @@
|
||||
<method token="0x6000004">
|
||||
<sequencepoints>
|
||||
<entry il="0x0" row="27" col="2" file_ref="1" hidden="false" />
|
||||
<entry il="0x1" row="28" col="3" file_ref="1" hidden="false" />
|
||||
<entry il="0x1" row="28" col="14" file_ref="1" hidden="false" />
|
||||
<entry il="0x7" row="30" col="4" file_ref="1" hidden="false" />
|
||||
<entry il="0x12" row="31" col="4" file_ref="1" hidden="false" />
|
||||
<entry il="0x1b" row="33" col="2" file_ref="1" hidden="false" />
|
||||
|
||||
@@ -19,8 +19,12 @@
|
||||
</method>
|
||||
<method token="0x6000003">
|
||||
<sequencepoints>
|
||||
<entry il="0xf" row="13" col="5" file_ref="1" hidden="false" />
|
||||
<entry il="0x24" row="13" col="8" file_ref="1" hidden="false" />
|
||||
<entry il="0x2a" row="11" col="2" file_ref="1" hidden="false" />
|
||||
<entry il="0x2b" row="12" col="3" file_ref="1" hidden="false" />
|
||||
<entry il="0x2d" row="14" col="4" file_ref="1" hidden="false" />
|
||||
<entry il="0x40" row="13" col="4" file_ref="1" hidden="false" />
|
||||
<entry il="0x46" row="16" col="3" file_ref="1" hidden="false" />
|
||||
<entry il="0x4b" row="17" col="2" file_ref="1" hidden="false" />
|
||||
</sequencepoints>
|
||||
@@ -33,6 +37,9 @@
|
||||
<sequencepoints>
|
||||
<entry il="0x0" row="20" col="2" file_ref="1" hidden="false" />
|
||||
<entry il="0x1" row="21" col="3" file_ref="1" hidden="false" />
|
||||
<entry il="0x11" row="21" col="59" file_ref="1" hidden="false" />
|
||||
<entry il="0x1c" row="21" col="53" file_ref="1" hidden="false" />
|
||||
<entry il="0x2c" row="21" col="47" file_ref="1" hidden="false" />
|
||||
<entry il="0x32" row="22" col="2" file_ref="1" hidden="false" />
|
||||
</sequencepoints>
|
||||
<locals>
|
||||
|
||||
@@ -67,7 +67,7 @@
|
||||
<entry il="0x0" row="30" col="2" file_ref="1" hidden="false" />
|
||||
<entry il="0x1" row="31" col="3" file_ref="1" hidden="false" />
|
||||
<entry il="0x7" row="32" col="3" file_ref="1" hidden="false" />
|
||||
<entry il="0xe" row="33" col="3" file_ref="1" hidden="false" />
|
||||
<entry il="0xe" row="33" col="15" file_ref="1" hidden="false" />
|
||||
<entry il="0x14" row="34" col="3" file_ref="1" hidden="false" />
|
||||
<entry il="0x81" row="35" col="2" file_ref="1" hidden="false" />
|
||||
</sequencepoints>
|
||||
@@ -81,7 +81,7 @@
|
||||
<method token="0x6000009">
|
||||
<sequencepoints>
|
||||
<entry il="0x0" row="38" col="2" file_ref="1" hidden="false" />
|
||||
<entry il="0x1" row="39" col="3" file_ref="1" hidden="false" />
|
||||
<entry il="0x1" row="39" col="15" file_ref="1" hidden="false" />
|
||||
<entry il="0x7" row="40" col="3" file_ref="1" hidden="false" />
|
||||
<entry il="0x1e4" row="41" col="2" file_ref="1" hidden="false" />
|
||||
</sequencepoints>
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
<method token="0x6000004">
|
||||
<sequencepoints>
|
||||
<entry il="0x0" row="16" col="2" file_ref="1" hidden="false" />
|
||||
<entry il="0x1" row="17" col="3" file_ref="1" hidden="false" />
|
||||
<entry il="0x1" row="17" col="15" file_ref="1" hidden="false" />
|
||||
<entry il="0x23" row="17" col="23" file_ref="1" hidden="false" />
|
||||
<entry il="0x2e" row="21" col="2" file_ref="1" hidden="false" />
|
||||
</sequencepoints>
|
||||
@@ -40,7 +40,7 @@
|
||||
<method token="0x6000006">
|
||||
<sequencepoints>
|
||||
<entry il="0x0" row="29" col="2" file_ref="1" hidden="false" />
|
||||
<entry il="0x1" row="30" col="3" file_ref="1" hidden="false" />
|
||||
<entry il="0x1" row="30" col="15" file_ref="1" hidden="false" />
|
||||
<entry il="0x23" row="30" col="23" file_ref="1" hidden="false" />
|
||||
<entry il="0x2e" row="31" col="2" file_ref="1" hidden="false" />
|
||||
</sequencepoints>
|
||||
@@ -99,6 +99,7 @@
|
||||
<sequencepoints>
|
||||
<entry il="0x21" row="34" col="2" file_ref="1" hidden="false" />
|
||||
<entry il="0x22" row="35" col="3" file_ref="1" hidden="false" />
|
||||
<entry il="0x23" row="35" col="15" file_ref="1" hidden="false" />
|
||||
<entry il="0x2d" row="36" col="3" file_ref="1" hidden="false" />
|
||||
<entry il="0x8b" row="37" col="3" file_ref="1" hidden="false" />
|
||||
<entry il="0x3ab" row="38" col="3" file_ref="1" hidden="false" />
|
||||
|
||||
@@ -41,6 +41,7 @@
|
||||
<sequencepoints>
|
||||
<entry il="0x27" row="7" col="2" file_ref="1" hidden="false" />
|
||||
<entry il="0x28" row="8" col="3" file_ref="1" hidden="false" />
|
||||
<entry il="0x2d" row="8" col="11" file_ref="1" hidden="false" />
|
||||
<entry il="0x32" row="9" col="3" file_ref="1" hidden="false" />
|
||||
<entry il="0x41" row="10" col="3" file_ref="1" hidden="false" />
|
||||
<entry il="0x42" row="11" col="4" file_ref="1" hidden="false" />
|
||||
@@ -77,6 +78,7 @@
|
||||
<sequencepoints>
|
||||
<entry il="0x0" row="14" col="3" file_ref="1" hidden="false" />
|
||||
<entry il="0x1" row="15" col="4" file_ref="1" hidden="false" />
|
||||
<entry il="0x6" row="15" col="12" file_ref="1" hidden="false" />
|
||||
<entry il="0xb" row="16" col="3" file_ref="1" hidden="false" />
|
||||
</sequencepoints>
|
||||
<locals />
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
<method token="0x6000005">
|
||||
<sequencepoints>
|
||||
<entry il="0x0" row="20" col="2" file_ref="1" hidden="false" />
|
||||
<entry il="0x1" row="21" col="3" file_ref="1" hidden="false" />
|
||||
<entry il="0x1" row="21" col="9" file_ref="1" hidden="false" />
|
||||
</sequencepoints>
|
||||
<locals />
|
||||
<scopes />
|
||||
@@ -68,6 +68,7 @@
|
||||
<sequencepoints>
|
||||
<entry il="0x21" row="15" col="2" file_ref="1" hidden="false" />
|
||||
<entry il="0x22" row="16" col="3" file_ref="1" hidden="false" />
|
||||
<entry il="0x29" row="16" col="21" file_ref="1" hidden="false" />
|
||||
<entry il="0x47" row="17" col="2" file_ref="1" hidden="false" />
|
||||
</sequencepoints>
|
||||
<locals />
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
<sequencepoints>
|
||||
<entry il="0x0" row="8" col="2" file_ref="1" hidden="false" />
|
||||
<entry il="0x1" row="9" col="3" file_ref="1" hidden="false" />
|
||||
<entry il="0x2" row="9" col="3" file_ref="1" hidden="false" />
|
||||
<entry il="0x7" row="9" col="8" file_ref="1" hidden="false" />
|
||||
<entry il="0xd" row="10" col="2" file_ref="1" hidden="false" />
|
||||
</sequencepoints>
|
||||
@@ -32,6 +33,7 @@
|
||||
<sequencepoints>
|
||||
<entry il="0x0" row="13" col="2" file_ref="1" hidden="false" />
|
||||
<entry il="0x1" row="14" col="3" file_ref="1" hidden="false" />
|
||||
<entry il="0x2" row="14" col="3" file_ref="1" hidden="false" />
|
||||
<entry il="0x7" row="14" col="11" file_ref="1" hidden="false" />
|
||||
<entry il="0xd" row="15" col="2" file_ref="1" hidden="false" />
|
||||
</sequencepoints>
|
||||
@@ -53,6 +55,7 @@
|
||||
<entry il="0x0" row="23" col="2" file_ref="1" hidden="false" />
|
||||
<entry il="0x1" row="24" col="3" file_ref="1" hidden="false" />
|
||||
<entry il="0x1f" row="25" col="3" file_ref="1" hidden="false" />
|
||||
<entry il="0x20" row="25" col="3" file_ref="1" hidden="false" />
|
||||
<entry il="0x25" row="25" col="8" file_ref="1" hidden="false" />
|
||||
<entry il="0x2b" row="26" col="2" file_ref="1" hidden="false" />
|
||||
</sequencepoints>
|
||||
|
||||
@@ -12,8 +12,8 @@
|
||||
<method token="0x6000002">
|
||||
<sequencepoints>
|
||||
<entry il="0x0" row="6" col="2" file_ref="1" hidden="false" />
|
||||
<entry il="0x1" row="7" col="3" file_ref="1" hidden="false" />
|
||||
<entry il="0x7" row="7" col="30" file_ref="1" hidden="false" />
|
||||
<entry il="0x1" row="7" col="14" file_ref="1" hidden="false" />
|
||||
<entry il="0x7" row="7" col="34" file_ref="1" hidden="false" />
|
||||
<entry il="0xd" row="8" col="2" file_ref="1" hidden="false" />
|
||||
</sequencepoints>
|
||||
<locals>
|
||||
|
||||
@@ -0,0 +1,125 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<symbols>
|
||||
<files>
|
||||
<file id="1" name="test-debug-27.cs" checksum="a14fe1107e45236d0519cb2c2c65cd46" />
|
||||
</files>
|
||||
<methods>
|
||||
<method token="0x6000001">
|
||||
<sequencepoints>
|
||||
<entry il="0x0" row="6" col="2" file_ref="1" hidden="false" />
|
||||
<entry il="0x1" row="8" col="2" file_ref="1" hidden="false" />
|
||||
</sequencepoints>
|
||||
<locals />
|
||||
<scopes />
|
||||
</method>
|
||||
<method token="0x6000002">
|
||||
<sequencepoints>
|
||||
<entry il="0x0" row="11" col="2" file_ref="1" hidden="false" />
|
||||
<entry il="0x1" row="12" col="3" file_ref="1" hidden="false" />
|
||||
<entry il="0x8" row="13" col="2" file_ref="1" hidden="false" />
|
||||
</sequencepoints>
|
||||
<locals />
|
||||
<scopes />
|
||||
</method>
|
||||
<method token="0x6000003">
|
||||
<sequencepoints />
|
||||
<locals />
|
||||
<scopes />
|
||||
</method>
|
||||
<method token="0x6000004">
|
||||
<sequencepoints>
|
||||
<entry il="0x0" row="19" col="2" file_ref="1" hidden="false" />
|
||||
<entry il="0x1" row="20" col="3" file_ref="1" hidden="false" />
|
||||
<entry il="0x8" row="21" col="2" file_ref="1" hidden="false" />
|
||||
</sequencepoints>
|
||||
<locals />
|
||||
<scopes />
|
||||
</method>
|
||||
<method token="0x6000005">
|
||||
<sequencepoints>
|
||||
<entry il="0x0" row="24" col="2" file_ref="1" hidden="false" />
|
||||
<entry il="0x1" row="25" col="3" file_ref="1" hidden="false" />
|
||||
<entry il="0x8" row="26" col="2" file_ref="1" hidden="false" />
|
||||
</sequencepoints>
|
||||
<locals />
|
||||
<scopes />
|
||||
</method>
|
||||
<method token="0x6000006">
|
||||
<sequencepoints>
|
||||
<entry il="0x0" row="29" col="2" file_ref="1" hidden="false" />
|
||||
<entry il="0x1" row="30" col="10" file_ref="1" hidden="false" />
|
||||
<entry il="0xc" row="31" col="2" file_ref="1" hidden="false" />
|
||||
</sequencepoints>
|
||||
<locals />
|
||||
<scopes />
|
||||
</method>
|
||||
<method token="0x6000007">
|
||||
<sequencepoints>
|
||||
<entry il="0x0" row="34" col="2" file_ref="1" hidden="false" />
|
||||
<entry il="0x1" row="35" col="3" file_ref="1" hidden="false" />
|
||||
<entry il="0x8" row="36" col="2" file_ref="1" hidden="false" />
|
||||
</sequencepoints>
|
||||
<locals />
|
||||
<scopes />
|
||||
</method>
|
||||
<method token="0x6000008">
|
||||
<sequencepoints>
|
||||
<entry il="0x0" row="39" col="2" file_ref="1" hidden="false" />
|
||||
<entry il="0x1" row="40" col="3" file_ref="1" hidden="false" />
|
||||
<entry il="0x1f" row="42" col="3" file_ref="1" hidden="false" />
|
||||
<entry il="0x20" row="42" col="13" file_ref="1" hidden="false" />
|
||||
<entry il="0x26" row="42" col="20" file_ref="1" hidden="false" />
|
||||
<entry il="0x2d" row="43" col="2" file_ref="1" hidden="false" />
|
||||
</sequencepoints>
|
||||
<locals>
|
||||
<entry name="f" il_index="0" scope_ref="0" />
|
||||
<entry name="res" il_index="1" scope_ref="0" />
|
||||
</locals>
|
||||
<scopes />
|
||||
</method>
|
||||
<method token="0x6000009">
|
||||
<sequencepoints>
|
||||
<entry il="0x0" row="46" col="2" file_ref="1" hidden="false" />
|
||||
<entry il="0x1" row="47" col="3" file_ref="1" hidden="false" />
|
||||
<entry il="0x4" row="47" col="11" file_ref="1" hidden="false" />
|
||||
<entry il="0x9" row="48" col="2" file_ref="1" hidden="false" />
|
||||
</sequencepoints>
|
||||
<locals>
|
||||
<entry name="s" il_index="0" scope_ref="0" />
|
||||
</locals>
|
||||
<scopes />
|
||||
</method>
|
||||
<method token="0x600000a">
|
||||
<sequencepoints>
|
||||
<entry il="0x0" row="51" col="2" file_ref="1" hidden="false" />
|
||||
<entry il="0x1" row="52" col="3" file_ref="1" hidden="false" />
|
||||
<entry il="0xa" row="52" col="11" file_ref="1" hidden="false" />
|
||||
<entry il="0x18" row="52" col="22" file_ref="1" hidden="false" />
|
||||
<entry il="0x1f" row="53" col="2" file_ref="1" hidden="false" />
|
||||
</sequencepoints>
|
||||
<locals>
|
||||
<entry name="i" il_index="0" scope_ref="0" />
|
||||
</locals>
|
||||
<scopes />
|
||||
</method>
|
||||
<method token="0x600000b">
|
||||
<sequencepoints>
|
||||
<entry il="0x0" row="56" col="2" file_ref="1" hidden="false" />
|
||||
<entry il="0x1" row="57" col="3" file_ref="1" hidden="false" />
|
||||
<entry il="0x6" row="57" col="11" file_ref="1" hidden="false" />
|
||||
<entry il="0xc" row="58" col="2" file_ref="1" hidden="false" />
|
||||
</sequencepoints>
|
||||
<locals />
|
||||
<scopes />
|
||||
</method>
|
||||
<method token="0x600000c">
|
||||
<sequencepoints>
|
||||
<entry il="0x0" row="61" col="2" file_ref="1" hidden="false" />
|
||||
<entry il="0x1" row="62" col="3" file_ref="1" hidden="false" />
|
||||
<entry il="0x8" row="63" col="2" file_ref="1" hidden="false" />
|
||||
</sequencepoints>
|
||||
<locals />
|
||||
<scopes />
|
||||
</method>
|
||||
</methods>
|
||||
</symbols>
|
||||
@@ -0,0 +1,68 @@
|
||||
using System;
|
||||
|
||||
// Tests for explicit call sequence point
|
||||
|
||||
struct S
|
||||
{
|
||||
public S (int i)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public static implicit operator int (S s)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
class C
|
||||
{
|
||||
public static int A ()
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
public static int B (C c)
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
|
||||
public static C Test ()
|
||||
{
|
||||
return new C ();
|
||||
}
|
||||
|
||||
public string Foo ()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
void Test_1 ()
|
||||
{
|
||||
Func<int> f = A;
|
||||
|
||||
var res = f () + f ();
|
||||
}
|
||||
|
||||
void Test_2 ()
|
||||
{
|
||||
var s = new S (0);
|
||||
}
|
||||
|
||||
void Test_3 ()
|
||||
{
|
||||
int i = new S () + new S ();
|
||||
}
|
||||
|
||||
void Test_4 ()
|
||||
{
|
||||
Test ().Foo ();
|
||||
}
|
||||
|
||||
static int Main ()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
using System;
|
||||
|
||||
|
||||
class C
|
||||
{
|
||||
static int Foo (string packageId, int version)
|
||||
{
|
||||
return Foo (packageId, version, ignoreDependencies: false, allowPrereleaseVersions: false);
|
||||
}
|
||||
|
||||
static int Foo (string packageId, int version, bool ignoreDependencies, bool allowPrereleaseVersions)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int Foo (double package, bool ignoreDependencies, bool allowPrereleaseVersions, bool ignoreWalkInfo)
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
|
||||
public static int Main ()
|
||||
{
|
||||
if (Foo ("", 1) != 1)
|
||||
return 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
+818
-675
File diff suppressed because it is too large.
Load diff
@@ -68,6 +68,7 @@ namespace Mono {
|
||||
|
||||
eval.InteractiveBaseClass = typeof (InteractiveBaseShell);
|
||||
eval.DescribeTypeExpressions = true;
|
||||
eval.WaitOnTask = true;
|
||||
|
||||
CSharpShell shell;
|
||||
#if !ON_DOTNET
|
||||
|
||||
@@ -351,7 +351,7 @@ add masterdoc support?
|
||||
<xs:element name="format">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:any minOccurs="0" processContents="lax" />
|
||||
<xs:any minOccurs="0" maxOccurs="unbounded" processContents="lax" />
|
||||
</xs:sequence>
|
||||
<xs:attribute ref="type" />
|
||||
</xs:complexType>
|
||||
|
||||
Regular → Executable
+4
-3
@@ -17,6 +17,7 @@
|
||||
#include "mono/utils/mono-compiler.h"
|
||||
|
||||
#include "declsec.h"
|
||||
#include "util.h"
|
||||
|
||||
static char*
|
||||
declsec_20_get_classname (const char* p, const char **rptr)
|
||||
@@ -113,12 +114,12 @@ declsec_20_write_value (GString *str, char type, const char *value)
|
||||
float val;
|
||||
int inf;
|
||||
readr4 (value, &val);
|
||||
inf = isinf (val);
|
||||
inf = dis_isinf (val);
|
||||
if (inf == -1)
|
||||
g_string_append_printf (str, "0xFF800000"); /* negative infinity */
|
||||
else if (inf == 1)
|
||||
g_string_append_printf (str, "0x7F800000"); /* positive infinity */
|
||||
else if (isnan (val))
|
||||
else if (dis_isnan (val))
|
||||
g_string_append_printf (str, "0xFFC00000"); /* NaN */
|
||||
else
|
||||
g_string_append_printf (str, "%.8g", val);
|
||||
@@ -128,7 +129,7 @@ declsec_20_write_value (GString *str, char type, const char *value)
|
||||
double val;
|
||||
int inf;
|
||||
readr8 (value, &val);
|
||||
inf = isinf (val);
|
||||
inf = dis_isinf (val);
|
||||
if (inf == -1)
|
||||
g_string_append_printf (str, "0xFFF00000000000000"); /* negative infinity */
|
||||
else if (inf == 1)
|
||||
|
||||
Regular → Executable
+5
-29
@@ -17,35 +17,11 @@
|
||||
#include "get.h"
|
||||
#include "dump.h"
|
||||
#include "dis-cil.h"
|
||||
#include "util.h"
|
||||
#include "mono/metadata/opcodes.h"
|
||||
#include "mono/metadata/class-internals.h"
|
||||
#include "mono/utils/mono-compiler.h"
|
||||
|
||||
#ifndef HAVE_ISINF
|
||||
|
||||
#ifdef HAVE_IEEEFP_H
|
||||
#include <ieeefp.h>
|
||||
int isinf (double);
|
||||
int
|
||||
isinf (double num)
|
||||
{
|
||||
fpclass_t klass;
|
||||
|
||||
klass = fpclass (num);
|
||||
if (klass == FP_NINF)
|
||||
return -1;
|
||||
|
||||
if (klass == FP_PINF)
|
||||
return 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
#else
|
||||
#error "Don't know how to implement isinf for this platform."
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#define CODE_INDENT g_assert (indent_level < 512); \
|
||||
indent[indent_level*2] = ' '; \
|
||||
indent[indent_level*2+1] = ' '; \
|
||||
@@ -191,12 +167,12 @@ disassemble_cil (MonoImage *m, MonoMethodHeader *mh, MonoGenericContainer *conta
|
||||
double r;
|
||||
int inf;
|
||||
readr8 (ptr, &r);
|
||||
inf = isinf (r);
|
||||
inf = dis_isinf (r);
|
||||
if (inf == -1)
|
||||
fprintf (output, "(00 00 00 00 00 00 f0 ff)"); /* negative infinity */
|
||||
else if (inf == 1)
|
||||
fprintf (output, "(00 00 00 00 00 00 f0 7f)"); /* positive infinity */
|
||||
else if (isnan (r))
|
||||
else if (dis_isnan (r))
|
||||
fprintf (output, "(00 00 00 00 00 00 f8 ff)"); /* NaN */
|
||||
else {
|
||||
char *str = stringify_double (r);
|
||||
@@ -300,12 +276,12 @@ disassemble_cil (MonoImage *m, MonoMethodHeader *mh, MonoGenericContainer *conta
|
||||
|
||||
readr4 (ptr, &f);
|
||||
|
||||
inf = isinf (f);
|
||||
inf = dis_isinf (f);
|
||||
if (inf == -1)
|
||||
fprintf (output, "(00 00 80 ff)"); /* negative infinity */
|
||||
else if (inf == 1)
|
||||
fprintf (output, "(00 00 80 7f)"); /* positive infinity */
|
||||
else if (isnan (f))
|
||||
else if (dis_isnan (f))
|
||||
fprintf (output, "(00 00 c0 ff)"); /* NaN */
|
||||
else {
|
||||
char *str = stringify_double ((double) f);
|
||||
|
||||
Regular → Executable
+3
-11
@@ -21,14 +21,6 @@
|
||||
#include "mono/metadata/class-internals.h"
|
||||
#include "mono/utils/mono-compiler.h"
|
||||
|
||||
#ifndef HAVE_ISINF
|
||||
|
||||
#ifdef HAVE_IEEEFP_H
|
||||
extern int isinf (double);
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#if defined(__native_client__) && defined(__GLIBC__)
|
||||
volatile int __nacl_thread_suspension_needed = 0;
|
||||
void __nacl_suspend_thread_if_needed() {}
|
||||
@@ -870,12 +862,12 @@ handle_enum:
|
||||
float val;
|
||||
int inf;
|
||||
readr4 (p, &val);
|
||||
inf = isinf (val);
|
||||
inf = dis_isinf (val);
|
||||
if (inf == -1)
|
||||
g_string_append_printf (res, "(00 00 80 ff)"); /* negative infinity */
|
||||
else if (inf == 1)
|
||||
g_string_append_printf (res, "(00 00 80 7f)"); /* positive infinity */
|
||||
else if (isnan (val))
|
||||
else if (dis_isnan (val))
|
||||
g_string_append_printf (res, "(00 00 c0 ff)"); /* NaN */
|
||||
else
|
||||
g_string_append_printf (res, "%g", val);
|
||||
@@ -887,7 +879,7 @@ handle_enum:
|
||||
int inf;
|
||||
|
||||
readr8 (p, &val);
|
||||
inf = isinf (val);
|
||||
inf = dis_isinf (val);
|
||||
if (inf == -1)
|
||||
g_string_append_printf (res, "(00 00 00 00 00 00 f0 ff)"); /* negative infinity */
|
||||
else if (inf == 1)
|
||||
|
||||
Regular → Executable
+1
-1
@@ -2310,7 +2310,7 @@ get_constant (MonoImage *m, MonoTypeEnum t, guint32 blob_index)
|
||||
#ifdef HAVE_ISFINITE
|
||||
normal = isfinite (r);
|
||||
#else
|
||||
normal = isnormal (r);
|
||||
normal = !dis_isinf (r) && !dis_isnan (r);
|
||||
#endif
|
||||
if (!normal) {
|
||||
return g_strdup_printf ("float32(0x%08x)", read32 (ptr));
|
||||
|
||||
+3
-2
@@ -30,6 +30,7 @@
|
||||
#include <mono/metadata/loader.h>
|
||||
#include <mono/metadata/assembly.h>
|
||||
#include <mono/metadata/appdomain.h>
|
||||
#include <mono/utils/bsearch.h>
|
||||
|
||||
static void setup_filter (MonoImage *image);
|
||||
static gboolean should_include_type (int idx);
|
||||
@@ -1109,7 +1110,7 @@ dis_interfaces (MonoImage *m, guint32 typedef_row, MonoGenericContainer *contain
|
||||
loc.col_idx = MONO_INTERFACEIMPL_CLASS;
|
||||
loc.idx = typedef_row;
|
||||
|
||||
if (!bsearch (&loc, table->base, table->rows, table->row_size, table_locator))
|
||||
if (!mono_binary_search (&loc, table->base, table->rows, table->row_size, table_locator))
|
||||
return;
|
||||
|
||||
start = loc.result;
|
||||
@@ -1680,7 +1681,7 @@ table_includes (TableFilter *tf, int idx)
|
||||
{
|
||||
if (!tf->count)
|
||||
return FALSE;
|
||||
return bsearch (&idx, tf->elems, tf->count, sizeof (int), int_cmp) != NULL;
|
||||
return mono_binary_search (&idx, tf->elems, tf->count, sizeof (int), int_cmp) != NULL;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
|
||||
Regular → Executable
+38
@@ -10,8 +10,13 @@
|
||||
#include <glib.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <math.h>
|
||||
#include "util.h"
|
||||
|
||||
#ifdef HAVE_IEEEFP_H
|
||||
#include <ieeefp.h>
|
||||
#endif
|
||||
|
||||
/**
|
||||
* map:
|
||||
* @code: code to lookup in table
|
||||
@@ -122,3 +127,36 @@ data_dump (const char *data, int len, const char* prefix) {
|
||||
return g_string_free (str, FALSE);
|
||||
}
|
||||
|
||||
int
|
||||
dis_isinf (double num)
|
||||
{
|
||||
#ifdef HAVE_ISINF
|
||||
return isinf (num);
|
||||
#elif defined(HAVE_IEEEFP_H)
|
||||
fpclass_t klass;
|
||||
|
||||
klass = fpclass (num);
|
||||
if (klass == FP_NINF)
|
||||
return -1;
|
||||
|
||||
if (klass == FP_PINF)
|
||||
return 1;
|
||||
|
||||
return 0;
|
||||
#elif defined(HAVE__FINITE)
|
||||
return _finite (num) ? 0 : 1;
|
||||
#else
|
||||
#error "Don't know how to implement isinf for this platform."
|
||||
#endif
|
||||
}
|
||||
|
||||
int
|
||||
dis_isnan (double num)
|
||||
{
|
||||
#ifdef __MINGW32_VERSION
|
||||
return _isnan (num);
|
||||
#else
|
||||
return isnan (num);
|
||||
#endif
|
||||
}
|
||||
|
||||
Regular → Executable
+2
@@ -8,3 +8,5 @@ const char *flags (guint32 code, dis_map_t *table);
|
||||
void hex_dump (const char *buffer, int base, int count);
|
||||
char* data_dump (const char *data, int len, const char* prefix);
|
||||
|
||||
extern int dis_isinf (double num);
|
||||
extern int dis_isnan (double num);
|
||||
Regular → Executable
+6
@@ -24,7 +24,13 @@
|
||||
#include <winsock2.h>
|
||||
#include <windows.h>
|
||||
#include <winbase.h>
|
||||
/*
|
||||
* The mingw version says:
|
||||
* /usr/i686-pc-mingw32/sys-root/mingw/include/ws2tcpip.h:38:2: error: #error "ws2tcpip.h is not compatible with winsock.h. Include winsock2.h instead."
|
||||
*/
|
||||
#ifdef _MSC_VER
|
||||
#include <ws2tcpip.h>
|
||||
#endif
|
||||
#include <psapi.h>
|
||||
#include <shlobj.h>
|
||||
#include <mswsock.h>
|
||||
|
||||
@@ -17,12 +17,13 @@
|
||||
#include <mono/io-layer/wapi-private.h>
|
||||
#include <mono/io-layer/misc-private.h>
|
||||
#include <mono/io-layer/messages.h>
|
||||
#include <mono/utils/bsearch.h>
|
||||
|
||||
#undef DEBUG
|
||||
|
||||
typedef struct {
|
||||
int id;
|
||||
const char const *txt;
|
||||
const char *txt;
|
||||
} ErrorDesc;
|
||||
|
||||
static ErrorDesc common_messages [] = {
|
||||
@@ -1830,7 +1831,7 @@ find_msg (guint32 id, ErrorDesc *base, int n)
|
||||
ErrorDesc d, *result;
|
||||
d.id = id;
|
||||
|
||||
result = bsearch (&d, base, n, sizeof (ErrorDesc), msg_compare);
|
||||
result = mono_binary_search (&d, base, n, sizeof (ErrorDesc), msg_compare);
|
||||
if (result == NULL)
|
||||
return NULL;
|
||||
return result->txt;
|
||||
|
||||
+50
-1
@@ -42,6 +42,8 @@
|
||||
#include <mono/utils/mono-logger-internal.h>
|
||||
#include <mono/utils/mono-memory-model.h>
|
||||
#include <mono/utils/atomic.h>
|
||||
#include <mono/utils/bsearch.h>
|
||||
|
||||
MonoStats mono_stats;
|
||||
|
||||
gboolean mono_print_vtable = FALSE;
|
||||
@@ -1426,6 +1428,52 @@ mono_class_setup_fields (MonoClass *class)
|
||||
MonoGenericContainer *container = NULL;
|
||||
MonoClass *gtd = class->generic_class ? mono_class_get_generic_type_definition (class) : NULL;
|
||||
|
||||
/*
|
||||
* FIXME: We have a race condition here. It's possible that this function returns
|
||||
* to its caller with `instance_size` set to `0` instead of the actual size. This
|
||||
* is not a problem when the function is called recursively on the same class,
|
||||
* because the size will be initialized by the outer invocation. What follows is a
|
||||
* description of how it can occur in other cases, too. There it is a problem,
|
||||
* because it can lead to the GC being asked to allocate an object of size `0`,
|
||||
* which SGen chokes on. The race condition is triggered infrequently by
|
||||
* `tests/sgen-suspend.cs`.
|
||||
*
|
||||
* This function is called for a class whenever one of its subclasses is inited.
|
||||
* For example, it's called for every subclass of Object. What it does is this:
|
||||
*
|
||||
* if (class->setup_fields_called)
|
||||
* return;
|
||||
* ...
|
||||
* class->instance_size = 0;
|
||||
* ...
|
||||
* class->setup_fields_called = 1;
|
||||
* ... critical point
|
||||
* class->instance_size = actual_instance_size;
|
||||
*
|
||||
* The last two steps are sometimes reversed, but that only changes the way in which
|
||||
* the race condition works.
|
||||
*
|
||||
* Assume thread A goes through this function and makes it to the critical point.
|
||||
* Now thread B runs the function and, since `setup_fields_called` is set, returns
|
||||
* immediately, but `instance_size` is incorrect.
|
||||
*
|
||||
* The other case looks like this:
|
||||
*
|
||||
* if (class->setup_fields_called)
|
||||
* return;
|
||||
* ... critical point X
|
||||
* class->instance_size = 0;
|
||||
* ... critical point Y
|
||||
* class->instance_size = actual_instance_size;
|
||||
* ...
|
||||
* class->setup_fields_called = 1;
|
||||
*
|
||||
* Assume thread A goes through the function and makes it to critical point X. Now
|
||||
* thread B runs through the whole of the function, returning, assuming
|
||||
* `instance_size` is set. At that point thread A gets to run and makes it to
|
||||
* critical point Y, at which time `instance_size` is `0` again, invalidating thread
|
||||
* B's assumption.
|
||||
*/
|
||||
if (class->setup_fields_called)
|
||||
return;
|
||||
|
||||
@@ -1503,6 +1551,7 @@ mono_class_setup_fields (MonoClass *class)
|
||||
mono_memory_barrier ();
|
||||
class->size_inited = 1;
|
||||
class->fields_inited = 1;
|
||||
class->setup_fields_called = 1;
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -2645,7 +2694,7 @@ compare_interface_ids (const void *p_key, const void *p_element) {
|
||||
/*FIXME verify all callers if they should switch to mono_class_interface_offset_with_variance*/
|
||||
int
|
||||
mono_class_interface_offset (MonoClass *klass, MonoClass *itf) {
|
||||
MonoClass **result = bsearch (
|
||||
MonoClass **result = mono_binary_search (
|
||||
itf,
|
||||
klass->interfaces_packed,
|
||||
klass->interface_offsets_count,
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
#include <mono/metadata/metadata-internals.h>
|
||||
#include <mono/metadata/class-internals.h>
|
||||
#include <mono/utils/mono-mmap.h>
|
||||
#include <mono/utils/bsearch.h>
|
||||
|
||||
#include <fcntl.h>
|
||||
#ifdef HAVE_UNISTD_H
|
||||
@@ -731,7 +732,7 @@ mono_debug_symfile_lookup_method (MonoDebugHandle *handle, MonoMethod *method)
|
||||
first_ie = (MonoSymbolFileMethodEntry *)
|
||||
(symfile->raw_contents + read32(&(symfile->offset_table->_method_table_offset)));
|
||||
|
||||
ie = bsearch (GUINT_TO_POINTER (mono_method_get_token (method)), first_ie,
|
||||
ie = mono_binary_search (GUINT_TO_POINTER (mono_method_get_token (method)), first_ie,
|
||||
read32(&(symfile->offset_table->_method_count)),
|
||||
sizeof (MonoSymbolFileMethodEntry), compare_method);
|
||||
|
||||
|
||||
@@ -625,6 +625,8 @@ int mono_framework_version (void) MONO_INTERNAL;
|
||||
|
||||
void mono_reflection_cleanup_domain (MonoDomain *domain) MONO_INTERNAL;
|
||||
|
||||
void mono_assembly_cleanup_domain_bindings (guint32 domain_id) MONO_INTERNAL;;
|
||||
void mono_assembly_cleanup_domain_bindings (guint32 domain_id) MONO_INTERNAL;
|
||||
|
||||
MonoJitInfo* mono_jit_info_table_find_internal (MonoDomain *domain, char *addr, gboolean try_aot) MONO_INTERNAL;
|
||||
|
||||
#endif /* __MONO_METADATA_DOMAIN_INTERNALS_H__ */
|
||||
+18
-4
@@ -331,8 +331,14 @@ jit_info_table_chunk_index (MonoJitInfoTableChunk *chunk, MonoThreadHazardPointe
|
||||
return left;
|
||||
}
|
||||
|
||||
/*
|
||||
* mono_jit_info_table_find_internal:
|
||||
*
|
||||
* If TRY_AOT is FALSE, avoid loading information for missing methods from AOT images, which is currently not async safe.
|
||||
* In this case, only those AOT methods will be found whose jit info is already loaded.
|
||||
*/
|
||||
MonoJitInfo*
|
||||
mono_jit_info_table_find (MonoDomain *domain, char *addr)
|
||||
mono_jit_info_table_find_internal (MonoDomain *domain, char *addr, gboolean try_aot)
|
||||
{
|
||||
MonoJitInfoTable *table;
|
||||
MonoJitInfo *ji;
|
||||
@@ -402,13 +408,21 @@ mono_jit_info_table_find (MonoDomain *domain, char *addr)
|
||||
ji = NULL;
|
||||
|
||||
/* Maybe its an AOT module */
|
||||
image = mono_jit_info_find_aot_module ((guint8*)addr);
|
||||
if (image)
|
||||
ji = jit_info_find_in_aot_func (domain, image, addr);
|
||||
if (try_aot) {
|
||||
image = mono_jit_info_find_aot_module ((guint8*)addr);
|
||||
if (image)
|
||||
ji = jit_info_find_in_aot_func (domain, image, addr);
|
||||
}
|
||||
|
||||
return ji;
|
||||
}
|
||||
|
||||
MonoJitInfo*
|
||||
mono_jit_info_table_find (MonoDomain *domain, char *addr)
|
||||
{
|
||||
return mono_jit_info_table_find_internal (domain, addr, TRUE);
|
||||
}
|
||||
|
||||
static G_GNUC_UNUSED void
|
||||
jit_info_table_check (MonoJitInfoTable *table)
|
||||
{
|
||||
|
||||
@@ -84,6 +84,7 @@
|
||||
#include <mono/utils/mono-mmap.h>
|
||||
#include <mono/utils/mono-io-portability.h>
|
||||
#include <mono/utils/mono-digest.h>
|
||||
#include <mono/utils/bsearch.h>
|
||||
|
||||
#if defined (HOST_WIN32)
|
||||
#include <windows.h>
|
||||
@@ -7947,7 +7948,7 @@ compare_method_imap (const void *key, const void *elem)
|
||||
static gpointer
|
||||
find_method_icall (const IcallTypeDesc *imap, const char *name)
|
||||
{
|
||||
const guint16 *nameslot = bsearch (name, icall_names_idx + imap->first_icall, icall_desc_num_icalls (imap), sizeof (icall_names_idx [0]), compare_method_imap);
|
||||
const guint16 *nameslot = mono_binary_search (name, icall_names_idx + imap->first_icall, icall_desc_num_icalls (imap), sizeof (icall_names_idx [0]), compare_method_imap);
|
||||
if (!nameslot)
|
||||
return NULL;
|
||||
return (gpointer)icall_functions [(nameslot - &icall_names_idx [0])];
|
||||
@@ -7963,7 +7964,7 @@ compare_class_imap (const void *key, const void *elem)
|
||||
static const IcallTypeDesc*
|
||||
find_class_icalls (const char *name)
|
||||
{
|
||||
const guint16 *nameslot = bsearch (name, icall_type_names_idx, Icall_type_num, sizeof (icall_type_names_idx [0]), compare_class_imap);
|
||||
const guint16 *nameslot = mono_binary_search (name, icall_type_names_idx, Icall_type_num, sizeof (icall_type_names_idx [0]), compare_class_imap);
|
||||
if (!nameslot)
|
||||
return NULL;
|
||||
return &icall_type_descs [nameslot - &icall_type_names_idx [0]];
|
||||
@@ -7981,7 +7982,7 @@ compare_method_imap (const void *key, const void *elem)
|
||||
static gpointer
|
||||
find_method_icall (const IcallTypeDesc *imap, const char *name)
|
||||
{
|
||||
const char **nameslot = bsearch (name, icall_names + imap->first_icall, icall_desc_num_icalls (imap), sizeof (icall_names [0]), compare_method_imap);
|
||||
const char **nameslot = mono_binary_search (name, icall_names + imap->first_icall, icall_desc_num_icalls (imap), sizeof (icall_names [0]), compare_method_imap);
|
||||
if (!nameslot)
|
||||
return NULL;
|
||||
return (gpointer)icall_functions [(nameslot - icall_names)];
|
||||
@@ -7997,7 +7998,7 @@ compare_class_imap (const void *key, const void *elem)
|
||||
static const IcallTypeDesc*
|
||||
find_class_icalls (const char *name)
|
||||
{
|
||||
const char **nameslot = bsearch (name, icall_type_names, Icall_type_num, sizeof (icall_type_names [0]), compare_class_imap);
|
||||
const char **nameslot = mono_binary_search (name, icall_type_names, Icall_type_num, sizeof (icall_type_names [0]), compare_class_imap);
|
||||
if (!nameslot)
|
||||
return NULL;
|
||||
return &icall_type_descs [nameslot - icall_type_names];
|
||||
@@ -8208,7 +8209,7 @@ mono_lookup_icall_symbol (MonoMethod *m)
|
||||
func = mono_lookup_internal_call (m);
|
||||
if (!func)
|
||||
return NULL;
|
||||
slot = bsearch (func, functions_sorted, G_N_ELEMENTS (icall_functions), sizeof (gpointer), func_cmp);
|
||||
slot = mono_binary_search (func, functions_sorted, G_N_ELEMENTS (icall_functions), sizeof (gpointer), func_cmp);
|
||||
if (!slot)
|
||||
return NULL;
|
||||
g_assert (slot);
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
#include <mono/metadata/locales.h>
|
||||
#include <mono/metadata/culture-info.h>
|
||||
#include <mono/metadata/culture-info-tables.h>
|
||||
#include <mono/utils/bsearch.h>
|
||||
|
||||
#ifndef DISABLE_NORMALIZATION
|
||||
#include <mono/metadata/normalization-tables.h>
|
||||
@@ -313,7 +314,7 @@ construct_culture_from_specific_name (MonoCultureInfo *ci, gchar *name)
|
||||
|
||||
MONO_ARCH_SAVE_REGS;
|
||||
|
||||
ne = bsearch (name, culture_name_entries, NUM_CULTURE_ENTRIES,
|
||||
ne = mono_binary_search (name, culture_name_entries, NUM_CULTURE_ENTRIES,
|
||||
sizeof (CultureInfoNameEntry), culture_name_locator);
|
||||
|
||||
if (ne == NULL)
|
||||
@@ -332,7 +333,7 @@ culture_info_entry_from_lcid (int lcid)
|
||||
{
|
||||
const CultureInfoEntry *ci;
|
||||
|
||||
ci = bsearch (&lcid, culture_entries, NUM_CULTURE_ENTRIES, sizeof (CultureInfoEntry), culture_lcid_locator);
|
||||
ci = mono_binary_search (&lcid, culture_entries, NUM_CULTURE_ENTRIES, sizeof (CultureInfoEntry), culture_lcid_locator);
|
||||
|
||||
return ci;
|
||||
}
|
||||
@@ -345,7 +346,7 @@ region_info_entry_from_lcid (int lcid)
|
||||
|
||||
MONO_ARCH_SAVE_REGS;
|
||||
|
||||
ne = bsearch (&lcid, culture_entries, NUM_CULTURE_ENTRIES, sizeof (CultureInfoEntry), culture_lcid_locator);
|
||||
ne = mono_binary_search (&lcid, culture_entries, NUM_CULTURE_ENTRIES, sizeof (CultureInfoEntry), culture_lcid_locator);
|
||||
|
||||
if (ne == NULL)
|
||||
return FALSE;
|
||||
@@ -537,7 +538,7 @@ ves_icall_System_Globalization_CultureInfo_construct_internal_locale_from_name (
|
||||
MONO_ARCH_SAVE_REGS;
|
||||
|
||||
n = mono_string_to_utf8 (name);
|
||||
ne = bsearch (n, culture_name_entries, NUM_CULTURE_ENTRIES,
|
||||
ne = mono_binary_search (n, culture_name_entries, NUM_CULTURE_ENTRIES,
|
||||
sizeof (CultureInfoNameEntry), culture_name_locator);
|
||||
|
||||
if (ne == NULL) {
|
||||
@@ -591,7 +592,7 @@ ves_icall_System_Globalization_RegionInfo_construct_internal_region_from_name (M
|
||||
MONO_ARCH_SAVE_REGS;
|
||||
|
||||
n = mono_string_to_utf8 (name);
|
||||
ne = bsearch (n, region_name_entries, NUM_REGION_ENTRIES,
|
||||
ne = mono_binary_search (n, region_name_entries, NUM_REGION_ENTRIES,
|
||||
sizeof (RegionInfoNameEntry), region_name_locator);
|
||||
|
||||
if (ne == NULL) {
|
||||
|
||||
+21
-4
@@ -122,9 +122,14 @@ mono_string_from_byvalwstr (gunichar2 *data, int len);
|
||||
static void
|
||||
mono_byvalarray_to_array (MonoArray *arr, gpointer native_arr, MonoClass *eltype, guint32 elnum);
|
||||
|
||||
static void
|
||||
mono_byvalarray_to_byte_array (MonoArray *arr, gpointer native_arr, guint32 elnum);
|
||||
|
||||
static void
|
||||
mono_array_to_byvalarray (gpointer native_arr, MonoArray *arr, MonoClass *eltype, guint32 elnum);
|
||||
|
||||
static void
|
||||
mono_array_to_byte_byvalarray (gpointer native_arr, MonoArray *arr, guint32 elnum);
|
||||
|
||||
static MonoAsyncResult *
|
||||
mono_delegate_begin_invoke (MonoDelegate *delegate, gpointer *params);
|
||||
@@ -239,7 +244,9 @@ mono_marshal_init (void)
|
||||
register_icall (mono_array_to_lparray, "mono_array_to_lparray", "ptr object", FALSE);
|
||||
register_icall (mono_free_lparray, "mono_free_lparray", "void object ptr", FALSE);
|
||||
register_icall (mono_byvalarray_to_array, "mono_byvalarray_to_array", "void object ptr ptr int32", FALSE);
|
||||
register_icall (mono_byvalarray_to_byte_array, "mono_byvalarray_to_byte_array", "void object ptr int32", FALSE);
|
||||
register_icall (mono_array_to_byvalarray, "mono_array_to_byvalarray", "void ptr object ptr int32", FALSE);
|
||||
register_icall (mono_array_to_byte_byvalarray, "mono_array_to_byte_byvalarray", "void ptr object int32", FALSE);
|
||||
register_icall (mono_delegate_to_ftnptr, "mono_delegate_to_ftnptr", "ptr object", FALSE);
|
||||
register_icall (mono_ftnptr_to_delegate, "mono_ftnptr_to_delegate", "object ptr ptr", FALSE);
|
||||
register_icall (mono_marshal_asany, "mono_marshal_asany", "ptr object int32 int32", FALSE);
|
||||
@@ -692,6 +699,12 @@ mono_byvalarray_to_array (MonoArray *arr, gpointer native_arr, MonoClass *elclas
|
||||
g_assert_not_reached ();
|
||||
}
|
||||
|
||||
static void
|
||||
mono_byvalarray_to_byte_array (MonoArray *arr, gpointer native_arr, guint32 elnum)
|
||||
{
|
||||
mono_byvalarray_to_array (arr, native_arr, mono_defaults.byte_class, elnum);
|
||||
}
|
||||
|
||||
static void
|
||||
mono_array_to_byvalarray (gpointer native_arr, MonoArray *arr, MonoClass *elclass, guint32 elnum)
|
||||
{
|
||||
@@ -715,6 +728,12 @@ mono_array_to_byvalarray (gpointer native_arr, MonoArray *arr, MonoClass *elclas
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
mono_array_to_byte_byvalarray (gpointer native_arr, MonoArray *arr, guint32 elnum)
|
||||
{
|
||||
mono_array_to_byvalarray (native_arr, arr, mono_defaults.byte_class, elnum);
|
||||
}
|
||||
|
||||
void
|
||||
mono_string_utf8_to_builder (MonoStringBuilder *sb, char *text)
|
||||
{
|
||||
@@ -1346,9 +1365,8 @@ emit_ptr_to_object_conv (MonoMethodBuilder *mb, MonoType *type, MonoMarshalConv
|
||||
mono_mb_emit_ldloc (mb, 1);
|
||||
mono_mb_emit_byte (mb, CEE_LDIND_REF);
|
||||
mono_mb_emit_ldloc (mb, 0);
|
||||
mono_mb_emit_ptr (mb, mono_defaults.byte_class);
|
||||
mono_mb_emit_icon (mb, mspec->data.array_data.num_elem);
|
||||
mono_mb_emit_icall (mb, mono_byvalarray_to_array);
|
||||
mono_mb_emit_icall (mb, mono_byvalarray_to_byte_array);
|
||||
break;
|
||||
}
|
||||
case MONO_MARSHAL_CONV_STR_BYVALSTR:
|
||||
@@ -1721,9 +1739,8 @@ emit_object_to_ptr_conv (MonoMethodBuilder *mb, MonoType *type, MonoMarshalConv
|
||||
mono_mb_emit_ldloc (mb, 1);
|
||||
mono_mb_emit_ldloc (mb, 0);
|
||||
mono_mb_emit_byte (mb, CEE_LDIND_REF);
|
||||
mono_mb_emit_ptr (mb, mono_defaults.byte_class);
|
||||
mono_mb_emit_icon (mb, mspec->data.array_data.num_elem);
|
||||
mono_mb_emit_icall (mb, mono_array_to_byvalarray);
|
||||
mono_mb_emit_icall (mb, mono_array_to_byte_byvalarray);
|
||||
mono_mb_patch_short_branch (mb, pos);
|
||||
break;
|
||||
}
|
||||
|
||||
Loaded 100 of 136 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user