mirror of
https://github.com/Sei-Lisa/LSL-PyOptimizer
synced 2025-07-01 15:48:21 +00:00
Get rid of DoesSomething() in favour of SEF
The missing bit was to mark labels are SEF when they are not referenced. Label references are now counted at parse time, enabling us to do this. Also, make FoldStmt clearer when the node is an expression.
This commit is contained in:
parent
a93ea0ca19
commit
285c7172fd
3 changed files with 71 additions and 55 deletions
|
@ -384,6 +384,12 @@ class deadcode(object):
|
|||
node = curnode.ch[index]
|
||||
|
||||
if not hasattr(node, 'X'):
|
||||
if curnode.ch[index].nt == 'JUMP':
|
||||
# Decrease label reference count
|
||||
scope = curnode.ch[index].scope
|
||||
name = curnode.ch[index].name
|
||||
assert self.symtab[scope][name]['ref'] > 0
|
||||
self.symtab[scope][name]['ref'] -= 1
|
||||
del curnode.ch[index]
|
||||
continue
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue