huff-rs icon indicating copy to clipboard operation
huff-rs copied to clipboard

feat: Nest Builtin Functions

Open lmittmann opened this issue 11 months ago • 0 comments

Thanks for this awesome project. I noticed that it is not possible to nest multiple builtin functions.

Example:

I want to store the function signature of test() at memory[0:4]:

// test.huff
#define function test() nonpayable returns ()

#define macro MAIN() = takes (0) returns (0) {
    __PADRIGHT(__FUNC_SIG(test)) 0x0 mstore
}
$ huffc -V
huffc 0.3.2
$ huffc test.huff
Error: Invalid Macro Arguments: "(" 
Expected literal, identifier (string), or an argument call

__FUNC_SIG gives me 0xXXXXXXXX, but I need 0xXXXXXXXX00000000000000000000000000000000000000000000000000000000.

lmittmann avatar Jul 16 '23 10:07 lmittmann