MysteryBlokHed / databind

Expand the functionality of Minecraft Datapacks.
https://databind.rtfd.io/en/stable
GNU General Public License v3.0
4 stars 0 forks source link

While loops cannot be used in functions #11

Closed MysteryBlokHed closed 3 years ago

MysteryBlokHed commented 3 years ago

Due to the implementation of functions, there cannot be nested functions even if they would not be nested in the output. This also means that while loops cannot be used in functions defined with :func, since a while loop becomes two functions.

Replacing the in_function boolean in transpile.rs with an integer that counts the current depth could help fix this problem. The current_function variable would also need to be changed to a Vec<String> of function names instead of just the name of the current function.