Exemplo n.º 1
0
        internal NamespaceTracker GetOrMakeChildPackage(string childName, Assembly assem)
        {
            // lock is held when this is called
            Assert.NotNull(childName, assem);
            Debug.Assert(childName.IndexOf('.') == -1);       // This is the simple name, not the full name
            Debug.Assert(_packageAssemblies.Contains(assem)); // Parent namespace must contain all the assemblies of the child

            MemberTracker ret;

            if (_dict.TryGetValue(childName, out ret))
            {
                // If we have a module, then we add the assembly to the InnerModule
                // If it's not a module, we'll wipe it out below, eg "def System(): pass" then
                // "import System" will result in the namespace being visible.
                NamespaceTracker package = ret as NamespaceTracker;
                if (package != null)
                {
                    if (!package._packageAssemblies.Contains(assem))
                    {
                        package._packageAssemblies.Add(assem);
                        package.UpdateSubtreeIds();
                    }
                    return(package);
                }
            }

            return(MakeChildPackage(childName, assem));
        }
Exemplo n.º 2
0
        protected void UpdateSubtreeIds()
        {
            // lock is held when this is called
            UpdateId();

            foreach (KeyValuePair <string, MemberTracker> kvp in _dict)
            {
                NamespaceTracker ns = kvp.Value as NamespaceTracker;
                ns?.UpdateSubtreeIds();
            }
        }