How to catch implicit conversion using SyntaxWalker and SemanticModel?
I'm traversing syntax tree and need a way to catch implicit conversion. SyntaxWalker doesn't have such virtual method and SyntaxTree itself doesn't have any info about implicit conversions. What should I do?
4 Replies
they won't be in the syntax, have you looked at the semantic model?
I would recommend reading https://learn.microsoft.com/en-us/dotnet/csharp/roslyn-sdk/compiler-api-model
.NET Compiler Platform SDK concepts and object model - C#
This overview provides the background you need to work effectively with the .NET compiler SDK. You'll learn the API layers, the major types involved, and the overall object model.
Work with the .NET Compiler Platform SDK semantic model - C#
This overview provides an understanding of the type you use to understand and manipulate the semantic model of your code.
Found in SemanticModel.GetConversion... It's kinda tricky to use, as it uses expression as argument...
But anyways