Fix warning.
[mono.git] / mcs / gmcs / tree.cs
index 96c1d0d527d3c1ac760f6f51c475ca234072b89a..da1045ad250e1767a90547a6a28b969bb0ec501d 100644 (file)
@@ -45,43 +45,20 @@ namespace Mono.CSharp
                        decls = new Hashtable ();
                }
 
-               public void RecordDecl (MemberName name, DeclSpace ds)
+               public void RecordDecl (Namespace ns, MemberName name, DeclSpace ds)
                {
-                       DeclSpace other = (DeclSpace) decls [name];
-                       if (other != null){
-                               PartialContainer other_pc = other as PartialContainer;
-                               if ((ds is TypeContainer) && (other_pc != null)) {
-                                       Report.Error (
-                                               260, ds.Location, "Missing partial modifier " +
-                                               "on declaration of type `{0}'; another " +
-                                               "partial implementation of this type exists",
-                                               name);
+                       // This is recorded for tracking inner partial classes only
+                       decls [name] = ds;
 
-                                       Report.LocationOfPreviousError (other.Location);
-                                       return;
-                               }
-
-                               Report.SymbolRelatedToPreviousError (
-                                       other.Location, other.GetSignatureForError ());
-
-                               Report.Error (
-                                       101, ds.Location,
-                                       "There is already a definition for `" + name + "'");
-                               return;
-                       }
-
-                       ds.RecordDecl ();
-
-                       decls.Add (name, ds);
+                       if (ds.Parent == root_types)
+                               ns.AddDeclSpace (name.Basename, ds);
                }
                
                //
                // FIXME: Why are we using Types?
                //
                 public TypeContainer Types {
-                        get {
-                                return root_types;
-                        }
+                        get { return root_types; }
                 }
 
                public DeclSpace GetDecl (MemberName name)
@@ -90,16 +67,14 @@ namespace Mono.CSharp
                }
 
                public Hashtable AllDecls {
-                       get {
-                               return decls;
-                       }
+                       get { return decls; }
                }
        }
 
-       public class RootTypes : TypeContainer
+       public sealed class RootTypes : TypeContainer
        {
                public RootTypes ()
-                       : base (null, null, MemberName.Null, null, Kind.Root, Location.Null)
+                       : base (null, null, MemberName.Null, null, Kind.Root)
                {
                        ec = new EmitContext (null, this, Location.Null, null, null, 0, false);
                }
@@ -109,10 +84,19 @@ namespace Mono.CSharp
                        throw new InvalidOperationException ();
                }
 
-               public override bool IsClsCompliaceRequired (DeclSpace ds)
+               public override bool IsClsComplianceRequired (DeclSpace ds)
                {
                        return true;
                }
 
+               public override string GetSignatureForError ()
+               {
+                       return "";
+               }
+
+               protected override bool AddToTypeContainer (DeclSpace ds)
+               {
+                       return AddToContainer (ds, ds.Name);
+               }
        }
 }