コード例 #1
0
        public MemberIdentifier(ITypeInfoSource ti, PropertyReference pr)
        {
            Type                 = MemberType.Property;
            Name                 = pr.Name;
            ReturnType           = pr.PropertyType;
            GenericArgumentCount = 0;
            ParameterTypes       = null;
            ti.CacheProxyNames(pr);

            var pd = pr.Resolve();

            if (pd != null)
            {
                if (pd.GetMethod != null)
                {
                    ParameterTypes = GetParameterTypes(pd.GetMethod.Parameters);
                }
                else if (pd.SetMethod != null)
                {
                    ParameterTypes = GetParameterTypes(pd.SetMethod.Parameters)
                                     .Take(pd.SetMethod.Parameters.Count - 1).ToArray();
                }
            }

            HashCode = Type.GetHashCode() ^ Name.GetHashCode();
        }
コード例 #2
0
        public MemberIdentifier(ITypeInfoSource ti, EventReference er)
        {
            Type                 = MemberType.Event;
            Name                 = er.Name;
            ReturnType           = er.EventType;
            GenericArgumentCount = 0;
            ParameterTypes       = null;
            ti.CacheProxyNames(er);

            var ed = er.Resolve();

            if (ed != null)
            {
                if (ed.AddMethod != null)
                {
                    IsStatic = ed.AddMethod.IsStatic;
                }
                else if (ed.RemoveMethod != null)
                {
                    IsStatic = ed.RemoveMethod.IsStatic;
                }
                else
                {
                    // FIXME
                    IsStatic = false;
                }
            }
            else
            {
                // FIXME
                IsStatic = false;
            }

            HashCode = Type.GetHashCode() ^ Name.GetHashCode();
        }
コード例 #3
0
        public MemberIdentifier(ITypeInfoSource ti, MethodReference mr, string newName = null)
        {
            IsStatic       = !mr.HasThis;
            Type           = MemberType.Method;
            Name           = newName ?? mr.Name;
            ReturnType     = mr.ReturnType;
            ParameterTypes = GetParameterTypes(mr.Parameters);

            if (mr is GenericInstanceMethod)
            {
                GenericArgumentCount = ((GenericInstanceMethod)mr).GenericArguments.Count;
            }
            else if (mr.HasGenericParameters)
            {
                GenericArgumentCount = mr.GenericParameters.Count;
            }
            else
            {
                GenericArgumentCount = 0;
            }

            ti.CacheProxyNames(mr);

            HashCode = Type.GetHashCode() ^ Name.GetHashCode();
        }
コード例 #4
0
        public MemberIdentifier(ITypeInfoSource ti, EventReference er)
        {
            Type                 = MemberType.Event;
            Name                 = er.Name;
            ReturnType           = er.EventType;
            GenericArgumentCount = 0;
            ParameterTypes       = null;
            ti.CacheProxyNames(er);

            HashCode = Type.GetHashCode() ^ Name.GetHashCode();
        }
コード例 #5
0
        public MemberIdentifier(ITypeInfoSource ti, FieldReference fr)
        {
            Type                 = MemberType.Field;
            Name                 = fr.Name;
            ReturnType           = fr.FieldType;
            GenericArgumentCount = 0;
            ParameterTypes       = null;
            ti.CacheProxyNames(fr);

            HashCode = Type.GetHashCode() ^ Name.GetHashCode();
        }
コード例 #6
0
        public MemberIdentifier(ITypeInfoSource ti, FieldReference fr)
        {
            Type                 = MemberType.Field;
            Name                 = fr.Name;
            ReturnType           = fr.FieldType;
            GenericArgumentCount = 0;
            ParameterTypes       = null;
            ti.CacheProxyNames(fr);

            var resolved = fr.Resolve();

            if (resolved != null)
            {
                IsStatic = resolved.IsStatic;
            }
            else
            {
                // FIXME
                IsStatic = false;
            }

            HashCode = Type.GetHashCode() ^ Name.GetHashCode();
        }