예제 #1
0
        internal IDictionary <string, IAnalysisSet> GetAllMembers(IMemberContainer container, IModuleContext moduleContext)
        {
            var names  = container.GetMemberNames(moduleContext);
            var result = new Dictionary <string, IAnalysisSet>();

            foreach (var name in names)
            {
                result[name] = GetAnalysisValueFromObjects(container.GetMember(moduleContext, name));
            }
            var children = (container as IModule)?.GetChildrenPackages(moduleContext);

            if (children?.Any() ?? false)
            {
                foreach (var child in children)
                {
                    IAnalysisSet existing;
                    if (result.TryGetValue(child.Key, out existing))
                    {
                        result[child.Key] = existing.Add(child.Value);
                    }
                    else
                    {
                        result[child.Key] = child.Value;
                    }
                }
            }

            return(result);
        }
예제 #2
0
        public IEnumerable <IReferenceable> GetDefinitions(string name, IMemberContainer innerContainer, IModuleContext context)
        {
            var res = new List <IReferenceable>();

            ReferenceDict references;

            lock (_references) {
                _references.TryGetValue(name, out references);
            }

            if (references != null)
            {
                lock (references) {
                    res.AddRange(references.Values);
                }
            }

            var member = innerContainer.GetMember(context, name) as ILocatedMember;

            if (member != null)
            {
                res.AddRange(member.Locations.MaybeEnumerate().Select(loc => new DefinitionList(loc)));
            }

            return(res);
        }
예제 #3
0
        internal IDictionary <string, ISet <Namespace> > GetAllMembers(IMemberContainer container, IModuleContext moduleContext)
        {
            var names  = container.GetMemberNames(moduleContext);
            var result = new Dictionary <string, ISet <Namespace> >();

            foreach (var name in names)
            {
                result[name] = GetNamespaceFromObjects(container.GetMember(moduleContext, name));
            }

            return(result);
        }
        public IEnumerable <IReferenceable> GetDefinitions(string name, IMemberContainer innerContainer, IModuleContext context)
        {
            IEnumerable <IReferenceable> refs = null;
            ReferenceDict references;

            if (_references != null && _references.TryGetValue(name, out references))
            {
                refs = references.Values;
            }

            var member = innerContainer.GetMember(context, name);

            if (member != null)
            {
                List <IReferenceable> res;
                if (refs == null)
                {
                    res = new List <IReferenceable>();
                }
                else
                {
                    res = new List <IReferenceable>(refs);
                }

                ILocatedMember locatedMember = member as ILocatedMember;
                if (locatedMember != null)
                {
                    foreach (var location in locatedMember.Locations)
                    {
                        res.Add(new DefinitionList(location));
                    }
                }
                return(res);
            }

            return(new IReferenceable[0]);
        }
예제 #5
0
파일: MemberView.cs 프로젝트: wenh123/PTVS
 public static IAnalysisItemView Make(IModuleContext context, IMemberContainer members, string name) {
     return Make(context, name, members.GetMember(context, name));
 }
예제 #6
0
 public static IAnalysisItemView Make(IModuleContext context, IMemberContainer members, string name)
 {
     return(Make(context, name, members.GetMember(context, name)));
 }
예제 #7
0
 public static T GetMember <T>(this IMemberContainer mc, string name) where T : class, IPythonType => mc.GetMember(name) as T;