Merge pull request #4431 from vkargov/vk-leaking-points
[mono.git] / mcs / tests / test-anon-27.cs
1 using System;
2
3 delegate void D ();
4
5 class X {
6
7         public static int Main ()
8         {
9                 X x = new X();
10                 x.M (10);
11                 e ();
12                 Console.WriteLine ("J should be 11= {0}", j);
13                 e ();
14                 Console.WriteLine ("J should be 11= {0}", j);
15                 x.M (100);
16                 e ();
17                 Console.WriteLine ("J should be 101= {0}", j);
18                 if (j != 101)
19                         return 3;
20                 Console.WriteLine ("OK");
21                 return 0;
22         }
23
24         static int j;
25         static D e;
26         
27         void M (int a)
28         {
29                 Console.WriteLine ("A is=" + a);        
30                 D d = delegate {
31                         int b;
32                         b = 1;
33                         e = delegate {
34                                         Console.WriteLine ("IN NESTED DELEGATE: {0}", a);
35                                         j = a + b;
36                                 };
37                         };
38                 d ();
39         }
40         
41 }