void ReadAttribute(MetadataImporter importer)
{
IList<CustomAttributeData> cad;
if (provider is MemberInfo) {
cad = CustomAttributeData.GetCustomAttributes ((MemberInfo) provider);
} else if (provider is ParameterInfo) {
cad = CustomAttributeData.GetCustomAttributes ((ParameterInfo) provider);
} else {
provider = null;
return;
}
if (cad.Count > 0) {
string ns, name;
foreach (var ca in cad) {
importer.GetCustomAttributeTypeName (ca, out ns, out name);
if (name != "DynamicAttribute" && ns != CompilerServicesNamespace)
continue;
if (ca.ConstructorArguments.Count == 0) {
flags = single_attribute;
break;
}
var arg_type = ca.ConstructorArguments[0].ArgumentType;
if (arg_type.IsArray && MetaType.GetTypeCode (arg_type.GetElementType ()) == TypeCode.Boolean) {
var carg = (IList<CustomAttributeTypedArgument>) ca.ConstructorArguments[0].Value;
flags = new bool[carg.Count];
for (int i = 0; i < flags.Length; ++i) {
if (MetaType.GetTypeCode (carg[i].ArgumentType) == TypeCode.Boolean)
flags[i] = (bool) carg[i].Value;
}
break;
}
}
}
provider = null;
}