X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=blobdiff_plain;ds=sidebyside;f=mcs%2Fmcs%2Frootcontext.cs;h=e6c2c4b2f1dc5ea543ad89cab34d2add27f13dc4;hb=cd5d5a8abe403c911b2a348122d9bc2f75b350c4;hp=5962a33ee5f2dd7b86bb6cea94b5e1cbc0d4033b;hpb=e5fe6c826dda8b351c309ba62d0032cc0bcd926e;p=mono.git diff --git a/mcs/mcs/rootcontext.cs b/mcs/mcs/rootcontext.cs index 5962a33ee5f..e6c2c4b2f1d 100644 --- a/mcs/mcs/rootcontext.cs +++ b/mcs/mcs/rootcontext.cs @@ -102,7 +102,7 @@ namespace Mono.CSharp { // // Contains the parsed tree // - static RootTypes root; + static ModuleContainer root; // // This hashtable contains all of the #definitions across the source code @@ -145,7 +145,7 @@ namespace Mono.CSharp { public static void Reset (bool full) { if (full) - root = new RootTypes (); + root = null; type_container_resolve_order = new ArrayList (); EntryPoint = null; @@ -167,8 +167,8 @@ namespace Mono.CSharp { // // Setup default defines // - RootContext.AllDefines = new ArrayList (); - RootContext.AddConditional ("__MonoCS__"); + AllDefines = new ArrayList (); + AddConditional ("__MonoCS__"); } public static void AddConditional (string p) @@ -183,8 +183,9 @@ namespace Mono.CSharp { return AllDefines.Contains (value); } - static public RootTypes ToplevelTypes { + static public ModuleContainer ToplevelTypes { get { return root; } + set { root = value; } } public static void RegisterOrder (TypeContainer tc) @@ -201,6 +202,8 @@ namespace Mono.CSharp { // static public void ResolveTree () { + root.Resolve (); + // // Interfaces are processed next, as classes and // structs might inherit from an object or implement @@ -257,9 +260,7 @@ namespace Mono.CSharp { // 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 (); } } @@ -312,8 +313,13 @@ namespace Mono.CSharp { 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; @@ -351,7 +357,7 @@ namespace Mono.CSharp { } CodeGen.Assembly.Emit (root); - CodeGen.Module.Emit (root); + root.Emit (); } // @@ -384,7 +390,7 @@ namespace Mono.CSharp { FieldBuilder fb; if (impl_details_class == null){ - impl_details_class = CodeGen.Module.Builder.DefineType ( + impl_details_class = ToplevelTypes.Builder.DefineType ( "", TypeAttributes.NotPublic, TypeManager.object_type);