|
|
|
@ -9,10 +9,8 @@ from slither.core.children.child_contract import ChildContract |
|
|
|
|
from slither.core.declarations.solidity_variables import (SolidityFunction, |
|
|
|
|
SolidityVariable, |
|
|
|
|
SolidityVariableComposed) |
|
|
|
|
from slither.core.expressions.identifier import Identifier |
|
|
|
|
from slither.core.expressions.index_access import IndexAccess |
|
|
|
|
from slither.core.expressions.member_access import MemberAccess |
|
|
|
|
from slither.core.expressions.unary_operation import UnaryOperation |
|
|
|
|
from slither.core.expressions import (Identifier, IndexAccess, MemberAccess, |
|
|
|
|
UnaryOperation) |
|
|
|
|
from slither.core.source_mapping.source_mapping import SourceMapping |
|
|
|
|
from slither.core.variables.state_variable import StateVariable |
|
|
|
|
|
|
|
|
@ -43,6 +41,8 @@ class Function(ChildContract, SourceMapping): |
|
|
|
|
self._parameters_ssa = [] |
|
|
|
|
self._returns = [] |
|
|
|
|
self._returns_ssa = [] |
|
|
|
|
self._return_values = None |
|
|
|
|
self._return_values_ssa = None |
|
|
|
|
self._vars_read = [] |
|
|
|
|
self._vars_written = [] |
|
|
|
|
self._state_vars_read = [] |
|
|
|
@ -468,6 +468,36 @@ class Function(ChildContract, SourceMapping): |
|
|
|
|
self._expressions = expressions |
|
|
|
|
return self._expressions |
|
|
|
|
|
|
|
|
|
@property |
|
|
|
|
def return_values(self): |
|
|
|
|
""" |
|
|
|
|
list(Return Values): List of the return values |
|
|
|
|
""" |
|
|
|
|
from slither.core.cfg.node import NodeType |
|
|
|
|
from slither.slithir.operations import Return |
|
|
|
|
|
|
|
|
|
if self._return_values is None: |
|
|
|
|
return_values = list() |
|
|
|
|
returns = [n for n in self.nodes if n.type == NodeType.RETURN] |
|
|
|
|
[return_values.extend(ir.values) for node in returns for ir in node.irs if isinstance(ir, Return)] |
|
|
|
|
self._return_values = list(set(return_values)) |
|
|
|
|
return self._return_values |
|
|
|
|
|
|
|
|
|
@property |
|
|
|
|
def return_values_ssa(self): |
|
|
|
|
""" |
|
|
|
|
list(Return Values in SSA form): List of the return values in ssa form |
|
|
|
|
""" |
|
|
|
|
from slither.core.cfg.node import NodeType |
|
|
|
|
from slither.slithir.operations import Return |
|
|
|
|
|
|
|
|
|
if self._return_values_ssa is None: |
|
|
|
|
return_values_ssa = list() |
|
|
|
|
returns = [n for n in self.nodes if n.type == NodeType.RETURN] |
|
|
|
|
[return_values_ssa.extend(ir.values) for node in returns for ir in node.irs_ssa if isinstance(ir, Return)] |
|
|
|
|
self._return_values_ssa = list(set(return_values_ssa)) |
|
|
|
|
return self._return_values_ssa |
|
|
|
|
|
|
|
|
|
# endregion |
|
|
|
|
################################################################################### |
|
|
|
|
################################################################################### |
|
|
|
|