[mono/mono] a769cce0: Fixes regression caused by 3912066fe1134ba665770723a24c8ea9b4f1aea3 change

"Marek Safar ([email protected])" <[email protected]>
Newsgroups gmane.comp.gnome.mono.patches
Message-ID <000001417e6f6e78-944f0ff5-0a08-45ae-95d7-dbd2b95951c8-000000@email.amazonses.com>
   Branch: refs/heads/master
     Home: https://github.com/mono/mono
  Compare: https://github.com/mono/mono/compare/d7cc362ebd5f...a769cce0b77f

   Commit: a769cce0b77f0fbd057b379b623f2f874f48a935
   Author: Marek Safar <[email protected]> (marek-safar)
     Date: 2013-10-03 13:07:45 GMT
      URL: https://github.com/mono/mono/commit/a769cce0b77f0fbd057b379b623f2f874f48a935

Fixes regression caused by 3912066fe1134ba665770723a24c8ea9b4f1aea3 change

Changed paths:
  M mcs/mcs/anonymous.cs
  M mcs/tests/ver-il-net_4_5.xml
Added paths:
  A mcs/tests/gtest-iter-31.cs

Modified: mcs/mcs/anonymous.cs
===================================================================
@@ -1698,13 +1698,12 @@ AnonymousMethodMethod DoCreateMethodHost (EmitContext ec)
 							// use ldftn on non-boxed instances either to share mutated state
 							//
 							parent = sm_parent.Parent.PartialContainer;
-						}
-					} else {
-						//
-						// For iterators we can host everything in one class
-						//
-						if (sm is IteratorStorey)
+						} else if (sm is IteratorStorey) {
+							//
+							// For iterators we can host everything in one class
+							//
 							parent = storey = sm;
+						}
 					}
 				}
 

Added: mcs/tests/gtest-iter-31.cs
===================================================================
@@ -0,0 +1,31 @@
+using System.Collections.Generic;
+using System.Linq;
+
+class B
+{
+	public object Foo (object obj)
+	{
+		return null;
+	}
+}
+
+class C
+{
+	B ctx = new B ();
+
+	public static void Main ()
+	{
+		foreach (var c in new C ().Test ()) {			
+		}
+	}
+
+	IEnumerable<ushort> Test ()
+	{
+		string[] s = new[] { "a", "b", "c" };
+
+		var m = s.Select (l => ctx.Foo (l)).ToArray ();
+
+		yield break;
+	}
+}
+

Modified: mcs/tests/ver-il-net_4_5.xml
===================================================================
@@ -24461,14 +24461,14 @@
       <method name="System.Collections.Generic.IEnumerator`1[System.Int32] System.Collections.Generic.IEnumerable&lt;int&gt;.GetEnumerator()" attrs="481">
         <size>40</size>
       </method>
-      <method name="Void &lt;Test&gt;m__0()" attrs="129">
-        <size>52</size>
-      </method>
       <method name="Void .ctor()" attrs="6278">
         <size>7</size>
       </method>
+      <method name="Void &lt;&gt;m__0()" attrs="131">
+        <size>57</size>
+      </method>
     </type>
-    <type name="M+&lt;Test&gt;c__AnonStorey1">
+    <type name="M+&lt;Test&gt;c__Iterator0+&lt;Test&gt;c__AnonStorey1">
       <method name="Void &lt;&gt;m__1()" attrs="131">
         <size>24</size>
       </method>
@@ -24477,6 +24477,56 @@
       </method>
     </type>
   </test>
+  <test name="gtest-iter-31.cs">
+    <type name="B">
+      <method name="System.Object Foo(System.Object)" attrs="134">
+        <size>10</size>
+      </method>
+      <method name="Void .ctor()" attrs="6278">
+        <size>7</size>
+      </method>
+    </type>
+    <type name="C">
+      <method name="Void Main()" attrs="150">
+        <size>62</size>
+      </method>
+      <method name="System.Collections.Generic.IEnumerable`1[System.UInt16] Test()" attrs="129">
+        <size>30</size>
+      </method>
+      <method name="Void .ctor()" attrs="6278">
+        <size>18</size>
+      </method>
+    </type>
+    <type name="C+&lt;Test&gt;c__Iterator0">
+      <method name="UInt16 System.Collections.Generic.IEnumerator&lt;ushort&gt;.get_Current()" attrs="2529">
+        <size>14</size>
+      </method>
+      <method name="System.Object System.Collections.IEnumerator.get_Current()" attrs="2529">
+        <size>19</size>
+      </method>
+      <method name="Boolean MoveNext()" attrs="486">
+        <size>81</size>
+      </method>
+      <method name="Void Dispose()" attrs="486">
+        <size>1</size>
+      </method>
+      <method name="Void Reset()" attrs="486">
+        <size>6</size>
+      </method>
+      <method name="IEnumerator System.Collections.IEnumerable.GetEnumerator()" attrs="481">
+        <size>14</size>
+      </method>
+      <method name="System.Collections.Generic.IEnumerator`1[System.UInt16] System.Collections.Generic.IEnumerable&lt;ushort&gt;.GetEnumerator()" attrs="481">
+        <size>40</size>
+      </method>
+      <method name="System.Object &lt;&gt;m__0(System.String)" attrs="131">
+        <size>25</size>
+      </method>
+      <method name="Void .ctor()" attrs="6278">
+        <size>7</size>
+      </method>
+    </type>
+  </test>
   <test name="gtest-lambda-01.cs">
     <type name="IntFunc">
       <method name="Int32 Invoke(Int32)" attrs="454">



_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.