[mcs] Implements cloning for yield break. Fixes #57796
authorMarek Safar <marek.safar@gmail.com>
Fri, 28 Jul 2017 09:12:47 +0000 (11:12 +0200)
committerMarek Safar <marek.safar@gmail.com>
Fri, 28 Jul 2017 09:14:08 +0000 (11:14 +0200)
mcs/errors/cs1621-2.cs [new file with mode: 0644]
mcs/mcs/iterators.cs

diff --git a/mcs/errors/cs1621-2.cs b/mcs/errors/cs1621-2.cs
new file mode 100644 (file)
index 0000000..fca7c67
--- /dev/null
@@ -0,0 +1,21 @@
+// CS1621: The yield statement cannot be used inside anonymous method blocks
+// Line: 12
+
+using System;
+using System.Collections;
+
+public class Test
+{
+       public IEnumerator Foo ()
+       {
+               Call (() => {
+                       yield break;
+               });
+
+               yield break;
+       }
+
+       void Call (Action a)
+       {
+       }
+}
\ No newline at end of file
index 3afe93ce5ffe1bf89df1833938932a96f7abb294..c0ccf129e74a77fd44b33e4c702b9e69412cd1e6 100644 (file)
@@ -161,7 +161,6 @@ namespace Mono.CSharp
 
                protected override void CloneTo (CloneContext clonectx, Statement target)
                {
-                       throw new NotSupportedException ();
                }
 
                protected override bool DoResolve (BlockContext bc)