Example #1
0
        private List <object> GenerateChildModules(ModuleInfo moduleInfo)
        {
            var res = new HashSet <object>(moduleInfo.GetChildrenPackages(null).Select(kv => kv.Key));

            // Add any child built-in modules as well. This will include the modules that are part of the package,
            // but which do not participate in analysis (e.g. native modules).
            foreach (var child in
                     from moduleName in moduleInfo.ProjectEntry.ProjectState.Interpreter.GetModuleNames()
                     let lastDot = moduleName.LastIndexOf('.')
                                   where lastDot >= 0
                                   let packageName = moduleName.Substring(0, lastDot)
                                                     where packageName == moduleInfo.Name
                                                     select moduleName.Substring(lastDot + 1)
                     )
            {
                // Only include the child if it is actually importable. As a
                // side-effect, we really import the child, which means that
                // GenerateMembers will not exclude it.
                ModuleReference modTableRef;
                if (moduleInfo.ProjectEntry.ProjectState.Modules.TryImport(moduleInfo.Name + "." + child, out modTableRef))
                {
                    res.Add(child);
                }
            }

            return(res.ToList());
        }