Fixed wrong name determination in field-count value coupling

This commit is contained in:
Samuele Lorefice
2025-03-07 19:11:17 +01:00
parent d3e54246c4
commit 26add1559f

View File

@@ -216,8 +216,10 @@ namespace CodeGenerator {
} else if (listFields.Select(f => f.Item2).Contains(field)) {
//update the size of the list attribute
string fName = field.Name.ParseFName();
//retrieve the name of the list pointer
string listPointerName = listFields.First(f => f.Item2.Name.ParseFName() == fName).Item1.Name.ParseFName();
//Try seeing if the list attribute is already present
var x = ctd.Members.OfType<CodeMemberField>().FirstOrDefault(member => member.Name == fName);
var x = ctd.Members.OfType<CodeMemberField>().FirstOrDefault(member => member.Name.ParseFName() == listPointerName);
if (x != null) //Update the existing list attribute
x.CustomAttributes[0].Arguments[5] = new(new CodePrimitiveExpression(totalSize));