1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-08 12:40:44 +00:00

Merge pull request #87518 from paulloz/dotnet/fix-warnings

Clean a number of C# warnings
This commit is contained in:
Rémi Verschelde
2024-01-26 11:46:37 +01:00
11 changed files with 50 additions and 26 deletions

View File

@@ -1,5 +1,4 @@
using System.Collections.Immutable;
using System.Diagnostics;
using System.Linq;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.CSharp;
@@ -34,7 +33,7 @@ namespace Godot.SourceGenerators
// Method invocation or variable declaration that contained the type arguments
var parentSyntax = context.Node.Parent;
Debug.Assert(parentSyntax != null);
Helper.ThrowIfNull(parentSyntax);
var sm = context.SemanticModel;
@@ -49,9 +48,10 @@ namespace Godot.SourceGenerators
continue;
var typeSymbol = sm.GetSymbolInfo(typeSyntax).Symbol as ITypeSymbol;
Debug.Assert(typeSymbol != null);
Helper.ThrowIfNull(typeSymbol);
var parentSymbol = sm.GetSymbolInfo(parentSyntax).Symbol;
Helper.ThrowIfNull(parentSymbol);
if (!ShouldCheckTypeArgument(context, parentSyntax, parentSymbol, typeSyntax, typeSymbol, i))
{
@@ -69,7 +69,7 @@ namespace Godot.SourceGenerators
var marshalType = MarshalUtils.ConvertManagedTypeToMarshalType(typeSymbol, typeCache);
if (marshalType == null)
if (marshalType is null)
{
Common.ReportGenericTypeArgumentMustBeVariant(context, typeSyntax, typeSymbol);
continue;