Created
December 9, 2022 20:23
-
-
Save emo-eth/ee2a167109006d63f089ad01dd03a410 to your computer and use it in GitHub Desktop.
script to detect duplicate fn definitions in seaport IR out
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from collections import defaultdict | |
from pprint import pprint | |
defs = [] | |
with open("Seaport.sol") as f: | |
lines = f.readlines() | |
for line in lines: | |
line = line.strip() | |
if line.startswith("function fun_"): | |
defs.append(line.split("(")[0].split(" ")[1].strip()) | |
common = defaultdict(list) | |
for d in defs: | |
no_fun = [x for x in d.split("_") if x][1] | |
just_name = no_fun.split("_")[0] | |
common[just_name].append(d) | |
multi = {} | |
for k, v in common.items(): | |
if len(v) > 1: | |
multi[k] = v | |
pprint(multi) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment