Alright JASS coders, I have an interesting little puzzle here.
This is a function that exists in DotA Allstars v6.83d-fixed. You can extract the .j and then find this function
Code:
function Trig_Spawn_Conditions takes nothing returns boolean
return true
if(INI)then
return ISI
endif
if(IQI)then
return IUI
endif
if(E2)then
return D2
endif
if QT0 then
return QR0
endif
if(N2)then
return I3
endif
if(K0)then
return PG0
endif
if(IAI)then
return IBI
endif
if(CN)then
return PW0
endif
return O0
endfunction
Now, this function has a return at the top and then more code below it (which is obviously unreachable) and another return statement at the bottom. It should be functionally equivalent to "return true". Any ideas on why code like this would ever be written? Maybe just to troll people like me?
This sort of JASS compilation trick was supposed to be patched year ago when the return bug was fixed.
Do you guys have any theories on why this compiles?
Mine:
BonusDotA Allstars also defines the following global variable:
Code:
integer array DD0
Later on in function VJ1, it defines the following local:
Code:
local string DD0
Why do these variables not collide?
Does JASS actually allow this if they are different datatypes? I feel like it doesn't, and it shouldn't.
This function does get called. So my theory above doesn't apply.
Maybe it allows it if one is an array and one isn't, since compiler confusing is impossible there.