merged Sys.Web.Services 2.0 support in my branch:
[mono.git] / mcs / mcs / roottypes.cs
1 //
2 // roottypes.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 //
10 //
11
12 using System;
13 using System.Collections;
14 using System.Reflection;
15 using System.Reflection.Emit;
16 using System.IO;
17
18 namespace Mono.CSharp
19 {
20         // <summary>
21         //   We store here all the toplevel types that we have parsed,
22         //   this is the root of all information we have parsed.
23         // </summary>
24         public sealed class RootTypes : TypeContainer
25         {
26                 public RootTypes ()
27                         : base (null, null, MemberName.Null, null, Kind.Root)
28                 {
29                         types = new ArrayList ();
30                 }
31
32                 public override bool IsClsComplianceRequired ()
33                 {
34                         return true;
35                 }
36
37                 public override bool GetClsCompliantAttributeValue ()
38                 {
39                         return CodeGen.Assembly.IsClsCompliant;
40                 }
41
42                 public override string GetSignatureForError ()
43                 {
44                         return "";
45                 }
46
47                 protected override bool AddMemberType (DeclSpace ds)
48                 {
49                         if (!AddToContainer (ds, ds.Name))
50                                 return false;
51                         ds.NamespaceEntry.NS.AddDeclSpace (ds.Basename, ds);
52                         return true;
53                 }
54
55                 public override TypeContainer AddPartial (TypeContainer nextPart, bool is_interface)
56                 {
57                         return AddPartial (nextPart, nextPart.Name, is_interface);
58                 }
59         }
60
61         public class RootDeclSpace : DeclSpace {
62                 public RootDeclSpace (NamespaceEntry ns)
63                         : base (ns, null, MemberName.Null, null)
64                 {
65                         PartialContainer = RootContext.ToplevelTypes;
66                 }
67
68                 public override AttributeTargets AttributeTargets {
69                         get { throw new InternalErrorException ("should not be called"); }
70                 }
71
72                 public override string DocCommentHeader {
73                         get { throw new InternalErrorException ("should not be called"); }
74                 }
75
76                 public override bool Define ()
77                 {
78                         throw new InternalErrorException ("should not be called");
79                 }
80
81                 public override TypeBuilder DefineType ()
82                 {
83                         throw new InternalErrorException ("should not be called");
84                 }
85
86                 public override MemberList FindMembers (MemberTypes mt, BindingFlags bf, MemberFilter filter, object criteria)
87                 {
88                         throw new InternalErrorException ("should not be called");
89                 }
90
91                 public override MemberCache MemberCache {
92                         get { return PartialContainer.MemberCache; }
93                 }
94
95                 public override bool GetClsCompliantAttributeValue ()
96                 {
97                         return PartialContainer.GetClsCompliantAttributeValue ();
98                 }
99
100                 public override bool IsClsComplianceRequired ()
101                 {
102                         return PartialContainer.IsClsComplianceRequired ();
103                 }
104         }
105 }