Merge pull request #384 from crytic/dev-contract-summary-fix

Fix contract summary printer bug
pull/390/head
Feist Josselin 5 years ago committed by GitHub
commit e5717ead56
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 11
      slither/printers/summary/contract.py

@ -48,7 +48,8 @@ class ContractSummary(AbstractPrinter):
# Order the function with # Order the function with
# contract_declarer -> list_functions # contract_declarer -> list_functions
public = [(f.contract_declarer.name, f) for f in c.functions if (not f.is_shadowed)] public = [(f.contract_declarer.name, f) for f in c.functions if (not f.is_shadowed and
not f.is_constructor_variables)]
collect = collections.defaultdict(list) collect = collections.defaultdict(list)
for a, b in public: for a, b in public:
collect[a].append(b) collect[a].append(b)
@ -61,14 +62,14 @@ class ContractSummary(AbstractPrinter):
for function in functions: for function in functions:
if function.visibility in ['external', 'public']: if function.visibility in ['external', 'public']:
txt += green(" - {} ({})\n".format(function, function.visibility)) txt += green(" - {} ({})\n".format(function.full_name, function.visibility))
if function.visibility in ['internal', 'private']: if function.visibility in ['internal', 'private']:
txt += magenta(" - {} ({})\n".format(function, function.visibility)) txt += magenta(" - {} ({})\n".format(function.full_name, function.visibility))
if function.visibility not in ['external', 'public', 'internal', 'private']: if function.visibility not in ['external', 'public', 'internal', 'private']:
txt += " - {}  ({})\n".format(function, function.visibility) txt += " - {}  ({})\n".format(function.full_name, function.visibility)
additional_fields.add(function, additional_fields={"visibility": additional_fields.add(function, additional_fields={"visibility":
function.visibility,}) function.visibility})
all_contracts.append((c, additional_fields.data)) all_contracts.append((c, additional_fields.data))

Loading…
Cancel
Save