From 671a5b4ea57359d6a2281992a5012f7b6b170e64 Mon Sep 17 00:00:00 2001 From: Raul Santos Date: Thu, 6 Jul 2023 12:43:23 +0200 Subject: [PATCH] C#: Compare symbol names without null flow state --- .../Godot.SourceGenerators/ExtensionMethods.cs | 14 +++++++------- .../ScriptPropertiesGenerator.cs | 2 +- .../ExtensionMethods.cs | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators/ExtensionMethods.cs b/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators/ExtensionMethods.cs index 38af1cbaded..b2a3c046e5b 100644 --- a/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators/ExtensionMethods.cs +++ b/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators/ExtensionMethods.cs @@ -37,7 +37,7 @@ namespace Godot.SourceGenerators while (symbol != null) { if (symbol.ContainingAssembly?.Name == assemblyName && - symbol.ToString() == typeFullName) + symbol.FullQualifiedNameOmitGlobal() == typeFullName) { return true; } @@ -230,22 +230,22 @@ namespace Godot.SourceGenerators .Replace(">", ")"); public static bool IsGodotExportAttribute(this INamedTypeSymbol symbol) - => symbol.ToString() == GodotClasses.ExportAttr; + => symbol.FullQualifiedNameOmitGlobal() == GodotClasses.ExportAttr; public static bool IsGodotSignalAttribute(this INamedTypeSymbol symbol) - => symbol.ToString() == GodotClasses.SignalAttr; + => symbol.FullQualifiedNameOmitGlobal() == GodotClasses.SignalAttr; public static bool IsGodotMustBeVariantAttribute(this INamedTypeSymbol symbol) - => symbol.ToString() == GodotClasses.MustBeVariantAttr; + => symbol.FullQualifiedNameOmitGlobal() == GodotClasses.MustBeVariantAttr; public static bool IsGodotClassNameAttribute(this INamedTypeSymbol symbol) - => symbol.ToString() == GodotClasses.GodotClassNameAttr; + => symbol.FullQualifiedNameOmitGlobal() == GodotClasses.GodotClassNameAttr; public static bool IsGodotGlobalClassAttribute(this INamedTypeSymbol symbol) - => symbol.ToString() == GodotClasses.GlobalClassAttr; + => symbol.FullQualifiedNameOmitGlobal() == GodotClasses.GlobalClassAttr; public static bool IsSystemFlagsAttribute(this INamedTypeSymbol symbol) - => symbol.ToString() == GodotClasses.SystemFlagsAttr; + => symbol.FullQualifiedNameOmitGlobal() == GodotClasses.SystemFlagsAttr; public static GodotMethodData? HasGodotCompatibleSignature( this IMethodSymbol method, diff --git a/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators/ScriptPropertiesGenerator.cs b/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators/ScriptPropertiesGenerator.cs index e856ad5c13a..3e6858485df 100644 --- a/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators/ScriptPropertiesGenerator.cs +++ b/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators/ScriptPropertiesGenerator.cs @@ -362,7 +362,7 @@ namespace Godot.SourceGenerators { foreach (var attr in memberSymbol.GetAttributes()) { - PropertyUsageFlags? propertyUsage = attr.AttributeClass?.ToString() switch + PropertyUsageFlags? propertyUsage = attr.AttributeClass?.FullQualifiedNameOmitGlobal() switch { GodotClasses.ExportCategoryAttr => PropertyUsageFlags.Category, GodotClasses.ExportGroupAttr => PropertyUsageFlags.Group, diff --git a/modules/mono/glue/GodotSharp/Godot.SourceGenerators.Internal/ExtensionMethods.cs b/modules/mono/glue/GodotSharp/Godot.SourceGenerators.Internal/ExtensionMethods.cs index 37f7005d015..a0bd96412a3 100644 --- a/modules/mono/glue/GodotSharp/Godot.SourceGenerators.Internal/ExtensionMethods.cs +++ b/modules/mono/glue/GodotSharp/Godot.SourceGenerators.Internal/ExtensionMethods.cs @@ -38,7 +38,7 @@ internal static class ExtensionMethods } private static bool IsGenerateUnmanagedCallbacksAttribute(this INamedTypeSymbol symbol) - => symbol.ToString() == GeneratorClasses.GenerateUnmanagedCallbacksAttr; + => symbol.FullQualifiedNameOmitGlobal() == GeneratorClasses.GenerateUnmanagedCallbacksAttr; public static IEnumerable<(ClassDeclarationSyntax cds, INamedTypeSymbol symbol)> SelectUnmanagedCallbacksClasses( this IEnumerable source,