protected virtual void GetNestedNamespacesAndTypes(Module module, bool constructorMustBeVisible, bool mustBeAttribute, string nameStr, int nameLen, MemberList members, TrivialHashtable alreadyInList, bool listAllUnderRootNamespace) { NamespaceList nSpaces = module.GetNamespaceList(); for (int j = 0, m = nSpaces == null ? 0 : nSpaces.Count; j < m; j++){ Namespace ns = nSpaces[j]; if (ns == null) continue; if (!ns.IsPublic && module != this.currentModule && !this.InternalsAreVisible(this.currentModule, module)) continue; //TODO: would be nice if namespaces with no attribute types can be eliminated if mustBeAttribute is true. //(This is hard. The Whidbey C# language service does not manage it either.) string nsStr = ns.Name.ToString(); if (nsStr.Length <= nameLen) continue; if (!nsStr.StartsWith(nameStr)) continue; if (nsStr.StartsWith("<")) continue; if (nameLen > 0 && nsStr[nameLen] != '.') continue; int pos = nsStr.IndexOf('.', nameLen+1); if (pos < 0) pos = nsStr.Length; if (nameLen == 0) nameLen = -1; Identifier id = new Identifier(nsStr.Substring(nameLen+1, pos-nameLen-1)); if (alreadyInList[id.UniqueIdKey] != null) continue; ns = new Namespace(id, Identifier.For(nsStr.Substring(0, pos)), null, null, null, null); members.Add(ns); alreadyInList[id.UniqueIdKey] = id; } int key = Identifier.For(nameStr).UniqueIdKey; TypeNodeList types = module.Types; bool addBecauseUnderRoot = listAllUnderRootNamespace && nameStr != null && nameStr.Length == 0; for (int i = 1, n = types == null ? 0 : types.Count; i < n; i++){ TypeNode t = types[i]; if (t == null || t.Name == null || t.Namespace == null || (t.Namespace.UniqueIdKey != key && !addBecauseUnderRoot)) continue; if (t.Template != null) continue; if (!t.IsPublic && module != this.currentModule && !this.InternalsAreVisible(this.currentModule, module)) continue; if (t.BaseType == null && t.Namespace == Identifier.Empty) continue; if (constructorMustBeVisible && this.TypeHasNoVisibleConstructorsOrIsAbstract(t)) continue; if (mustBeAttribute && !this.GetTypeView(t).IsAssignableTo(SystemTypes.Attribute)) continue; if (t == SystemTypes.Void) continue; if (alreadyInList[t.Name.UniqueIdKey] != null) continue; members.Add(t); alreadyInList[t.Name.UniqueIdKey] = t; } }