Skip to content

CompositeVisitor<TContext, TBaseNode, TResult> Class

Definition

A Visitor<TContext, TNode, TResult> built from multiple other visitors that visit specific node types. When a node is visited the visitor with the most specific type for the node will be used. If no suitable visitor is found an InvalidOperationException is thrown; register a visitor for the base node type to provide a fallback instead.

public sealed class CompositeVisitor<TContext, TBaseNode, TResult> : Visitor<TContext, TBaseNode, TResult>, ICompositeVisitorBuilder<TContext, TBaseNode, TResult>
   where TBaseNode : Node<TBaseNode>

View source

Type Parameters

Name Description
TContext The type of the context object.
TBaseNode The base type of all nodes in the tree.
TResult The type of the result of visiting a node.

Methods

Name Description
Build() Fluent interface to build a CompositeVisitor<TContext, TBaseNode, TResult>.
VisitNode(TContext, TBaseNode) Called to visit a node.