diff --git a/slither/core/cfg/node.py b/slither/core/cfg/node.py index 8cfef32af..951eb1187 100644 --- a/slither/core/cfg/node.py +++ b/slither/core/cfg/node.py @@ -138,6 +138,10 @@ class Node(SourceMapping, ChildFunction): """ return self._node_type + @type.setter + def type(self, t): + self._node_type = t + @property def variables_read(self): """ diff --git a/slither/solc_parsing/declarations/function.py b/slither/solc_parsing/declarations/function.py index 78a285500..8995ce5d3 100644 --- a/slither/solc_parsing/declarations/function.py +++ b/slither/solc_parsing/declarations/function.py @@ -857,12 +857,16 @@ class FunctionSolc(Function): if node.type == NodeType.VARIABLE: assert isinstance(true_expr, AssignmentOperation) #true_expr = true_expr.expression_right + elif node.type == NodeType.RETURN: + true_node.type = NodeType.RETURN true_node.add_expression(true_expr) true_node.analyze_expressions(self) false_node = self._new_node(NodeType.EXPRESSION, node.source_mapping) if node.type == NodeType.VARIABLE: assert isinstance(false_expr, AssignmentOperation) + elif node.type == NodeType.RETURN: + false_node.type = NodeType.RETURN #false_expr = false_expr.expression_right false_node.add_expression(false_expr) false_node.analyze_expressions(self)