Skip to content

Conversation

@joperezr
Copy link
Member

@joperezr joperezr commented Mar 1, 2022

fixes #61425

This adds the remaining overloads for Count which work over the passed in span.

cc: @stephentoub @danmoseley

@ghost
Copy link

ghost commented Mar 1, 2022

Note regarding the new-api-needs-documentation label:

This serves as a reminder for when your PR is modifying a ref *.cs file and adding/modifying public APIs, to please make sure the API implementation in the src *.cs file is documented with triple slash comments, so the PR reviewers can sign off that change.

@ghost ghost assigned joperezr Mar 1, 2022
@ghost
Copy link

ghost commented Mar 1, 2022

Tagging subscribers to this area: @dotnet/area-system-text-regularexpressions
See info in area-owners.md if you want to be subscribed.

Issue Details

fixes #61425

This adds the remaining overloads for Count which work over the passed in span.

cc: @stephentoub @danmoseley

Author: joperezr
Assignees: -
Labels:

area-System.Text.RegularExpressions, new-api-needs-documentation

Milestone: -

@joperezr
Copy link
Member Author

joperezr commented Mar 4, 2022

The failures are unrelated (test failures of DLLImportGenerator which have been fixed in main). I'll rebase in order to be able to get a clean CI.

{
runner.runtext = null; // drop reference to text to avoid keeping it alive in a cache.
_runner = runner;
}
Copy link
Member

@stephentoub stephentoub Mar 7, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not for this PR, but subsequently I think we should delete the try/finally. We never expect exceptions to come out of the execution, and if they do, the worst that happens is we lose the runner instance. Same with the other overloads.

match.Text = null;
}
return;
if (usingStringOverload && reuseMatchObject)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Assigning null is pretty cheap. Do we functionally need this usingStringOverload, or could we just always null out match.Text if reuseMatchObject? If there's negligible perf difference, I'd rather keep it simpler. Might even be a tad faster by not having the extra argument and branch.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, I missed this comment will send a short follow up addressing this one

@stephentoub stephentoub merged commit 0da5545 into dotnet:main Mar 8, 2022
@joperezr joperezr deleted the CountSpan branch April 6, 2022 16:59
@ghost ghost locked as resolved and limited conversation to collaborators May 6, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[API Proposal]: Regex.Count

2 participants