All pastes #199668 Raw Edit

Untitled

public text v1 · immutable
#199668 ·published 2006-10-12 17:56 UTC
rendered paste body
Index: /work/rohan/mono/mcs/mcs/anonymous.cs
===================================================================
--- /work/rohan/mono/mcs/mcs/anonymous.cs	(revision 66618)
+++ /work/rohan/mono/mcs/mcs/anonymous.cs	(working copy)
@@ -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,
Index: /work/rohan/mono/mcs/mcs/codegen.cs
===================================================================
--- /work/rohan/mono/mcs/mcs/codegen.cs	(revision 66618)
+++ /work/rohan/mono/mcs/mcs/codegen.cs	(working copy)
@@ -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