From b377db830b75f0514e851c93ffc2b3b3905a50c5 Mon Sep 17 00:00:00 2001 From: Dylan Perks Date: Thu, 31 Oct 2024 22:08:48 +0000 Subject: [PATCH] Fix ToString change being applied to wrong structs --- .../Converters/Readers/VulkanReader.cs | 28 ++++++++++--------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/src/Core/Silk.NET.BuildTools/Converters/Readers/VulkanReader.cs b/src/Core/Silk.NET.BuildTools/Converters/Readers/VulkanReader.cs index 398b1021fe..15b036a976 100644 --- a/src/Core/Silk.NET.BuildTools/Converters/Readers/VulkanReader.cs +++ b/src/Core/Silk.NET.BuildTools/Converters/Readers/VulkanReader.cs @@ -149,14 +149,6 @@ IReadOnlyList GetAllAliasesFromName(string? api, string structName) continue; } - var toString = new Function - { - Accessibility = Accessibility.Public, - IsOverride = true, - ReturnType = new Type { Name = "string" }, - Name = "ToString" - }; - var @struct = new Struct { Fields = s.Members.Select @@ -188,10 +180,6 @@ IReadOnlyList GetAllAliasesFromName(string? api, string structName) }.WithFixedFieldFixup09072020() ) .ToList(), - Functions = new List - { - new(toString, new StringBuilder("return Handle.ToString();"), toString, false) - }, Name = Naming.TranslateLite(TrimName(s.Name, task), prefix), NativeName = s.Name, ProfileName = s.Api @@ -348,6 +336,19 @@ IReadOnlyList GetAllAliasesFromName(string? api, string structName) } } + var toString = new Function + { + Accessibility = Accessibility.Public, + IsOverride = true, + ReturnType = new Type { Name = "string" }, + Name = "ToString" + }; + + var handleFuns = new List + { + new(toString, new StringBuilder("return Handle.ToString();"), toString, false) + }; + foreach (var h in spec.Handles) { ret.Add @@ -359,7 +360,8 @@ IReadOnlyList GetAllAliasesFromName(string? api, string structName) new Field {Name = "Handle", Type = new Type {Name = h.CanBeDispatched ? "nint" : "ulong"}} }, Name = Naming.TranslateLite(TrimName(h.Name, task), prefix), - NativeName = h.Name + NativeName = h.Name, + Functions = handleFuns } ); }