Example #1
0
 public static void Accept <T>(
     this ISyntaxNode node,
     VisitorFn <T> enter,
     VisitorFn <T> leave,
     Func <ISyntaxNode, VisitorAction> defaultAction)
     where T : ISyntaxNode =>
 Accept(
     node,
     new VisitorFnWrapper <T>(enter, leave),
     _defaultVisitationMap,
     defaultAction);
Example #2
0
 public static void Accept <T>(
     this ISyntaxNode node,
     VisitorFn <T> enter,
     VisitorFn <T> leave,
     IVisitationMap visitationMap)
     where T : ISyntaxNode =>
 Accept(
     node,
     new VisitorFnWrapper <T>(enter, leave),
     visitationMap,
     null);
Example #3
0
        public static void VisitTree(Node treeRoot, VisitorFn fn)
        {
            var children = treeRoot.GetChildren();

            fn(treeRoot);

            // Walk children to add to the actors flat list.
            foreach (Node child in children)
            {
                VisitTree(child, fn);
            }
        }
        public static void VisitTree(GameObject treeRoot, VisitorFn fn)
        {
            fn(treeRoot);

            // Walk children to add to the actors flat list.
            Transform transform = treeRoot.transform;

            for (int i = 0; i < transform.childCount; ++i)
            {
                var childGO = transform.GetChild(i).gameObject;
                VisitTree(childGO, fn);
            }
        }
Example #5
0
 public static void Accept <T>(
     this ISyntaxNode node,
     VisitorFn <T> enter,
     VisitorFn <T> leave)
     where T : ISyntaxNode =>
 Accept <T>(node, enter, leave, _defaultVisitationMap);
Example #6
0
 public VisitorFnWrapper(VisitorFn <T> enter, VisitorFn <T> leave)
 {
     _enter = enter;
     _leave = leave;
 }