Fix bug in FoldStmt where EXPR nodes were not optimized out.

This commit is contained in:
Sei Lisa 2014-08-05 15:38:19 +02:00
parent 24a32c30e3
commit bcc7fe3524

View file

@ -39,7 +39,10 @@ class optimizer(renamer, deadcode):
nothing.
"""
# Ideally this should consider side effect analysis of the whole thing.
if parent[index]['nt'] in ('CONST', 'IDENT', 'FIELD'):
node = parent[index]
if node['nt'] == 'EXPR':
node = node['ch'][0]
if node['nt'] in ('CONST', 'IDENT', 'FLD'):
parent[index] = {'nt':';','t':None}
def FoldCond(self, parent, index):