solidity/test/libsolidity/semanticTests/functionCall/call_internal_function_via_expression.sol

25 lines
634 B
Solidity

contract C {
function foo() internal returns (uint) {
return 42;
}
function get_ptr(function() internal returns (uint) ptr) internal returns(function() internal returns (uint)) {
return ptr;
}
function associated() public returns (uint) {
// This expression directly references function definition
return (foo)();
}
function unassociated() public returns (uint) {
// This expression is not associated with a specific function definition
return (get_ptr(foo))();
}
}
// ====
// compileViaYul: also
// ----
// associated() -> 42
// unassociated() -> 42