Skip to content

Commit 9ee86f3

Browse files
committed
infrastructure
1 parent dd3a9dd commit 9ee86f3

File tree

1 file changed

+16
-16
lines changed

1 file changed

+16
-16
lines changed

CSharpCodeAnalyst/Exploration/CodeGraphExplorer.cs

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -393,7 +393,21 @@ public SearchResult FollowIncomingCallsHeuristically(string id)
393393

394394
if (element.ElementType == CodeElementType.Method)
395395
{
396-
396+
// 1. Abstractions (priority 0)
397+
// For methods the abstractions like interfaces may be called.
398+
var abstractions = allImplementsAndOverrides.Where(d => d.SourceId == element.Id).ToArray();
399+
foundRelationships.UnionWith(abstractions);
400+
var abstractionTargets = abstractions.Select(d => _codeGraph.Nodes[d.TargetId]).ToHashSet();
401+
foundElements.UnionWith(abstractionTargets);
402+
AddToProcessingQueue(abstractionTargets, currentContext, 2);
403+
404+
405+
// Add Events that are handled by this method (priority 1).
406+
var handles = allHandles.Where(h => h.SourceId == element.Id).ToArray();
407+
foundRelationships.UnionWith(handles);
408+
var events = handles.Select(h => _codeGraph.Nodes[h.TargetId]).ToHashSet();
409+
foundElements.UnionWith(events);
410+
AddToProcessingQueue(events, currentContext, 2);
397411

398412

399413
// 3. Calls (priority 2)
@@ -425,21 +439,7 @@ public SearchResult FollowIncomingCallsHeuristically(string id)
425439
AddToProcessingQueue([callSource], currentContext, 2);
426440
}
427441

428-
// 1. Abstractions (priority 0)
429-
// For methods the abstractions like interfaces may be called.
430-
var abstractions = allImplementsAndOverrides.Where(d => d.SourceId == element.Id).ToArray();
431-
foundRelationships.UnionWith(abstractions);
432-
var abstractionTargets = abstractions.Select(d => _codeGraph.Nodes[d.TargetId]).ToHashSet();
433-
foundElements.UnionWith(abstractionTargets);
434-
AddToProcessingQueue(abstractionTargets, currentContext, 2);
435-
436-
437-
// Add Events that are handled by this method (priority 1).
438-
var handles = allHandles.Where(h => h.SourceId == element.Id).ToArray();
439-
foundRelationships.UnionWith(handles);
440-
var events = handles.Select(h => _codeGraph.Nodes[h.TargetId]).ToHashSet();
441-
foundElements.UnionWith(events);
442-
AddToProcessingQueue(events, currentContext, 2);
442+
443443

444444

445445
}

0 commit comments

Comments
 (0)