wurstscript / WurstScript

Programming language and toolkit to create Warcraft III Maps

Home Page:https://wurstlang.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Map crashes due to generated jass function with too many arguments

jlfarris91 opened this issue · comments

In Jass the max number of function arguments is 32 and there's a function being generated by Wurst that has 33.

Additionally, I can build the map multiple times in a row and get the same function generated differently each time - some with 33, some with 32.

Last Stand has this problem, not sure what I can do to help sort this out since building the project is a bit involved. Might help for the compiler to throw an exception when it tries to generate a function with more than 32 arguments.

Can you post what functions are having so many parameters?

It's odd to me that it's a different function complaining with each compile

cyc_ indicates this function is used to resolve a cyclic dependency, which you ideally shouldn't have. So consider getting rid of any initlater in your packages. The cycle resolution might not be deterministic, which is why it is a different function on different compilations.
Also it seems most parameters are coming from stacktraces, so turning them off should also get rid of the error.
Additionally, the parameter amount seems to stem from using tuples for many things, which isn't ideal either. Consider using classes for data stuff.
Other than updating pjass to detect this error I will not do anything regarding this issue, as it seems non trivial to solve in the compiler, but trivially to solve by the user.
Another option is to use the lua backend, which doesn't have the same parameter limitations (but other limitations).

Oh great, I can give those suggestions a try. Thanks.

Tuples are terribly convenient.

I think it would be worth detecting any generated arguments that exceed the limit so that users don't waste time waiting for the game to launch before ultimately crashing.

commented

I updated pjass now to detect functions with too many parameters in jass output.