From 9f8441bc6539281cae2a4a5afdf6dcd172daa460 Mon Sep 17 00:00:00 2001 From: Sei Lisa Date: Sat, 4 Feb 2017 04:08:18 +0100 Subject: [PATCH] Fix lslparse.DoesSomething. It was non-funcional because of a copy/paste error. --- lslopt/lslfoldconst.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lslopt/lslfoldconst.py b/lslopt/lslfoldconst.py index 79ea3d8..92b3d0b 100644 --- a/lslopt/lslfoldconst.py +++ b/lslopt/lslfoldconst.py @@ -46,11 +46,15 @@ class foldconst(object): def DoesSomething(self, node): """Tell if a subtree does something or is just empty statements (a pure combination of ';' and '{}') + + Not to be confused with lslparse.does_something which includes labels, + and applies to a block's statement list, not to a node. """ if node['nt'] != ';': if node['nt'] == '{}': - if self.does_something(node['ch']): - return True + for subnode in node['ch']: + if self.DoesSomething(subnode): + return True else: return True return False