@@ -13,60 +13,57 @@ namespace Microsoft.CodeAnalysis;
13
13
14
14
public readonly struct SolutionChanges
15
15
{
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 ; }
21
18
22
19
internal SolutionChanges ( Solution newSolution , Solution oldSolution )
23
20
{
24
- _newSolution = newSolution ;
25
- _oldSolution = oldSolution ;
21
+ NewSolution = newSolution ;
22
+ OldSolution = oldSolution ;
26
23
}
27
24
28
25
public IEnumerable < Project > GetAddedProjects ( )
29
26
{
30
- foreach ( var id in _newSolution . ProjectIds )
27
+ foreach ( var id in NewSolution . ProjectIds )
31
28
{
32
- if ( ! _oldSolution . ContainsProject ( id ) )
29
+ if ( ! OldSolution . ContainsProject ( id ) )
33
30
{
34
- yield return _newSolution . GetRequiredProject ( id ) ;
31
+ yield return NewSolution . GetRequiredProject ( id ) ;
35
32
}
36
33
}
37
34
}
38
35
39
36
public IEnumerable < ProjectChanges > GetProjectChanges ( )
40
37
{
41
- var old = _oldSolution ;
38
+ var old = OldSolution ;
42
39
43
40
// 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 )
45
42
{
46
- var newState = _newSolution . GetProjectState ( id ) ;
43
+ var newState = NewSolution . GetProjectState ( id ) ;
47
44
var oldState = old . GetProjectState ( id ) ;
48
45
if ( oldState != null && newState != null && newState != oldState )
49
46
{
50
- yield return _newSolution . GetRequiredProject ( id ) . GetChanges ( _oldSolution . GetRequiredProject ( id ) ) ;
47
+ yield return NewSolution . GetRequiredProject ( id ) . GetChanges ( OldSolution . GetRequiredProject ( id ) ) ;
51
48
}
52
49
}
53
50
}
54
51
55
52
public IEnumerable < Project > GetRemovedProjects ( )
56
53
{
57
- foreach ( var id in _oldSolution . ProjectIds )
54
+ foreach ( var id in OldSolution . ProjectIds )
58
55
{
59
- if ( ! _newSolution . ContainsProject ( id ) )
56
+ if ( ! NewSolution . ContainsProject ( id ) )
60
57
{
61
- yield return _oldSolution . GetRequiredProject ( id ) ;
58
+ yield return OldSolution . GetRequiredProject ( id ) ;
62
59
}
63
60
}
64
61
}
65
62
66
63
public IEnumerable < AnalyzerReference > GetAddedAnalyzerReferences ( )
67
64
{
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 )
70
67
{
71
68
if ( ! oldAnalyzerReferences . Contains ( analyzerReference ) )
72
69
{
@@ -77,8 +74,8 @@ public IEnumerable<AnalyzerReference> GetAddedAnalyzerReferences()
77
74
78
75
public IEnumerable < AnalyzerReference > GetRemovedAnalyzerReferences ( )
79
76
{
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 )
82
79
{
83
80
if ( ! newAnalyzerReferences . Contains ( analyzerReference ) )
84
81
{
@@ -97,18 +94,18 @@ public IEnumerable<AnalyzerReference> GetRemovedAnalyzerReferences()
97
94
/// </remarks>
98
95
internal IEnumerable < DocumentId > GetExplicitlyChangedSourceGeneratedDocuments ( )
99
96
{
100
- if ( _newSolution . CompilationState . FrozenSourceGeneratedDocumentStates . IsEmpty )
97
+ if ( NewSolution . CompilationState . FrozenSourceGeneratedDocumentStates . IsEmpty )
101
98
return [ ] ;
102
99
103
100
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 )
105
102
{
106
- var oldState = _oldSolution . CompilationState . TryGetSourceGeneratedDocumentStateForAlreadyGeneratedId ( id ) ;
103
+ var oldState = OldSolution . CompilationState . TryGetSourceGeneratedDocumentStateForAlreadyGeneratedId ( id ) ;
107
104
oldStateBuilder . AddIfNotNull ( oldState ) ;
108
105
}
109
106
110
107
var oldStates = new TextDocumentStates < SourceGeneratedDocumentState > ( oldStateBuilder ) ;
111
- return _newSolution . CompilationState . FrozenSourceGeneratedDocumentStates . GetChangedStateIds (
108
+ return NewSolution . CompilationState . FrozenSourceGeneratedDocumentStates . GetChangedStateIds (
112
109
oldStates ,
113
110
ignoreUnchangedContent : true ,
114
111
ignoreUnchangeableDocuments : false ) ;
0 commit comments