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:
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user