4
4
using Rubberduck . Parsing . VBA ;
5
5
using Rubberduck . Inspections . CodePathAnalysis ;
6
6
using Rubberduck . Parsing . Symbols ;
7
- using Rubberduck . Inspections . CodePathAnalysis . Nodes ;
8
7
using Rubberduck . Inspections . CodePathAnalysis . Extensions ;
9
8
using System . Linq ;
10
9
using Rubberduck . Inspections . Results ;
@@ -29,41 +28,12 @@ protected override IEnumerable<IInspectionResult> DoGetInspectionResults()
29
28
{
30
29
var tree = _walker . GenerateTree ( variable . ParentScopeDeclaration . Context , variable ) ;
31
30
32
- nodes . AddRange ( GetIdentifierReferences ( tree , variable ) ) ;
31
+ nodes . AddRange ( tree . GetIdentifierReferences ( ) ) ;
33
32
}
34
33
35
34
return nodes
36
35
. Select ( issue => new IdentifierReferenceInspectionResult ( this , Description , State , issue ) )
37
36
. ToList ( ) ;
38
37
}
39
-
40
- private List < IdentifierReference > GetIdentifierReferences ( INode node , Declaration declaration )
41
- {
42
- var nodes = new List < IdentifierReference > ( ) ;
43
-
44
- var blockNodes = node . GetNodes ( new [ ] { typeof ( BlockNode ) } ) ;
45
- foreach ( var block in blockNodes )
46
- {
47
- INode lastNode = default ;
48
- foreach ( var flattenedNode in block . GetFlattenedNodes ( new [ ] { typeof ( GenericNode ) , typeof ( BlockNode ) } ) )
49
- {
50
- if ( flattenedNode is AssignmentNode &&
51
- lastNode is AssignmentNode )
52
- {
53
- nodes . Add ( lastNode . Reference ) ;
54
- }
55
-
56
- lastNode = flattenedNode ;
57
- }
58
-
59
- if ( lastNode is AssignmentNode &&
60
- block . Children [ 0 ] . GetFirstNode ( new [ ] { typeof ( GenericNode ) } ) is DeclarationNode )
61
- {
62
- nodes . Add ( lastNode . Reference ) ;
63
- }
64
- }
65
-
66
- return nodes ;
67
- }
68
38
}
69
39
}
0 commit comments