mirror of
https://github.com/Sei-Lisa/LSL-PyOptimizer
synced 2025-07-01 15:48:21 +00:00
Don't run dead code removal when in calc mode. Add TODO item.
Running 'main.py -O expr' without disabling DCR led to an immediate crash, due to it trying to access the default state.
This commit is contained in:
parent
250090f418
commit
7419ac4982
1 changed files with 8 additions and 0 deletions
|
@ -475,6 +475,14 @@ class deadcode(object):
|
|||
# sophisticated (yet).
|
||||
|
||||
# TODO: Inlining of functions that are a single 'return' line.
|
||||
# TODO: Remove empty events if they are side effect-free.
|
||||
# Note that e.g. touch/* events are not SEF, because their presence
|
||||
# causes the hand to be shown, so we need a list of SEF events.
|
||||
|
||||
if lslfuncs.lslcommon.IsCalc:
|
||||
# Do nothing if in calculator mode (there's no default event
|
||||
# and it crashes without this)
|
||||
return
|
||||
|
||||
statedef = self.tree[self.symtab[0]['default']['Loc']]
|
||||
assert statedef['nt'] == 'STDEF' and statedef['name'] == 'default'
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue