-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Additional cleanup of the DiagnosticAnalyzerServier #80005
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
Merged
Merged
Changes from 1 commit
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
721db06
Extract class to its own file
CyrusNajmabadi 687783a
Extract remote-host dispatching code to its own file
CyrusNajmabadi 1d38cc0
Remove unnecessary 'diag incremental analyzer' indirection
CyrusNajmabadi da0c2db
Make fields private
CyrusNajmabadi 84e49a4
Merge related code and rename file
CyrusNajmabadi 0478e3e
Merge related code and rename file
CyrusNajmabadi ea82ef5
Merge function and helper
CyrusNajmabadi 0c07bd3
Rename file
CyrusNajmabadi 2b643cc
Rename files
CyrusNajmabadi 00592e3
Name methods to make it clear where they run
CyrusNajmabadi bcdad14
Update tests
CyrusNajmabadi 67b117a
Expose through test accessor
CyrusNajmabadi 4a0c3d5
Inline methods
CyrusNajmabadi 53ba623
Extract type into its own file and rename file
CyrusNajmabadi 644a8a0
Rename file
CyrusNajmabadi 575fc07
Move files up one directory
CyrusNajmabadi ca1b7c4
Use immutable arrays
CyrusNajmabadi a37c8d6
Remove 'state manager' indirection
CyrusNajmabadi 2052db0
inline method
CyrusNajmabadi 3004968
Simply arguments
CyrusNajmabadi 693a77a
Disposable buildrs
CyrusNajmabadi 4ed8d81
Switch to a non-async interlocked update for our dictionaries
CyrusNajmabadi d3b74d7
Merge branch 'main' into diagCleanup
CyrusNajmabadi File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
38 changes: 38 additions & 0 deletions
38
...atures/Core/Portable/Diagnostics/Service/EngineV2/ChecksumAndAnalyzersEqualityComparer.cs
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| // Licensed to the .NET Foundation under one or more agreements. | ||
| // The .NET Foundation licenses this file to you under the MIT license. | ||
| // See the LICENSE file in the project root for more information. | ||
|
|
||
| using System.Collections.Generic; | ||
| using System.Collections.Immutable; | ||
| using Roslyn.Utilities; | ||
|
|
||
| namespace Microsoft.CodeAnalysis.Diagnostics; | ||
|
|
||
| internal sealed partial class DiagnosticAnalyzerService | ||
| { | ||
| private sealed class ChecksumAndAnalyzersEqualityComparer | ||
| : IEqualityComparer<(Checksum checksum, ImmutableArray<DiagnosticAnalyzer> analyzers)> | ||
| { | ||
| public static readonly ChecksumAndAnalyzersEqualityComparer Instance = new(); | ||
|
|
||
| public bool Equals((Checksum checksum, ImmutableArray<DiagnosticAnalyzer> analyzers) x, (Checksum checksum, ImmutableArray<DiagnosticAnalyzer> analyzers) y) | ||
| { | ||
| if (x.checksum != y.checksum) | ||
| return false; | ||
|
|
||
| // Fast path for when the analyzers are the same reference. | ||
| return x.analyzers == y.analyzers || x.analyzers.SetEquals(y.analyzers); | ||
| } | ||
|
|
||
| public int GetHashCode((Checksum checksum, ImmutableArray<DiagnosticAnalyzer> analyzers) obj) | ||
| { | ||
| var hashCode = obj.checksum.GetHashCode(); | ||
|
|
||
| // Use addition so that we're resilient to any order for the analyzers. | ||
| foreach (var analyzer in obj.analyzers) | ||
| hashCode += analyzer.GetHashCode(); | ||
|
|
||
| return hashCode; | ||
| } | ||
| } | ||
| } |
This file contains hidden or 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 hidden or 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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Not sure the name of this file is right.