mirror of
https://github.com/github/codeql.git
synced 2025-12-17 01:03:14 +01:00
Merge pull request #12258 from michaelnebel/csharp/enumanddelegatemodfiers
C#: Generalise modifier extraction from symbols.
This commit is contained in:
@@ -77,12 +77,8 @@ namespace Semmle.Extraction.CSharp
|
||||
/// <summary>
|
||||
/// Gets the source-level modifiers belonging to this symbol, if any.
|
||||
/// </summary>
|
||||
public static IEnumerable<string> GetSourceLevelModifiers(this ISymbol symbol)
|
||||
{
|
||||
var methodModifiers = symbol.GetModifiers<Microsoft.CodeAnalysis.CSharp.Syntax.BaseMethodDeclarationSyntax>(md => md.Modifiers);
|
||||
var typeModifiers = symbol.GetModifiers<Microsoft.CodeAnalysis.CSharp.Syntax.TypeDeclarationSyntax>(cd => cd.Modifiers);
|
||||
return methodModifiers.Concat(typeModifiers).Select(m => m.Text);
|
||||
}
|
||||
public static IEnumerable<string> GetSourceLevelModifiers(this ISymbol symbol) =>
|
||||
symbol.GetModifiers<Microsoft.CodeAnalysis.CSharp.Syntax.MemberDeclarationSyntax>(md => md.Modifiers).Select(m => m.Text);
|
||||
|
||||
/// <summary>
|
||||
/// Holds if the ID generated for `dependant` will contain a reference to
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
---
|
||||
category: minorAnalysis
|
||||
---
|
||||
* The extraction of member modifiers has been generalised, which could lead to the extraction of more modifiers.
|
||||
Reference in New Issue
Block a user