lep / jhcr

A compiler to allow hot code reload in WarCraft 3
https://www.hiveworkshop.com/threads/jass-hot-code-reload.313811/
GNU Lesser General Public License v3.0
31 stars 2 forks source link

incorrect JASS operator precedence in generated script file #8

Closed shuen4 closed 11 months ago

shuen4 commented 11 months ago
// input
if not false and true then
    call BJDebugMsg("test")
endif

// generate (incorrect)
if (not (false and true)) then
    call BJDebugMsg ("test")
endif
// input
if (not false) and true then
    call BJDebugMsg("test")
endif

// generate (correct)
if ((not false) and true) then
    call BJDebugMsg ("test")
endif
// input
if not false and false then
    call BJDebugMsg("test")
endif

// generate (incorrect)
if (not (false and false)) then
    call BJDebugMsg ("test")
endif
// input
if (not false) and false then
    call BJDebugMsg("test")
endif

// generate (correct)
if ((not false) and false) then
    call BJDebugMsg ("test")
endif

result: input - 1st and 2nd will run if block generated - 1st to 3rd will run if block

lep commented 11 months ago

Thanks. Should be fixed in affd6b5c536cff858d37f990e897ec5153b0ac50 Feel free to test unary plus and minus aswell 😄