Esempio n. 1
0
        private static void FindDerivedSymbols(ITypeDefinition cls, IMember member, Action <ISearchProgressMonitor, IEntity> reportFunction)
        {
            Solution currentSelectedSolution = IdeApp.ProjectOperations.CurrentSelectedSolution;

            if (currentSelectedSolution != null)
            {
                Project project = TypeSystemService.GetProject(cls);
                if (project != null)
                {
                    IEnumerable <Project> referencingProjects = ReferenceFinder.GetAllReferencingProjects(currentSelectedSolution, project);
                    if (FindDerivedSymbolsHelper._lookupFunction == null)
                    {
                        FindDerivedSymbolsHelper._lookupFunction = new Func <Project, ICompilation> (TypeSystemService.GetCompilation);
                    }
                    List <ICompilation> list = (from c in referencingProjects.Select(FindDerivedSymbolsHelper._lookupFunction)
                                                where c != null
                                                select c).ToList <ICompilation> ();
                    Parallel.ForEach <ICompilation> (list, delegate(ICompilation comp) {
                        try {
                            FindDerivedSymbolsHelper.SearchCompilation(null, comp, cls, member, reportFunction);
                        } catch (Exception ex) {
                            LoggingService.LogInternalError(ex);
                        }
                    });
                }
            }
        }
Esempio n. 2
0
        public static void FindDerivedMembers(IMember member, Action <ISearchProgressMonitor, IEntity> reportFunction)
        {
            ITypeDefinition declaringTypeDefinition = member.DeclaringTypeDefinition;

            if (declaringTypeDefinition != null)
            {
                FindDerivedSymbolsHelper.FindDerivedSymbols(declaringTypeDefinition, member, reportFunction);
            }
        }
Esempio n. 3
0
        private static void SearchCompilation(ISearchProgressMonitor monitor, ICompilation comp, ITypeDefinition cls, IMember member, Action <ISearchProgressMonitor, IEntity> reportFunction)
        {
            ITypeDefinition typeDefinition = TypeSystemExtensions.Import(comp, cls);

            if (typeDefinition != null)
            {
                IMember member2 = null;
                if (member != null)
                {
                    member2 = TypeSystemExtensions.Import(comp, member);
                    if (member2 == null)
                    {
                        return;
                    }
                }
                foreach (ITypeDefinition current in TypeSystemExtensions.GetAllTypeDefinitions(comp.MainAssembly))
                {
                    if (TypeSystemExtensions.IsDerivedFrom(current, typeDefinition))
                    {
                        IEntity entity;
                        if (member != null)
                        {
                            entity = FindDerivedSymbolsHelper.FindDerivedMember(member2, current);
                            if (entity == null)
                            {
                                continue;
                            }
                        }
                        else
                        {
                            entity = current;
                        }
                        //at this point we can jump to the first one
                        reportFunction(monitor, entity);
                    }
                }
            }
        }
Esempio n. 4
0
 //
 // Static Methods
 //
 public static void FindDerivedClasses(ITypeDefinition cls, Action <ISearchProgressMonitor, IEntity> reportFunction)
 {
     FindDerivedSymbolsHelper.FindDerivedSymbols(cls, null, reportFunction);
 }