external_function.sol 566 B

12345678910111213141516
  1. // RUN: --target solana --emit cfg
  2. contract C {
  3. // BEGIN-CHECK: C::C::function::combineToFunctionPointer__address_bytes4
  4. function combineToFunctionPointer(address newAddress, bytes4 newSelector) public pure returns (bytes4, address) {
  5. function() external fun;
  6. assembly {
  7. // CHECK: store (struct %fun field 0), uint32((arg #1))
  8. fun.selector := newSelector
  9. // CHECK: store (struct %fun field 1), (arg #0)
  10. fun.address := newAddress
  11. }
  12. return (fun.selector, fun.address);
  13. }
  14. }