Author: miguel
Date: 2005-04-10 11:51:36 -0400 (Sun, 10 Apr 2005)
New Revision: 42758

Modified:
   trunk/mcs/errors/TestRunner.cs
   trunk/mcs/mcs/ChangeLog
   trunk/mcs/mcs/class.cs
   trunk/mcs/mcs/driver.cs
   trunk/mcs/mcs/report.cs
Log:
2005-04-10  Miguel de Icaza  <[EMAIL PROTECTED]>

        * driver.cs (CompilerCallableEntryPoint.InvokeCompiler): Always
        reset after execution;   Take a TextWriter argument for the
        output.

        * report.cs: Use the error stream instead of hardcoding stderr. 




Modified: trunk/mcs/errors/TestRunner.cs
===================================================================
--- trunk/mcs/errors/TestRunner.cs      2005-04-10 14:34:40 UTC (rev 42757)
+++ trunk/mcs/errors/TestRunner.cs      2005-04-10 15:51:36 UTC (rev 42758)
@@ -24,7 +24,7 @@
                                BindingFlags.Static | BindingFlags.Public);
                        if (ep == null)
                                throw new MissingMethodException ("static 
InvokeCompiler");
-                       method_arg = new object [1];
+                       method_arg = new object [2];
                }
 
                public string Output {
@@ -35,16 +35,10 @@
 
                public bool Invoke(string[] args)
                {
-                       TextWriter old_writer = Console.Error;
                        output = new StringWriter ();
-                       Console.SetError (output);
                        method_arg [0] = args;
-                       try {
-                               return (bool)ep.Invoke (null, method_arg);
-                       }
-                       finally {
-                               Console.SetError (old_writer);
-                       }
+                       method_arg [1] = output;
+                       return (bool)ep.Invoke (null, method_arg);
                }
        }
 
@@ -144,6 +138,7 @@
                        ReadWrongErrors (wrong_errors_file);
                        ITester tester;
                        try {
+                               Console.WriteLine ("Loading:" + mcs);
                                tester = new ReflectionTester 
(Assembly.LoadFile (mcs));
                        }
                        catch (Exception) {

Modified: trunk/mcs/mcs/ChangeLog
===================================================================
--- trunk/mcs/mcs/ChangeLog     2005-04-10 14:34:40 UTC (rev 42757)
+++ trunk/mcs/mcs/ChangeLog     2005-04-10 15:51:36 UTC (rev 42758)
@@ -1,3 +1,17 @@
+2005-04-10  Miguel de Icaza  <[EMAIL PROTECTED]>
+
+       * driver.cs (CompilerCallableEntryPoint.InvokeCompiler): Always
+       reset after execution;   Take a TextWriter argument for the
+       output.
+
+       * report.cs: Use the error stream instead of hardcoding stderr. 
+
+2005-04-09  Miguel de Icaza  <[EMAIL PROTECTED]>
+
+       * class.cs: Reduce code paths to test, too small of an
+       optimization to make it worth the extra testing.  Always perform
+       it. 
+
 2005-04-08  Raja R Harinath  <[EMAIL PROTECTED]>
 
        Fix #74510.

Modified: trunk/mcs/mcs/class.cs
===================================================================
--- trunk/mcs/mcs/class.cs      2005-04-10 14:34:40 UTC (rev 42757)
+++ trunk/mcs/mcs/class.cs      2005-04-10 15:51:36 UTC (rev 42758)
@@ -879,12 +879,10 @@
                                if (a == null)
                                        return false;
 
-                               if (RootContext.Optimize) {
-                                       Constant c = e as Constant;
-                                       if (c != null) {
-                                               if (c.IsDefaultValue)
-                                                       continue;
-                                       }
+                               Constant c = e as Constant;
+                               if (c != null) {
+                                       if (c.IsDefaultValue)
+                                               continue;
                                }
 
                                a.EmitStatement (ec);

Modified: trunk/mcs/mcs/driver.cs
===================================================================
--- trunk/mcs/mcs/driver.cs     2005-04-10 14:34:40 UTC (rev 42757)
+++ trunk/mcs/mcs/driver.cs     2005-04-10 15:51:36 UTC (rev 42758)
@@ -1765,16 +1765,16 @@
        public class CompilerCallableEntryPoint : MarshalByRefObject {
                static bool used = false;
                
-               public static bool InvokeCompiler (string [] args)
+               public static bool InvokeCompiler (string [] args, TextWriter 
error)
                {
-                       if (used)
-                               Reset ();
-                       else
-                               used = true;
+                       Report.Stderr = error;
+                       bool ret = Driver.MainDriver (args) && Report.Errors == 
0;
+                       Report.Stderr = Console.Error;
 
-                       return Driver.MainDriver (args) && Report.Errors == 0;
+                       Reset ();
+                       return ret;
                }
-
+               
                static void Reset ()
                {
                        Driver.Reset ();

Modified: trunk/mcs/mcs/report.cs
===================================================================
--- trunk/mcs/mcs/report.cs     2005-04-10 14:34:40 UTC (rev 42757)
+++ trunk/mcs/mcs/report.cs     2005-04-10 15:51:36 UTC (rev 42758)
@@ -10,6 +10,7 @@
 // FIXME: currently our class library does not support custom number format 
strings
 //
 using System;
+using System.IO;
 using System.Text;
 using System.Collections;
 using System.Collections.Specialized;
@@ -47,6 +48,8 @@
                ///   Whether to dump a stack trace on errors. 
                /// </summary>
                static public bool Stacktrace;
+
+               static public TextWriter Stderr = Console.Error;
                
                //
                // If the 'expected' error code is reported then the
@@ -100,10 +103,10 @@
                                        msg.Append (' ');
                                }
                                msg.AppendFormat ("{0} CS{1:0000}: {2}", 
MessageType, code, text);
-                               Console.Error.WriteLine (msg.ToString ());
+                               Stderr.WriteLine (msg.ToString ());
 
                                foreach (string s in extra_information) 
-                                       Console.Error.WriteLine (s + 
MessageType);
+                                       Stderr.WriteLine (s + MessageType);
 
                                extra_information.Clear ();
 
@@ -279,7 +282,7 @@
                
                static public void LocationOfPreviousError (Location loc)
                {
-                       Console.Error.WriteLine (String.Format ("{0}({1}) 
(Location of symbol related to previous error)", loc.Name, loc.Row));
+                       Stderr.WriteLine (String.Format ("{0}({1}) (Location of 
symbol related to previous error)", loc.Name, loc.Row));
                }    
         
                static public void RuntimeMissingSupport (Location loc, string 
feature) 

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to