2009-12-10 Marek Safar <marek.safar@gmail.com>
authorMarek Safar <marek.safar@gmail.com>
Thu, 10 Dec 2009 12:35:21 +0000 (12:35 -0000)
committerMarek Safar <marek.safar@gmail.com>
Thu, 10 Dec 2009 12:35:21 +0000 (12:35 -0000)
* ecore.cs: Ignore base imported methods when they are already
in method bag.

* eval.cs: Handle non-existent keys.

* report.cs, driver.cs: Make fatal work with console printer only.

svn path=/trunk/mcs/; revision=148022

mcs/mcs/ChangeLog
mcs/mcs/driver.cs
mcs/mcs/ecore.cs
mcs/mcs/eval.cs
mcs/mcs/report.cs

index a213419ebfe2093889c6e81d7b7c4bcf282ba310..54e986adba70510f7e8bd789a5646377beafde52 100644 (file)
@@ -1,3 +1,12 @@
+2009-12-10  Marek Safar  <marek.safar@gmail.com>
+
+       * ecore.cs: Ignore base imported methods when they are already
+       in method bag.
+       
+       * eval.cs: Handle non-existent keys.
+       
+       * report.cs, driver.cs: Make fatal work with console printer only.
+
 2009-12-08 Rodrigo Kumpera  <rkumpera@novell.com>
 
        * typemanager.cs (MakeGenericMethod): Fix stupid mistake.
 2009-12-08  Marek Safar  <marek.safar@gmail.com>
 
        A fix for bug #561149
-       anonymous.cs: Use actual type parameters when checking for generic
+       anonymous.cs: Use actual type parameters when checking for generic
        method host.
 
 2009-12-08  Marek Safar  <marek.safar@gmail.com>
 
        A fix for bug #561369
-       expression.cs (DoNumericPromotion): Fixed typo.
+       expression.cs (DoNumericPromotion): Fixed typo.
 
 2009-12-08  Marek Safar  <marek.safar@gmail.com>
 
index a59327a061afda0752fdd077e96ad63fa66dbc62..3674bd6ce81292db2306a2181b2610e1ec388f98 100644 (file)
@@ -68,6 +68,7 @@ namespace Mono.CSharp
                bool want_debugging_support;
                bool parse_only;
                bool timestamps;
+               bool fatal_errors;
                
                //
                // Whether to load the initial config file (what CSC.RSP has by default)
@@ -298,11 +299,13 @@ namespace Mono.CSharp
                public static int Main (string[] args)
                {
                        Location.InEmacs = Environment.GetEnvironmentVariable ("EMACS") == "t";
-
-                       Driver d = Driver.Create (args, true, new ConsoleReportPrinter ());
+                       var crp = new ConsoleReportPrinter ();
+                       Driver d = Driver.Create (args, true, crp);
                        if (d == null)
                                return 1;
 
+                       crp.Fatal = d.fatal_errors;
+
                        if (d.Compile () && d.Report.Errors == 0) {
                                if (d.Report.Warnings > 0) {
                                        Console.WriteLine ("Compilation succeeded - {0} warning(s)", d.Report.Warnings);
@@ -987,7 +990,7 @@ namespace Mono.CSharp
                                return true;
                                
                        case "--fatal":
-                               Report.Fatal = true;
+                               fatal_errors = true;
                                return true;
                                
                        case "--nowarn":
index 446ae40afb56d76177a24ab421525b3157676e79..c05da119f7a368befdcdfb476ab0b9c2522c6c26 100644 (file)
@@ -4232,6 +4232,8 @@ namespace Mono.CSharp {
                                                        candidate_overrides = new List<MethodBase> ();
                                                candidate_overrides.Add (m);
                                                m = TypeManager.TryGetBaseDefinition (m);
+                                               if (m != null && Array.Exists (Methods, l => l == m))
+                                                       continue;
                                        }
                                        if (m != null)
                                                Methods [j++] = m;
index 0176a5194a859184dc121348f0df21ed23ab9d7e..13e5652d6cd56abe8e42203b6cc2f7d5ad78ecee 100644 (file)
@@ -786,7 +786,9 @@ namespace Mono.CSharp {
 
                static internal FieldInfo LookupField (string name)
                {
-                       FieldInfo fi =  (FieldInfo) fields [name];
+                       FieldInfo fi;
+                       if (!fields.TryGetValue (name, out fi))
+                               return null;
 
                        return fi;
                }
index 63a1fab8e5b4936918dd3369aac27524ba5b3e17..af1e756bc40a2279e29e8b5e628bddafa7af2872 100644 (file)
@@ -20,12 +20,8 @@ namespace Mono.CSharp {
        //
        // Errors and warnings manager
        //
-       public class Report {
-               /// <summary>  
-               ///   Whether errors should be throw an exception
-               /// </summary>
-               public bool Fatal;
-               
+       public class Report
+       {
                /// <summary>  
                ///   Whether warnings should be considered errors
                /// </summary>
@@ -396,9 +392,6 @@ namespace Mono.CSharp {
                        extra_information.Clear ();
 
                        printer.Print (msg);
-
-                       if (Fatal)
-                               throw new Exception (msg.Text);
                }
 
                public void Error (int code, Location loc, string format, string arg)
@@ -882,6 +875,8 @@ namespace Mono.CSharp {
                {
                }
 
+               public bool Fatal { get; set; }
+
                static int NameToCode (string s)
                {
                        switch (s) {
@@ -977,6 +972,9 @@ namespace Mono.CSharp {
 
                        if (Stacktrace)
                                Console.WriteLine (FriendlyStackTrace (new StackTrace (true)));
+
+                       if (Fatal)
+                               throw new Exception (msg.Text);
                }
 
                public static string FriendlyStackTrace (Exception e)