Skip to content

Commit

Permalink
Remove a boxed enumerator allocated during TryMapToHostDocumentPositi…
Browse files Browse the repository at this point in the history
…on (#9130)
  • Loading branch information
ToddGrun authored Aug 16, 2023
1 parent 36b8bfe commit f9cc2c0
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -326,8 +326,9 @@ public bool TryMapToHostDocumentPosition(IRazorGeneratedDocument generatedDocume
throw new InvalidOperationException("Cannot use document mapping service on a generated document that has a null CodeDocument.");
}

foreach (var mapping in generatedDocument.SourceMappings)
for (var i = 0; i < generatedDocument.SourceMappings.Count; i++)
{
var mapping = generatedDocument.SourceMappings[i];
var generatedSpan = mapping.GeneratedSpan;
var generatedAbsoluteIndex = generatedSpan.AbsoluteIndex;
if (generatedAbsoluteIndex <= generatedDocumentIndex)
Expand Down

0 comments on commit f9cc2c0

Please sign in to comment.