Skip to content

CompositeVisitor<TBaseNode, TResult> Class

Definition

A Visitor<TNode, TResult> built from multiple other visitors that visit specific node types and do not take a context object. 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<TBaseNode, TResult> : Visitor<TBaseNode, TResult>, ICompositeVisitorBuilder<TBaseNode, TResult>
   where TBaseNode : Node<TBaseNode>

View source

Type Parameters

Name Description
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<TBaseNode, TResult>.
VisitNode(TBaseNode) Called to visit a node.