[Mono-bugs] [Bug 77767][Nor] Changed - [PATCH][GMCS] allow yield
break in catch clause
bugzilla-daemon at bugzilla.ximian.com
bugzilla-daemon at bugzilla.ximian.com
Tue Mar 14 00:31:37 EST 2006
Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.
Changed by atsushi at ximian.com.
http://bugzilla.ximian.com/show_bug.cgi?id=77767
--- shadow/77767 2006-03-13 17:13:23.000000000 -0500
+++ shadow/77767.tmp.11054 2006-03-14 00:31:37.000000000 -0500
@@ -61,6 +61,47 @@
------- Additional Comments From miguel at ximian.com 2006-03-13 17:13 -------
Am pretty sure that yielding inside a catch was not allowed.
Maybe something changed, but we need to make sure that if we yield in
a catch clause that the generated code actually works and generates
the proper code.
+
+------- Additional Comments From atsushi at ximian.com 2006-03-14 00:31 -------
+yield return inside try-statement with catch clauses is still invalid
+in the latest specification. Considering that all other terms on yield
+validity it is carefully defined.
+
+Allowing yield break makes sense in such situation like:
+
+using System;
+using System.Collections.Generic;
+
+public class Test
+{
+ public IEnumerator<string> GetEnumerator ()
+ {
+ yield return "TEST";
+ try {
+ int.Parse (args [0]);
+ } catch {
+ yield break;
+ }
+ yield return "TEST2";
+ }
+
+ static void Main (string [] args)
+ {
+ new Test ().Run (args);
+ }
+
+ string [] args;
+ void Run (string [] args)
+ {
+ this.args = args;
+ foreach (string s in this)
+ Console.WriteLine (s);
+ }
+}
+
+("mono blah.exe" and "mono blah.exe 1" shows the differences.)
+
+I'm going to prepare patch for mcs too.
More information about the mono-bugs
mailing list