Skip to content

Commit

Permalink
Inline CompilationDiagnostic variables
Browse files Browse the repository at this point in the history
  • Loading branch information
KubaZ2 committed Dec 3, 2024
1 parent bc95e58 commit d77bd55
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 14 deletions.
10 changes: 4 additions & 6 deletions Bot/Sharp/Compilation/FSharpCompiler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -70,12 +70,10 @@ public async ValueTask<bool> CompileAsync(ulong operationId, string code, IColle
{
var resultDiagnostic = resultDiagnostics[i];

CompilationDiagnostic diagnostic = new((DiagnosticSeverity)resultDiagnostic.Severity.Tag,
$"FS{resultDiagnostic.ErrorNumber:D4}",
new(resultDiagnostic.StartLine - 1, resultDiagnostic.StartColumn),
resultDiagnostic.Message);

diagnostics.Add(diagnostic);
diagnostics.Add(new((DiagnosticSeverity)resultDiagnostic.Severity.Tag,
$"FS{resultDiagnostic.ErrorNumber:D4}",
new(resultDiagnostic.StartLine - 1, resultDiagnostic.StartColumn),
resultDiagnostic.Message));
}

return resultCode is 0;
Expand Down
12 changes: 4 additions & 8 deletions Bot/Sharp/Compilation/RoslynCompiler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,10 @@ public ValueTask<bool> CompileAsync(ulong operationId, string code, ICollection<
{
var resultDiagnostic = resultDiagnostics[i];

var location = resultDiagnostic.Location.GetMappedLineSpan().Span.Start;

CompilationDiagnostic diagnostic = new(resultDiagnostic.Severity,
resultDiagnostic.Id,
location,
resultDiagnostic.GetMessage());

diagnostics.Add(diagnostic);
diagnostics.Add(new(resultDiagnostic.Severity,
resultDiagnostic.Id,
resultDiagnostic.Location.GetMappedLineSpan().Span.Start,
resultDiagnostic.GetMessage()));
}

return new(result.Success);
Expand Down

0 comments on commit d77bd55

Please sign in to comment.