New semantics for the integer 'for' loop
The numerical 'for' loop over integers now uses a precomputed counter to control its number of iteractions. This change eliminates several weird cases caused by overflows (wrap-around) in the control variable. (It also ensures that every integer loop halts.) Also, the special opcodes for the usual case of step==1 were removed. (The new code is already somewhat complex for the usual case, but efficient.)
This commit is contained in:
@@ -162,7 +162,7 @@ test([[for i,v in pairs{'a','b'} do
|
||||
end
|
||||
]], {1,2,1,2,1,3})
|
||||
|
||||
test([[for i=1,4 do a=1 end]], {1,1,1,1,1})
|
||||
test([[for i=1,4 do a=1 end]], {1,1,1,1}, true)
|
||||
|
||||
|
||||
do -- testing line info/trace with large gaps in source
|
||||
|
||||
Reference in New Issue
Block a user