X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=blobdiff_plain;f=mcs%2Fgmcs%2Ftree.cs;h=e0453caf977b4ae6bd6d6b6b28de5dcf676e4424;hb=1733851d28faad34184ad6cbf25992e33f483e44;hp=57e4740a751c7b42ece146bb68768c74ca2422c5;hpb=c7cfb1e7236af539cb992e125d29524e60e4d7ea;p=mono.git
diff --git a/mcs/gmcs/tree.cs b/mcs/gmcs/tree.cs
old mode 100755
new mode 100644
index 57e4740a751..e0453caf977
--- a/mcs/gmcs/tree.cs
+++ b/mcs/gmcs/tree.cs
@@ -33,11 +33,6 @@ namespace Mono.CSharp
public class Tree {
TypeContainer root_types;
- //
- // Keeps track of namespaces defined in the source code
- //
- Hashtable namespaces;
-
//
// Keeps track of all the types definied (classes, structs, ifaces, enums)
//
@@ -45,46 +40,37 @@ namespace Mono.CSharp
public Tree ()
{
- root_types = new TypeContainer (null, "", new Location (-1));
+ root_types = new RootTypes ();
decls = new Hashtable ();
- namespaces = new Hashtable ();
}
- public void RecordDecl (string name, DeclSpace ds)
+ public void RecordDecl (Namespace ns, MemberName name, DeclSpace ds)
{
- if (decls.Contains (name)){
- Report.Error (
- 101, ds.Location,
- "There is already a definition for `" + name + "'");
- DeclSpace other = (DeclSpace) decls [name];
- Report.Error (0,
- other.Location, "(Location of symbol related to previous error)");
+ DeclSpace other = (DeclSpace) decls [name];
+ if (other != null){
+ Report.SymbolRelatedToPreviousError (other);
+
+ 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);
+ else
+ Report.Error (
+ 101, ds.Location,
+ "There is already a definition for '{0}'", name);
return;
}
- decls.Add (name, ds);
- }
-
- public NamespaceEntry RecordNamespace (NamespaceEntry parent, SourceFile file, string name)
- {
- NamespaceEntry ns = new NamespaceEntry (parent, file, name);
-
- if (namespaces.Contains (file)){
- Hashtable ns_ns = (Hashtable) namespaces [file];
- if (ns_ns.Contains (ns.Name))
- return (NamespaceEntry) ns_ns [ns.Name];
- ns_ns.Add (ns.Name, ns);
- } else {
- Hashtable new_table = new Hashtable ();
- namespaces [file] = new_table;
-
- new_table.Add (ns.Name, ns);
- }
+ decls.Add (name, ds);
- return ns;
+ if (ds.Parent == Types)
+ ns.DefineName (name.Basename, ds);
}
-
+
//
// FIXME: Why are we using Types?
//
@@ -94,16 +80,35 @@ namespace Mono.CSharp
}
}
- public Hashtable Decls {
+ public DeclSpace GetDecl (MemberName name)
+ {
+ return (DeclSpace) decls [name];
+ }
+
+ public Hashtable AllDecls {
get {
return decls;
}
}
+ }
- public Hashtable Namespaces {
- get {
- return namespaces;
- }
+ public class RootTypes : TypeContainer
+ {
+ public RootTypes ()
+ : base (null, null, MemberName.Null, null, Kind.Root, Location.Null)
+ {
+ ec = new EmitContext (null, this, Location.Null, null, null, 0, false);
}
+
+ public override PendingImplementation GetPendingImplementations ()
+ {
+ throw new InvalidOperationException ();
+ }
+
+ public override bool IsClsComplianceRequired (DeclSpace ds)
+ {
+ return true;
+ }
+
}
}