Ejemplo n.º 1
0
        private void ExploreCallNode(CallGraphNode node)
        {
            Debug.Assert(node.Declaration != null);
            MethodWalker walker = new MethodWalker(this);

            walker.Visit(node.Declaration);
            TypeAndMethodName[] childrenNames = walker.GetChildren();
            foreach (TypeAndMethodName childName in childrenNames)
            {
                CallGraphNode childNode = GetNode(childName);
                if (childNode.Declaration != null)
                {
                    childNode.Parents.Add(node);
                    node.Children.Add(childNode);
                    ExploreCallNode(childNode);
                }
            }
        }
        private void ExploreCallNode(CallGraphNode node)
        {
            Debug.Assert(node.Declaration != null);
            MethodWalker walker = new MethodWalker(this);

            walker.Visit(node.Declaration);
            TypeAndMethodName[] childrenNames = walker.GetChildren();
            foreach (TypeAndMethodName childName in childrenNames)
            {
                if (childName.Equals(node.Name))
                {
                    throw new ShaderGenerationException(
                              $"A function invoked transitively by {_rootNode.Name} calls {childName}, which calls itself. Recursive functions are not supported.");
                }
                CallGraphNode childNode = GetNode(childName);
                if (childNode.Declaration != null)
                {
                    childNode.Parents.Add(node);
                    node.Children.Add(childNode);
                    ExploreCallNode(childNode);
                }
            }
        }