* cs-parser.jay (GetTokenName): Mark GENERATE_COMPLETION and COMPLETE_COMPLETION...
[mono.git] / mcs / mcs / driver.cs
index e657b93efbf603208a990cd77977189a0fca2767..4476e56c6b0ccdc6dc4c5b3c82c64dcebb56311b 100644 (file)
@@ -297,16 +297,19 @@ namespace Mono.CSharp
                        if (d == null)
                                return 1;
 
-                       else if (d.Compile () && Report.Errors == 0) {
+                       if (d.Compile () && Report.Errors == 0) {
                                if (Report.Warnings > 0) {
                                        Console.WriteLine ("Compilation succeeded - {0} warning(s)", Report.Warnings);
                                }
+                               Environment.Exit (0);
                                return 0;
-                       } else {
-                               Console.WriteLine("Compilation failed: {0} error(s), {1} warnings",
-                                       Report.Errors, Report.Warnings);
-                               return 1;
                        }
+                       
+                       
+                       Console.WriteLine("Compilation failed: {0} error(s), {1} warnings",
+                               Report.Errors, Report.Warnings);
+                       Environment.Exit (1);
+                       return 1;
                }
 
                static public void LoadAssembly (string assembly, bool soft)
@@ -1595,6 +1598,9 @@ namespace Mono.CSharp
                //
                public bool Compile ()
                {
+                       // TODO: Should be passed to parser as an argument
+                       RootContext.ToplevelTypes = new ModuleContainer (RootContext.Unsafe);
+
                        Parse ();
                        if (Report.Errors > 0)
                                return false;
@@ -1638,7 +1644,7 @@ namespace Mono.CSharp
                                set_method.Invoke (CodeGen.Assembly.Builder, BindingFlags.Default, null, new object[]{true}, null);
                        }
 
-                       GlobalRootNamespace.Instance.AddModuleReference (CodeGen.Module.Builder);
+                       GlobalRootNamespace.Instance.AddModuleReference (RootContext.ToplevelTypes.Builder);
 
                        //
                        // Load assemblies required
@@ -1664,8 +1670,6 @@ namespace Mono.CSharp
                        if (timestamps)
                                ShowTime ("   Core Types done");
 
-                       CodeGen.Module.Resolve ();
-
                        //
                        // The second pass of the compiler
                        //
@@ -1987,6 +1991,7 @@ namespace Mono.CSharp
                        Location.Reset ();
                        Report.Reset ();
                        TypeManager.Reset ();
+                       PredefinedAttributes.Reset ();
                        TypeHandle.Reset ();
 
                        if (full_flag)