[jit] Fix the saving of the 'cfg->ret_var_set' flag when inlining, it was set to...
[mono.git] / mcs / tests / test-57.cs
1 using System;
2
3 public delegate void EventHandler (int i, int j);
4
5 public class Button {
6
7         private EventHandler click;
8
9         public event EventHandler Click {
10                 add    { click += value; }
11                 remove { click -= value; }
12         }
13
14         public void OnClick (int i, int j)
15         {
16                 if (click == null) {
17                         Console.WriteLine ("Nothing to click!");
18                         return;
19                 }
20
21                 click (i, j);
22         }
23
24         public void Reset ()
25         {
26                 click = null;
27         }
28 }
29
30 public class Blah {
31
32         Button Button1 = new Button ();
33
34         public void Connect ()
35         {
36                 Button1.Click += new EventHandler (Button1_Click);
37                 Button1.Click += new EventHandler (Foo_Click);
38                 Button1.Click += null;
39         }
40
41         public void Button1_Click (int i, int j)
42         {
43                 Console.WriteLine ("Button1 was clicked !");
44                 Console.WriteLine ("Answer : " + (i+j));
45         }
46
47         public void Foo_Click (int i, int j)
48         {
49                 Console.WriteLine ("Foo was clicked !");
50                 Console.WriteLine ("Answer : " + (i+j));
51         }
52
53         public void Disconnect ()
54         {
55                 Console.WriteLine ("Disconnecting Button1's handler ...");
56                 Button1.Click -= new EventHandler (Button1_Click);
57         }
58
59         public static int Main ()
60         {
61                 Blah b = new Blah ();
62
63                 b.Connect ();
64
65                 b.Button1.OnClick (2, 3);
66
67                 b.Disconnect ();
68
69                 Console.WriteLine ("Now calling OnClick again");
70                 b.Button1.OnClick (3, 7);
71
72                 Console.WriteLine ("Events test passes");
73                 return 0;
74         }
75         
76 }