Add missing source mapping

pull/238/head
Josselin 5 years ago
parent 122b4268cf
commit 9ad04d9128
  1. 4
      slither/solc_parsing/cfg/node.py
  2. 1
      slither/solc_parsing/declarations/contract.py
  3. 4
      slither/solc_parsing/expressions/expression_parsing.py

@ -37,10 +37,12 @@ class NodeSolc(Node):
if self.type == NodeType.VARIABLE: if self.type == NodeType.VARIABLE:
# Update the expression to be an assignement to the variable # Update the expression to be an assignement to the variable
#print(self.variable_declaration) #print(self.variable_declaration)
self._expression = AssignmentOperation(Identifier(self.variable_declaration), _expression = AssignmentOperation(Identifier(self.variable_declaration),
self.expression, self.expression,
AssignmentOperationType.ASSIGN, AssignmentOperationType.ASSIGN,
self.variable_declaration.type) self.variable_declaration.type)
_expression.set_offset(self.expression.source_mapping, caller_context)
self._expression = _expression
expression = self.expression expression = self.expression
pp = ReadVar(expression) pp = ReadVar(expression)

@ -382,6 +382,7 @@ class ContractSolc04(Contract):
AssignmentOperationType.ASSIGN, AssignmentOperationType.ASSIGN,
variable.type) variable.type)
expression.set_offset(variable.source_mapping, self.slither)
node.add_expression(expression) node.add_expression(expression)
return node return node

@ -581,7 +581,9 @@ def parse_expression(expression, caller_context):
var = find_variable(super_name, caller_context, is_super=True) var = find_variable(super_name, caller_context, is_super=True)
if var is None: if var is None:
raise VariableNotFound('Variable not found: {}'.format(super_name)) 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 = MemberAccess(member_name, member_type, member_expression)
member_access.set_offset(expression['src'], caller_context.slither) member_access.set_offset(expression['src'], caller_context.slither)
if str(member_access) in SOLIDITY_VARIABLES_COMPOSED: if str(member_access) in SOLIDITY_VARIABLES_COMPOSED:

Loading…
Cancel
Save