X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=blobdiff_plain;f=mono%2Fmini%2Fexceptions.cs;h=aa5ca277ac544e5e57bdeffbbfd454a0c95de9ab;hb=1cfd52452a4af3fd6eee32f45a8067926af8479e;hp=d011fd3d042ff2cd8ef07f981dbe71fc1c74364a;hpb=b5ea5215ef189a83dfad492f334bccd2e081ad8e;p=mono.git diff --git a/mono/mini/exceptions.cs b/mono/mini/exceptions.cs index d011fd3d042..aa5ca277ac5 100644 --- a/mono/mini/exceptions.cs +++ b/mono/mini/exceptions.cs @@ -1462,7 +1462,6 @@ class Tests return 0; } - [Category ("NaClDisable")] public static int test_0_div_zero () { int d = 1; int q = 0; @@ -1633,7 +1632,6 @@ class Tests return 0; } - [Category ("NaClDisable")] public static int test_0_long_div_zero () { long d = 1; long q = 0; @@ -2230,7 +2228,6 @@ class Tests } } - [Category ("!INTERPRETER")] public static int test_0_exception_in_cctor () { try { Broken.DoSomething (); @@ -2319,7 +2316,6 @@ class Tests Console.WriteLine (); } - [Category ("!INTERPRETER")] [Category ("!BITCODE")] public static int test_0_rethrow_stacktrace () { // Check that rethrowing an exception preserves the original stack trace @@ -2708,7 +2704,6 @@ class Tests public static Foo* pFoo; } - [Category ("!INTERPRETER")] /* MS.NET doesn't seem to throw in this case */ public unsafe static int test_0_ldflda_null_pointer () { int* pi = &Foo.pFoo->i; @@ -2848,6 +2843,95 @@ class Tests } return 0; } + + public class MyException : Exception { + public int marker = 0; + public string res = ""; + + public MyException (String res) { + this.res = res; + } + + public bool FilterWithoutState () { + return this.marker == 0x666; + } + + public bool FilterWithState () { + bool ret = this.marker == 0x566; + this.marker += 0x100; + return ret; + } + + public bool FilterWithStringState () { + bool ret = this.marker == 0x777; + this.res = "fromFilter_" + this.res; + return ret; + } + } + + [Category ("!BITCODE")] + public static int test_1_basic_filter_catch () { + try { + MyException e = new MyException (""); + e.marker = 0x1337; + throw e; + } catch (MyException ex) when (ex.marker == 0x1337) { + return 1; + } + return 0; + } + + [Category ("!BITCODE")] + public static int test_1234_complicated_filter_catch () { + string res = "init"; + try { + MyException e = new MyException (res); + e.marker = 0x566; + try { + try { + throw e; + } catch (MyException ex) when (ex.FilterWithoutState ()) { + res = "WRONG_" + res; + } finally { + e.marker = 0x777; + res = "innerFinally_" + res; + } + } catch (MyException ex) when (ex.FilterWithState ()) { + res = "2ndcatch_" + res; + } + // "2ndcatch_innerFinally_init" + // Console.WriteLine ("res1: " + res); + e.res = res; + throw e; + } catch (MyException ex) when (ex.FilterWithStringState ()) { + res = "fwos_" + ex.res; + } finally { + res = "outerFinally_" + res; + } + // Console.WriteLine ("res2: " + res); + return "outerFinally_fwos_fromFilter_2ndcatch_innerFinally_init" == res ? 1234 : 0; + } + + public struct FooStruct + { + public long Part1 { get; } + public long Part2 { get; } + + public byte Part3 { get; } + } + + [MethodImpl( MethodImplOptions.NoInlining )] + private static bool ExceptionFilter( byte x, FooStruct item ) => true; + + [Category ("!BITCODE")] + public static int test_0_filter_caller_area () { + try { + throw new Exception(); + } + catch (Exception) when (ExceptionFilter (default(byte), default (FooStruct))) { + } + return 0; + } } #if !__MOBILE__