mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
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.
This commit is contained in:
+31
@@ -0,0 +1,31 @@
|
||||
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"
|
||||
Reference in New Issue
Block a user