Add constructors to contract.all_functions_called

pull/20/head
Josselin 6 years ago
parent 58121ce24d
commit 8c34abe1c3
  1. 12
      slither/core/declarations/contract.py

@ -95,6 +95,10 @@ class Contract(ChildSlither, SourceMapping):
def modifiers_as_dict(self):
return self._modifiers
@property
def constructor(self):
return next((func for func in self.functions if func.is_constructor), None)
@property
def functions(self):
'''
@ -116,7 +120,13 @@ class Contract(ChildSlither, SourceMapping):
'''
all_calls = (f.all_internal_calls() for f in self.functions)
all_calls = [item for sublist in all_calls for item in sublist] + self.functions
all_calls = set(all_calls)
all_calls = list(set(all_calls))
all_constructors = [c.constructor for c in self.inheritance]
all_constructors = list(set([c for c in all_constructors if c]))
all_calls = set(all_calls+all_constructors)
return [c for c in all_calls if isinstance(c, Function)]
def functions_as_dict(self):

Loading…
Cancel
Save