[Bug-Candidate]: get_dependencies bug
- Dominant language
- Python
- Stars
- 6.4k
- Forks
- 1.1k
- PR merge metrics
- No merged PRs in 30d
Description
### Describe the issue:
test.sol:
```
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.12;
contract Contract {
uint256 var_amount;
function direct_returns(uint256 amount) internal returns (uint256) {
uint256 _amount = var_amount + amount;
return _amount;
}
function indirect_returns(uint256 amount)
internal
returns (uint256 _amount)
{
_amount = var_amount + amount;
}
function test() external {
uint256 a = direct_returns(10);
uint256 b = indirect_returns(10);
}
}
```
test.py:
```
direct_returns_function:Function
indirect_returns_function:Function
test_function:Function
a_variable:Variable
b_variable:Variable
#contract is test.sol:Contract
for function in contract.functions:
if function.name=="direct_returns":
direct_returns_function = function
elif function.name=="indirect_returns":
indirect_returns_function = function
elif function.name=="test":
test_function = function
for vari in test_function.variables_as_dict.values():
if vari.name=="a":
a_variable = vari
elif vari.name=="b":
b_variable = vari
print([vari.name for vari in get_dependencies(a_variable,contract)])
print([vari.name for vari in get_dependencies(b_variable,contract)])
```
get result:
```
['TMP_2', 'TMP_0', 'amount', '_amount', 'var_amount']
['TMP_3']
```
I was expecting the same result (same result length), but here it is different
### Code example to reproduce the issue:
``
### Version:
0.9.1
### Relevant log output:
_No response_
Contributor guide
Assessment
This issue has not been assessed yet.