浏览代码

2008-04-21 Jb Evain <[email protected]>

	* Expression.cs (Call): don't rely on the fact that if the
	instance expression is null, then it's a static call. Explicitely
	check on the MethodInfo for that.
	* EmitContext.cs (EmitCall): same pattern.


svn path=/trunk/mcs/; revision=101336
Jb Evain 17 年之前
父节点
当前提交
55e6fcbe63

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

@@ -1,3 +1,10 @@
+2008-04-21  Jb Evain  <[email protected]>
+
+	* Expression.cs (Call): don't rely on the fact that if the
+	instance expression is null, then it's a static call. Explicitely
+	check on the MethodInfo for that.
+	* EmitContext.cs (EmitCall): same pattern.
+
 2008-04-20  Jb Evain  <[email protected]>
 
 	* MemberMemberBinding.cs (Emit): implement.

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

@@ -124,7 +124,7 @@ namespace System.Linq.Expressions {
 
 		public void EmitCall (Expression expression, IEnumerable<Expression> arguments, MethodInfo method)
 		{
-			if (expression != null)
+			if (!method.IsStatic)
 				EmitLoad (expression);
 
 			EmitCollection (arguments);

+ 1 - 1
mcs/class/System.Core/System.Linq.Expressions/Expression.cs

@@ -909,7 +909,7 @@ namespace System.Linq.Expressions {
 				throw new ArgumentNullException ("method");
 			if (instance == null && !method.IsStatic)
 				throw new ArgumentNullException ("instance");
-			if (instance != null && !instance.Type.IsAssignableTo (method.DeclaringType))
+			if (!method.IsStatic && !instance.Type.IsAssignableTo (method.DeclaringType))
 				throw new ArgumentException ("Type is not assignable to the declaring type of the method");
 
 			var args = arguments.ToReadOnlyCollection ();