diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2019-07-10 14:58:31 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2019-07-10 14:58:31 -0300 |
commit | be8445d7e4b6122620c428877b51a27d464253d5 (patch) | |
tree | e0160895d105e5a3c20ec65c3196bffa042bd93f /testes | |
parent | 3d296304ef14ac9a6d1fa9357541ddd9bb54722f (diff) | |
download | lua-be8445d7e4b6122620c428877b51a27d464253d5.tar.gz lua-be8445d7e4b6122620c428877b51a27d464253d5.tar.bz2 lua-be8445d7e4b6122620c428877b51a27d464253d5.zip |
Details
In the generic for loop, it is simpler for OP_TFORLOOP to use the
same 'ra' as OP_TFORCALL. Moreover, the internal names of the loop
temporaries "(for ...)" don't need to leak internal details (even
because the numerical for loop doesn't have a fixed role for each of
its temporaries).
Diffstat (limited to 'testes')
-rw-r--r-- | testes/files.lua | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/testes/files.lua b/testes/files.lua index 54931c14..c8f23d18 100644 --- a/testes/files.lua +++ b/testes/files.lua | |||
@@ -427,10 +427,12 @@ do -- testing closing file in line iteration | |||
427 | -- get the to-be-closed variable from a loop | 427 | -- get the to-be-closed variable from a loop |
428 | local function gettoclose (lv) | 428 | local function gettoclose (lv) |
429 | lv = lv + 1 | 429 | lv = lv + 1 |
430 | for i = 1, math.maxinteger do | 430 | local stvar = 0 -- to-be-closed is 4th state variable in the loop |
431 | for i = 1, 1000 do | ||
431 | local n, v = debug.getlocal(lv, i) | 432 | local n, v = debug.getlocal(lv, i) |
432 | if n == "(for toclose)" then | 433 | if n == "(for state)" then |
433 | return v | 434 | stvar = stvar + 1 |
435 | if stvar == 4 then return v end | ||
434 | end | 436 | end |
435 | end | 437 | end |
436 | end | 438 | end |