Browse Source

2008-05-14 Jb Evain <[email protected]>

	* LambdaExpression.cs, EmitContext.cs: When encountering a lambda
	inside an ET, compile it as a read of a global. Based on a patch
	by Roei Erez <[email protected]>


svn path=/trunk/mcs/; revision=103177
Jb Evain 17 years ago
parent
commit
3865601b87

+ 6 - 0
mcs/class/System.Core/System.Linq.Expressions/ChangeLog

@@ -1,3 +1,9 @@
+2008-05-14  Jb Evain  <[email protected]>
+
+	* LambdaExpression.cs, EmitContext.cs: When encountering a lambda
+	inside an ET, compile it as a read of a global. Based on a patch
+	by Roei Erez <[email protected]>
+
 2008-05-08  Jb Evain  <[email protected]>
 
 	* Expression.cs, EmitContext.cs: deal with call to methods

+ 2 - 2
mcs/class/System.Core/System.Linq.Expressions/EmitContext.cs

@@ -240,7 +240,7 @@ namespace System.Linq.Expressions {
 			method = new DynamicMethod (GenerateName (), return_type, param_types, typeof (ExecutionScope), true);
 			ig = method.GetILGenerator ();
 
-			owner.Emit (this);
+			owner.EmitBody (this);
 		}
 
 		public override Delegate CreateDelegate ()
@@ -273,7 +273,7 @@ namespace System.Linq.Expressions {
 			var method = type.DefineMethod (name, MethodAttributes.Public | MethodAttributes.Static, return_type, param_types);
 			ig = method.GetILGenerator ();
 
-			owner.Emit (this);
+			owner.EmitBody (this);
 
 			type.CreateType ();
 			assembly.Save (file_name);

+ 5 - 0
mcs/class/System.Core/System.Linq.Expressions/LambdaExpression.cs

@@ -62,6 +62,11 @@ namespace System.Linq.Expressions {
 		}
 
 		internal override void Emit (EmitContext ec)
+		{
+			ec.EmitReadGlobal (Compile ());
+		}
+
+		internal void EmitBody (EmitContext ec)
 		{
 			body.Emit (ec);
 			EmitPopIfNeeded (ec);