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