+2004-07-20 Martin Baulig <martin@ximian.com>
+
+ * tree.cs (Tree.RecordNamespace): Removed.
+ (Tree.Namespaces): Removed.
+
+ * rootcontext.cs (RootContext.IsNamespace): Removed.
+
+ * cs-parser.jay (namespace_declaration): Just create a new
+ NamespaceEntry here.
+
2004-07-20 Martin Baulig <martin@ximian.com>
* statement.cs (ExceptionStatement): New abstract class. This is
Report.Error_T (134, lexer.Location);
}
- current_namespace = RootContext.Tree.RecordNamespace (current_namespace, file, $3.ToString (), lexer.Location);
- }
+ current_namespace = new NamespaceEntry (
+ current_namespace, file, $3.ToString (), lexer.Location);
+ }
namespace_body opt_semicolon
{
current_namespace = current_namespace.Parent;
return LookupType (tc, name, true, loc);
}
- static public bool IsNamespace (string name)
- {
- Namespace ns;
-
- if (tree.Namespaces != null){
- ns = (Namespace) tree.Namespaces [name];
-
- if (ns != null)
- return true;
- }
-
- return false;
- }
-
static void Report1530 (Location loc)
{
Report.Error (1530, loc, "Keyword new not allowed for namespace elements");
public class Tree {
TypeContainer root_types;
- // <summary>
- // Keeps track of namespaces defined in the source code
- // </summary>
- Hashtable namespaces;
-
// <summary>
// Keeps track of all the types definied (classes, structs, ifaces, enums)
// </summary>
root_types = new TypeContainer ();
decls = new Hashtable ();
- namespaces = new Hashtable ();
}
DoubleHash decl_ns_name = new DoubleHash ();
return (DeclSpace) res;
}
- public NamespaceEntry RecordNamespace (NamespaceEntry parent, SourceFile file, string name, Location loc)
- {
- NamespaceEntry ns = new NamespaceEntry (parent, file, name, loc);
-
- if (namespaces.Contains (file)){
- Hashtable ns_ns = (Hashtable) namespaces [file];
-
- if (ns_ns.Contains (ns.FullName))
- return (NamespaceEntry) ns_ns [ns.FullName];
- ns_ns.Add (ns.FullName, ns);
- } else {
- Hashtable new_table = new Hashtable ();
- namespaces [file] = new_table;
-
- new_table.Add (ns.FullName, ns);
- }
-
- return ns;
- }
-
//
// FIXME: Why are we using Types?
//
return decls;
}
}
-
- public Hashtable Namespaces {
- get {
- return namespaces;
- }
- }
}
}