From cc64d36486c7186566d4eb8307c2b76430fdc954 Mon Sep 17 00:00:00 2001 From: Josselin Date: Tue, 30 Oct 2018 18:57:46 +0100 Subject: [PATCH] Fix bug --- slither/core/source_mapping/source_mapping.py | 5 ++++- slither/solc_parsing/declarations/function.py | 8 ++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/slither/core/source_mapping/source_mapping.py b/slither/core/source_mapping/source_mapping.py index 64dd7fcc4..642a2fb4c 100644 --- a/slither/core/source_mapping/source_mapping.py +++ b/slither/core/source_mapping/source_mapping.py @@ -62,7 +62,10 @@ class SourceMapping(Context): return {'start':s, 'length':l, 'filename': filename, 'lines' : lines } 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 diff --git a/slither/solc_parsing/declarations/function.py b/slither/solc_parsing/declarations/function.py index b138f0d06..5b3952917 100644 --- a/slither/solc_parsing/declarations/function.py +++ b/slither/solc_parsing/declarations/function.py @@ -867,23 +867,23 @@ class FunctionSolc(Function): 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.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: true_node.add_variable_declaration(node.variable_declaration) true_node.add_expression(true_expr) 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: false_node.add_variable_declaration(node.variable_declaration) false_node.add_expression(false_expr) 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: father.remove_son(node)