diff --git a/mcs/mcs/eval.cs b/mcs/mcs/eval.cs index aa7812c6886e9..724153265a7a5 100644 --- a/mcs/mcs/eval.cs +++ b/mcs/mcs/eval.cs @@ -112,11 +112,13 @@ internal static ReportPrinter SetPrinter (ReportPrinter report_printer) 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; RootContext.ToplevelTypes = new ModuleCompiled (ctx, true); @@ -244,7 +246,7 @@ static public string Compile (string input, out CompiledMethod compiled) compiled = null; return null; } - + lock (evaluator_lock){ if (!inited) Init (); @@ -266,10 +268,12 @@ static public string Compile (string input, out CompiledMethod compiled) 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 (); } compiled = CompileBlock (parser_result as Class, parser.undo, ctx.Report);