[Sol->Yul] Implement .length for storage arrays

This commit is contained in:
Mathias Baumann
2019-06-19 18:09:23 +02:00
parent c5b50039d2
commit 910cb8d329
6 changed files with 225 additions and 1 deletions
@@ -0,0 +1,19 @@
contract C {
uint[] storageArray;
function set_get_length(uint256 len) public returns (uint256)
{
storageArray.length = len;
return storageArray.length;
}
}
// ====
// compileViaYul: true
// ----
// set_get_length(uint256): 0 -> 0
// set_get_length(uint256): 1 -> 1
// set_get_length(uint256): 10 -> 10
// set_get_length(uint256): 20 -> 20
// set_get_length(uint256): 0 -> 0
// set_get_length(uint256): 0xFF -> 0xFF
// set_get_length(uint256): 0xFFFF -> 0xFFFF