Initial set of Ward sgen annotations (#5705)
[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                         call instance string [mscorlib]System.MethodAccessException::get_Message ()
53                         ldstr "Method `MethFail.sfoo()' is inaccessible from method `Test.call_sfoo()'"
54                         call instance bool [mscorlib]System.String::Equals (string)
55                         brfalse fail
56                         br continue
57                 } catch [mscorlib]System.Exception {
58                         pop
59                         br fail
60                 }
61
62 continue:
63                 .try {
64                         call void Test::call_foo ()
65                         br fail
66                 } catch [mscorlib]System.MethodAccessException {
67                         pop
68                         br success
69                 } catch [mscorlib]System.Exception {
70                         pop
71                         br fail
72                 }
73                 
74 success:
75                 ldstr "PASS"
76                 call void [mscorlib]System.Console::WriteLine(string)
77                 ldc.i4.0
78                 ret
79
80 fail:
81                 ldstr "FAIL"
82                 call void [mscorlib]System.Console::WriteLine(string)
83                 ldc.i4.1
84                 ret
85         }
86 }