[interp] Reduce computation under calc_section mutex
[mono-project.git] / mcs / tests / test-474.cs
blob42357f22e0faa99b815a1e7cfcbd24784d57f5cb
1 // Test for bug 76550 -- EmitAssign getting called
2 // on captured params.
4 class Z {
5 public static void Main ()
7 TestPreinc (1);
8 TestPostinc (1);
11 delegate void X ();
13 static void TestPreinc (int i)
15 Assert (i, 1);
16 X x = delegate {
17 int z = ++i;
18 Assert (z, 2);
19 Assert (i, 2);
21 x ();
22 Assert (i, 2);
25 static void TestPostinc (int i)
27 Assert (i, 1);
28 X x = delegate {
29 int z = i++;
30 Assert (z, 1);
31 Assert (i, 2);
33 x ();
34 Assert (i, 2);
37 static void Assert (int a, int b)
39 if (a == b)
40 return;
42 throw new System.Exception ("Incorrect was: " + a + " should have been " + b + ".");