UndertaleModTool
UndertaleModTool copied to clipboard
Bug: the compiler removes return statements sometimes
Describe the bug
a return at the end of an if statement with other code in it removes the return when compiled
Reproducing steps
- Open a script (not sure if it works on the new functions thing, definitely works on legacy scripts)
- Put the following code at the beginning:
if(some_var) {
do_something()
return;
}
- Click away to compile the code
- Observe the return disappear
Setup Details
- commit 61d0f89
- win10 latest
- Will You Snail?
This occurs because scripts automatically decompile with an unnecessary return
at the end and I wanted to ignore that return to match bytecode. Thus, it can be fixed at AssemblyWriter.cs#1019, but maintaining 1:1 compilation will require removing the unnecessary return
generation. Not that that's a high priority.