提交 86c7d6cb 编写于 作者: S Sam Harwell 提交者: GitHub

Merge pull request #19184 from sharwell/faster-callback

Remove unnecessary delegate allocations when calling back to analyzers
...@@ -151,14 +151,17 @@ public ImmutableArray<DiagnosticDescriptor> GetOrComputeDescriptors(DiagnosticAn ...@@ -151,14 +151,17 @@ public ImmutableArray<DiagnosticDescriptor> GetOrComputeDescriptors(DiagnosticAn
var supportedDiagnostics = ImmutableArray<DiagnosticDescriptor>.Empty; var supportedDiagnostics = ImmutableArray<DiagnosticDescriptor>.Empty;
// Catch Exception from analyzer.SupportedDiagnostics // Catch Exception from analyzer.SupportedDiagnostics
analyzerExecutor.ExecuteAndCatchIfThrows(analyzer, () => analyzerExecutor.ExecuteAndCatchIfThrows(
{ analyzer,
var supportedDiagnosticsLocal = analyzer.SupportedDiagnostics; _ =>
if (!supportedDiagnosticsLocal.IsDefaultOrEmpty)
{ {
supportedDiagnostics = supportedDiagnosticsLocal; var supportedDiagnosticsLocal = analyzer.SupportedDiagnostics;
} if (!supportedDiagnosticsLocal.IsDefaultOrEmpty)
}); {
supportedDiagnostics = supportedDiagnosticsLocal;
}
},
argument: default(object));
// Force evaluate and report exception diagnostics from LocalizableString.ToString(). // Force evaluate and report exception diagnostics from LocalizableString.ToString().
Action<Exception, DiagnosticAnalyzer, Diagnostic> onAnalyzerException = analyzerExecutor.OnAnalyzerException; Action<Exception, DiagnosticAnalyzer, Diagnostic> onAnalyzerException = analyzerExecutor.OnAnalyzerException;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册