Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove unnecessary array allocations in SelectionProcessor/SubTreeProcessor #9597

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
remove static array fields as they're not used for anything
  • Loading branch information
h3xds1nz committed Aug 18, 2024
commit 5faaede1eb0455ce145ffa6c0dc9d0a2e310ab3a
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,7 @@ public override Object ResolveLocatorPart(ContentLocatorPart locatorPart, Depend
/// Returns a list of XmlQualifiedNames representing the
/// the locator parts this processor can resolve/generate.
/// </summary>
public override ReadOnlySpan<XmlQualifiedName> GetLocatorPartTypes() => s_locatorPartTypeNames;
public override ReadOnlySpan<XmlQualifiedName> GetLocatorPartTypes() => new(in s_fixedTextElementName);

#endregion Public Methods

Expand Down Expand Up @@ -623,9 +623,6 @@ private static bool GetTextViewRange(DocumentPage documentPage, out ITextPointer
// Name of locator part element
private static readonly XmlQualifiedName s_fixedTextElementName = new("FixedTextRange", AnnotationXmlConstants.Namespaces.BaseSchemaNamespace);

// ContentLocatorPart types understood by this processor
private static readonly XmlQualifiedName[] s_locatorPartTypeNames = [s_fixedTextElementName];

#endregion Private Fields

#region Internal Classes
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ public override Object ResolveLocatorPart(ContentLocatorPart locatorPart, Depend
/// Returns a list of XmlQualifiedNames representing the
/// the locator parts this processor can resolve/generate.
/// </summary>
public override ReadOnlySpan<XmlQualifiedName> GetLocatorPartTypes() => s_locatorPartTypeNames;
public override ReadOnlySpan<XmlQualifiedName> GetLocatorPartTypes() => new(in s_characterRangeElementName);

#endregion Public Methods

Expand Down Expand Up @@ -555,9 +555,6 @@ private void GetTextSegmentValues(TextSegment segment, ITextPointer elementStart

#region Private Fields

// ContentLocatorPart types understood by this processor
private static readonly XmlQualifiedName[] s_locatorPartTypeNames = [s_characterRangeElementName];

// Optional DPV - used in printing case when there is no viewer available
private DocumentPageView _targetPage = null;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ public override Object ResolveLocatorPart(ContentLocatorPart locatorPart, Depend
/// the locator parts this processor can generate. This processor
/// does not resolve these ContentLocatorParts - only generates them.
/// </summary>
public override ReadOnlySpan<XmlQualifiedName> GetLocatorPartTypes() => s_locatorPartTypeNames;
public override ReadOnlySpan<XmlQualifiedName> GetLocatorPartTypes() => ReadOnlySpan<XmlQualifiedName>.Empty;

#endregion Public Methods

Expand Down Expand Up @@ -288,9 +288,6 @@ private ITextView VerifySelection(object selection)

#region Private Fields

// ContentLocator part types understood by this processor
private static readonly XmlQualifiedName[] s_locatorPartTypeNames = Array.Empty<XmlQualifiedName>();

#endregion Private Fields
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ public override Object ResolveLocatorPart(ContentLocatorPart locatorPart, Depend
/// Returns a list of XmlQualifiedNames representing the
/// the locator parts this processor can resolve/generate.
/// </summary>
public override ReadOnlySpan<XmlQualifiedName> GetLocatorPartTypes() => s_locatorPartTypeNames;
public override ReadOnlySpan<XmlQualifiedName> GetLocatorPartTypes() => ReadOnlySpan<XmlQualifiedName>.Empty;

#endregion Public Methods

Expand Down Expand Up @@ -205,9 +205,6 @@ public override Object ResolveLocatorPart(ContentLocatorPart locatorPart, Depend

#region Private Fields

// ContentLocatorPart types understood by this processor
private static readonly XmlQualifiedName[] s_locatorPartTypeNames = Array.Empty<XmlQualifiedName>();

#endregion Private Fields
}
}