Author: martin
Date: 2006-10-12 14:04:57 -0400 (Thu, 12 Oct 2006)
New Revision: 66620

Added:
   trunk/mcs/tests/gtest-anon-13.cs
Modified:
   trunk/mcs/mcs/ChangeLog
   trunk/mcs/mcs/anonymous.cs
   trunk/mcs/mcs/codegen.cs
Log:
2006-10-12  Martin Baulig  <[EMAIL PROTECTED]>

        * anonymous.cs
        (AnonymousContainer.Resolve): Inflate the `ReturnType'.  Fixes #79592.
        


Modified: trunk/mcs/mcs/ChangeLog
===================================================================
--- trunk/mcs/mcs/ChangeLog     2006-10-12 17:30:27 UTC (rev 66619)
+++ trunk/mcs/mcs/ChangeLog     2006-10-12 18:04:57 UTC (rev 66620)
@@ -1,5 +1,10 @@
 2006-10-12  Martin Baulig  <[EMAIL PROTECTED]>
 
+       * anonymous.cs
+       (AnonymousContainer.Resolve): Inflate the `ReturnType'.  Fixes #79592.
+       
+2006-10-12  Martin Baulig  <[EMAIL PROTECTED]>
+
        * statement.cs
        (Using.EmitLocalVariableDeclFinally): Small fix for iterators.
 

Modified: trunk/mcs/mcs/anonymous.cs
===================================================================
--- trunk/mcs/mcs/anonymous.cs  2006-10-12 17:30:27 UTC (rev 66619)
+++ trunk/mcs/mcs/anonymous.cs  2006-10-12 18:04:57 UTC (rev 66620)
@@ -1161,7 +1161,7 @@
                public readonly ToplevelBlock Block;
 
                public readonly int ModFlags;
-               public readonly Type ReturnType;
+               public Type ReturnType;
                public readonly TypeContainer Host;
 
                //
@@ -1212,6 +1212,18 @@
                        Report.Debug (64, "RESOLVE ANONYMOUS METHOD", this, 
Location, ec,
                                      RootScope, Parameters, ec.IsStatic);
 
+                       if (ReturnType != null) {
+                               TypeExpr return_type_expr;
+                               if (RootScope != null)
+                                       return_type_expr = 
RootScope.InflateType (ReturnType);
+                               else
+                                       return_type_expr = new TypeExpression 
(ReturnType, Location);
+                               return_type_expr = 
return_type_expr.ResolveAsTypeTerminal (ec, false);
+                               if ((return_type_expr == null) || 
(return_type_expr.Type == null))
+                                       return false;
+                               ReturnType = return_type_expr.Type;
+                       }
+
                        aec = new EmitContext (
                                ec.ResolveContext, ec.TypeContainer,
                                RootScope != null ? RootScope : Host, Location, 
null, ReturnType,

Modified: trunk/mcs/mcs/codegen.cs
===================================================================
--- trunk/mcs/mcs/codegen.cs    2006-10-12 17:30:27 UTC (rev 66619)
+++ trunk/mcs/mcs/codegen.cs    2006-10-12 18:04:57 UTC (rev 66620)
@@ -288,7 +288,7 @@
                ///   The value that is allowed to be returned or NULL if there 
is no
                ///   return type.
                /// </summary>
-               public Type ReturnType;
+               public readonly Type ReturnType;
 
                /// <summary>
                ///   Points to the Type (extracted from the TypeContainer) that

Added: trunk/mcs/tests/gtest-anon-13.cs
===================================================================
--- trunk/mcs/tests/gtest-anon-13.cs    2006-10-12 17:30:27 UTC (rev 66619)
+++ trunk/mcs/tests/gtest-anon-13.cs    2006-10-12 18:04:57 UTC (rev 66620)
@@ -0,0 +1,18 @@
+using System;
+using System.Runtime.InteropServices;
+using System.Collections.Generic;
+
+class X
+{
+       public delegate T ModuleBinder<T> (object o);
+
+       public ModuleBinder<TDelegate> CreateMethodUnscoped<TDelegate> ()
+       {
+               return delegate (object o) {
+                       return (TDelegate)(object)null;
+               };
+       }
+
+       static void Main ()
+       { }
+}


Property changes on: trunk/mcs/tests/gtest-anon-13.cs
___________________________________________________________________
Name: svn:executable
   + *

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

Reply via email to