2 // roottypes.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 // We store here all the toplevel types that we have parsed,
22 // this is the root of all information we have parsed.
24 public sealed class RootTypes : TypeContainer
27 : base (null, null, MemberName.Null, null, Kind.Root)
29 types = new ArrayList ();
32 public override bool IsClsComplianceRequired ()
37 public override bool GetClsCompliantAttributeValue ()
39 return CodeGen.Assembly.IsClsCompliant;
42 public override string GetSignatureForError ()
47 protected override bool AddMemberType (DeclSpace ds)
49 if (!AddToContainer (ds, ds.Name))
51 ds.NamespaceEntry.NS.AddDeclSpace (ds.Basename, ds);
55 public override TypeContainer AddPartial (TypeContainer nextPart)
57 return AddPartial (nextPart, nextPart.Name);
61 public class RootDeclSpace : DeclSpace {
62 public RootDeclSpace (NamespaceEntry ns)
63 : base (ns, null, MemberName.Null, null)
65 PartialContainer = RootContext.ToplevelTypes;
68 public override AttributeTargets AttributeTargets {
69 get { throw new InternalErrorException ("should not be called"); }
72 public override string DocCommentHeader {
73 get { throw new InternalErrorException ("should not be called"); }
76 public override bool Define ()
78 throw new InternalErrorException ("should not be called");
81 public override TypeBuilder DefineType ()
83 throw new InternalErrorException ("should not be called");
86 public override MemberList FindMembers (MemberTypes mt, BindingFlags bf, MemberFilter filter, object criteria)
88 throw new InternalErrorException ("should not be called");
91 public override MemberCache MemberCache {
92 get { return PartialContainer.MemberCache; }
95 public override bool GetClsCompliantAttributeValue ()
97 return PartialContainer.GetClsCompliantAttributeValue ();
100 public override bool IsClsComplianceRequired ()
102 return PartialContainer.IsClsComplianceRequired ();