Fix #72015.
authorRaja R Harinath <harinath@hurrynot.org>
Tue, 8 Feb 2005 12:04:17 +0000 (12:04 -0000)
committerRaja R Harinath <harinath@hurrynot.org>
Tue, 8 Feb 2005 12:04:17 +0000 (12:04 -0000)
* delegate.cs (Delegate.DefineType): When bootstrapping corlib, if
TypeManager.multicast_delegate_type is null, resolve it by looking
up "System.MulticastDelegate".
* rootcontext.cs (RootContext.ResolveCore): Simplify.

svn path=/trunk/mcs/; revision=40298

mcs/mcs/ChangeLog
mcs/mcs/delegate.cs
mcs/mcs/rootcontext.cs

index 49020ee8b0e0c609d43df703344e5ba6ab3ba190..221116d04ffee4c2c6ac5365b0fa211239747423 100644 (file)
@@ -1,3 +1,11 @@
+2005-02-08  Raja R Harinath  <rharinath@novell.com>
+
+       Fix #72015.
+       * delegate.cs (Delegate.DefineType): When bootstrapping corlib, if
+       TypeManager.multicast_delegate_type is null, resolve it by looking
+       up "System.MulticastDelegate".
+       * rootcontext.cs (RootContext.ResolveCore): Simplify.
+
 2005-02-07  Abin Thomas (NOSIP)  <projectmonokochi@rediffmail.com>
            Anoob V.E (NOSIP)  <projectmonokochi@rediffmail.com>
            Harilal P.R (NOSIP)  <projectmonokochi@rediffmail.com>
index c58990088c81425a81e39a123c32bbd013c0e8ba..0eaaf114af890d6c0e16b0e527fdf47e1637490d 100644 (file)
@@ -84,11 +84,13 @@ namespace Mono.CSharp {
                        TypeAttributes attr = Modifiers.TypeAttr (ModFlags, IsTopLevel) |
                                TypeAttributes.Class | TypeAttributes.Sealed;
 
+                       if (TypeManager.multicast_delegate_type == null && !RootContext.StdLib) {
+                               TypeExpr expr = new TypeLookupExpression ("System.MulticastDelegate");
+                               TypeManager.multicast_delegate_type = expr.ResolveType (ec);
+                       }
+
                        if (TypeManager.multicast_delegate_type == null)
-                               Report.Error (-100, Location, "Internal error: delegate used before " +
-                                             "System.MulticastDelegate is resolved.  This can only " +
-                                             "happen during corlib compilation, when using a delegate " +
-                                             "in any of the `core' classes.  See bug #72015 for details.");
+                               throw new InternalErrorException ("System.MulticastDelegate unresolved");
 
                        if (IsTopLevel) {
                                if (TypeManager.NamespaceClash (Name, Location))
@@ -120,7 +122,9 @@ namespace Mono.CSharp {
                {
                        MethodAttributes mattr;
                        int i;
-                       ec = new EmitContext (this, this, Location, null, null, ModFlags, false);
+
+                       if (ec == null)
+                               throw new InternalErrorException ("Define called before DefineType?");
 
                        // FIXME: POSSIBLY make this static, as it is always constant
                        //
index 595590e1fb3dd7a609d27664db9ff2e04c503688..b37873c5ce7560c837160d7591ed1c4a9a1e8733 100644 (file)
@@ -356,6 +356,9 @@ namespace Mono.CSharp {
                        // These are classes that depends on the core interfaces
                        //
                        string [] classes_second_stage = {
+                               "System.Enum",
+                               "System.String",
+                               "System.Array",
                                "System.Reflection.MemberInfo",
                                "System.Type",
                                "System.Exception",
@@ -390,17 +393,16 @@ namespace Mono.CSharp {
                                "System.Security.CodeAccessPermission"
                        };
 
-                       // We must store them here before calling BootstrapCorlib_ResolveDelegate.
-                       TypeManager.string_type = BootstrapCorlib_ResolveClass (root, "System.String");
-                       TypeManager.enum_type = BootstrapCorlib_ResolveClass (root, "System.Enum");
-                       TypeManager.array_type = BootstrapCorlib_ResolveClass (root, "System.Array");
-                       TypeManager.multicast_delegate_type = BootstrapCorlib_ResolveClass (root, "System.MulticastDelegate");
-                       TypeManager.delegate_type = BootstrapCorlib_ResolveClass (root, "System.Delegate");
-                       
                        foreach (string cname in classes_second_stage)
                                BootstrapCorlib_ResolveClass (root, cname);
 
                        BootstrapCorlib_ResolveDelegate (root, "System.AsyncCallback");
+
+                       // These will be defined indirectly during the previous ResolveDelegate.
+                       // However make sure the rest of the checks happen.
+                       string [] delegate_types = { "System.Delegate", "System.MulticastDelegate" };
+                       foreach (string cname in delegate_types)
+                               BootstrapCorlib_ResolveClass (root, cname);
                }
                        
                // <summary>