Looking at the online source for CSharpSyntaxVisitor there are just a small number of default members.
Implementing a CSharpSyntaxWalker, which derives from CSharpSyntaxVisitor, there are many virtual methods to override, for visiting syntax elements in C#.
Where are these defined/declared?
CSharpSyntaxVisitor is implemented as a partial class, but searching on github I was unable to locate where the basic version of the class is extended with the syntax elements.
Can someone please help point me to where this stuff is defined?
CodePudding user response:
You'll find them in Syntax.xml.Main.Generated.cs
. This code used to be generated by a tool, from a file called Syntax.xml
.
These days, it looks like it's generated using a Source Generator. The source generator is called SourceGenerator
, and the bit which generates the additional partial class for CSharpSyntaxVisitor
containing those extra Visit
methods is here. It still reads its input from Syntax.xml
.