* Makefile (centum_tests): Add Mono.Security and
[mono.git] / mcs / gmcs / rootcontext.cs
index f045711a20d60f2d65fa8dfbec2a6a92095de724..10b5bc81e5100d7fdec3d9220915e369e01dc993 100644 (file)
@@ -42,7 +42,7 @@ namespace Mono.CSharp {
                // This is only used to tell whether `System.Object' should
                // have a base class or not.
                //
-               public static bool StdLib = true;
+               public static bool StdLib;
 
                //
                // This keeps track of the order in which classes were defined
@@ -63,9 +63,9 @@ namespace Mono.CSharp {
                
                static TypeBuilder impl_details_class;
 
-               public static int WarningLevel = 3;
+               public static int WarningLevel;
 
-               public static Target Target = Target.Exe;
+               public static Target Target;
                public static string TargetExt = ".exe";
 
                public static bool VerifyClsCompliance = true;
@@ -75,7 +75,7 @@ namespace Mono.CSharp {
                /// </summary>
                public static bool Optimize = true;
 
-               public static LanguageVersion Version = LanguageVersion.Default;
+               public static LanguageVersion Version;
 
                //
                // We keep strongname related info here because
@@ -83,20 +83,40 @@ namespace Mono.CSharp {
                //
                public static string StrongNameKeyFile;
                public static string StrongNameKeyContainer;
-               public static bool StrongNameDelaySign = false;
+               public static bool StrongNameDelaySign;
 
                //
                // If set, enable XML documentation generation
                //
                public static Documentation Documentation;
 
+               static public string MainClass;
+
                //
                // Constructor
                //
                static RootContext ()
+               {
+                       Reset ();
+               }
+
+               public static void Reset ()
                {
                        tree = new Tree ();
                        type_container_resolve_order = new ArrayList ();
+                       EntryPoint = null;
+                       WarningLevel = 3;
+                       Checked = false;
+                       Unsafe = false;
+                       StdLib = true;
+                       StrongNameKeyFile = null;
+                       StrongNameKeyContainer = null;
+                       StrongNameDelaySign = false;
+                       MainClass = null;
+                       Target = Target.Exe;
+                       Version = LanguageVersion.Default;
+                       Documentation = null;
+                       impl_details_class = null;
                }
 
                public static bool NeedsEntryPoint {
@@ -111,8 +131,6 @@ namespace Mono.CSharp {
                        }
                }
 
-               static public string MainClass;
-               
                public static void RegisterOrder (TypeContainer tc)
                {
                        type_container_resolve_order.Add (tc);
@@ -121,20 +139,13 @@ namespace Mono.CSharp {
                // 
                // The default compiler checked state
                //
-               static public bool Checked = false;
+               static public bool Checked;
 
                //
                // Whether to allow Unsafe code
                //
-               static public bool Unsafe = false;
+               static public bool Unsafe;
                
-               static string MakeFQN (string nsn, string name)
-               {
-                       if (nsn == "")
-                               return name;
-                       return String.Concat (nsn, ".", name);
-               }
-
                // <remarks>
                //   This function is used to resolve the hierarchy tree.
                //   It processes interfaces, structs and classes in that order.
@@ -154,7 +165,7 @@ namespace Mono.CSharp {
 
                        ArrayList ifaces = root.Interfaces;
                        if (ifaces != null){
-                               foreach (Interface i in ifaces) 
+                               foreach (TypeContainer i in ifaces) 
                                        i.DefineType ();
                        }
 
@@ -265,7 +276,7 @@ namespace Mono.CSharp {
                        object o = root.GetDefinition (name);
                        if (o == null){
                                Report.Error (518, "The predefined type `" + name + "' is not defined");
-                               Environment.Exit (1);
+                               return;
                        }
 
                        if (!(o is Delegate)){
@@ -375,6 +386,8 @@ namespace Mono.CSharp {
                                "System.Runtime.CompilerServices.MethodImplAttribute",
                                "System.Runtime.InteropServices.MarshalAsAttribute",
                                "System.Runtime.CompilerServices.NewConstraintAttribute",
+                               "System.Runtime.CompilerServices.CompilerGeneratedAttribute",
+                               "System.Runtime.CompilerServices.FixedBufferAttribute",
                                "System.Diagnostics.ConditionalAttribute",
                                "System.ObsoleteAttribute",
                                "System.ParamArrayAttribute",
@@ -386,10 +399,12 @@ namespace Mono.CSharp {
                                "System.Runtime.InteropServices.OutAttribute",
                                "System.Runtime.InteropServices.StructLayoutAttribute",
                                "System.Runtime.InteropServices.FieldOffsetAttribute",
+                               "System.Runtime.InteropServices.DefaultCharSetAttribute",
                                "System.InvalidOperationException",
                                "System.NotSupportedException",
                                "System.MarshalByRefObject",
-                               "System.Security.CodeAccessPermission"
+                               "System.Security.CodeAccessPermission",
+                               "System.Runtime.CompilerServices.RequiredAttributeAttribute"
                        };
 
                        foreach (string cname in classes_second_stage)
@@ -451,9 +466,7 @@ namespace Mono.CSharp {
                        //
                        if (helper_classes != null){
                                foreach (TypeBuilder type_builder in helper_classes) {
-#if NET_2_0
                                        type_builder.SetCustomAttribute (TypeManager.compiler_generated_attr);
-#endif
                                        type_builder.CreateType ();
                                }
                        }
@@ -614,6 +627,9 @@ namespace Mono.CSharp {
                        if (type_container_resolve_order != null) {
                                foreach (TypeContainer tc in type_container_resolve_order)
                                        tc.EmitType ();
+
+                               foreach (TypeContainer tc in type_container_resolve_order)
+                                       tc.VerifyMembers ();
                        }
                        
                        if (Tree.Types.Delegates != null) {