Fix incorrect ternary conversion on Return node (close #115)

pull/122/head
Josselin 6 years ago
parent b31fdc44d2
commit c8952db2ed
  1. 4
      slither/core/cfg/node.py
  2. 4
      slither/solc_parsing/declarations/function.py

@ -138,6 +138,10 @@ class Node(SourceMapping, ChildFunction):
""" """
return self._node_type return self._node_type
@type.setter
def type(self, t):
self._node_type = t
@property @property
def variables_read(self): def variables_read(self):
""" """

@ -857,12 +857,16 @@ class FunctionSolc(Function):
if node.type == NodeType.VARIABLE: if node.type == NodeType.VARIABLE:
assert isinstance(true_expr, AssignmentOperation) assert isinstance(true_expr, AssignmentOperation)
#true_expr = true_expr.expression_right #true_expr = true_expr.expression_right
elif node.type == NodeType.RETURN:
true_node.type = NodeType.RETURN
true_node.add_expression(true_expr) true_node.add_expression(true_expr)
true_node.analyze_expressions(self) true_node.analyze_expressions(self)
false_node = self._new_node(NodeType.EXPRESSION, node.source_mapping) false_node = self._new_node(NodeType.EXPRESSION, node.source_mapping)
if node.type == NodeType.VARIABLE: if node.type == NodeType.VARIABLE:
assert isinstance(false_expr, AssignmentOperation) assert isinstance(false_expr, AssignmentOperation)
elif node.type == NodeType.RETURN:
false_node.type = NodeType.RETURN
#false_expr = false_expr.expression_right #false_expr = false_expr.expression_right
false_node.add_expression(false_expr) false_node.add_expression(false_expr)
false_node.analyze_expressions(self) false_node.analyze_expressions(self)

Loading…
Cancel
Save