[csharp] repl using statement fix + support for --fatal
authorMiguel de Icaza <miguel@gnome.org>
Sat, 22 Jan 2011 00:55:30 +0000 (19:55 -0500)
committerMiguel de Icaza <miguel@gnome.org>
Sat, 22 Jan 2011 00:55:30 +0000 (19:55 -0500)
Fixes #638585 which kept reporting the same error on the using statements over and over
Added support for the --fatal flag to the REPL

mcs/mcs/eval.cs

index a8b22ff233bd926e2a5e633c6c1fe5bf2cf73521..4ce7958a09803ccb1c15dde1d2346b5b8ba22d66 100644 (file)
@@ -114,11 +114,13 @@ namespace Mono.CSharp
                        lock (evaluator_lock){
                                if (inited)
                                        return new string [0];
-                               
-                               driver = Driver.Create (args, false, new ConsoleReportPrinter ());
+
+                               var crp = new ConsoleReportPrinter ();
+                               driver = Driver.Create (args, false, crp);
                                if (driver == null)
                                        throw new Exception ("Failed to create compiler driver with the given arguments");
 
+                               crp.Fatal = driver.fatal_errors;
                                ctx = driver.ctx;
 
                                CompilerCallableEntryPoint.Reset ();
@@ -240,7 +242,7 @@ namespace Mono.CSharp
                                compiled = null;
                                return null;
                        }
-                       
+
                        lock (evaluator_lock){
                                if (!inited)
                                        Init ();
@@ -264,10 +266,12 @@ namespace Mono.CSharp
                                
                                if (!(parser_result is Class)){
                                        int errors = ctx.Report.Errors;
-                                       
+
                                        NamespaceEntry.VerifyAllUsing ();
                                        if (errors == ctx.Report.Errors)
                                                parser.CurrentNamespace.Extract (using_alias_list, using_list);
+                                       else
+                                               NamespaceEntry.Reset ();
                                }
 
 #if STATIC