Skip to content

Commit

Permalink
fix cfg printer filename generation (#633)
Browse files Browse the repository at this point in the history
* fix cfg printer filename generation
  • Loading branch information
samczsun authored Sep 22, 2020
1 parent d51336c commit df89ea3
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions slither/printers/functions/cfg.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down

0 comments on commit df89ea3

Please sign in to comment.