katsaii / catspeak-lang

A cross-platform modding language for GameMaker games.
https://www.katsaii.com/catspeak-lang/
MIT License
81 stars 4 forks source link

[IR/Compiler] Add .createCall0-3 support #120

Open tabularelf opened 4 weeks ago

tabularelf commented 4 weeks ago

What is your feature request?

I’ve been doing a lot of .createCall as I’ve been finding it more and more necessary to pass around and define specific functions. But a lot of the time I don’t need to loop and pass a bunch of arguments. Calling and passing arguments directly should also make things a bit faster.

Please describe in detail how you expect this new feature to behave.

Similar to .createCall, except that each program can be executed directly with up to x arguments, up to three. Each function accepting one more additional argument than the last.

return ir.createCall0(ir.createGet("self"), lexer.getLocation()))

I have similar code here extended for with() scope handle. Since I need to be able to pass values into them.

tabularelf commented 3 weeks ago

Reopened this, I can’t recall if the IR can do this

katsaii commented 3 weeks ago

I'd prefer this be on the code generator side by updating __catspeak_expr_call__ to include

tabularelf commented 3 weeks ago

Works for me