diff --git a/slither/solc_parsing/cfg/node.py b/slither/solc_parsing/cfg/node.py index 1775084f6..c711b31c3 100644 --- a/slither/solc_parsing/cfg/node.py +++ b/slither/solc_parsing/cfg/node.py @@ -37,10 +37,12 @@ class NodeSolc(Node): if self.type == NodeType.VARIABLE: # Update the expression to be an assignement to the variable #print(self.variable_declaration) - self._expression = AssignmentOperation(Identifier(self.variable_declaration), - self.expression, - AssignmentOperationType.ASSIGN, - self.variable_declaration.type) + _expression = AssignmentOperation(Identifier(self.variable_declaration), + self.expression, + AssignmentOperationType.ASSIGN, + self.variable_declaration.type) + _expression.set_offset(self.expression.source_mapping, caller_context) + self._expression = _expression expression = self.expression pp = ReadVar(expression) diff --git a/slither/solc_parsing/declarations/contract.py b/slither/solc_parsing/declarations/contract.py index 3f8b52f6f..ebb43a185 100644 --- a/slither/solc_parsing/declarations/contract.py +++ b/slither/solc_parsing/declarations/contract.py @@ -382,6 +382,7 @@ class ContractSolc04(Contract): AssignmentOperationType.ASSIGN, variable.type) + expression.set_offset(variable.source_mapping, self.slither) node.add_expression(expression) return node diff --git a/slither/solc_parsing/expressions/expression_parsing.py b/slither/solc_parsing/expressions/expression_parsing.py index 92314a80a..4ccaeb275 100644 --- a/slither/solc_parsing/expressions/expression_parsing.py +++ b/slither/solc_parsing/expressions/expression_parsing.py @@ -581,7 +581,9 @@ def parse_expression(expression, caller_context): var = find_variable(super_name, caller_context, is_super=True) if var is None: raise VariableNotFound('Variable not found: {}'.format(super_name)) - return SuperIdentifier(var) + sup = SuperIdentifier(var) + sup.set_offset(expression['src'], caller_context) + return sup member_access = MemberAccess(member_name, member_type, member_expression) member_access.set_offset(expression['src'], caller_context.slither) if str(member_access) in SOLIDITY_VARIABLES_COMPOSED: