public async Task VisitNode()

in Forge.TreeWalker/src/TreeWalkerSession.cs [472:515]


        public async Task<string> VisitNode(string treeNodeKey)
        {
            TreeNode treeNode = this.Schema.Tree[treeNodeKey];

            if (string.IsNullOrWhiteSpace(this.currentNodeSkipActionContext))
            {
                // Do not skip actions when this.currentNodeSkipActionContext is null or whitespace.

                // Do type-specific behavior.
                switch (treeNode.Type)
                {
                    case TreeNodeType.Leaf:
                        {
                            await this.PerformLeafTypeBehavior(treeNode).ConfigureAwait(false);
                            break;
                        }
                    case TreeNodeType.Subroutine:
                        {
                            // Exceptions are thrown here if the actions hit a timeout, were cancelled, or failed.
                            await this.PerformSubroutineTypeBehavior(treeNode, treeNodeKey).ConfigureAwait(false);
                            break;
                        }
                    case TreeNodeType.Action:
                        {
                            // Exceptions are thrown here if the actions hit a timeout, were cancelled, or failed.
                            await this.PerformActionTypeBehavior(treeNode, treeNodeKey).ConfigureAwait(false);
                            break;
                        }
                    default:
                        {
                            break;
                        }
                }
            }

            if (treeNode.Type == TreeNodeType.Leaf)
            {
                // Leaf type can't have ChildSelector so we return here.
                return null;
            }

            // Return next child to visit, if possible.
            return await this.SelectChild(treeNode).ConfigureAwait(false);
        }