mirror of
https://github.com/Sei-Lisa/LSL-PyOptimizer
synced 2025-07-01 15:48:21 +00:00
Our previous fix was incomplete, because it failed to detect the last IF in a chain of ELSE IFs. For example: if (a == 2) llDie(); else if (a) llDie(); else if (a == 3) llDie(); That would be transformed by the IF swapper into: if (a ^ 2) if (a) llDie(); else if (a == 3) llDie(); else llDie(); Note that the last 'else' would bind to the last 'if', not to the first one. So the condition is actually like this: child[1] of an 'if' statement needs to be guarded in {} if the 'else' may belong to the wrong 'if'. It will belong to the wrong 'if' if child[1] is a (possibly empty) chain of 'if {whatever} else ...', followed by an 'if' without 'else', that is: if (cond) stmt; (which was what our previous check did), but also e.g.: if (cond) stmt; else if (cond) stmt; else if (cond) stmt; which we neglected to consider in our previous fix. |
||
---|---|---|
.. | ||
__init__.py | ||
lslbasefuncs.py | ||
lslcommon.py | ||
lsldeadcode.py | ||
lslextrafuncs.py | ||
lslfoldconst.py | ||
lslfuncopt.py | ||
lslfuncs.py | ||
lsljson.py | ||
lsllastpass.py | ||
lslloadlib.py | ||
lsloptimizer.py | ||
lsloutput.py | ||
lslparse.py | ||
lslrenamer.py |