diff options
author | Marek Safar <marek.safar@gmail.com> | 2017-07-28 12:12:47 +0300 |
---|---|---|
committer | Marek Safar <marek.safar@gmail.com> | 2017-07-28 12:14:42 +0300 |
commit | bda280c5e854e3124692256729c3a551945c1494 (patch) | |
tree | 04ff0456d8a6c2bc024c92cc9f00ab7b1c7482ef | |
parent | 41ecc70a69dd11e304c31e9815f8fe94e661727c (diff) |
[mcs] Implements cloning for yield break. Fixes #57796
-rw-r--r-- | mcs/errors/cs1621-2.cs | 21 | ||||
-rw-r--r-- | mcs/mcs/iterators.cs | 1 |
2 files changed, 21 insertions, 1 deletions
diff --git a/mcs/errors/cs1621-2.cs b/mcs/errors/cs1621-2.cs new file mode 100644 index 00000000000..fca7c673b3c --- /dev/null +++ b/mcs/errors/cs1621-2.cs @@ -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 diff --git a/mcs/mcs/iterators.cs b/mcs/mcs/iterators.cs index 3afe93ce5ff..c0ccf129e74 100644 --- a/mcs/mcs/iterators.cs +++ b/mcs/mcs/iterators.cs @@ -161,7 +161,6 @@ namespace Mono.CSharp protected override void CloneTo (CloneContext clonectx, Statement target) { - throw new NotSupportedException (); } protected override bool DoResolve (BlockContext bc) |