Welcome to mirror list, hosted at ThFree Co, Russian Federation.

test-anon-33.cs « tests « mcs - github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 6537567f5a050ed0b38fe31366facab0cf657343 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
//
// This test showed that there were cases where there was no
// shared "ScopeInfo", and that we could not root and keep a "topmost"
// variable in the compiler for a CaptureContext.
//
// This illustrates two roots of captured scopes, independent of
// each other
//

using System;

delegate void Do ();

class T {
        static void doit (int v) {
                Console.WriteLine (v);
        }
        static void Main () {
                Do[] arr = new Do [5];
                for (int i = 0; i < 5; ++i) {
                        arr [i] = delegate {doit (i);};
                }
                for (int i = 0; i < 5; ++i) {
                        arr [i] ();
                }
{
                for (int j = 0; j < 5; ++j) {
                        arr [j] = delegate {doit (j);};
                }
}
        }

}