Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added Subtype Analyzer #306

Merged
merged 1 commit into from
Mar 15, 2024

Conversation

mitchcapper
Copy link

Find classes/interfaces that directly subtype the analyzed class/interface.

Technically I generally only use the new-ilspy branch for non-debugging but this applied fine to master as well so submitting here.

I felt directly subtyping was the best way to go rather than any that implement/subtype felt natural with the normal behavior of the analyze panel and avoids too many downstream results for popular classes/interfaces.

Not sure if the copyright header is correct.

image

Copy link
Member

@ElektroKill ElektroKill left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some minor code style issues and a few edge cases to handle in the checks!

I also think hat calling the node Subtypes would be better than calling it Subtyped By which in my opinion sounds a bit weird. Let me know what you think of this!

@mitchcapper mitchcapper force-pushed the oldil_subtype_analyzer_pr branch from 4b116c6 to 0f36890 Compare March 14, 2024 20:32
@mitchcapper
Copy link
Author

All changes made. Let me know if you want the class renamed from SubtypedBy in addition to just the language string.

This code could be executed many times. Avoid using LINQ and instead use a normal iterative for loop. It doesn't make that much of a difference in most cases but we should keep consistent with the rest of dnSpy

I think I styled it after this so depending on how much consistency you want you may want to update: https://github.com/dnSpyEx/dnSpy/blob/feature/new-ilspy/Extensions/dnSpy.Analyzer/TreeNodes/InterfaceEventImplementedByNode.cs#L82

@ElektroKill
Copy link
Member

This code could be executed many times. Avoid using LINQ and instead use a normal iterative for loop. It doesn't make that much of a difference in most cases but we should keep consistent with the rest of dnSpy

I think I styled it after this so depending on how much consistency you want you may want to update: feature/new-ilspy/Extensions/dnSpy.Analyzer/TreeNodes/InterfaceEventImplementedByNode.cs#L82

Some of the analyzer code is very old and based on old ILSpy analyzer source code. It hasn't been touched for years and could use some modernization but I'm not touching it for now since it's not really causing any problems yet.

@mitchcapper mitchcapper force-pushed the oldil_subtype_analyzer_pr branch from 0f36890 to 9056842 Compare March 14, 2024 22:28
@mitchcapper
Copy link
Author

all set

Copy link
Member

@ElektroKill ElektroKill left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One last issue regarding naming. Otherwise LGTM!

Find classes/interfaces that directly subtype the analyzed class
@mitchcapper mitchcapper force-pushed the oldil_subtype_analyzer_pr branch from 9056842 to 31c9da4 Compare March 15, 2024 20:35
@mitchcapper
Copy link
Author

Change the data name to SubtypesTreeNode to better reflect its value.

I think we had a small miscommunication,

I am happy you are willing to own your share of the blame on this miscommunication. You with your clear directions and me with my inability to read id say pretty 50/50.

@ElektroKill ElektroKill merged commit 2f150e6 into dnSpyEx:master Mar 15, 2024
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants