Ejemplo n.º 1
0
        protected override void Initialize()
        {
            if (members != null)
            {
                return;
            }

            members = new Dictionary <SymbolId, List <ReflectedMember> >();

            MemberInfo[] infos = type.GetMembers();
            foreach (MemberInfo info in infos)
            {
                object[] attrs = info.GetCustomAttributes(typeof(IronPython.Runtime.PythonNameAttribute), false);
                if (attrs == null || attrs.Length == 0)
                {
                    continue;
                }
                IronPython.Runtime.PythonNameAttribute attr = attrs[0] as IronPython.Runtime.PythonNameAttribute;

                ReflectedMember md = CreateMemberDefinition(info);
                if (md != null)
                {
                    SymbolId name = SymbolTable.StringToId(attr.name);
                    List <ReflectedMember> list;
                    if (!members.TryGetValue(name, out list))
                    {
                        members[name] = list = new List <ReflectedMember>();
                    }
                    list.Add(md);
                }
            }
        }
Ejemplo n.º 2
0
        protected virtual void Initialize()
        {
            if (members != null)
            {
                return;
            }

            MemberInfo[] infos = type.GetMembers();

            members = new Dictionary <SymbolId, List <ReflectedMember> >();
            foreach (MemberInfo info in infos)
            {
                ReflectedMember md = CreateMemberDefinition(info);
                if (md != null)
                {
                    List <ReflectedMember> list;
                    SymbolId name = SymbolTable.StringToId(info.Name);
                    if (!members.TryGetValue(name, out list))
                    {
                        members[name] = list = new List <ReflectedMember>();
                    }
                    list.Add(md);
                }
            }
        }