Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/linker.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'src/ILLink.RoslynAnalyzer/ISymbolExtensions.cs')
-rw-r--r--src/ILLink.RoslynAnalyzer/ISymbolExtensions.cs13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/ILLink.RoslynAnalyzer/ISymbolExtensions.cs b/src/ILLink.RoslynAnalyzer/ISymbolExtensions.cs
index fa262c760..0d39282d3 100644
--- a/src/ILLink.RoslynAnalyzer/ISymbolExtensions.cs
+++ b/src/ILLink.RoslynAnalyzer/ISymbolExtensions.cs
@@ -58,6 +58,19 @@ namespace ILLink.RoslynAnalyzer
return (DynamicallyAccessedMemberTypes) dynamicallyAccessedMembers.ConstructorArguments[0].Value!;
}
+ internal static bool TryGetReturnAttribute (this IMethodSymbol member, string attributeName, [NotNullWhen (returnValue: true)] out AttributeData? attribute)
+ {
+ attribute = null;
+ foreach (var attr in member.GetReturnTypeAttributes ()) {
+ if (attr.AttributeClass is { } attrClass && attrClass.HasName (attributeName)) {
+ attribute = attr;
+ return true;
+ }
+ }
+
+ return false;
+ }
+
internal static DynamicallyAccessedMemberTypes GetDynamicallyAccessedMemberTypesOnAssociatedSymbol (this IMethodSymbol methodSymbol) =>
methodSymbol.AssociatedSymbol is ISymbol associatedSymbol ? GetDynamicallyAccessedMemberTypes (associatedSymbol) : DynamicallyAccessedMemberTypes.None;