Skip to content

Fix disassembling lateral proc overrides - #2690

Open
snowyukitty wants to merge 2 commits into
OpenDreamProject:masterfrom
snowyukitty:fix/disassembler-lateral-overrides
Open

Fix disassembling lateral proc overrides#2690
snowyukitty wants to merge 2 commits into
OpenDreamProject:masterfrom
snowyukitty:fix/disassembler-lateral-overrides

Conversation

@snowyukitty

Copy link
Copy Markdown

Summary

  • Preserve every lateral proc definition in compiler-emitted source order instead of keeping only the final definition.
  • Decompile all matching definitions together and print a notice explaining the multi-definition output.
  • Add a compiler-to-CLI regression test and run the dedicated test project in CI.

Fixes #2562

Testing

  • dotnet build DMDisassembler/DMDisassembler.csproj --configuration Release --no-restore
  • dotnet test DMDisassembler.Tests/DMDisassembler.Tests.csproj --configuration Release --no-build --no-restore
  • Compiled a three-definition reproduction and confirmed the CLI prints the notice followed by definitions returning 1, 2, and 3 in source order.

@boring-cyborg boring-cyborg Bot added the Compiler Involves the OpenDream compiler label Jul 29, 2026
Comment thread DMDisassembler/Program.cs
Console.WriteLine(proc.Decompile());
} else if (_selectedType.Procs.TryGetValue(name, out DMProc[]? procs)) {
if (procs.Length > 1) {
Console.WriteLine($"Notice: Found {procs.Length} definitions of {name}(); decompiling all in source order.");

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Personally, I'd like a second message afterwards too since I may not always scroll up past the text wall to see this one. Just a Finished decompiling all {proc.Length} definitions of {name}() or similar.

@snowyukitty

Copy link
Copy Markdown
Author

Added a completion message after the last definition and extended the regression test to verify it appears after the final decompiled body. Thanks!

startInfo.ArgumentList.Add(disassembler);
startInfo.ArgumentList.Add(jsonFile);

using var process = new Process { StartInfo = startInfo };
"ReturnFloat 3"
}), output);
Assert.That(output, Does.Contain(completion));
Assert.That(output.Split(notice, StringSplitOptions.None), Has.Length.EqualTo(2), output);
}), output);
Assert.That(output, Does.Contain(completion));
Assert.That(output.Split(notice, StringSplitOptions.None), Has.Length.EqualTo(2), output);
Assert.That(output.Split(completion, StringSplitOptions.None), Has.Length.EqualTo(2), output);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Compiler Involves the OpenDream compiler size/L

Projects

None yet

Development

Successfully merging this pull request may close these issues.

DMDisassembler does not handle lateral proc overrides

3 participants