mirror of
https://github.com/SK-la/osu-framework.git
synced 2026-03-13 11:20:31 +00:00
Fix issues pointed out by .NET code style analysis
This commit is contained in:
@@ -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);
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user