|
|
|
@ -40,7 +40,8 @@ namespace ICSharpCode.Decompiler.TypeSystem
@@ -40,7 +40,8 @@ namespace ICSharpCode.Decompiler.TypeSystem
|
|
|
|
|
SRM.MetadataReader metadata, |
|
|
|
|
TypeSystemOptions options, |
|
|
|
|
Nullability nullableContext, |
|
|
|
|
bool typeChildrenOnly = false) |
|
|
|
|
bool typeChildrenOnly = false, |
|
|
|
|
SRM.CustomAttributeHandleCollection? additionalAttributes = null) |
|
|
|
|
{ |
|
|
|
|
bool hasDynamicAttribute = false; |
|
|
|
|
bool[] dynamicAttributeData = null; |
|
|
|
@ -57,10 +58,8 @@ namespace ICSharpCode.Decompiler.TypeSystem
@@ -57,10 +58,8 @@ namespace ICSharpCode.Decompiler.TypeSystem
|
|
|
|
|
{ |
|
|
|
|
nullability = Nullability.Oblivious; |
|
|
|
|
} |
|
|
|
|
const TypeSystemOptions relevantOptions = TypeSystemOptions.Dynamic | TypeSystemOptions.Tuple | TypeSystemOptions.NullabilityAnnotations | TypeSystemOptions.NativeIntegers; |
|
|
|
|
if (attributes != null && (options & relevantOptions) != 0) |
|
|
|
|
{ |
|
|
|
|
foreach (var attrHandle in attributes.Value) |
|
|
|
|
|
|
|
|
|
void ProcessAttribute(SRM.CustomAttributeHandle attrHandle) |
|
|
|
|
{ |
|
|
|
|
var attr = metadata.GetCustomAttribute(attrHandle); |
|
|
|
|
var attrType = attr.GetAttributeType(metadata); |
|
|
|
@ -123,6 +122,22 @@ namespace ICSharpCode.Decompiler.TypeSystem
@@ -123,6 +122,22 @@ namespace ICSharpCode.Decompiler.TypeSystem
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
const TypeSystemOptions relevantOptions = TypeSystemOptions.Dynamic | TypeSystemOptions.Tuple | TypeSystemOptions.NullabilityAnnotations | TypeSystemOptions.NativeIntegers; |
|
|
|
|
if (attributes != null && (options & relevantOptions) != 0) |
|
|
|
|
{ |
|
|
|
|
foreach (var attrHandle in attributes.Value) |
|
|
|
|
{ |
|
|
|
|
ProcessAttribute(attrHandle); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
if (additionalAttributes != null && (options & relevantOptions) != 0) |
|
|
|
|
{ |
|
|
|
|
// Note: additional attributes will override the values from the normal attributes.
|
|
|
|
|
foreach (var attrHandle in additionalAttributes.Value) |
|
|
|
|
{ |
|
|
|
|
ProcessAttribute(attrHandle); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
if (hasDynamicAttribute || hasNativeIntegersAttribute || nullability != Nullability.Oblivious || nullableAttributeData != null |
|
|
|
|
|| (options & (TypeSystemOptions.Tuple | TypeSystemOptions.KeepModifiers)) != TypeSystemOptions.KeepModifiers) |
|
|
|
|