From bcc7fe352424612778164495cce14a467dd1aa63 Mon Sep 17 00:00:00 2001 From: Sei Lisa Date: Tue, 5 Aug 2014 15:38:19 +0200 Subject: [PATCH] Fix bug in FoldStmt where EXPR nodes were not optimized out. --- lslopt/lsloptimizer.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lslopt/lsloptimizer.py b/lslopt/lsloptimizer.py index 9790a45..43048e1 100644 --- a/lslopt/lsloptimizer.py +++ b/lslopt/lsloptimizer.py @@ -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):