Fixed a bug in AttributeBuilder where setting the derived type would not be applied if there wasn't one already set up.

This commit is contained in:
Samuele Lorefice
2025-02-26 19:23:33 +01:00
parent 55f3d411b3
commit 80234eb599
2 changed files with 5 additions and 1 deletions

View File

@@ -58,7 +58,10 @@ namespace CodeGenerator {
/// </summary>
/// <param name="baseType">Fully qualified name from which this is going to be derived</param>
public AttributeBuilder DeriveFromClass(string baseType) {
_attrDecl.BaseTypes[0] = new(baseType);
if (_attrDecl.BaseTypes.Count == 0)
_attrDecl.BaseTypes.Add(typeof(Attribute));
else
_attrDecl.BaseTypes[0] = new(baseType);
return this;
}