Support .offset and .length for calldata bytes and string arrays.

This commit is contained in:
chriseth
2020-11-18 01:45:56 +01:00
parent e694cc1b1c
commit 2665eaa4fa
31 changed files with 366 additions and 128 deletions
@@ -0,0 +1,12 @@
contract C {
function f(uint[2][] calldata x) public returns (uint o, uint l, uint s) {
assembly { l := x.length o := x.offset }
uint[2] calldata t = x[1];
// statically-sized arrays only use one slot, so we read directly.
assembly { s := t }
}
}
// ====
// compileViaYul: also
// ----
// f(uint256[2][]): 0x20, 2, 1, 2, 3, 4 -> 0x44, 2, 0x84