diff options
author | Tlakaelel Axayakatl Ceja <tlakaelel.ceja@microsoft.com> | 2021-12-15 23:59:30 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-12-15 23:59:30 +0300 |
commit | cd4f61ff0e8c916920f9ac246ef5a89b05f60b4a (patch) | |
tree | 3c95968e75561d067b13759a4b40beade350843b | |
parent | 9e3a9538cae1bc6995733983e4734d0253b01fc8 (diff) |
After separating the argument verification from getting the attribute the method TryGetRequiresAttribute is just TryGetAttribute, so deleting the method to simplify stuff (#2448)
-rw-r--r-- | src/ILLink.RoslynAnalyzer/RequiresISymbolExtensions.cs | 21 |
1 files changed, 2 insertions, 19 deletions
diff --git a/src/ILLink.RoslynAnalyzer/RequiresISymbolExtensions.cs b/src/ILLink.RoslynAnalyzer/RequiresISymbolExtensions.cs index f4593a1a9..1c54e3af9 100644 --- a/src/ILLink.RoslynAnalyzer/RequiresISymbolExtensions.cs +++ b/src/ILLink.RoslynAnalyzer/RequiresISymbolExtensions.cs @@ -18,12 +18,12 @@ namespace ILLink.RoslynAnalyzer if (member.IsStaticConstructor ()) return false; - if (TryGetRequiresAttribute (member, requiresAttribute, out requiresAttributeData)) + if (member.TryGetAttribute (requiresAttribute, out requiresAttributeData)) return true; // Also check the containing type if (member.IsStatic || member.IsConstructor ()) - return TryGetRequiresAttribute (member.ContainingType, requiresAttribute, out requiresAttributeData); + return member.ContainingType.TryGetAttribute (requiresAttribute, out requiresAttributeData); return false; } @@ -64,22 +64,5 @@ namespace ILLink.RoslynAnalyzer return false; } - - /// <summary> - /// This method determines if the member has a Requires attribute and returns it in the variable requiresAttribute. - /// </summary> - /// <param name="member">Symbol of the member to search attribute.</param> - /// <param name="requiresAttribute">Output variable in case of matching Requires attribute.</param> - /// <returns>True if the member contains a Requires attribute; otherwise, returns false.</returns> - private static bool TryGetRequiresAttribute (ISymbol member, string requiresAttribute, [NotNullWhen (returnValue: true)] out AttributeData? requiresAttributeData) - { - requiresAttributeData = null; - - if (!member.TryGetAttribute (requiresAttribute, out var attribute)) - return false; - - requiresAttributeData = attribute; - return true; - } } } |