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;
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 all the types definied (classes, structs, ifaces, enums)
43 root_types = new RootTypes ();
45 decls = new Hashtable ();
48 public void RecordDecl (MemberName name, DeclSpace ds)
50 DeclSpace other = (DeclSpace) decls [name];
52 PartialContainer other_pc = other as PartialContainer;
53 if ((ds is TypeContainer) && (other_pc != null)) {
55 260, ds.Location, "Missing partial modifier " +
56 "on declaration of type `{0}'; another " +
57 "partial implementation of this type exists",
60 Report.LocationOfPreviousError (other.Location);
64 Report.SymbolRelatedToPreviousError (
65 other.Location, other.GetSignatureForError ());
69 "There is already a definition for `" + name + "'");
79 // FIXME: Why are we using Types?
81 public TypeContainer Types {
87 public DeclSpace GetDecl (MemberName name)
89 return (DeclSpace) decls [name];
92 public Hashtable AllDecls {
99 public class RootTypes : TypeContainer
102 : base (null, null, MemberName.Null, null, Kind.Root, Location.Null)
104 ec = new EmitContext (null, this, Location.Null, null, null, 0, false);
107 public override PendingImplementation GetPendingImplementations ()
109 throw new InvalidOperationException ();
112 public override bool IsClsComplianceRequired (DeclSpace ds)