Merge pull request #353 from crytic/dev-contract-summary

Remove shadowed functions from contract summary printer
pull/355/head
Feist Josselin 5 years ago committed by GitHub
commit 7e58e92a58
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 7
      slither/core/declarations/contract.py
  2. 2
      slither/printers/summary/contract.py

@ -640,14 +640,15 @@ class Contract(ChildSlither, SourceMapping):
################################################################################### ###################################################################################
################################################################################### ###################################################################################
def get_summary(self): def get_summary(self, include_shadowed=True):
""" Return the function summary """ Return the function summary
:param include_shadowed: boolean to indicate if shadowed functions should be included (default True)
Returns: Returns:
(str, list, list, list, list): (name, inheritance, variables, fuction summaries, modifier summaries) (str, list, list, list, list): (name, inheritance, variables, fuction summaries, modifier summaries)
""" """
func_summaries = [f.get_summary() for f in self.functions] func_summaries = [f.get_summary() for f in self.functions if (not f.is_shadowed or include_shadowed)]
modif_summaries = [f.get_summary() for f in self.modifiers] modif_summaries = [f.get_summary() for f in self.modifiers if (not f.is_shadowed or include_shadowed)]
return (self.name, [str(x) for x in self.inheritance], [str(x) for x in self.variables], func_summaries, modif_summaries) return (self.name, [str(x) for x in self.inheritance], [str(x) for x in self.variables], func_summaries, modif_summaries)
def is_signature_only(self): def is_signature_only(self):

@ -21,7 +21,7 @@ class ContractSummary(AbstractPrinter):
txt = "" txt = ""
for c in self.contracts: for c in self.contracts:
(name, _inheritance, _var, func_summaries, _modif_summaries) = c.get_summary() (name, _inheritance, _var, func_summaries, _modif_summaries) = c.get_summary(False)
txt += blue("\n+ Contract %s\n"%name) txt += blue("\n+ Contract %s\n"%name)
# (c_name, f_name, visi, _, _, _, _, _) in func_summaries # (c_name, f_name, visi, _, _, _, _, _) in func_summaries
public = [(elem[0], (elem[1], elem[2]) ) for elem in func_summaries] public = [(elem[0], (elem[1], elem[2]) ) for elem in func_summaries]

Loading…
Cancel
Save