Esempio n. 1
0
        private void CreateModuleTree(LibraryNode root, LibraryNode current, ScopeNode scope, string namePrefix, ModuleId moduleId)
        {
            if ((null == root) || (null == scope) || (null == scope.NestedScopes))
            {
                return;
            }
            foreach (ScopeNode subItem in scope.NestedScopes)
            {
                PythonLibraryNode newNode       = new PythonLibraryNode(subItem, namePrefix, moduleId.Hierarchy, moduleId.ItemID, provider);
                string            newNamePrefix = namePrefix;

                // The classes are always added to the root node, the functions to the
                // current node.
                if ((newNode.NodeType & LibraryNode.LibraryNodeType.Members) != LibraryNode.LibraryNodeType.None)
                {
                    current.AddNode(newNode);
                }
                else if ((newNode.NodeType & LibraryNode.LibraryNodeType.Classes) != LibraryNode.LibraryNodeType.None)
                {
                    // Classes are always added to the root.
                    root.AddNode(newNode);
                    newNamePrefix = newNode.Name + ".";
                }

                // Now use recursion to get the other types.
                CreateModuleTree(root, newNode, subItem, newNamePrefix, moduleId);
            }
        }
 internal PythonLibraryNode(PythonLibraryNode node) :
     base(node)
 {
     this.fileId         = node.fileId;
     this.ownerHierarchy = node.ownerHierarchy;
     this.fileMoniker    = node.fileMoniker;
 }
Esempio n. 3
0
 internal PythonLibraryNode(PythonLibraryNode node)
     : base(node)
 {
     this.fileId = node.fileId;
     this.ownerHierarchy = node.ownerHierarchy;
     this.fileMoniker = node.fileMoniker;
 }
        private void CreateModuleTree(LibraryNode root, LibraryNode current, ScopeNode scope, string namePrefix, ModuleId moduleId)
        {
            if ((null == root) || (null == scope) || (null == scope.NestedScopes)) {
                return;
            }
            foreach (ScopeNode subItem in scope.NestedScopes) {
                PythonLibraryNode newNode = new PythonLibraryNode(subItem, namePrefix, moduleId.Hierarchy, moduleId.ItemID, provider);
                string newNamePrefix = namePrefix;

                // The classes are always added to the root node, the functions to the
                // current node.
                if ((newNode.NodeType & LibraryNode.LibraryNodeType.Members) != LibraryNode.LibraryNodeType.None) {
                    current.AddNode(newNode);
                } else if ((newNode.NodeType & LibraryNode.LibraryNodeType.Classes) != LibraryNode.LibraryNodeType.None) {
                    // Classes are always added to the root.
                    root.AddNode(newNode);
                    newNamePrefix = newNode.Name + ".";
                }

                // Now use recursion to get the other types.
                CreateModuleTree(root, newNode, subItem, newNamePrefix, moduleId);
            }
        }