Lonami / pyndustric

A Python compiler for Mindustry's logic processors assembly language
MIT License
49 stars 9 forks source link

Function calls with arguments get arguments mixed up #56

Closed bend-n closed 1 year ago

bend-n commented 1 year ago
def dot(x, y):
    return y
print(dot(4, 2)) # prints 2 in python 3.11, in mlog it prints 4
Lonami commented 1 year ago

NGL that's pretty funny. Would be good to add a test after:

https://github.com/Lonami/pyndustric/blob/ce779de63ef48281f07b6cdc3356b6c7b74e117c/test_all.py#L615

and to fix it, of course. Should be relatively easy to fix, if you'd like to send a PR.

My first guess is you could simply wrap the args in reversed():

https://github.com/Lonami/pyndustric/blob/ce779de63ef48281f07b6cdc3356b6c7b74e117c/pyndustric/compiler.py#L441

But I can't find how arguments are used right now.