protected sealed override RuntimeNamedMethodInfo GetPropertyMethod(PropertyMethodSemantics whichMethod)
        {
            MethodDefinitionHandle methodHandle;
            PropertyAccessors      propertyAccessors = _property.GetAccessors();

            switch (whichMethod)
            {
            case PropertyMethodSemantics.Getter:
                methodHandle = propertyAccessors.Getter;
                break;

            case PropertyMethodSemantics.Setter:
                methodHandle = propertyAccessors.Setter;
                break;

            default:
                return(null);
            }

            bool inherited = !_reflectedType.Equals(ContextTypeInfo);

            if (inherited)
            {
                MethodAttributes flags = _reader.GetMethodDefinition(methodHandle).Attributes;
                if ((flags & MethodAttributes.MemberAccessMask) == MethodAttributes.Private)
                {
                    return(null);
                }
            }

            return(RuntimeNamedMethodInfo <EcmaFormatMethodCommon> .GetRuntimeNamedMethodInfo(new EcmaFormatMethodCommon(methodHandle, _definingTypeInfo, ContextTypeInfo), _reflectedType));
        }
示例#2
0
        protected sealed override RuntimeNamedMethodInfo GetPropertyMethod(PropertyMethodSemantics whichMethod)
        {
            NativeFormatMethodSemanticsAttributes localMethodSemantics;

            switch (whichMethod)
            {
            case PropertyMethodSemantics.Getter:
                localMethodSemantics = NativeFormatMethodSemanticsAttributes.Getter;
                break;

            case PropertyMethodSemantics.Setter:
                localMethodSemantics = NativeFormatMethodSemanticsAttributes.Setter;
                break;

            default:
                return(null);
            }

            bool inherited = !_reflectedType.Equals(ContextTypeInfo);

            foreach (MethodSemanticsHandle methodSemanticsHandle in _property.MethodSemantics)
            {
                MethodSemantics methodSemantics = methodSemanticsHandle.GetMethodSemantics(_reader);
                if (methodSemantics.Attributes == localMethodSemantics)
                {
                    MethodHandle methodHandle = methodSemantics.Method;

                    if (inherited)
                    {
                        MethodAttributes flags = methodHandle.GetMethod(_reader).Flags;
                        if ((flags & MethodAttributes.MemberAccessMask) == MethodAttributes.Private)
                        {
                            continue;
                        }
                    }

                    return(RuntimeNamedMethodInfo <NativeFormatMethodCommon> .GetRuntimeNamedMethodInfo(new NativeFormatMethodCommon(methodHandle, _definingTypeInfo, ContextTypeInfo), _reflectedType));
                }
            }

            return(null);
        }
示例#3
0
 /// <summary>
 /// Override to return the Method that corresponds to the specified semantic.
 /// Return null if a method of the appropriate semantic does not exist
 /// </summary>
 protected abstract RuntimeNamedMethodInfo GetPropertyMethod(PropertyMethodSemantics whichMethod);
示例#4
0
 /// <summary>
 /// Override to return the Method that corresponds to the specified semantic.
 /// Return null if a method of the appropriate semantic does not exist
 /// </summary>
 protected abstract RuntimeNamedMethodInfo GetPropertyMethod(PropertyMethodSemantics whichMethod);
        protected sealed override RuntimeNamedMethodInfo GetPropertyMethod(PropertyMethodSemantics whichMethod)
        {
            NativeFormatMethodSemanticsAttributes localMethodSemantics;
            switch (whichMethod)
            {
                case PropertyMethodSemantics.Getter:
                    localMethodSemantics = NativeFormatMethodSemanticsAttributes.Getter;
                    break;

                case PropertyMethodSemantics.Setter:
                    localMethodSemantics = NativeFormatMethodSemanticsAttributes.Setter;
                    break;

                default:
                    return null;
            }

            bool inherited = !_reflectedType.Equals(ContextTypeInfo);

            foreach (MethodSemanticsHandle methodSemanticsHandle in _property.MethodSemantics)
            {
                MethodSemantics methodSemantics = methodSemanticsHandle.GetMethodSemantics(_reader);
                if (methodSemantics.Attributes == localMethodSemantics)
                {
                    MethodHandle methodHandle = methodSemantics.Method;

                    if (inherited)
                    {
                        MethodAttributes flags = methodHandle.GetMethod(_reader).Flags;
                        if ((flags & MethodAttributes.MemberAccessMask) == MethodAttributes.Private)
                            continue;
                    }

                    return RuntimeNamedMethodInfo<NativeFormatMethodCommon>.GetRuntimeNamedMethodInfo(new NativeFormatMethodCommon(methodHandle, _definingTypeInfo, ContextTypeInfo), _reflectedType);
                }
            }
            
            return null;
        }