Skip to content

Commit

Permalink
Merge pull request #45289 from Youssef1313/patch-4
Browse files Browse the repository at this point in the history
Call GetSyntaxRootAsync once outside loop
  • Loading branch information
CyrusNajmabadi authored Jun 19, 2020
2 parents 09d5725 + f6e1d3c commit 6be131e
Showing 1 changed file with 1 addition and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,9 @@ protected override async Task FixAllAsync(
CancellationToken cancellationToken)
{
var declarators = new List<TSymbolSyntax>();

var root = await document.GetSyntaxRootAsync(cancellationToken).ConfigureAwait(false);
foreach (var diagnostic in diagnostics)
{
var root = await document.GetSyntaxRootAsync(cancellationToken).ConfigureAwait(false);
var diagnosticSpan = diagnostic.Location.SourceSpan;

declarators.Add(root.FindNode(diagnosticSpan, getInnermostNodeForTie: true).FirstAncestorOrSelf<TSymbolSyntax>());
Expand Down

0 comments on commit 6be131e

Please sign in to comment.