Author: marek
Date: 2007-11-19 09:52:45 -0500 (Mon, 19 Nov 2007)
New Revision: 89929
Modified:
branches/mono-1-2-6/mcs/mcs/ChangeLog
branches/mono-1-2-6/mcs/mcs/delegate.cs
Log:
2007-11-19 Marek Safar <[EMAIL PROTECTED]>
A fix for regression #342512
* delegate.cs: Use delegate argument expression when is available. Don't
emit virtual call when class is sealed.
Modified: branches/mono-1-2-6/mcs/mcs/ChangeLog
===================================================================
--- branches/mono-1-2-6/mcs/mcs/ChangeLog 2007-11-19 14:52:10 UTC (rev
89928)
+++ branches/mono-1-2-6/mcs/mcs/ChangeLog 2007-11-19 14:52:45 UTC (rev
89929)
@@ -1,3 +1,9 @@
+2007-11-19 Marek Safar <[EMAIL PROTECTED]>
+
+ A fix for regression #342512
+ * delegate.cs: Use delegate argument expression when is available. Don't
+ emit virtual call when class is sealed.
+
2007-11-14 Marek Safar <[EMAIL PROTECTED]>
A fix for a regression cause by #324222
Modified: branches/mono-1-2-6/mcs/mcs/delegate.cs
===================================================================
--- branches/mono-1-2-6/mcs/mcs/delegate.cs 2007-11-19 14:52:10 UTC (rev
89928)
+++ branches/mono-1-2-6/mcs/mcs/delegate.cs 2007-11-19 14:52:45 UTC (rev
89929)
@@ -706,6 +706,19 @@
Error_ConversionFailed (ec, delegate_method,
ret_expr);
}
+ DoResolveInstanceExpression (ec);
+ eclass = ExprClass.Value;
+ return this;
+ }
+
+ void DoResolveInstanceExpression (EmitContext ec)
+ {
+ //
+ // Argument is another delegate
+ //
+ if (delegate_instance_expression != null)
+ return;
+
if (method_group.InstanceExpression != null)
delegate_instance_expression =
method_group.InstanceExpression;
else if (!ec.IsStatic)
@@ -714,9 +727,6 @@
if (delegate_instance_expression != null &&
delegate_instance_expression.Type.IsValueType)
delegate_instance_expression = new BoxedCast (
delegate_instance_expression,
TypeManager.object_type);
-
- eclass = ExprClass.Value;
- return this;
}
public override void Emit (EmitContext ec)
@@ -726,7 +736,7 @@
else
delegate_instance_expression.Emit (ec);
- if (delegate_method.IsVirtual && !method_group.IsBase) {
+ if (!delegate_method.DeclaringType.IsSealed &&
delegate_method.IsVirtual && !method_group.IsBase) {
ec.ig.Emit (OpCodes.Dup);
ec.ig.Emit (OpCodes.Ldvirtftn, (MethodInfo)
delegate_method);
} else
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches