Fix issues pointed out by .NET code style analysis

This commit is contained in:
Salman Ahmed
2022-12-22 12:49:48 +03:00
parent cff691b2f8
commit 2bdc1f5bbf
2 changed files with 6 additions and 6 deletions

View File

@@ -55,7 +55,7 @@ namespace osu.Framework.SourceGeneration.Analysers
case TypeSyntax typeSyntax:
{
if (await registerCodeFixForType(context, typeSyntax, diagnostic))
if (await registerCodeFixForType(context, typeSyntax, diagnostic).ConfigureAwait(false))
return;
break;
@@ -63,7 +63,7 @@ namespace osu.Framework.SourceGeneration.Analysers
case ObjectCreationExpressionSyntax objectCreationExpression:
{
if (await registerCodeFixForType(context, objectCreationExpression.Type.Parent!, diagnostic))
if (await registerCodeFixForType(context, objectCreationExpression.Type.Parent!, diagnostic).ConfigureAwait(false))
return;
break;
@@ -71,7 +71,7 @@ namespace osu.Framework.SourceGeneration.Analysers
case ExpressionSyntax expressionSyntax:
{
if (await registerCodeFixForType(context, expressionSyntax.Parent!, diagnostic))
if (await registerCodeFixForType(context, expressionSyntax.Parent!, diagnostic).ConfigureAwait(false))
return;
break;
@@ -95,7 +95,7 @@ namespace osu.Framework.SourceGeneration.Analysers
private async Task<bool> registerCodeFixForType(CodeFixContext context, SyntaxNode typeSyntax, Diagnostic diagnostic)
{
var compilation = await context.Document.Project.GetCompilationAsync(context.CancellationToken);
var compilation = await context.Document.Project.GetCompilationAsync(context.CancellationToken).ConfigureAwait(false);
ITypeSymbol? typeSymbol = compilation?.GetSemanticModel(typeSyntax.SyntaxTree).GetTypeInfo(typeSyntax).Type;
@@ -105,7 +105,7 @@ namespace osu.Framework.SourceGeneration.Analysers
if (typeSymbol.DeclaringSyntaxReferences.Length == 0)
return false;
ClassDeclarationSyntax? classSyntax = (await typeSymbol.DeclaringSyntaxReferences[0].SyntaxTree.GetRootAsync(context.CancellationToken))
ClassDeclarationSyntax? classSyntax = (await typeSymbol.DeclaringSyntaxReferences[0].SyntaxTree.GetRootAsync(context.CancellationToken).ConfigureAwait(false))
.DescendantNodes().OfType<ClassDeclarationSyntax>()
.FirstOrDefault(c => c.Identifier.ValueText == typeSymbol.Name);

View File

@@ -9,7 +9,7 @@ namespace osu.Framework.SourceGeneration
{
public static readonly SyntaxTargetNameComparer DEFAULT = new SyntaxTargetNameComparer();
public bool Equals(SyntaxTarget x, SyntaxTarget y)
public bool Equals(SyntaxTarget? x, SyntaxTarget? y)
{
if (ReferenceEquals(x, y)) return true;
if (ReferenceEquals(x, null)) return false;