Skip to content

Commit

Permalink
Allow to generate inner anonymous enum but not global enums
Browse files Browse the repository at this point in the history
  • Loading branch information
xoofx committed May 25, 2024
1 parent 8425ecf commit 8d15025
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions src/CppAst.CodeGen/CSharp/Plugins/DefaultEnumConverter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ public void Register(CSharpConverter converter, CSharpConverterPipeline pipeline

public static CSharpElement? ConvertEnum(CSharpConverter converter, CppEnum cppEnum, CSharpElement context)
{
// If the enum is anonymous, we don't generate it
if (cppEnum.IsAnonymous)
// We don't support generate anonymous enums
if (cppEnum.IsAnonymous && context is CSharpCompilation)
{
return null;
}
Expand All @@ -27,11 +27,6 @@ public void Register(CSharpConverter converter, CSharpConverterPipeline pipeline
CppElement = cppEnum
};

if (cppEnum.IsAnonymous)
{
csEnum.Name += "AnonymousEnum";
}

var container = converter.GetCSharpContainer(cppEnum, context);
container.Members.Add(csEnum);

Expand Down

0 comments on commit 8d15025

Please sign in to comment.