From 57a0918f2434de0e0d23fad511f2fc4e63853cea Mon Sep 17 00:00:00 2001 From: Josselin Date: Fri, 4 Jan 2019 17:27:37 +0000 Subject: [PATCH] API changes: - Remove contract.get_functions_overridden_by - Add function.functions_shadowed --- slither/core/declarations/contract.py | 11 ----------- slither/core/declarations/function.py | 12 ++++++++++++ 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/slither/core/declarations/contract.py b/slither/core/declarations/contract.py index a4e5bbc907..724d3b0351 100644 --- a/slither/core/declarations/contract.py +++ b/slither/core/declarations/contract.py @@ -163,17 +163,6 @@ def functions_and_modifiers_not_inherited(self): ''' return self.functions_not_inherited + self.modifiers_not_inherited - def get_functions_overridden_by(self, function): - ''' - Return the list of functions overriden by the function - Args: - (core.Function) - Returns: - list(core.Function) - - ''' - candidates = self.functions_inherited - return [f for f in candidates if f.name == function] @property def all_functions_called(self): diff --git a/slither/core/declarations/function.py b/slither/core/declarations/function.py index d8e4a99319..3f31429b40 100644 --- a/slither/core/declarations/function.py +++ b/slither/core/declarations/function.py @@ -319,6 +319,18 @@ def full_name(self): name, parameters, _ = self.signature return name+'('+','.join(parameters)+')' + @property + def functions_shadowed(self): + ''' + Return the list of functions shadowed + Returns: + list(core.Function) + + ''' + candidates = [c.functions_not_inherited for c in self.contract.inheritance] + candidates = [candidate for sublist in candidates for candidate in sublist] + return [f for f in candidates if f.full_name == self.full_name] + @property def slither(self):