[Sol->Yul] Implementing struct copying from storage to memory

This commit is contained in:
Djordje Mijovic
2020-09-02 12:28:53 +02:00
parent b89c863e11
commit 381784dd89
4 changed files with 94 additions and 6 deletions
@@ -3,6 +3,7 @@ contract c {
uint256 a;
uint256 b;
}
uint[75] r;
Struct data1;
Struct data2;
@@ -15,5 +16,7 @@ contract c {
}
}
// ====
// compileViaYul: also
// ----
// test() -> true
@@ -0,0 +1,26 @@
pragma experimental ABIEncoderV2;
contract C {
struct S {
uint32 a;
uint128 b;
uint256 c;
}
struct X {
uint32 a;
S s;
}
uint[79] arr;
X x = X(12, S(42, 23, 34));
function f() external returns (uint32, uint128, uint256) {
X memory m = x;
return (m.s.a, m.s.b, m.s.c);
}
}
// ====
// compileViaYul: also
// ----
// f() -> 42, 23, 34