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 in pre/post callbacks for blocks #118

Open tabularelf opened 1 month ago

tabularelf commented 1 month ago

What is your feature request?

Allow the ir to include pre/post callbacks for blocks. Right now I am doing certain with() functionality support, that requires me to execute push/pop stacks. But doing break/continue/return breaks any pop conditions. I can deal with break, but I cannot deal with continue/return.

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

Changing it from ir.pushBlock([inherit=false]) ir.popBlock([location=undefined]) to ir.pushBlock([inherit=false], [pushcallback=undefined]) ir.popBlock([popcallback=undefined], [location=undefined])

If a push/pop callback condition is passed through, it will execute those first prior to running the code between the blocks each time. Meaning that I can force execute a push/pop statement in between.