asar
asar copied to clipboard
Variadic macro arguments are not resolved in `elseif` statements
asar 1.90
macro foo(...)
if 0 == 1
print "no"
elseif <...[0]> == 42
print "yes"
else
print "bug"
endif
endmacro
%foo(42)
This patch prints bug, as well as an error that elseif <...[0]> == 42 contains an invalid number, <...[0]> specifically.
https://github.com/RPGHacker/asar/blob/9bd5a49ef0f2965cd8c5b17e9de687c5df854783/src/asar/assembleblock.cpp#L1000-L1011
The above was an attempt at fixing the overarching bug, but it does not account for this condition in replace_macro_args() which guards variadic argument resolving:
https://github.com/RPGHacker/asar/blob/9bd5a49ef0f2965cd8c5b17e9de687c5df854783/src/asar/macro.cpp#L277-L286
I'm not sure at a glance what the solution here would be, but given that this is already a hacky bit of code that fixes most of the overarching bug, that doesn't surprise me.