Imported Upstream version 4.2.0.179

Former-commit-id: 4610231f55806d2a05ed69e5ff3faa7336cc1479
This commit is contained in:
Xamarin Public Jenkins
2015-08-26 07:17:56 -04:00
committed by Jo Shields
parent aa7da660d6
commit c042cd0c52
7507 changed files with 90259 additions and 657307 deletions

View File

@@ -96,27 +96,24 @@ namespace IKVM.Reflection.Emit
public void SetCustomAttribute(CustomAttributeBuilder customAttributeBuilder)
{
Universe u = moduleBuilder.universe;
if (customAttributeBuilder.Constructor.DeclaringType == u.System_Runtime_InteropServices_InAttribute)
switch (customAttributeBuilder.KnownCA)
{
flags |= (short)ParameterAttributes.In;
}
else if (customAttributeBuilder.Constructor.DeclaringType == u.System_Runtime_InteropServices_OutAttribute)
{
flags |= (short)ParameterAttributes.Out;
}
else if (customAttributeBuilder.Constructor.DeclaringType == u.System_Runtime_InteropServices_OptionalAttribute)
{
flags |= (short)ParameterAttributes.Optional;
}
else if (customAttributeBuilder.Constructor.DeclaringType == u.System_Runtime_InteropServices_MarshalAsAttribute)
{
FieldMarshal.SetMarshalAsAttribute(moduleBuilder, PseudoToken, customAttributeBuilder);
flags |= (short)ParameterAttributes.HasFieldMarshal;
}
else
{
moduleBuilder.SetCustomAttribute(PseudoToken, customAttributeBuilder);
case KnownCA.InAttribute:
flags |= (short)ParameterAttributes.In;
break;
case KnownCA.OutAttribute:
flags |= (short)ParameterAttributes.Out;
break;
case KnownCA.OptionalAttribute:
flags |= (short)ParameterAttributes.Optional;
break;
case KnownCA.MarshalAsAttribute:
FieldMarshal.SetMarshalAsAttribute(moduleBuilder, PseudoToken, customAttributeBuilder);
flags |= (short)ParameterAttributes.HasFieldMarshal;
break;
default:
moduleBuilder.SetCustomAttribute(PseudoToken, customAttributeBuilder);
break;
}
}