-
Notifications
You must be signed in to change notification settings - Fork 4.1k
Use spans in low level lexer char array handling code #79232
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
Conversation
char[] textBuffer, | ||
int keyStart, | ||
int keyLength, | ||
ReadOnlySpan<char> textBuffer, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
much cleaner to just pass spans all the way through. in the bowels that's all we were using the array+start+length for anyways.
|
||
return hashCode; | ||
} | ||
=> GetFNVHashCode(text.AsSpan(start, length)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we already have the overload that works on a ROS. just defer to that.
@dotnet/roslyn-compiler this is ready for review. |
{ | ||
var span = chars.AsSpan(start, len); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
note that these layers were also often using spans. Now they don't use spans partially for some op, and array+start+length for others. They use spans consistently through teh entire path.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks like some tests also need updating
Thanks. Fixed @RikkiGibson |
@chsienki ptal. |
…t#79232)" (dotnet#79245) This reverts commit bdc869e.
Found while doing work in simplifying the lexer/sliding-text-window code. As these are all about efficiently workign with contiguous segments of characters, this fell out as a nice simplification.
Note that a bunch of this code was already span-ified previously. This just pushes that spanification higher to some internal component boundary points.