2 // rootcontext.cs: keeps track of our tree representation, and assemblies loaded.
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)
11 using System.Collections;
12 using System.Reflection;
13 using System.Reflection.Emit;
17 public class RootContext {
20 // Contains the parsed tree
25 // Contains loaded assemblies and our generated code as we go.
27 TypeManager type_manager;
30 // The System.Reflection.Emit CodeGenerator
39 type_manager = new TypeManager ();
42 public TypeManager TypeManager {
54 public CilCodeGen CodeGen {
61 // Temporary hack, we should probably
62 // intialize `cg' rather than depending on
63 // external initialization of it.
66 mb = cg.ModuleBuilder;
71 // Creates the Interface @iface using the ModuleBuilder
74 // Resolve recursively dependencies.
76 bool CreateInterface (Interface iface)
79 string name = iface.Name;
84 iface.InTransit = true;
85 tb = mb.DefineType (name,
86 TypeAttributes.Interface |
87 TypeAttributes.Public |
88 TypeAttributes.Abstract);
90 iface.Definition = tb;
93 // if Recursive_Def (child) == false
94 // error (child.Name recursive def with iface.Name)
96 type_manager.AddType (name, tb);
98 iface.InTransit = false;
102 public void ResolveInterfaceBases ()
104 ArrayList ifaces = tree.Interfaces;
106 foreach (Interface iface in ifaces){
107 string name = iface.Name;
109 DefineInterface (iface);
113 public void ResolveClassBases ()