Closed Tonaie closed 4 years ago
Thanks a lot, and that was a nice test case! I've added it to the test suite, please let me know if that's a problem for you.
Oops, I pressed the send button too soon.
There were several problems here:
RETURN
statements was being deleted from the statement; when the constant folding module saw a RETURN
without parameters as a last statement, it thought it was OK to remove it (it would, if that was valid, so that part was actually working correctly).The fix is already committed and applied to the online version.
A test case had to be disabled because this fix brought back a RETURN statement in it.
This is a little of a special case because jump statements are rarely used but take this function for an example:
After optimizing:
Even though the
return [];
at the end of the original function is never reached because of the jump statement, LSL requires it in order to compile.