UndertaleModTool icon indicating copy to clipboard operation
UndertaleModTool copied to clipboard

General changes to help improve ability to compare decompiled code quality between DS and UMT

Open Grossley opened this issue 3 years ago • 4 comments

Which component should be improved?

Decompiler

Describe your feature suggestion in more detail

  1. Toggleable option of whether semicolons are placed at the end of lines of code would help with comparing decompilation quality.
  2. Add the final blank line on all decompiled code entries in DS.
  3. Always wrap the condition of an if statement with parentheses, even if it's only one condition 3a. (ex. if __b__ becomes if (__b__)).

Grossley avatar May 27 '22 17:05 Grossley

The blank line at the end of files is standard for a lot of things. It's good to have a terminator newline when files end, so programs that read code don't mess up, and if you concatenate two files together, it's much nicer that they have newlines at the end. I'm pretty sure git even warns you if you don't have one. Personally, I think the 2nd point should be changed to, make DS add a final blank line.

NyakoFox avatar May 27 '22 17:05 NyakoFox

The blank line at the end of files is standard for a lot of things. It's good to have a terminator newline when files end, so programs that read code don't mess up, and if you concatenate two files together, it's much nicer that they have newlines at the end. I'm pretty sure git even warns you if you don't have one. Personally, I think the 2nd point should be changed to, make DS add a final blank line.

Sounds good to me.

Grossley avatar May 27 '22 17:05 Grossley

Agree with this.

Archie-osu avatar May 27 '22 17:05 Archie-osu

+1, I'd like to add a suggestion from #785:

Make all if() statements use { ... } instead of 2-line ifs that don't use curly braces

Eg rather than this:

if (something == true)
    do_stuff()

It would be this:

if (something == true) {
    do_stuff()
}

IME this approach makes refactoring code a lot easier, and IMO makes the code easier to read

In #785 I also proposed using the c# style of brackets on newlines, as well as adding space below them, screenshot is in this comment.

All suggested as an option, if that's possible, so users have a choice depending on their preferred style

ithinkandicode avatar Aug 29 '22 21:08 ithinkandicode