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
;
38 root_types
= new RootTypes ();
41 public void RecordDecl (Namespace ns
, MemberName name
, DeclSpace ds
)
43 if (ds
.Parent
== root_types
)
44 ns
.AddDeclSpace (name
.Basename
, ds
);
48 // FIXME: Why are we using Types?
50 public TypeContainer Types
{
51 get { return root_types; }
55 public sealed class RootTypes
: TypeContainer
58 : base (null, null, MemberName
.Null
, null, Kind
.Root
)
60 types
= new ArrayList ();
63 public override bool IsClsComplianceRequired ()
68 public override bool GetClsCompliantAttributeValue ()
70 return CodeGen
.Assembly
.IsClsCompliant
;
73 public override string GetSignatureForError ()
78 protected override bool AddToTypeContainer (DeclSpace ds
)
80 return AddToContainer (ds
, ds
.Name
);
83 public override TypeContainer
AddPartial (TypeContainer nextPart
)
85 return AddPartial (nextPart
, nextPart
.Name
);