-
Notifications
You must be signed in to change notification settings - Fork 4k
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
Use singular helper when creating checksums #72849
Conversation
@@ -74,6 +74,9 @@ public static Checksum Create(Checksum checksum1, Checksum checksum2) | |||
public static Checksum Create(Checksum checksum1, Checksum checksum2, Checksum checksum3) | |||
=> Create(stackalloc[] { checksum1, checksum2, checksum3 }); | |||
|
|||
public static Checksum Create(Checksum checksum1, Checksum checksum2, Checksum checksum3, Checksum checksum4) | |||
=> Create(stackalloc[] { checksum1, checksum2, checksum3, checksum4 }); |
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.
needed in linked pr.
@@ -205,7 +205,7 @@ private IOptionsSerializationService GetOptionsSerializationService(string langu | |||
=> _lazyLanguageSerializationService.GetOrAdd(languageName, n => _workspaceServices.GetLanguageServices(n).GetRequiredService<IOptionsSerializationService>()); | |||
|
|||
public Checksum CreateParseOptionsChecksum(ParseOptions value) | |||
=> Checksum.Create(value, this); | |||
=> Checksum.Create((value, @this: this), static (tuple, writer) => tuple.@this.SerializeParseOptions(tuple.value, writer)); |
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.
no need for the specialized helper for ParseOptions all the way in teh chcksum layer.
{ | ||
foreach (var checksum in checksums) | ||
checksum.WriteTo(writer); | ||
} |
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.
all these helpers now defer to the helper that takes a callback and passed it an ObjectWriter to write data into (which itself is then checksumed). This is teh same logic as before, just with teh common code of creating the objectwriter and checksum'ing it pushed to the helper.
return Create(stream); | ||
} | ||
|
||
public static Checksum Create(ParseOptions value, ISerializerService serializer) |
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.
this helper went away entirely. the one place that was calling it just inlined its behavior at the callsite.
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.
Extracted from #72494.