mirror of
https://github.com/Sei-Lisa/LSL-PyOptimizer
synced 2025-07-01 15:48:21 +00:00
Fix bug where list elements of global declarations were removed.
CleanNode was too greedy, because children of global declarations (particularly lists) are not marked executable. Make a special case for them and don't recurse, since what matters is whether the declaration itself is executed. Its contents can't be cleaned up.
This commit is contained in:
parent
f77590df67
commit
cc96850f66
1 changed files with 2 additions and 1 deletions
|
@ -362,7 +362,8 @@ class deadcode(object):
|
|||
"""Recursively checks if the children are used, deleting those that are
|
||||
not.
|
||||
"""
|
||||
if 'ch' not in curnode:
|
||||
if 'ch' not in curnode or (curnode['nt'] == 'DECL'
|
||||
and curnode['scope'] == 0):
|
||||
return
|
||||
# NOTE: Should not depend on 'Loc', since the nodes that are the
|
||||
# destination of 'Loc' are renumbered as we delete stuff from globals.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue