From df89ea32c1409e75beb5fcb8dc20f3c0e2e34c40 Mon Sep 17 00:00:00 2001 From: Sam Sun Date: Tue, 22 Sep 2020 12:28:04 -0400 Subject: [PATCH] fix cfg printer filename generation (#633) * fix cfg printer filename generation --- slither/printers/functions/cfg.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/slither/printers/functions/cfg.py b/slither/printers/functions/cfg.py index 502a17501b..43c0c65e86 100644 --- a/slither/printers/functions/cfg.py +++ b/slither/printers/functions/cfg.py @@ -22,14 +22,16 @@ def output(self, filename): continue for function in contract.functions + contract.modifiers: if filename: - filename = "{}-{}-{}.dot".format(filename, contract.name, function.full_name) + new_filename = "{}-{}-{}.dot".format( + filename, contract.name, function.full_name + ) else: - filename = "{}-{}.dot".format(contract.name, function.full_name) - info += "Export {}\n".format(filename) + new_filename = "{}-{}.dot".format(contract.name, function.full_name) + info += "Export {}\n".format(new_filename) content = function.slithir_cfg_to_dot_str() - with open(filename, "w", encoding="utf8") as f: + with open(new_filename, "w", encoding="utf8") as f: f.write(content) - all_files.append((filename, content)) + all_files.append((new_filename, content)) self.info(info)