Skip to content

Commit

Permalink
Avoid delegate allocation in LinkInlineParser.MarkParentAsInactive
Browse files Browse the repository at this point in the history
  • Loading branch information
MihaZupan committed Apr 5, 2020
1 parent a99e650 commit 84ec832
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions src/Markdig/Parsers/Inlines/LinkInlineParser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -300,19 +300,19 @@ private bool TryProcessLinkOrImage(InlineProcessor inlineState, ref StringSlice

private void MarkParentAsInactive(Inline inline)
{
if (inline == null)
while (inline != null)
{
return;
}

foreach (var parent in inline.FindParentOfType<LinkDelimiterInline>())
{
if (parent.IsImage)
if (inline is LinkDelimiterInline linkInline)
{
break;
if (linkInline.IsImage)
{
break;
}

linkInline.IsActive = false;
}

parent.IsActive = false;
inline = inline.Parent;
}
}
}
Expand Down

0 comments on commit 84ec832

Please sign in to comment.