|
|
|
@ -47,7 +47,7 @@ def get_pointer_name(variable): |
|
|
|
|
return None |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def find_variable(var_name, caller_context): |
|
|
|
|
def find_variable(var_name, caller_context, referenced_declaration=None): |
|
|
|
|
|
|
|
|
|
if isinstance(caller_context, Contract): |
|
|
|
|
function = None |
|
|
|
@ -123,6 +123,11 @@ def find_variable(var_name, caller_context): |
|
|
|
|
if var_name in contracts: |
|
|
|
|
return contracts[var_name] |
|
|
|
|
|
|
|
|
|
if referenced_declaration: |
|
|
|
|
for contract in contract.slither.contracts: |
|
|
|
|
if contract.id == referenced_declaration: |
|
|
|
|
return contract |
|
|
|
|
|
|
|
|
|
raise VariableNotFound('Variable not found: {}'.format(var_name)) |
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -406,7 +411,11 @@ def parse_expression(expression, caller_context): |
|
|
|
|
value = value+'('+found[0]+')' |
|
|
|
|
value = filter_name(value) |
|
|
|
|
|
|
|
|
|
var = find_variable(value, caller_context) |
|
|
|
|
if 'referencedDeclaration' in expression: |
|
|
|
|
referenced_declaration = expression['referencedDeclaration'] |
|
|
|
|
else: |
|
|
|
|
referenced_declaration = None |
|
|
|
|
var = find_variable(value, caller_context, referenced_declaration) |
|
|
|
|
|
|
|
|
|
identifier = Identifier(var) |
|
|
|
|
return identifier |
|
|
|
|