2 // tree.cs: keeps a tree representation of the generated code
4 // Author: Miguel de Icaza (miguel@gnu.org)
6 // Licensed under the terms of the GNU GPL
8 // (C) 2001 Ximian, Inc (http://www.ximian.com)
13 using System.Collections;
14 using System.Reflection;
15 using System.Reflection.Emit;
18 namespace Mono.MonoBASIC
21 public interface ITreeDump {
22 int Dump (Tree tree, StreamWriter output);
23 void ParseOptions (string options);
28 // We store here all the toplevel types that we have parsed,
29 // this is the root of all information we have parsed.
34 TypeContainer root_types;
37 // Keeps track of namespaces defined in the source code
42 // Keeps track of all the types definied (classes, structs, ifaces, enums)
48 root_types = new TypeContainer (null, "", null, new Location (-1, 0));
50 decls = new Hashtable ();
51 namespaces = new Hashtable ();
54 public void RecordDecl (string name, DeclSpace ds)
56 if (decls.Contains (name)){
59 "There is already a definition for `" + name + "'");
60 DeclSpace other = (DeclSpace) decls [name];
62 other.Location, "(Location of symbol related to previous error)");
68 public Namespace RecordNamespace (Namespace parent, string file, string name)
70 Namespace ns = new Namespace (parent, name);
72 if (namespaces.Contains (file)){
73 Hashtable ns_ns = (Hashtable) namespaces [file];
75 if (ns_ns.Contains (ns.Name))
76 return (Namespace) ns_ns [ns.Name];
77 ns_ns.Add (ns.Name, ns);
79 Hashtable new_table = new Hashtable ();
80 namespaces [file] = new_table;
82 new_table.Add (ns.Name, ns);
89 // FIXME: Why are we using Types?
91 public TypeContainer Types {
97 public Hashtable Decls {
103 public Hashtable Namespaces {