C#: Fix generated nested class order

This commit is contained in:
Raul Santos 2023-10-18 03:25:24 +02:00
parent dce1aab174
commit fe078219fc
No known key found for this signature in database
GPG key ID: B532473AE3A803E4
7 changed files with 71 additions and 21 deletions

View file

@ -105,16 +105,20 @@ namespace Godot.SourceGenerators
if (isInnerClass)
{
var containingType = symbol.ContainingType;
AppendPartialContainingTypeDeclarations(containingType);
while (containingType != null)
void AppendPartialContainingTypeDeclarations(INamedTypeSymbol? containingType)
{
if (containingType == null)
return;
AppendPartialContainingTypeDeclarations(containingType.ContainingType);
source.Append("partial ");
source.Append(containingType.GetDeclarationKeyword());
source.Append(" ");
source.Append(containingType.NameWithTypeParameters());
source.Append("\n{\n");
containingType = containingType.ContainingType;
}
}