2010-06-21 Atsushi Enomoto <atsushi@ximian.com>
[mcs.git] / ilasm / tests / test-seh-a.il
blob63f69178672cd513a0dcb4b94010f011aab32b83
1 //
2 // Test catch and finally 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 extern System { }
12 .assembly 'test-seh-a' { }
15 .class public T {
17         .field private static int32 exc_caught
18         .field private static int32 fin_caught
19   
20         .method public static specialname void .cctor ()
21         {
22                 ldc.i4.0
23                 stsfld int32 T::exc_caught
25                 ldc.i4.0
26                 stsfld int32 T::fin_caught
28                 ret
29         }
31         .method public static int32 Main ()
32         {
33                 .entrypoint
35                 .try {
36                         .try {
37                                 ldstr "#jibba!!jabba"
38                                 newobj void [System]System.Uri::.ctor (string)
39                                 leave outer
40                         } catch [mscorlib]System.Exception {
41                                 ldc.i4.1
42                                 stsfld int32 T::exc_caught
43                                 leave outer
44                         }
45                         leave outer
46                  } finally {
47                         ldc.i4.1
48                         stsfld int32 T::fin_caught
49                         endfinally
50                  }
51            
53         outer:
54                 ldsfld int32 T::exc_caught
55                 brfalse fail
57                 ldsfld int32 T::fin_caught
58                 brfalse fail
60         pass:
61                 ldstr "PASS"
62                 call void [mscorlib]System.Console::WriteLine (string)
63                 ldc.i4.0
64                 ret
66         fail:
67                 ldstr "FAIL"
68                 call void [mscorlib]System.Console::WriteLine (string)
69                 ldc.i4.1
70                 ret
72         }
75