Skip to content

Commit

Permalink
Fix #7
Browse files Browse the repository at this point in the history
  • Loading branch information
colinator27 committed Aug 12, 2024
1 parent afac234 commit 409138d
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
4 changes: 4 additions & 0 deletions Underanalyzer/Decompiler/AST/Nodes/EnumDeclNode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ public void Print(ASTPrinter printer)
{
printer.Write("enum ");
printer.Write(Enum.Name);
if (printer.Context.Settings.OpenBlockBraceOnSameLine)
{
printer.Write(' ');
}
printer.OpenBlock();

// Sort values of enum by value
Expand Down
23 changes: 23 additions & 0 deletions UnderanalyzerTest/DecompileContext.DecompileToString.Settings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1119,4 +1119,27 @@ pop.v.i self.d
}
);
}

[Fact]
public void TestEnumOpenBraceSameLine()
{
TestUtil.VerifyDecompileResult(
"""
push.l 0
pop.v.l self.a
""",
"""
a = UnknownEnum.Value_0;

enum UnknownEnum {
Value_0
}
""",
null,
new DecompileSettings()
{
OpenBlockBraceOnSameLine = true
}
);
}
}

0 comments on commit 409138d

Please sign in to comment.