forked from dotnet/runtime
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Split AsnReader into a class and a ref struct (AsnValueReader)
Largely, the intent of this change was to reduce the number of temporary readers required for deeply structured payloads (`ReadSequence` returns a new reader), while still maintaining the better usability of the class; and, frankly, to understand what the impact of splitting functionality into "bare metal" and "more usable" pieces was. ``` foreach (file in AsnReader.*) { Copy/paste the entirety of the `partial class AsnReader`; Change the top version to say ref partial struct AsnValueReader; Replace all AsnReader calls in the top version to say AsnValueReader. Replace all ReadOnlyMemory in the top portion with ReadOnlySpan; Remove ArraySegment overloads from the top portion (when present); Rewrite the bottom portion to open a ref reader at the state the memory is tracking and defer work into the ref reader; Run all the existing tests to ensure that nothing broke in that piece; } ``` Once that was done, I changed the asn.xslt to generate all of the decoding in terms of AsnValueReader. This didn't change field generation from ReadOnlyMemory to ReadOnlySpan (and the types from struct to ref struct)--a change that could be done later--but instead added a new ReadOnlyMemory input parameter so it can use Overlaps to slice the memory as appropriate (with a fallback of ToArray()). While I was editing asn.xslt I fixed probably all of the whitespace errors it generated. I still left the "stylecop, have no opinion about whitespace" pragma since the generator isn't run as part of most people's (or the official) builds. This also turns on the nullability checks in all of the generated structs.
- Loading branch information
Showing
114 changed files
with
4,563 additions
and
2,382 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.