Пример #1
0
        protected internal override StaticTypeWrapper GetParameterType(StaticParameterWrapper parameter)
        {
            var parameterHandle = parameter.Handle as ParameterDefinition;

            if (parameterHandle != null)
            {
                return(MakeType(parameterHandle.ParameterType));
            }

            var returnTypeHandle = parameter.Handle as MethodReturnType;

            if (returnTypeHandle != null)
            {
                return(MakeType(returnTypeHandle.ReturnType));
            }

            var typeReferenceHandle = parameter.Handle as TypeReference;

            if (typeReferenceHandle != null)
            {
                return(MakeType(typeReferenceHandle));
            }

            throw new ArgumentException("Could not extract parameter type.");
        }
Пример #2
0
        protected internal override int GetParameterPosition(StaticParameterWrapper parameter)
        {
            ParameterDefinition parameterHandle = parameter.Handle as ParameterDefinition;

            if (parameterHandle != null)
            {
                return(parameterHandle.Method.Parameters.IndexOf(parameterHandle));
            }

            return(-1);
        }
Пример #3
0
        protected internal override string GetParameterName(StaticParameterWrapper parameter)
        {
            ParameterDefinition parameterHandle = parameter.Handle as ParameterDefinition;

            if (parameterHandle != null)
            {
                return(parameterHandle.Name);
            }

            return(null);
        }
Пример #4
0
        protected internal override ParameterAttributes GetParameterAttributes(StaticParameterWrapper parameter)
        {
            var parameterHandle = parameter.Handle as ParameterDefinition;

            if (parameterHandle != null)
            {
                return((ParameterAttributes)parameterHandle.Attributes);
            }

            var returnTypeHandle = (MethodReturnType)parameter.Handle;

            return(returnTypeHandle.HasConstant ? ParameterAttributes.HasDefault : ParameterAttributes.None);
        }
 protected override IEnumerable<StaticAttributeWrapper> GetParameterCustomAttributes(StaticParameterWrapper parameter)
 {
     IParameter parameterHandle = (IParameter)parameter.Handle;
     return GetAttributesForAttributeOwner(parameterHandle);
 }
        protected override ParameterAttributes GetParameterAttributes(StaticParameterWrapper parameter)
        {
            IParameter parameterHandle = (IParameter)parameter.Handle;

            ParameterAttributes flags = 0;
            ReflectorFlagsUtils.AddFlagIfTrue(ref flags, ParameterAttributes.HasDefault, !parameterHandle.GetDefaultValue().IsBadValue());
            ReflectorFlagsUtils.AddFlagIfTrue(ref flags, ParameterAttributes.In, parameterHandle.Kind == ParameterKind.REFERENCE);
            ReflectorFlagsUtils.AddFlagIfTrue(ref flags, ParameterAttributes.Out, parameterHandle.Kind == ParameterKind.OUTPUT || parameterHandle.Kind == ParameterKind.REFERENCE);
            ReflectorFlagsUtils.AddFlagIfTrue(ref flags, ParameterAttributes.Optional, parameterHandle.IsOptional);
            return flags;
        }
Пример #7
0
 /// <summary>
 /// Gets the parameter type.
 /// </summary>
 /// <param name="parameter">The parameter, not null.</param>
 /// <returns>The parameter type.</returns>
 protected internal abstract StaticTypeWrapper GetParameterType(StaticParameterWrapper parameter);
Пример #8
0
 /// <summary>
 /// Gets the parameter's position, or -1 if the parameter is a return value.
 /// </summary>
 /// <param name="parameter">The parameter, not null.</param>
 /// <returns>The parameter's position.</returns>
 protected internal abstract int GetParameterPosition(StaticParameterWrapper parameter);
        protected internal override IEnumerable<StaticAttributeWrapper> GetParameterCustomAttributes(StaticParameterWrapper parameter)
        {
            ParameterDefinition parameterHandle = parameter.Handle as ParameterDefinition;
            if (parameterHandle != null)
                return EnumerateAttributes(parameterHandle.CustomAttributes);

            MethodReturnType returnTypeHandle = (MethodReturnType)parameter.Handle;
            return EnumerateAttributes(returnTypeHandle.CustomAttributes);
        }
 /// <summary>
 /// Gets the parameter's position, or -1 if the parameter is a return value.
 /// </summary>
 /// <param name="parameter">The parameter, not null.</param>
 /// <returns>The parameter's position.</returns>
 protected internal abstract int GetParameterPosition(StaticParameterWrapper parameter);
 /// <summary>
 /// Gets the custom attributes of a parameter.
 /// </summary>
 /// <param name="parameter">The parameter, not null.</param>
 /// <returns>The custom attributes.</returns>
 protected internal abstract IEnumerable<StaticAttributeWrapper> GetParameterCustomAttributes(StaticParameterWrapper parameter);
Пример #12
0
        protected override StaticTypeWrapper GetParameterType(StaticParameterWrapper parameter)
        {
            IParameter parameterHandle = (IParameter)parameter.Handle;
            StaticTypeWrapper parameterType = MakeType(parameterHandle.Type);

            if (parameterHandle.Kind != ParameterKind.VALUE)
                parameterType = parameterType.MakeByRefType();

            return parameterType;
        }
Пример #13
0
 protected override string GetParameterName(StaticParameterWrapper parameter)
 {
     IParameter parameterHandle = (IParameter)parameter.Handle;
     return parameterHandle.ShortName;
 }
Пример #14
0
        protected internal override IEnumerable <StaticAttributeWrapper> GetParameterCustomAttributes(StaticParameterWrapper parameter)
        {
            ParameterDefinition parameterHandle = parameter.Handle as ParameterDefinition;

            if (parameterHandle != null)
            {
                return(EnumerateAttributes(parameterHandle.CustomAttributes));
            }

            MethodReturnType returnTypeHandle = (MethodReturnType)parameter.Handle;

            return(EnumerateAttributes(returnTypeHandle.CustomAttributes));
        }
Пример #15
0
        /// <inheritdoc />
        public override bool Equals(object obj)
        {
            StaticParameterWrapper other = obj as StaticParameterWrapper;

            return(EqualsByHandle(other) && member.Equals(other.member));
        }
        protected internal override StaticTypeWrapper GetParameterType(StaticParameterWrapper parameter)
        {
            var parameterHandle = parameter.Handle as ParameterDefinition;
            if (parameterHandle != null)
                return MakeType(parameterHandle.ParameterType);

            var returnTypeHandle = parameter.Handle as MethodReturnType;
            if (returnTypeHandle != null)
                return MakeType(returnTypeHandle.ReturnType);

            var typeReferenceHandle = parameter.Handle as TypeReference;
            if (typeReferenceHandle != null)
                return MakeType(typeReferenceHandle);

            throw new ArgumentException("Could not extract parameter type.");
        }
        protected internal override int GetParameterPosition(StaticParameterWrapper parameter)
        {
            ParameterDefinition parameterHandle = parameter.Handle as ParameterDefinition;
            if (parameterHandle != null)
                return parameterHandle.Method.Parameters.IndexOf(parameterHandle);

            return -1;
        }
        protected internal override string GetParameterName(StaticParameterWrapper parameter)
        {
            ParameterDefinition parameterHandle = parameter.Handle as ParameterDefinition;
            if (parameterHandle != null)
                return parameterHandle.Name;

            return null;
        }
Пример #19
0
 protected override int GetParameterPosition(StaticParameterWrapper parameter)
 {
     IParameter parameterHandle = (IParameter)parameter.Handle;
     int parameterIndex = parameterHandle.ContainingParametersOwner.Parameters.IndexOf(parameterHandle);
     return parameterIndex;
 }
Пример #20
0
 /// <summary>
 /// Gets the attributes of a parameter.
 /// </summary>
 /// <param name="parameter">The parameter, not null.</param>
 /// <returns>The parameter attributes.</returns>
 protected internal abstract ParameterAttributes GetParameterAttributes(StaticParameterWrapper parameter);
 /// <summary>
 /// Gets the attributes of a parameter.
 /// </summary>
 /// <param name="parameter">The parameter, not null.</param>
 /// <returns>The parameter attributes.</returns>
 protected internal abstract ParameterAttributes GetParameterAttributes(StaticParameterWrapper parameter);
Пример #22
0
 /// <summary>
 /// Gets the custom attributes of a parameter.
 /// </summary>
 /// <param name="parameter">The parameter, not null.</param>
 /// <returns>The custom attributes.</returns>
 protected internal abstract IEnumerable <StaticAttributeWrapper> GetParameterCustomAttributes(StaticParameterWrapper parameter);
 /// <summary>
 /// Gets the name of a parameter.
 /// </summary>
 /// <param name="parameter">The parameter, not null.</param>
 /// <returns>The parameter's name.</returns>
 protected internal abstract string GetParameterName(StaticParameterWrapper parameter);
Пример #24
0
 /// <summary>
 /// Gets the name of a parameter.
 /// </summary>
 /// <param name="parameter">The parameter, not null.</param>
 /// <returns>The parameter's name.</returns>
 protected internal abstract string GetParameterName(StaticParameterWrapper parameter);
 /// <summary>
 /// Gets the parameter type.
 /// </summary>
 /// <param name="parameter">The parameter, not null.</param>
 /// <returns>The parameter type.</returns>
 protected internal abstract StaticTypeWrapper GetParameterType(StaticParameterWrapper parameter);
        protected internal override ParameterAttributes GetParameterAttributes(StaticParameterWrapper parameter)
        {
            var parameterHandle = parameter.Handle as ParameterDefinition;

            if (parameterHandle != null)
                return (ParameterAttributes)parameterHandle.Attributes;

            var returnTypeHandle = (MethodReturnType)parameter.Handle;
            return returnTypeHandle.HasConstant ? ParameterAttributes.HasDefault : ParameterAttributes.None;
        }