From 9caac7fc843e1eb0481dc901ea5a088413ce03ca Mon Sep 17 00:00:00 2001 From: rocky Date: Wed, 1 Apr 2020 11:00:25 -0400 Subject: [PATCH] Small tweaks ... * Remove unneeded Makefile * sync n_ifelsesmt transform with decompyle3 --- uncompyle6/Makefile | 7 ------- uncompyle6/semantics/transform.py | 9 ++++++--- 2 files changed, 6 insertions(+), 10 deletions(-) delete mode 100644 uncompyle6/Makefile diff --git a/uncompyle6/Makefile b/uncompyle6/Makefile deleted file mode 100644 index bc80236c1..000000000 --- a/uncompyle6/Makefile +++ /dev/null @@ -1,7 +0,0 @@ -# Whatever it is you want to do, it should be forwarded to the -# to top-level irectories -PHONY=check all -all: check - -%: - $(MAKE) -C .. $@ diff --git a/uncompyle6/semantics/transform.py b/uncompyle6/semantics/transform.py index 3504a2068..ba2dd5dee 100644 --- a/uncompyle6/semantics/transform.py +++ b/uncompyle6/semantics/transform.py @@ -262,8 +262,11 @@ def n_ifelsestmt(self, node, preprocess=False): old_stmts = None else_suite_index = 1 - if len(n) == 1 == len(n[0]) and n[0] == "stmt": + len_n = len(n) + if len_n == 1 == len(n[0]) and n[0] == "stmt": n = n[0][0] + elif len_n == 0: + return node elif n[0].kind in ("lastc_stmt", "lastl_stmt"): n = n[0] if n[0].kind in ( @@ -282,14 +285,14 @@ def n_ifelsestmt(self, node, preprocess=False): pass else: if ( - len(n) > 1 + len_n > 1 and isinstance(n[0], SyntaxTree) and 1 == len(n[0]) and n[0] == "stmt" and n[1].kind == "stmt" ): else_suite_stmts = n[0] - elif len(n) == 1: + elif len_n == 1: else_suite_stmts = n else: return node