Fixed generation of unnamed unions handling within objects.

The generated code was missing an identifier and thus was unable to
compile.

Now we generated a name based on the type and this seems for fix the
issues with Gtk3.gir file.
This commit is contained in:
Abou Al Montacir 2023-05-21 19:38:52 +02:00 committed by Maxim Ganetsky
parent 0d14433fe7
commit 0838345684

View File

@ -1523,6 +1523,7 @@ var
var
SetFound: Boolean;
PropType: String;
FieldName: String;
begin
if not MeetsVersionConstraints(Field) then
@ -1572,7 +1573,11 @@ var
Field.CType := AItem.CType+'_union_'+Field.Name;
ResolveTypeTranslation(Field);
HandleUnion(TgirUnion(Field));
TypeDecl.Add(IndentText(SanitizeName(Field.Name, UsedNames)+': '+ Field.TranslatedName+'; //union extracted from object and named '''+Field.TranslatedName+'''',4,0));
FieldName := Field.Name;
if FieldName = '' then begin
FieldName := '__unnamed_field__' + Field.CType;
end;
TypeDecl.Add(IndentText(SanitizeName(FieldName, UsedNames)+': '+ Field.TranslatedName+'; //union extracted from object and named '''+Field.TranslatedName+'''',4,0));
end
end;
end;