2010-02-19 Rodrigo Kumpera <rkumpera@novell.com>
[mono.git] / mono / tests / method-access.il
blob98e9f7fa7ff6b0696a2724929e437928438b31ac
1 .assembly extern mscorlib {}
3 .assembly 'method-access' {}
5 .class public MethFail extends [mscorlib]System.Object {
7         .method private void foo ()
8         {
9                 ret
10         }
12         .method static private void sfoo ()
13         {
14                 ret
15         }
17         .method public specialname rtspecialname instance void  .ctor()
18         {
19                 ldarg.0
20                 call       instance void [mscorlib]System.Object::.ctor()
21                 ret
22         }
25 .class Test {
27         .method static void call_sfoo ()
28         {
29                 call void MethFail::sfoo ()
30                 ret
31         }
33         .method static void call_foo ()
34         {
35                 .locals (MethFail mf)
37                 newobj instance void MethFail::.ctor()
38                 stloc mf
39                 ldloc mf
40                 call instance void MethFail::foo ()
41                 ret
42         }
44         .method static int32 Main ()
45         {
46                 .entrypoint
48                 .try {
49                         call void Test::call_sfoo ()
50                         br fail
51                 } catch [mscorlib]System.MethodAccessException {
52                         pop
53                         br continue
54                 } catch [mscorlib]System.Exception {
55                         pop
56                         br fail
57                 }
59 continue:
60                 .try {
61                         call void Test::call_foo ()
62                         br fail
63                 } catch [mscorlib]System.MethodAccessException {
64                         pop
65                         br success
66                 } catch [mscorlib]System.Exception {
67                         pop
68                         br fail
69                 }
70                 
71 success:
72                 ldstr "PASS"
73                 call void [mscorlib]System.Console::WriteLine(string)
74                 ldc.i4.0
75                 ret
77 fail:
78                 ldstr "FAIL"
79                 call void [mscorlib]System.Console::WriteLine(string)
80                 ldc.i4.1
81                 ret
82         }