예제 #1
0
        public static IList <CustomAttributeData> __GetCustomAttributes(ParameterInfo parameter, Type attributeType, bool inherit)
        {
            Module module = parameter.Module;
            List <CustomAttributeData> list = null;

            if (module.universe.ReturnPseudoCustomAttributes)
            {
                if (attributeType == null || attributeType.IsAssignableFrom(parameter.Module.universe.System_Runtime_InteropServices_MarshalAsAttribute))
                {
                    FieldMarshal spec;
                    if (parameter.__TryGetFieldMarshal(out spec))
                    {
                        if (list == null)
                        {
                            list = new List <CustomAttributeData>();
                        }
                        list.Add(CustomAttributeData.CreateMarshalAsPseudoCustomAttribute(parameter.Module, spec));
                    }
                }
            }
            ModuleBuilder mb    = module as ModuleBuilder;
            int           token = parameter.MetadataToken;

            if (mb != null && mb.IsSaved && mb.IsPseudoToken(token))
            {
                token = mb.ResolvePseudoToken(token);
            }
            return(GetCustomAttributesImpl(list, module, token, attributeType) ?? EmptyList);
        }
		public static IList<CustomAttributeData> __GetCustomAttributes(ParameterInfo parameter, Type attributeType, bool inherit)
		{
			Module module = parameter.Module;
			List<CustomAttributeData> list = null;
			if (module.universe.ReturnPseudoCustomAttributes)
			{
				if (attributeType == null || attributeType.IsAssignableFrom(parameter.Module.universe.System_Runtime_InteropServices_MarshalAsAttribute))
				{
					FieldMarshal spec;
					if (parameter.__TryGetFieldMarshal(out spec))
					{
						if (list == null)
						{
							list = new List<CustomAttributeData>();
						}
						list.Add(CustomAttributeData.CreateMarshalAsPseudoCustomAttribute(parameter.Module, spec));
					}
				}
			}
			ModuleBuilder mb = module as ModuleBuilder;
			int token = parameter.MetadataToken;
			if (mb != null && mb.IsSaved && ModuleBuilder.IsPseudoToken(token))
			{
				token = mb.ResolvePseudoToken(token);
			}
			return GetCustomAttributesImpl(list, module, token, attributeType) ?? EmptyList;
		}
예제 #3
0
 public override bool __TryGetFieldMarshal(out FieldMarshal fieldMarshal)
 {
     return(forward.__TryGetFieldMarshal(out fieldMarshal));
 }
예제 #4
0
        void AddAttributes(ParameterInfo parameter, DefaultUnresolvedParameter targetParameter)
        {
            if (!targetParameter.IsOut) {
                if (parameter.IsIn)
                    targetParameter.Attributes.Add(inAttribute);
                if (parameter.IsOut)
                    targetParameter.Attributes.Add(outAttribute);
            }
            AddCustomAttributes(parameter.CustomAttributes, targetParameter.Attributes);

            FieldMarshal marshalInfo;
            if (parameter.__TryGetFieldMarshal (out marshalInfo)) {
                targetParameter.Attributes.Add(ConvertMarshalInfo(marshalInfo));
            }
        }
예제 #5
0
 public override bool __TryGetFieldMarshal(out FieldMarshal fieldMarshal)
 {
     return(parameterInfo.__TryGetFieldMarshal(out fieldMarshal));
 }