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

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Maurer <benm@mono-cvs.ximian.com>2005-12-04 05:33:53 +0300
committerBen Maurer <benm@mono-cvs.ximian.com>2005-12-04 05:33:53 +0300
commit9171f5a2d32364ad39b2bd7f997215d04c9e78e6 (patch)
treeb2692a84a58ea512f1c9ab1a7510b2aa7013b1d4 /mcs/tests/test-474.cs
parent6d72e16ae961ce949983431364143209e605d7c1 (diff)
In mcs:
2005-12-03 Ben Maurer <bmaurer@ximian.com> * anonymous.cs: Have the param code handle leaving copies on the stack etc. Allows anonymous params to take part in the assignment code (++, +=, etc). Fixes bug #76550 * expression.cs: Handle the prepare_for_load/leave_copy by passing it down to the anon code. * iterators.cs: Use dummy var here * codegen.cs: Handle new vars In tests: 2005-12-03 Ben Maurer <bmaurer@ximian.com> * test-474.cs: new test. svn path=/trunk/mcs/; revision=53896
Diffstat (limited to 'mcs/tests/test-474.cs')
-rw-r--r--mcs/tests/test-474.cs44
1 files changed, 44 insertions, 0 deletions
diff --git a/mcs/tests/test-474.cs b/mcs/tests/test-474.cs
new file mode 100644
index 00000000000..09408fb2a65
--- /dev/null
+++ b/mcs/tests/test-474.cs
@@ -0,0 +1,44 @@
+// Test for bug 76550 -- EmitAssign getting called
+// on captured params.
+
+class Z {
+ static void Main ()
+ {
+ TestPreinc (1);
+ TestPostinc (1);
+ }
+
+ delegate void X ();
+
+ static void TestPreinc (int i)
+ {
+ Assert (i, 1);
+ X x = delegate {
+ int z = ++i;
+ Assert (z, 2);
+ Assert (i, 2);
+ };
+ x ();
+ Assert (i, 2);
+ }
+
+ static void TestPostinc (int i)
+ {
+ Assert (i, 1);
+ X x = delegate {
+ int z = i++;
+ Assert (z, 1);
+ Assert (i, 2);
+ };
+ x ();
+ Assert (i, 2);
+ }
+
+ static void Assert (int a, int b)
+ {
+ if (a == b)
+ return;
+
+ throw new System.Exception ("Incorrect was: " + a + " should have been " + b + ".");
+ }
+}