Remove DisplayDiagnostics() from RoslynScriptEngine.cs
This commit is contained in:
Родитель
fc968fbb1e
Коммит
c2766fd479
|
@ -100,13 +100,8 @@ namespace Microsoft.Spark.CSharp
|
|||
|
||||
if (hasErrors)
|
||||
{
|
||||
DisplayDiagnostics(diagnostics);
|
||||
var message = new StringBuilder();
|
||||
foreach (var diagnostic in diagnostics)
|
||||
{
|
||||
message.Append("[").Append(diagnostic.Severity).Append("] ").Append(": ").Append(diagnostic).Append("\r\n");
|
||||
}
|
||||
return new ScriptResult(compilationException: new Exception(message.ToString()));
|
||||
var diagnosticMessages = diagnostics.Select(diagnostic => "[" + diagnostic.Severity + "] " + diagnostic).ToList();
|
||||
return new ScriptResult(compilationException: new Exception(string.Join("\r\n", diagnosticMessages)));
|
||||
}
|
||||
|
||||
var compilationDump = DumpCompilation(script.GetCompilation());
|
||||
|
@ -146,23 +141,6 @@ namespace Microsoft.Spark.CSharp
|
|||
}
|
||||
}
|
||||
|
||||
internal void DisplayDiagnostics(IEnumerable<Diagnostic> diagnostics)
|
||||
{
|
||||
// refer to http://source.roslyn.io/#Microsoft.CodeAnalysis.Scripting/Hosting/CommandLine/CommandLineRunner.cs,268
|
||||
try
|
||||
{
|
||||
foreach (var diagnostic in diagnostics)
|
||||
{
|
||||
Console.ForegroundColor = (diagnostic.Severity == DiagnosticSeverity.Error) ? ConsoleColor.Red : ConsoleColor.Yellow;
|
||||
Console.WriteLine(diagnostic.ToString());
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
Console.ResetColor();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Check whether the given code is a complete submission
|
||||
/// </summary>
|
||||
|
|
Загрузка…
Ссылка в новой задаче