Skip to content

Commit

Permalink
Explicitly remove property accessors from search results
Browse files Browse the repository at this point in the history
Currently backend won't decompile accessors,
because they don't appear as normal members
in tree, although they come back as normal type
members from search.
  • Loading branch information
Rpinski committed Feb 17, 2023
1 parent 286fdc5 commit 2938e92
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
2 changes: 0 additions & 2 deletions backend/src/ILSpy.Backend/Decompiler/ILSpySettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ public ILSpySettings()
public DecompilerSettings DecompilerSettings { get; } = new DecompilerSettings
{
ThrowOnAssemblyResolveErrors = false,
AutomaticProperties = false,
AutomaticEvents = false
};
}
}
Expand Down
12 changes: 11 additions & 1 deletion backend/src/ILSpy.Backend/Decompiler/SearchBackend.cs
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ await Task.Factory.StartNew(() => {

}, cancellationToken, TaskCreationOptions.LongRunning, TaskScheduler.Current).ConfigureAwait(false);

return resultQueue.OrderBy(r => r, resultsComparer).Select(ConvertResultToNode);
return resultQueue.Where(IsNotAccessor).OrderBy(r => r, resultsComparer).Select(ConvertResultToNode);
}
catch (TaskCanceledException)
{
Expand All @@ -100,6 +100,16 @@ await Task.Factory.StartNew(() => {
return Enumerable.Empty<NodeData>();
}

bool IsNotAccessor(SearchResult searchResult)
{
if (searchResult is MemberSearchResult memberSearchResult)
{
return memberSearchResult.Member.SymbolKind != SymbolKind.Accessor;
}

return true;
}

NodeData ConvertResultToNode(SearchResult result)
{
var memberSearchResult = result as MemberSearchResult;
Expand Down

0 comments on commit 2938e92

Please sign in to comment.