pull/72/head
Josselin 6 years ago
parent c08c3b56e7
commit cc64d36486
  1. 5
      slither/core/source_mapping/source_mapping.py
  2. 8
      slither/solc_parsing/declarations/function.py

@ -62,7 +62,10 @@ class SourceMapping(Context):
return {'start':s, 'length':l, 'filename': filename, 'lines' : lines } return {'start':s, 'length':l, 'filename': filename, 'lines' : lines }
def set_offset(self, offset, slither): def set_offset(self, offset, slither):
self._source_mapping = self._convert_source_mapping(offset, slither) if isinstance(offset, dict):
self._source_mapping = offset
else:
self._source_mapping = self._convert_source_mapping(offset, slither)
@property @property

@ -867,23 +867,23 @@ class FunctionSolc(Function):
def split_ternary_node(self, node, condition, true_expr, false_expr): def split_ternary_node(self, node, condition, true_expr, false_expr):
condition_node = self._new_node(NodeType.IF, condition['src']) condition_node = self._new_node(NodeType.IF, node.source_mapping)
condition_node.add_expression(condition) condition_node.add_expression(condition)
condition_node.analyze_expressions(self) condition_node.analyze_expressions(self)
true_node = self._new_node(node.type, true_expr['src']) true_node = self._new_node(node.type, node.source_mapping)
if node.type == NodeType.VARIABLE: if node.type == NodeType.VARIABLE:
true_node.add_variable_declaration(node.variable_declaration) true_node.add_variable_declaration(node.variable_declaration)
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(node.type, false_expr['src']) false_node = self._new_node(node.type, node.source_mapping)
if node.type == NodeType.VARIABLE: if node.type == NodeType.VARIABLE:
false_node.add_variable_declaration(node.variable_declaration) false_node.add_variable_declaration(node.variable_declaration)
false_node.add_expression(false_expr) false_node.add_expression(false_expr)
false_node.analyze_expressions(self) false_node.analyze_expressions(self)
endif_node = self._new_node(NodeType.ENDIF, condition['src']) endif_node = self._new_node(NodeType.ENDIF, node.source_mapping)
for father in node.fathers: for father in node.fathers:
father.remove_son(node) father.remove_son(node)

Loading…
Cancel
Save