in mono/mono/mini:
[mono.git] / mono / tests / method-access.il
1 .assembly extern mscorlib {}
2
3 .assembly 'method-access' {}
4
5 .class public MethFail extends [mscorlib]System.Object {
6
7         .method private void foo ()
8         {
9                 ret
10         }
11
12         .method static private void sfoo ()
13         {
14                 ret
15         }
16
17         .method public specialname rtspecialname instance void  .ctor()
18         {
19                 ldarg.0
20                 call       instance void [mscorlib]System.Object::.ctor()
21                 ret
22         }
23 }
24
25 .class Test {
26
27         .method static void call_sfoo ()
28         {
29                 call void MethFail::sfoo ()
30                 ret
31         }
32
33         .method static void call_foo ()
34         {
35                 .locals (MethFail mf)
36
37                 newobj instance void MethFail::.ctor()
38                 stloc mf
39                 ldloc mf
40                 call instance void MethFail::foo ()
41                 ret
42         }
43
44         .method static int32 Main ()
45         {
46                 .entrypoint
47
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                 }
58
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
76
77 fail:
78                 ldstr "FAIL"
79                 call void [mscorlib]System.Console::WriteLine(string)
80                 ldc.i4.1
81                 ret
82         }
83 }