Another partial cut at #52067
authorRafael Teixeira <monoman@gmail.com>
Fri, 27 Feb 2004 15:30:15 +0000 (15:30 -0000)
committerRafael Teixeira <monoman@gmail.com>
Fri, 27 Feb 2004 15:30:15 +0000 (15:30 -0000)
svn path=/trunk/mcs/; revision=23533

mcs/mbas/testmbas/WriteOK.vb
mcs/mbas/typemanager.cs

index e91271c89f556d841a8fa21a78cf71e5c9b1b2ff..4ef4901d54888eed59e924c2e9b28fdc910b57e9 100644 (file)
@@ -40,6 +40,9 @@ Module WriteOK
                WriteOK5.ModuleSub("Qualified") ' 122
                ModuleSub("Unqualified") ' 103
                
+               Another.WriteOK6.ModuleSub("Qualified") ' 122
+               Another.ModuleSub("SemiQualified") ' 103
+
                Console.WriteLine(Strings.ChrW(64))
 
                Console.Write("Positive cases for IsNumeric: ")
@@ -82,3 +85,13 @@ Public Module WriteOK5
         Console.WriteLine("ModuleSub:OK! (" & Parm & ")")
     End Sub
 End Module
+
+Namespace Another
+
+Public Module WriteOK6
+    Public Sub ModuleSub(Parm As String)
+        Console.WriteLine("Another.ModuleSub:OK! (" & Parm & ")")
+    End Sub
+End Module
+
+End Namespace
index 6b1d0ba8565f4150cda9e224a4a4a455ad2f9cfe..52e5c38087c8b398b18576f85a3f0546f30ce267 100644 (file)
@@ -494,13 +494,20 @@ public class TypeManager {
        /// 
        private static void AddStandardModule(Type type)
        {
-               int top = standardModules != null ? standardModules.Length : 0;
-               StandardModule [] n = new StandardModule [top + 1];
+           object[] attributes = type.GetCustomAttributes(false);
+           for (int i = 0; i < attributes.Length; i ++) {
+                       if (attributes[i].ToString() == "Microsoft.VisualBasic.CompilerServices.StandardModuleAttribute") {
+                               int top = standardModules != null ? standardModules.Length : 0;
+                               StandardModule [] n = new StandardModule [top + 1];
 
-               if (standardModules != null)
-                       standardModules.CopyTo (n, 0);
-               n [top] = new StandardModule(type.Namespace, type.Name) ;
-               standardModules = n;
+                               if (standardModules != null)
+                                       standardModules.CopyTo (n, 0);
+                               n [top] = new StandardModule(type.Namespace, type.Name) ;
+                               standardModules = n;
+
+                               return;
+                       }
+        }
        }
 
        //