Skip to content

Commit

Permalink
[csharp] repl using statement fix + support for --fatal
Browse files Browse the repository at this point in the history
Fixes #638585 which kept reporting the same error on the using statements over and over
Added support for the --fatal flag to the REPL
  • Loading branch information
migueldeicaza committed Jan 22, 2011
1 parent a9d4d0b commit bfdc166
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions mcs/mcs/eval.cs
Expand Up @@ -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);
Expand Down Expand Up @@ -244,7 +246,7 @@ static public string Compile (string input, out CompiledMethod compiled)
compiled = null;
return null;
}

lock (evaluator_lock){
if (!inited)
Init ();
Expand All @@ -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);
Expand Down

0 comments on commit bfdc166

Please sign in to comment.