Exemple #1
0
        private Set <MemberInfo> getAllTypeInfos()
        {
            if (allTypeInfos == null)
            {
                var l = new HashSet <MemberInfo>();
                var currentPackage = packageNames.aggregate("", (p, q) => p + q + "/");

                // Top level types
                foreach (var type in typeSystem.AllClassNames.where (p => p.indexOf('/') == -1))
                {
                    var info = MemberInfo.getInfo(typeSystem.getType(type));
                    if (info.Type.PackageName.equals(currentPackage) || info.IsPublic)
                    {
                        l.add(info);
                    }
                }

                // Types from enclosing packages
                var pkg        = "";
                var classNames = typeSystem.AllClassNames;
                foreach (var name in packageNames)
                {
                    pkg       += name + "/";
                    classNames = classNames.where (p => p.startsWith(pkg));
                    foreach (var type in classNames.where (p => p.indexOf('/', pkg.length()) == -1))
                    {
                        var info = MemberInfo.getInfo(typeSystem.getType(type));
                        if (info.Type.PackageName.equals(currentPackage) || info.IsPublic)
                        {
                            l.add(info);
                        }
                    }
                }

                // Types from using directives
                foreach (var pinfo in packageInfos)
                {
                    foreach (var name in pinfo.UsedPackages)
                    {
                        pkg = name + "/";
                        foreach (var type in typeSystem.AllClassNames.where (p => p.startsWith(pkg) && p.indexOf('/', pkg.length()) == -1))
                        {
                            var info = MemberInfo.getInfo(typeSystem.getType(type));
                            if (info.Type.PackageName.equals(currentPackage) || info.IsPublic)
                            {
                                l.add(info);
                            }
                        }
                    }
                }

                allTypeInfos = l;
            }
            return(allTypeInfos);
        }