2010-06-21 Rodrigo Kumpera <rkumpera@novell.com>
[mcs.git] / ilasm / tests / test-seh-d.il
blob0122b210b0fbc7c6a6524ada8356a7e39ab059f0
1 //
2 // Test catch and filter blocks
3 //
4 // Author(s):
5 //  Jackson Harper (Jackson@LatitudeGeo.com)
6 //
7 // (C) 2003 Jackson Harper, All rights reserved
8 //
10 .assembly extern mscorlib { }
11 .assembly 'test-seh-b' { }
14 .class public T {
16         .field private static int32 exc_not_thrown
17         .field private static int32 flt_1_caught
18         .field private static int32 flt_2_caught
19           
20         .method public static specialname void .cctor ()
21         {
22                 ldc.i4.0
23                 stsfld int32 T::exc_not_thrown
25                 ldc.i4.0
26                 stsfld int32 T::flt_1_caught
28                 ldc.i4 0
29                 stsfld int32 T::flt_2_caught
31                 ret
32         }
34         .method public static int32 Main ()
35         {
36                 .entrypoint
38                 .try {
39                         ldc.i4.0
40                         ldc.i4.0
41                         div
43                         ldc.i4.1
44                         stsfld int32 T::exc_not_thrown
46                         leave outer
47                 } filter {
48                         pop
49                         ldc.i4.0
50                         endfilter
51                 } {
52                         ldc.i4.1
53                         stsfld int32 T::flt_1_caught
54                         leave outer
55                 } filter {
56                         pop
57                         ldc.i4.1
58                         endfilter
59                 } {
60                         ldc.i4.1
61                         stsfld int32 T::flt_2_caught
62                         leave outer
63                 }
64            
66         outer:
67                 ldsfld int32 T::exc_not_thrown
68                 brtrue fail
70                 ldsfld int32 T::flt_1_caught
71                 brtrue fail
73                 ldsfld int32 T::flt_2_caught
74                 brfalse fail
76         pass:
77                 ldstr "PASS"
78                 call void [mscorlib]System.Console::WriteLine (string)
79                 ldc.i4.0
80                 ret
82         fail:
83                 ldstr "FAIL"
84                 call void [mscorlib]System.Console::WriteLine (string)
85                 ldc.i4.1
86                 ret
88         }
91