2006-04-27 Jonathan Chambers <jonathan.chambers@ansys.com>
[mcs.git] / mcs / tree.cs
blobd6a822811d0607d92699309e3630985d8c3d9fe0
1 //
2 // tree.cs: keeps a tree representation of the generated code
3 //
4 // Author: Miguel de Icaza (miguel@gnu.org)
5 //
6 // Licensed under the terms of the GNU GPL
7 //
8 // (C) 2001 Ximian, Inc (http://www.ximian.com)
9 //
12 using System;
13 using System.Collections;
14 using System.Reflection;
15 using System.Reflection.Emit;
16 using System.IO;
18 namespace Mono.CSharp
21 public interface ITreeDump {
22 int Dump (Tree tree, StreamWriter output);
23 void ParseOptions (string options);
26 // <summary>
27 //
28 // We store here all the toplevel types that we have parsed,
29 // this is the root of all information we have parsed.
30 //
31 // </summary>
33 public class Tree {
34 TypeContainer root_types;
36 public Tree ()
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
57 public RootTypes ()
58 : base (null, null, MemberName.Null, null, Kind.Root)
60 types = new ArrayList ();
63 public override bool IsClsComplianceRequired ()
65 return true;
68 public override bool GetClsCompliantAttributeValue ()
70 return CodeGen.Assembly.IsClsCompliant;
73 public override string GetSignatureForError ()
75 return "";
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);