Skip to content

Commit b377db8

Browse files
committed
Fix ToString change being applied to wrong structs
1 parent e4191ca commit b377db8

File tree

1 file changed

+15
-13
lines changed

1 file changed

+15
-13
lines changed

src/Core/Silk.NET.BuildTools/Converters/Readers/VulkanReader.cs

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -149,14 +149,6 @@ IReadOnlyList<Struct> GetAllAliasesFromName(string? api, string structName)
149149
continue;
150150
}
151151

152-
var toString = new Function
153-
{
154-
Accessibility = Accessibility.Public,
155-
IsOverride = true,
156-
ReturnType = new Type { Name = "string" },
157-
Name = "ToString"
158-
};
159-
160152
var @struct = new Struct
161153
{
162154
Fields = s.Members.Select
@@ -188,10 +180,6 @@ IReadOnlyList<Struct> GetAllAliasesFromName(string? api, string structName)
188180
}.WithFixedFieldFixup09072020()
189181
)
190182
.ToList(),
191-
Functions = new List<ImplementedFunction>
192-
{
193-
new(toString, new StringBuilder("return Handle.ToString();"), toString, false)
194-
},
195183
Name = Naming.TranslateLite(TrimName(s.Name, task), prefix),
196184
NativeName = s.Name,
197185
ProfileName = s.Api
@@ -348,6 +336,19 @@ IReadOnlyList<Struct> GetAllAliasesFromName(string? api, string structName)
348336
}
349337
}
350338

339+
var toString = new Function
340+
{
341+
Accessibility = Accessibility.Public,
342+
IsOverride = true,
343+
ReturnType = new Type { Name = "string" },
344+
Name = "ToString"
345+
};
346+
347+
var handleFuns = new List<ImplementedFunction>
348+
{
349+
new(toString, new StringBuilder("return Handle.ToString();"), toString, false)
350+
};
351+
351352
foreach (var h in spec.Handles)
352353
{
353354
ret.Add
@@ -359,7 +360,8 @@ IReadOnlyList<Struct> GetAllAliasesFromName(string? api, string structName)
359360
new Field {Name = "Handle", Type = new Type {Name = h.CanBeDispatched ? "nint" : "ulong"}}
360361
},
361362
Name = Naming.TranslateLite(TrimName(h.Name, task), prefix),
362-
NativeName = h.Name
363+
NativeName = h.Name,
364+
Functions = handleFuns
363365
}
364366
);
365367
}

0 commit comments

Comments
 (0)