mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
[Sol->Yul] Implementing struct copying from storage to memory
This commit is contained in:
@@ -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
|
||||
Reference in New Issue
Block a user