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,18 @@
contract C {
function f(uint, bytes calldata x, uint) public returns (uint r, uint v) {
assembly {
x.offset := 8
x.length := 20
}
assembly {
r := x.offset
v := x.length
}
}
}
// ====
// compileViaYul: also
// ----
// f(uint256,bytes,uint256): 7, 0x60, 8, 2, 0 -> 8, 0x14
// f(uint256,bytes,uint256): 0, 0, 0 -> 8, 0x14