diff --git a/slither/core/declarations/function.py b/slither/core/declarations/function.py index 0a6f5ae2a..628961193 100644 --- a/slither/core/declarations/function.py +++ b/slither/core/declarations/function.py @@ -177,6 +177,8 @@ def __init__(self, compilation_unit: "SlitherCompilationUnit") -> None: self._all_library_calls: Optional[List["LibraryCallType"]] = None self._all_low_level_calls: Optional[List["LowLevelCallType"]] = None self._all_solidity_calls: Optional[List["SolidityFunction"]] = None + self._all_variables_read: Optional[List["Variable"]] = None + self._all_variables_written: Optional[List["Variable"]] = None self._all_state_variables_read: Optional[List["StateVariable"]] = None self._all_solidity_variables_read: Optional[List["SolidityVariable"]] = None self._all_state_variables_written: Optional[List["StateVariable"]] = None @@ -1153,6 +1155,18 @@ def _explore_functions(self, f_new_values: Callable[["Function"], List]) -> List return list(set(values)) + def all_variables_read(self) -> List["Variable"]: + """recursive version of variables_read""" + if self._all_variables_read is None: + self._all_variables_read = self._explore_functions(lambda x: x.variables_read) + return self._all_variables_read + + def all_variables_written(self) -> List["Variable"]: + """recursive version of variables_written""" + if self._all_variables_written is None: + self._all_variables_written = self._explore_functions(lambda x: x.variables_written) + return self._all_variables_written + def all_state_variables_read(self) -> List["StateVariable"]: """recursive version of variables_read""" if self._all_state_variables_read is None: