Class SyntaxWalker
Walks the syntax tree, allowing subclasses to operate on all nodes, token and trivia. The walker will perform a depth first walk of the tree.
Inheritance
Inherited Members
Namespace: Loretta.CodeAnalysis
Assembly: Loretta.CodeAnalysis.dll
Syntax
public abstract class SyntaxWalker
Constructors
| Improve this Doc View SourceSyntaxWalker(SyntaxWalkerDepth)
Creates a new walker instance.
Declaration
protected SyntaxWalker(SyntaxWalkerDepth depth = SyntaxWalkerDepth.Node)
Parameters
Type | Name | Description |
---|---|---|
SyntaxWalkerDepth | depth | Syntax the SyntaxWalker should descend into. |
Properties
| Improve this Doc View SourceDepth
Syntax the SyntaxWalker should descend into.
Declaration
protected SyntaxWalkerDepth Depth { get; }
Property Value
Type | Description |
---|---|
SyntaxWalkerDepth |
Methods
| Improve this Doc View SourceVisit(SyntaxNode)
Called when the walker visits a node. This method may be overridden if subclasses want to handle the node. Overrides should call back into this base method if they want the children of this node to be visited.
Declaration
public virtual void Visit(SyntaxNode node)
Parameters
Type | Name | Description |
---|---|---|
SyntaxNode | node | The current node that the walker is visiting. |
VisitToken(SyntaxToken)
Called when the walker visits a token. This method may be overridden if subclasses want to handle the token. Overrides should call back into this base method if they want the trivia of this token to be visited.
Declaration
protected virtual void VisitToken(SyntaxToken token)
Parameters
Type | Name | Description |
---|---|---|
SyntaxToken | token | The current token that the walker is visiting. |
VisitTrivia(SyntaxTrivia)
Called when the walker visits a trivia syntax. This method may be overridden if subclasses want to handle the token. Overrides should call back into this base method if they want the children of this trivia syntax to be visited.
Declaration
protected virtual void VisitTrivia(SyntaxTrivia trivia)
Parameters
Type | Name | Description |
---|---|---|
SyntaxTrivia | trivia | The current trivia syntax that the walker is visiting. |