Closed theCapypara closed 2 months ago
I find this example a bit confusing. You say it wouldn't loop without continue;
, which implies it would loop if continue;
is present. But then you show an example that does have continue;
and say that wouldn't have looped before?
Whoops, I removed it. I had that in there while testing. There isn't supposed to be a continue in the example.
Whoops, I removed it. I had that in there while testing. There isn't supposed to be a continue in the example.
Oh, there we go. It makes sense now.
This does not change the fact that the decompiler will still add continue statements to forevers, even if they may seem redundant.
Why is this btw? Aren't they unnecessary now?
No. The reason they were added had nothing to do with this bug, except for the fact that they kinda hid it.
I need to reexamine if this is true, but according to the TODO comment in the decompiler, there is no reliable way in the optimization phase to know if the place where the dummy continues are inserted are really going to be the last statement in hhe generated ExplorerScript code and would actually cause a loop. I don't know anymore why that would be, in theory no matter how the code ends up being generated it should match the graph and thus always be effectively the last statement, so it should loop even without a continue. I'll do some testing.
Yeah basically there is no way to know if the marker that generates continues is actually required (a real continue) or not because it was auto-inserted by previous steps in the decompliation. It might be possible to mark these somehow.
This fixes that
forever
blocks without acontinue
statement would not actually loop.:warning: This is a breaking change, but also a bugfix, since this was never supposed to be the behaviour.
Example:
Assuming
print
is a function that prints the const string, this would print before:It will now print:
The last line repeats indefinitely.
:information_source: This does not change the fact that the decompiler will still add
continue
statements to forevers, even if they may seem redundant.