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

Design suggestion - using IOperation instead of SyntaxNode #6

Open
Meir017 opened this issue Aug 29, 2024 · 2 comments
Open

Design suggestion - using IOperation instead of SyntaxNode #6

Meir017 opened this issue Aug 29, 2024 · 2 comments
Labels
enhancement New feature or request

Comments

@Meir017
Copy link
Contributor

Meir017 commented Aug 29, 2024

Hey, great project and I love this concept of generating (metadata for) diagrams that document the codebase.

Using OperationWalker instead of CSharpSyntaxWalker will be more efficient for this project

  • Better productivity when writing new analyzers as you the IOperation provides access to type metadata and more
  • It will support VB as well, not only C#
  • We'll have more context when writing these analyzers (ex: object obj = new(); currently doesn't work since it's an ImplicitObjectCreationExpressionSyntax and not an ObjectCreationExpressionSyntax) and we'll be able to provide more context (constant values and such)

This change doesn't look like a breaking change for the library since the constructor for SourceAnalyzer will not need to change at all.

@eNeRGy164
Copy link
Member

Didn't know about OperationWalker, as it didn't exist when I started working on this 5 years ago. 😝

Look like a nice enhancement.

@eNeRGy164 eNeRGy164 added the enhancement New feature or request label Aug 29, 2024
@Meir017
Copy link
Contributor Author

Meir017 commented Aug 29, 2024

me too, I did this migration in https://github.com/fluentassertions/fluentassertions.analyzers/pulls?q=is%3Apr+Migrate+IOperation+is%3Aclosed and got much better performance and simplicity (I also merged multiple analyzers into a single) and coding became so much simpler as the SyntaxNode reflects the actual syntax and we just want to analyze the logic.

I have to give credit to @meziantou for enlightening me

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants