[Sol->Yul] Implementing push for nested storage arrays and storage arrays of structs.

This commit is contained in:
Djordje Mijovic
2020-10-06 13:06:40 +02:00
parent 756e21a888
commit 818afcbec2
7 changed files with 53 additions and 5 deletions
@@ -0,0 +1,17 @@
contract C {
uint8 b = 23;
uint120[][] s;
uint8 a = 17;
function f() public {
s.push();
assert(s.length == 1);
assert(s[0].length == 0);
s[0].push();
assert(s[0].length == 1);
assert(s[0][0] == 0);
}
}
// ====
// compileViaYul: also
// ----
// f() ->
@@ -39,6 +39,8 @@ contract c {
}
}
// ====
// compileViaYul: also
// ----
// getLengths() -> 0, 0
// setLengths(uint256,uint256): 48, 49 ->
@@ -24,6 +24,8 @@ contract C {
array2d.push().push() = value;
}
}
// ====
// compileViaYul: also
// ----
// l() -> 0
// f(uint256,uint256): 42, 64 ->