Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Baulig <martin@novell.com>2006-10-12 22:04:57 +0400
committerMartin Baulig <martin@novell.com>2006-10-12 22:04:57 +0400
commitd973adf739079a754013a7aabaf062c6e8362d58 (patch)
treebbd68bf9c62c5e98d7f4211a0339b0b2ca1dd824
parent104931c89843ed27e23c73e600826678cd7d7dfe (diff)
2006-10-12 Martin Baulig <martin@ximian.com>mono-1.1.18
* anonymous.cs (AnonymousContainer.Resolve): Inflate the `ReturnType'. Fixes #79592. svn path=/trunk/mcs/; revision=66620
-rw-r--r--mcs/mcs/ChangeLog5
-rw-r--r--mcs/mcs/anonymous.cs14
-rw-r--r--mcs/mcs/codegen.cs2
-rwxr-xr-xmcs/tests/gtest-anon-13.cs18
4 files changed, 37 insertions, 2 deletions
diff --git a/mcs/mcs/ChangeLog b/mcs/mcs/ChangeLog
index 9c015ffd06e..91561ee362b 100644
--- a/mcs/mcs/ChangeLog
+++ b/mcs/mcs/ChangeLog
@@ -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.
diff --git a/mcs/mcs/anonymous.cs b/mcs/mcs/anonymous.cs
index 463bca02be7..89bc65cf9f6 100644
--- a/mcs/mcs/anonymous.cs
+++ b/mcs/mcs/anonymous.cs
@@ -1161,7 +1161,7 @@ namespace Mono.CSharp {
public readonly ToplevelBlock Block;
public readonly int ModFlags;
- public readonly Type ReturnType;
+ public Type ReturnType;
public readonly TypeContainer Host;
//
@@ -1212,6 +1212,18 @@ namespace Mono.CSharp {
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,
diff --git a/mcs/mcs/codegen.cs b/mcs/mcs/codegen.cs
index e4d1b300f1b..4fdc92b3e65 100644
--- a/mcs/mcs/codegen.cs
+++ b/mcs/mcs/codegen.cs
@@ -288,7 +288,7 @@ namespace Mono.CSharp {
/// 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
diff --git a/mcs/tests/gtest-anon-13.cs b/mcs/tests/gtest-anon-13.cs
new file mode 100755
index 00000000000..99d55bc821b
--- /dev/null
+++ b/mcs/tests/gtest-anon-13.cs
@@ -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 ()
+ { }
+}