mirror of
https://github.com/github/codeql.git
synced 2026-04-24 08:15:14 +02:00
C#: Use nameof in nullability attributes
This commit is contained in:
@@ -140,7 +140,7 @@ namespace Semmle.Autobuild.Shared
|
||||
/// <summary>
|
||||
/// Returns the file name and extension of the specified path string.
|
||||
/// </summary>
|
||||
[return: NotNullIfNotNull("path")]
|
||||
[return: NotNullIfNotNull(nameof(path))]
|
||||
string? GetFileName(string? path);
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -126,7 +126,7 @@ namespace Semmle.Extraction.CSharp.Entities
|
||||
}
|
||||
}
|
||||
|
||||
[return: NotNullIfNotNull("constructor")]
|
||||
[return: NotNullIfNotNull(nameof(constructor))]
|
||||
public static new Constructor? Create(Context cx, IMethodSymbol? constructor)
|
||||
{
|
||||
if (constructor is null)
|
||||
|
||||
@@ -232,7 +232,7 @@ namespace Semmle.Extraction.CSharp.Entities
|
||||
/// <param name="cx"></param>
|
||||
/// <param name="methodDecl"></param>
|
||||
/// <returns></returns>
|
||||
[return: NotNullIfNotNull("methodDecl")]
|
||||
[return: NotNullIfNotNull(nameof(methodDecl))]
|
||||
public static Method? Create(Context cx, IMethodSymbol? methodDecl)
|
||||
{
|
||||
if (methodDecl is null)
|
||||
|
||||
@@ -591,7 +591,7 @@ namespace Semmle.Extraction.CSharp
|
||||
public static INamedTypeSymbol? GetNonObjectBaseType(this ITypeSymbol symbol, Context cx) =>
|
||||
symbol is ITypeParameterSymbol || SymbolEqualityComparer.Default.Equals(symbol.BaseType, cx.Compilation.ObjectType) ? null : symbol.BaseType;
|
||||
|
||||
[return: NotNullIfNotNull("symbol")]
|
||||
[return: NotNullIfNotNull(nameof(symbol))]
|
||||
public static IEntity? CreateEntity(this Context cx, ISymbol symbol)
|
||||
{
|
||||
if (symbol is null)
|
||||
|
||||
Reference in New Issue
Block a user