Author: martin
Date: 2006-09-27 06:12:04 -0400 (Wed, 27 Sep 2006)
New Revision: 65955

Modified:
   branches/martin/anonymous-methods/mcs/convert.cs
Log:
Anonymous methods ...

Modified: branches/martin/anonymous-methods/mcs/convert.cs
===================================================================
--- branches/martin/anonymous-methods/mcs/convert.cs    2006-09-27 10:11:33 UTC 
(rev 65954)
+++ branches/martin/anonymous-methods/mcs/convert.cs    2006-09-27 10:12:04 UTC 
(rev 65955)
@@ -856,8 +856,8 @@
                                if (!TypeManager.IsDelegateType (target_type))
                                        return false;
 
-                               AnonymousMethod am = (AnonymousMethod) expr;
-                               return am.ImplicitStandardConversionExists 
(target_type);
+                               AnonymousMethodExpression ame = 
(AnonymousMethodExpression) expr;
+                               return ame.ImplicitStandardConversionExists 
(target_type);
                        }
 
                        return false;
@@ -1334,20 +1334,14 @@
                        }
 
                        if (expr_type == TypeManager.anonymous_method_type){
-                               if (!TypeManager.IsDelegateType (target_type)){
-                                       Report.Error (1660, loc,
-                                               "Cannot convert anonymous 
method block to type `{0}' because it is not a delegate type",
-                                               TypeManager.CSharpName 
(target_type));
-                                       return null;
-                               }
+                               AnonymousMethodExpression ame = 
(AnonymousMethodExpression) expr;
 
-                               AnonymousMethod am = (AnonymousMethod) expr;
                                int errors = Report.Errors;
 
-                               Expression conv = am.Compatible (ec, 
target_type);
+                               Expression conv = ame.Compatible (ec, 
target_type);
                                if (conv != null)
                                        return conv;
-
+                               
                                //
                                // We return something instead of null, to avoid
                                // the duplicate error, since am.Compatible 
would have

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to