diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2019-07-25 13:55:29 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2019-07-25 13:55:29 -0300 |
commit | 9a37dc0ce64c51fd57f5e658a5af8f3671a26b0a (patch) | |
tree | 32d5d49d87ea9124c8209803d1ac78c94ec7a881 /testes | |
parent | 0eb6aa4013051c8c0148c09d8c85ee7cbdc96f42 (diff) | |
download | lua-9a37dc0ce64c51fd57f5e658a5af8f3671a26b0a.tar.gz lua-9a37dc0ce64c51fd57f5e658a5af8f3671a26b0a.tar.bz2 lua-9a37dc0ce64c51fd57f5e658a5af8f3671a26b0a.zip |
Small corrections when setting 'L->top'
- OP_NEWTABLE can use 'ra + 1' to set top (instead of ci->top);
- OP_CLOSE doesn't need to set top ('Protect' already does that);
- OP_TFORCALL must use 'ProtectNT', to preserve the top already set.
(That was a small bug, because iterators could be called with
extra parameters besides the state and the control variable.)
- Comments and an extra test for the bug in previous item.
Diffstat (limited to 'testes')
-rw-r--r-- | testes/nextvar.lua | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/testes/nextvar.lua b/testes/nextvar.lua index a7fe625e..9d919631 100644 --- a/testes/nextvar.lua +++ b/testes/nextvar.lua | |||
@@ -671,7 +671,8 @@ collectgarbage() | |||
671 | 671 | ||
672 | local function f (n, p) | 672 | local function f (n, p) |
673 | local t = {}; for i=1,p do t[i] = i*10 end | 673 | local t = {}; for i=1,p do t[i] = i*10 end |
674 | return function (_,n) | 674 | return function (_, n, ...) |
675 | assert(select("#", ...) == 0) -- no extra arguments | ||
675 | if n > 0 then | 676 | if n > 0 then |
676 | n = n-1 | 677 | n = n-1 |
677 | return n, table.unpack(t) | 678 | return n, table.unpack(t) |