* typemanager.cs: Property.GetGetMethod() does not return the method if it
[mono.git] / mcs / mbas / interface.cs
index dce7b2c5f1eb0d94b5177a0f2e2fe7b6d8991443..71cfa1cbd04d03d5d9ded7a91fa1bf171ebe45e6 100644 (file)
@@ -14,7 +14,7 @@ using System.IO;
 using System.Reflection;
 using System.Reflection.Emit;
 
-namespace Mono.CSharp {
+namespace Mono.MonoBASIC {
 
        /// <summary>
        ///   Interfaces
@@ -53,6 +53,8 @@ namespace Mono.CSharp {
                IMemberContainer parent_container;
                MemberCache member_cache;
 
+               bool members_defined;
+
                // These will happen after the semantic analysis
                
                // Hashtable defined_indexers;
@@ -72,7 +74,7 @@ namespace Mono.CSharp {
                public Interface (TypeContainer parent, string name, int mod, Attributes attrs, Location l)
                        : base (parent, name, l)
                {
-                       ModFlags = Modifiers.Check (AllowedModifiers, mod, Modifiers.PRIVATE, l);
+                       ModFlags = Modifiers.Check (AllowedModifiers, mod, Modifiers.PUBLIC, l);
                        OptAttributes = attrs;
                        
                        method_builders = new ArrayList ();
@@ -228,9 +230,22 @@ namespace Mono.CSharp {
                        return true;
                }
 
-               public MethodInfo [] GetMethods ()
+               //
+               // This might trigger a definition of the methods.  This happens only
+               // with Attributes, as Attribute classes are processed before interfaces.
+               // Ideally, we should make everything just define recursively in terms
+               // of its dependencies.
+               //
+               public MethodInfo [] GetMethods (TypeContainer container)
                {
-                       int n = method_builders.Count;
+                       int n = 0;
+                       
+                       if (!members_defined){
+                               if (DefineMembers (container))
+                                       n = method_builders.Count;
+                       } else
+                               n = method_builders.Count;
+                       
                        MethodInfo [] mi = new MethodInfo [n];
                        
                        method_builders.CopyTo (mi, 0);
@@ -297,6 +312,9 @@ namespace Mono.CSharp {
                        if (return_type.IsPointer && !UnsafeOK (this))
                                return;
 
+                       if (arg_types == null)
+                               return;
+
                        foreach (Type t in arg_types){
 
                                if (t == null)
@@ -639,7 +657,7 @@ namespace Mono.CSharp {
 
                Type GetInterfaceTypeByName (string name)
                {
-                       Type t = FindType (name);
+                       Type t = FindType (Location, name);
 
                        if (t == null) {
                                Report.Error (246, Location, "The type or namespace `" + name +
@@ -695,7 +713,7 @@ namespace Mono.CSharp {
                                if (!Parent.AsAccessible (t, ModFlags))
                                        Report.Error (61, Location,
                                                      "Inconsistent accessibility: base interface `" +
-                                                     TypeManager.CSharpName (t) + "' is less " +
+                                                     TypeManager.MonoBASIC_Name (t) + "' is less " +
                                                      "accessible than interface `" +
                                                      Name + "'");
 
@@ -832,7 +850,7 @@ namespace Mono.CSharp {
 
                        member_cache = new MemberCache (this);
 #endif
-
+                       members_defined = true;
                        return true;
                }