4 using SiliconStudio.Shaders.Ast;
6 namespace SiliconStudio.Shaders.Visitor
19 protected SearchVisitor(Func<Node, Node> filterFunction,
bool buildScopeDeclaration =
false,
bool useNodeStack =
false)
20 : base(buildScopeDeclaration, useNodeStack)
22 FilterFunction = filterFunction;
31 protected Func<Node, Node> FilterFunction {
get; set; }
41 node = FilterFunction(node);
42 return (node != null) ? base.Visit(node) : null;
52 public static void Run(
Node node, Func<Node, Node> filter,
bool buildScopeDeclaration =
false,
bool useNodeStack =
false)
54 var visitor =
new SearchVisitor(filter, buildScopeDeclaration, useNodeStack);
override Node Visit(Node node)
Visits the specified node.
A visitor that takes a filter function to apply to each node.
SearchVisitor(Func< Node, Node > filterFunction, bool buildScopeDeclaration=false, bool useNodeStack=false)
Initializes a new instance of the SearchVisitor class.
static void Run(Node node, Func< Node, Node > filter, bool buildScopeDeclaration=false, bool useNodeStack=false)
Searches from the specified node.