@@ -13,60 +13,57 @@ namespace Microsoft.CodeAnalysis;
1313
1414public readonly struct SolutionChanges
1515{
16- private readonly Solution _newSolution ;
17- private readonly Solution _oldSolution ;
18-
19- internal Solution OldSolution => _oldSolution ;
20- internal Solution NewSolution => _newSolution ;
16+ internal Solution OldSolution { get ; }
17+ internal Solution NewSolution { get ; }
2118
2219 internal SolutionChanges ( Solution newSolution , Solution oldSolution )
2320 {
24- _newSolution = newSolution ;
25- _oldSolution = oldSolution ;
21+ NewSolution = newSolution ;
22+ OldSolution = oldSolution ;
2623 }
2724
2825 public IEnumerable < Project > GetAddedProjects ( )
2926 {
30- foreach ( var id in _newSolution . ProjectIds )
27+ foreach ( var id in NewSolution . ProjectIds )
3128 {
32- if ( ! _oldSolution . ContainsProject ( id ) )
29+ if ( ! OldSolution . ContainsProject ( id ) )
3330 {
34- yield return _newSolution . GetRequiredProject ( id ) ;
31+ yield return NewSolution . GetRequiredProject ( id ) ;
3532 }
3633 }
3734 }
3835
3936 public IEnumerable < ProjectChanges > GetProjectChanges ( )
4037 {
41- var old = _oldSolution ;
38+ var old = OldSolution ;
4239
4340 // if the project states are different then there is a change.
44- foreach ( var id in _newSolution . ProjectIds )
41+ foreach ( var id in NewSolution . ProjectIds )
4542 {
46- var newState = _newSolution . GetProjectState ( id ) ;
43+ var newState = NewSolution . GetProjectState ( id ) ;
4744 var oldState = old . GetProjectState ( id ) ;
4845 if ( oldState != null && newState != null && newState != oldState )
4946 {
50- yield return _newSolution . GetRequiredProject ( id ) . GetChanges ( _oldSolution . GetRequiredProject ( id ) ) ;
47+ yield return NewSolution . GetRequiredProject ( id ) . GetChanges ( OldSolution . GetRequiredProject ( id ) ) ;
5148 }
5249 }
5350 }
5451
5552 public IEnumerable < Project > GetRemovedProjects ( )
5653 {
57- foreach ( var id in _oldSolution . ProjectIds )
54+ foreach ( var id in OldSolution . ProjectIds )
5855 {
59- if ( ! _newSolution . ContainsProject ( id ) )
56+ if ( ! NewSolution . ContainsProject ( id ) )
6057 {
61- yield return _oldSolution . GetRequiredProject ( id ) ;
58+ yield return OldSolution . GetRequiredProject ( id ) ;
6259 }
6360 }
6461 }
6562
6663 public IEnumerable < AnalyzerReference > GetAddedAnalyzerReferences ( )
6764 {
68- var oldAnalyzerReferences = new HashSet < AnalyzerReference > ( _oldSolution . AnalyzerReferences ) ;
69- foreach ( var analyzerReference in _newSolution . AnalyzerReferences )
65+ var oldAnalyzerReferences = new HashSet < AnalyzerReference > ( OldSolution . AnalyzerReferences ) ;
66+ foreach ( var analyzerReference in NewSolution . AnalyzerReferences )
7067 {
7168 if ( ! oldAnalyzerReferences . Contains ( analyzerReference ) )
7269 {
@@ -77,8 +74,8 @@ public IEnumerable<AnalyzerReference> GetAddedAnalyzerReferences()
7774
7875 public IEnumerable < AnalyzerReference > GetRemovedAnalyzerReferences ( )
7976 {
80- var newAnalyzerReferences = new HashSet < AnalyzerReference > ( _newSolution . AnalyzerReferences ) ;
81- foreach ( var analyzerReference in _oldSolution . AnalyzerReferences )
77+ var newAnalyzerReferences = new HashSet < AnalyzerReference > ( NewSolution . AnalyzerReferences ) ;
78+ foreach ( var analyzerReference in OldSolution . AnalyzerReferences )
8279 {
8380 if ( ! newAnalyzerReferences . Contains ( analyzerReference ) )
8481 {
@@ -97,18 +94,18 @@ public IEnumerable<AnalyzerReference> GetRemovedAnalyzerReferences()
9794 /// </remarks>
9895 internal IEnumerable < DocumentId > GetExplicitlyChangedSourceGeneratedDocuments ( )
9996 {
100- if ( _newSolution . CompilationState . FrozenSourceGeneratedDocumentStates . IsEmpty )
97+ if ( NewSolution . CompilationState . FrozenSourceGeneratedDocumentStates . IsEmpty )
10198 return [ ] ;
10299
103100 using var _ = ArrayBuilder < SourceGeneratedDocumentState > . GetInstance ( out var oldStateBuilder ) ;
104- foreach ( var ( id , _) in _newSolution . CompilationState . FrozenSourceGeneratedDocumentStates . States )
101+ foreach ( var ( id , _) in NewSolution . CompilationState . FrozenSourceGeneratedDocumentStates . States )
105102 {
106- var oldState = _oldSolution . CompilationState . TryGetSourceGeneratedDocumentStateForAlreadyGeneratedId ( id ) ;
103+ var oldState = OldSolution . CompilationState . TryGetSourceGeneratedDocumentStateForAlreadyGeneratedId ( id ) ;
107104 oldStateBuilder . AddIfNotNull ( oldState ) ;
108105 }
109106
110107 var oldStates = new TextDocumentStates < SourceGeneratedDocumentState > ( oldStateBuilder ) ;
111- return _newSolution . CompilationState . FrozenSourceGeneratedDocumentStates . GetChangedStateIds (
108+ return NewSolution . CompilationState . FrozenSourceGeneratedDocumentStates . GetChangedStateIds (
112109 oldStates ,
113110 ignoreUnchangedContent : true ,
114111 ignoreUnchangeableDocuments : false ) ;
0 commit comments