solidity/test/libsolidity/semanticTests/constructor/functions_called_by_constructor_through_dispatch.sol
Kamil Śliwak 1a2e441bc5 Generate internal dispatch only for functions that might actually get called via pointers
- This also adds support for internal library calls as a side-effect since they'll now be pulled into the internal dispatch automatically.
2020-05-26 17:01:50 +02:00

32 lines
727 B
Solidity

contract Test {
bytes6 name;
constructor() public {
function (bytes6 _name) internal setter = setName;
setter("abcdef");
applyShift(leftByteShift, 3);
}
function getName() public returns (bytes6 ret) {
return name;
}
function setName(bytes6 _name) private {
name = _name;
}
function leftByteShift(bytes6 _value, uint _shift) public returns (bytes6) {
return _value << _shift * 8;
}
function applyShift(function (bytes6 _value, uint _shift) internal returns (bytes6) _shiftOperator, uint _bytes) internal {
name = _shiftOperator(name, _bytes);
}
}
// ====
// compileViaYul: also
// ----
// getName() -> "def\x00\x00\x00"