internal NamespaceTracker GetOrMakeChildPackage(string childName, Assembly assem) { // lock is held when this is called Assert.NotNull(childName, assem); Debug.Assert(childName.IndexOf(Type.Delimiter) == -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.UpdateId(); } return(package); } } return(MakeChildPackage(childName, assem)); }
protected void UpdateId() { _id = Interlocked.Increment(ref _masterId); foreach (KeyValuePair <string, MemberTracker> kvp in _dict) { NamespaceTracker ns = kvp.Value as NamespaceTracker; if (ns == null) { continue; } ns.UpdateId(); } }
protected void UpdateId() { _id = Interlocked.Increment(ref _masterId); foreach (KeyValuePair <string, MemberTracker> kvp in _dict) { NamespaceTracker ns = kvp.Value as NamespaceTracker; if (ns == null) { continue; } lock (ns) { // namespace trackers are trees so we always take this // in order ns.UpdateId(); } } }