public Declaration FindMemberEnclosedProjectInModule(Declaration callingProject, Declaration callingModule, Declaration callingParent, Declaration memberModule, string memberName, DeclarationType memberType)
        {
            var allMatches    = MatchName(memberName);
            var memberMatches = allMatches.Where(m =>
                                                 m.DeclarationType.HasFlag(memberType) &&
                                                 Declaration.GetMemberProject(m).Equals(callingProject) &&
                                                 memberModule.Equals(Declaration.GetMemberModule(m)));
            var accessibleMembers = memberMatches.Where(m => AccessibilityCheck.IsMemberAccessible(callingProject, callingModule, callingParent, m));
            var match             = accessibleMembers.FirstOrDefault();

            return(match);
        }
        public Declaration FindModuleEnclosingProjectWithoutEnclosingModule(Declaration callingProject, Declaration callingModule, string calleeModuleName, DeclarationType moduleType)
        {
            var nameMatches   = MatchName(calleeModuleName);
            var moduleMatches = nameMatches.Where(m =>
                                                  m.DeclarationType.HasFlag(moduleType) &&
                                                  Declaration.GetMemberProject(m).Equals(callingProject) &&
                                                  !m.Equals(callingModule));
            var accessibleModules = moduleMatches.Where(calledModule => AccessibilityCheck.IsModuleAccessible(callingProject, callingModule, calledModule));
            var match             = accessibleModules.FirstOrDefault();

            return(match);
        }
        public Declaration FindMemberReferencedProject(Declaration callingProject, Declaration callingModule, Declaration callingParent, Declaration referencedProject, string memberName, DeclarationType memberType)
        {
            var memberMatches     = FindAllInReferencedProjectByPriority(callingProject, memberName, p => p.DeclarationType.HasFlag(memberType) && referencedProject.Equals(Declaration.GetMemberProject(p)));
            var accessibleMembers = memberMatches.Where(m => AccessibilityCheck.IsMemberAccessible(callingProject, callingModule, callingParent, m));
            var match             = accessibleMembers.FirstOrDefault();

            return(match);
        }
        public Declaration FindModuleReferencedProject(Declaration callingProject, Declaration callingModule, Declaration referencedProject, string calleeModuleName, DeclarationType moduleType)
        {
            var moduleMatches     = FindAllInReferencedProjectByPriority(callingProject, calleeModuleName, p => referencedProject.Equals(Declaration.GetMemberProject(p)) && p.DeclarationType.HasFlag(moduleType));
            var accessibleModules = moduleMatches.Where(calledModule => AccessibilityCheck.IsModuleAccessible(callingProject, callingModule, calledModule));
            var match             = accessibleModules.FirstOrDefault();

            return(match);
        }