@@ -44,6 +44,9 @@ private void AnalyzeDependencies(Solution solution)
44
44
AnalyzeFieldDependencies ( element , fieldSymbol ) ;
45
45
}
46
46
47
+ // For all type of symbols check if decorated with an attribute.
48
+ AnalyzeAttributeDependencies ( element , symbol ) ;
49
+
47
50
if ( loop % 10 == 0 )
48
51
{
49
52
ParserProgress ? . Invoke ( this , new ParserProgressArg
@@ -56,6 +59,22 @@ private void AnalyzeDependencies(Solution solution)
56
59
}
57
60
}
58
61
62
+ private void AnalyzeAttributeDependencies ( CodeElement element , ISymbol symbol )
63
+ {
64
+ foreach ( var attributeData in symbol . GetAttributes ( ) )
65
+ {
66
+ if ( attributeData . AttributeClass != null )
67
+ {
68
+ var location = attributeData . ApplicationSyntaxReference != null
69
+ ? GetLocation ( attributeData . ApplicationSyntaxReference . GetSyntax ( ) )
70
+ : null ;
71
+
72
+ element . Attributes . Add ( attributeData . AttributeClass . Name ) ;
73
+ AddTypeDependency ( element , attributeData . AttributeClass , DependencyType . UsesAttribute , location ) ;
74
+ }
75
+ }
76
+ }
77
+
59
78
private void AnalyzeDelegateDependencies ( CodeElement delegateElement , INamedTypeSymbol delegateSymbol )
60
79
{
61
80
var methodSymbol = delegateSymbol . DelegateInvokeMethod ;
@@ -119,7 +138,7 @@ private void AnalyzeMethodDependencies(Solution solution, CodeElement methodElem
119
138
// If this method is an interface method or an abstract method, find its implementations
120
139
if ( methodSymbol . IsAbstract || methodSymbol . ContainingType . TypeKind == TypeKind . Interface )
121
140
{
122
- FindImplementations ( solution , methodElement , methodSymbol ) ;
141
+ FindImplementations ( methodElement , methodSymbol ) ;
123
142
}
124
143
125
144
// Check for method override
@@ -150,7 +169,7 @@ private void AnalyzeMethodDependencies(Solution solution, CodeElement methodElem
150
169
}
151
170
152
171
153
- private void FindImplementations ( Solution solution , CodeElement methodElement , IMethodSymbol methodSymbol )
172
+ private void FindImplementations ( CodeElement methodElement , IMethodSymbol methodSymbol )
154
173
{
155
174
var implementingTypes = new HashSet < INamedTypeSymbol > ( SymbolEqualityComparer . Default ) ;
156
175
@@ -183,13 +202,13 @@ private void FindImplementations(Solution solution, CodeElement methodElement, I
183
202
184
203
private IEnumerable < INamedTypeSymbol > FindTypesImplementingInterface ( INamedTypeSymbol interfaceSymbol )
185
204
{
186
- return AllNamedTypesInSolution
205
+ return _allNamedTypesInSolution
187
206
. Where ( type => type . AllInterfaces . Any ( i => SymbolEqualityComparer . Default . Equals ( i , interfaceSymbol ) ) ) ;
188
207
}
189
208
190
209
private IEnumerable < INamedTypeSymbol > FindTypesDerivedFrom ( INamedTypeSymbol baseType )
191
210
{
192
- return AllNamedTypesInSolution
211
+ return _allNamedTypesInSolution
193
212
. Where ( type => IsTypeDerivedFrom ( type , baseType ) ) ;
194
213
}
195
214
0 commit comments