Permalink
Browse files

2006-10-12 Martin Baulig <martin@ximian.com>

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

svn path=/trunk/mcs/; revision=66620
  • Loading branch information...
1 parent 104931c commit d973adf739079a754013a7aabaf062c6e8362d58 Martin Baulig committed Oct 12, 2006
Showing with 37 additions and 2 deletions.
  1. +5 −0 mcs/mcs/ChangeLog
  2. +13 −1 mcs/mcs/anonymous.cs
  3. +1 −1 mcs/mcs/codegen.cs
  4. +18 −0 mcs/tests/gtest-anon-13.cs
View
@@ -1,5 +1,10 @@
2006-10-12 Martin Baulig <martin@ximian.com>
+ * anonymous.cs
+ (AnonymousContainer.Resolve): Inflate the `ReturnType'. Fixes #79592.
+
+2006-10-12 Martin Baulig <martin@ximian.com>
+
* statement.cs
(Using.EmitLocalVariableDeclFinally): Small fix for iterators.
View
@@ -1161,7 +1161,7 @@ public abstract class AnonymousContainer : IAnonymousContainer
public readonly ToplevelBlock Block;
public readonly int ModFlags;
- public readonly Type ReturnType;
+ public Type ReturnType;
public readonly TypeContainer Host;
//
@@ -1212,6 +1212,18 @@ public virtual bool Resolve (EmitContext ec)
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,
View
@@ -288,7 +288,7 @@ public enum Flags : byte {
/// 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
View
@@ -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 ()
+ { }
+}

0 comments on commit d973adf

Please sign in to comment.