//
// Contains the parsed tree
//
- static RootTypes root;
+ static ModuleContainer root;
//
// This hashtable contains all of the #definitions across the source code
public static void Reset (bool full)
{
if (full)
- root = new RootTypes ();
+ root = null;
type_container_resolve_order = new ArrayList ();
EntryPoint = null;
//
// Setup default defines
//
- RootContext.AllDefines = new ArrayList ();
- RootContext.AddConditional ("__MonoCS__");
+ AllDefines = new ArrayList ();
+ AddConditional ("__MonoCS__");
}
public static void AddConditional (string p)
return AllDefines.Contains (value);
}
- static public RootTypes ToplevelTypes {
+ static public ModuleContainer ToplevelTypes {
get { return root; }
+ set { root = value; }
}
public static void RegisterOrder (TypeContainer tc)
// </remarks>
static public void ResolveTree ()
{
+ root.Resolve ();
+
//
// Interfaces are processed next, as classes and
// structs might inherit from an object or implement
//
if (helper_classes != null){
foreach (TypeBuilder type_builder in helper_classes) {
-#if GMCS_SOURCE
- type_builder.SetCustomAttribute (TypeManager.GetCompilerGeneratedAttribute (Location.Null));
-#endif
+ PredefinedAttributes.Get.CompilerGenerated.EmitAttribute (type_builder);
type_builder.CreateType ();
}
}
if (type_container_resolve_order != null){
foreach (TypeContainer tc in type_container_resolve_order)
tc.ResolveType ();
- foreach (TypeContainer tc in type_container_resolve_order)
- tc.Define ();
+ foreach (TypeContainer tc in type_container_resolve_order) {
+ try {
+ tc.Define ();
+ } catch (Exception e) {
+ throw new InternalErrorException (tc, e);
+ }
+ }
}
ArrayList delegates = root.Delegates;
}
CodeGen.Assembly.Emit (root);
- CodeGen.Module.Emit (root);
+ root.Emit ();
}
//
FieldBuilder fb;
if (impl_details_class == null){
- impl_details_class = CodeGen.Module.Builder.DefineType (
+ impl_details_class = ToplevelTypes.Builder.DefineType (
"<PrivateImplementationDetails>",
TypeAttributes.NotPublic,
TypeManager.object_type);