Author: raja
Date: 2005-03-10 03:39:16 -0500 (Thu, 10 Mar 2005)
New Revision: 41636

Added:
   trunk/mcs/tests/mtest-7-dll.cs
   trunk/mcs/tests/mtest-7-exe.cs
Modified:
   trunk/mcs/mcs/ChangeLog
   trunk/mcs/mcs/typemanager.cs
   trunk/mcs/tests/ChangeLog
   trunk/mcs/tests/Makefile
Log:
Fix #73516.
* mcs/typemanager.cs (ComputeNamespaces): Import namespaces from
referenced modules too.
* tests/mtest-7-exe.cs, tests/mtest-7-dll.cs: New test from #73516.
* tests/Makefile (DISTFILES): Add test-353-2.cs.


Modified: trunk/mcs/mcs/ChangeLog
===================================================================
--- trunk/mcs/mcs/ChangeLog     2005-03-10 06:50:18 UTC (rev 41635)
+++ trunk/mcs/mcs/ChangeLog     2005-03-10 08:39:16 UTC (rev 41636)
@@ -1,3 +1,9 @@
+2005-03-10  Raja R Harinath  <[EMAIL PROTECTED]>
+
+       Fix #73516.
+       * typemanager.cs (ComputeNamespaces): Import namespaces from
+       referenced modules too.
+
 2005-03-09  Raja R Harinath  <[EMAIL PROTECTED]>
 
        * class.cs (TypeContainer.AddToMemberContainer): Use "." rather

Modified: trunk/mcs/mcs/typemanager.cs
===================================================================
--- trunk/mcs/mcs/typemanager.cs        2005-03-10 06:50:18 UTC (rev 41635)
+++ trunk/mcs/mcs/typemanager.cs        2005-03-10 08:39:16 UTC (rev 41636)
@@ -794,6 +794,8 @@
        {
                MethodInfo assembly_get_namespaces = typeof 
(Assembly).GetMethod ("GetNamespaces", 
BindingFlags.Instance|BindingFlags.NonPublic);
 
+               Hashtable cache = null;
+
                //
                // First add the assembly namespaces
                //
@@ -810,7 +812,7 @@
                                }
                        }
                } else {
-                       Hashtable cache = new Hashtable ();
+                       cache = new Hashtable ();
                        cache.Add ("", null);
                        foreach (Assembly a in assemblies) {
                                foreach (Type t in a.GetExportedTypes ()) {
@@ -823,6 +825,25 @@
                                }
                        }
                }
+
+               //
+               // Then add module namespaces
+               //
+               foreach (Module m in modules) {
+                       if (m == CodeGen.Module.Builder)
+                               continue;
+                       if (cache == null) {
+                               cache = new Hashtable ();
+                               cache.Add ("", null);
+                       }
+                       foreach (Type t in m.GetTypes ()) {
+                               string ns = t.Namespace;
+                               if (ns == null || cache.Contains (ns))
+                                       continue;
+                               Namespace.LookupNamespace (ns, true);
+                               cache.Add (ns, null);
+                       }
+               }
        }
 
        /// <summary>

Modified: trunk/mcs/tests/ChangeLog
===================================================================
--- trunk/mcs/tests/ChangeLog   2005-03-10 06:50:18 UTC (rev 41635)
+++ trunk/mcs/tests/ChangeLog   2005-03-10 08:39:16 UTC (rev 41636)
@@ -1,3 +1,8 @@
+2005-03-10  Raja R Harinath  <[EMAIL PROTECTED]>
+
+       * mtest-7-exe.cs, mtest-7-dll.cs: New test from #73516.
+       * Makefile (DISTFILES): Add test-353-2.cs.
+
 2005-03-09  Raja R Harinath  <[EMAIL PROTECTED]>
 
        * test-357.cs: New test for partial classes.

Modified: trunk/mcs/tests/Makefile
===================================================================
--- trunk/mcs/tests/Makefile    2005-03-10 06:50:18 UTC (rev 41635)
+++ trunk/mcs/tests/Makefile    2005-03-10 08:39:16 UTC (rev 41636)
@@ -7,7 +7,8 @@
 SUBDIRS =
 include ../build/rules.make
 
-DISTFILES = README.tests harness.mk $(wildcard *.cs) $(wildcard *.il) 
$(wildcard *.xml) $(wildcard *.inc)
+DISTFILES = README.tests harness.mk $(wildcard *.cs) $(wildcard *.il) 
$(wildcard *.xml) $(wildcard *.inc) \
+       test-353-2.cs
 
 with_mono_path = 
MONO_PATH="$(topdir)/class/lib/$(PROFILE)$(PLATFORM_PATH_SEPARATOR)$$MONO_PATH"
 
@@ -85,6 +86,7 @@
        mtest-4-dll mtest-4-exe \
        mtest-5-dll mtest-5-exe \
        mtest-6-dll mtest-6-exe \
+       mtest-7-dll mtest-7-exe \
        test-319-dll test-319-exe \
        covariance-1 covariance-2 covariance-3 \
        conv-dll conv-exe \

Added: trunk/mcs/tests/mtest-7-dll.cs
===================================================================
--- trunk/mcs/tests/mtest-7-dll.cs      2005-03-10 06:50:18 UTC (rev 41635)
+++ trunk/mcs/tests/mtest-7-dll.cs      2005-03-10 08:39:16 UTC (rev 41636)
@@ -0,0 +1,12 @@
+// Compiler options: -t:module
+
+namespace n1
+{
+        public class Adder
+        {
+                public int Add(int x, int y)
+                {
+                        return x+y;
+                }
+        }
+}

Added: trunk/mcs/tests/mtest-7-exe.cs
===================================================================
--- trunk/mcs/tests/mtest-7-exe.cs      2005-03-10 06:50:18 UTC (rev 41635)
+++ trunk/mcs/tests/mtest-7-exe.cs      2005-03-10 08:39:16 UTC (rev 41636)
@@ -0,0 +1,15 @@
+// Compiler options: -addmodule:mtest-7-dll.netmodule
+
+using n1;
+using System;
+
+public class ModTest
+{
+        
+        public static void Main(string[] args)
+        {
+                Adder a=new Adder();
+                Console.WriteLine(a.Add(2,3));
+        }
+
+}

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

Reply via email to