- declaring the same variable name in separate code blocks throws a shadowing error. While I don't really think we need block level variable scope I think it would be good if the parser were able to deal with this more gracefully otherwise it's impossible to declare variables close to their use in context where the same variable name is appropriate (a long switch where only a couple of blocks need the variable for example)
Code: Select all
if <something> then
local tVar
put SomeFunction() into tVar
...
else
local tVar -- the engine can just ignore because the declaration is in a different block
put SomeOtherFunction() into tVar
---
end if
-- tVar is not used out here so there's no real shadowing
Code: Select all
repeat
local tIndex = 1 -- should reset tIndex to 1 each iteration
repeat
add 1 to tIndex
end repeat
end repeat