Ejemplo n.º 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.");
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 3
0
        protected internal override string GetParameterName(StaticParameterWrapper parameter)
        {
            ParameterDefinition parameterHandle = parameter.Handle as ParameterDefinition;

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

            return(null);
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 5
0
 protected override IEnumerable<StaticAttributeWrapper> GetParameterCustomAttributes(StaticParameterWrapper parameter)
 {
     IParameter parameterHandle = (IParameter)parameter.Handle;
     return GetAttributesForAttributeOwner(parameterHandle);
 }
Ejemplo n.º 6
0
        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;
        }
Ejemplo n.º 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);
Ejemplo n.º 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);
Ejemplo n.º 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;
        }
Ejemplo n.º 13
0
 protected override string GetParameterName(StaticParameterWrapper parameter)
 {
     IParameter parameterHandle = (IParameter)parameter.Handle;
     return parameterHandle.ShortName;
 }
Ejemplo n.º 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));
        }
Ejemplo n.º 15
0
        /// <inheritdoc />
        public override bool Equals(object obj)
        {
            StaticParameterWrapper other = obj as StaticParameterWrapper;

            return(EqualsByHandle(other) && member.Equals(other.member));
        }
Ejemplo n.º 16
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.");
        }
Ejemplo n.º 17
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;
        }
Ejemplo n.º 18
0
        protected internal override string GetParameterName(StaticParameterWrapper parameter)
        {
            ParameterDefinition parameterHandle = parameter.Handle as ParameterDefinition;
            if (parameterHandle != null)
                return parameterHandle.Name;

            return null;
        }
Ejemplo n.º 19
0
 protected override int GetParameterPosition(StaticParameterWrapper parameter)
 {
     IParameter parameterHandle = (IParameter)parameter.Handle;
     int parameterIndex = parameterHandle.ContainingParametersOwner.Parameters.IndexOf(parameterHandle);
     return parameterIndex;
 }
Ejemplo n.º 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);
Ejemplo n.º 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);
Ejemplo n.º 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);
Ejemplo n.º 26
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;
        }