diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2009-10-28 10:20:07 -0200 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2009-10-28 10:20:07 -0200 |
| commit | 77077b39d59aa50bd64c7b7c5e660c6e187d11f2 (patch) | |
| tree | 064e7a8949790985624d859ccc12f9be52508181 | |
| parent | 5bc91c640588ca77b9f84146fc88fcc9bdbfbcd1 (diff) | |
| download | lua-77077b39d59aa50bd64c7b7c5e660c6e187d11f2.tar.gz lua-77077b39d59aa50bd64c7b7c5e660c6e187d11f2.tar.bz2 lua-77077b39d59aa50bd64c7b7c5e660c6e187d11f2.zip | |
comment explaining OP_VARARG was wrong (and corresponding code was not
very clear)
| -rw-r--r-- | lopcodes.h | 4 | ||||
| -rw-r--r-- | lvm.c | 6 |
2 files changed, 5 insertions, 5 deletions
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lopcodes.h,v 1.130 2009/09/23 20:33:05 roberto Exp roberto $ | 2 | ** $Id: lopcodes.h,v 1.131 2009/09/28 16:32:50 roberto Exp roberto $ |
| 3 | ** Opcodes for Lua virtual machine | 3 | ** Opcodes for Lua virtual machine |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| @@ -217,7 +217,7 @@ OP_SETLIST,/* A B C R(A)[(C-1)*FPF+i] := R(A+i), 1 <= i <= B */ | |||
| 217 | OP_CLOSE,/* A close all variables in the stack up to (>=) R(A)*/ | 217 | OP_CLOSE,/* A close all variables in the stack up to (>=) R(A)*/ |
| 218 | OP_CLOSURE,/* A Bx R(A) := closure(KPROTO[Bx]) */ | 218 | OP_CLOSURE,/* A Bx R(A) := closure(KPROTO[Bx]) */ |
| 219 | 219 | ||
| 220 | OP_VARARG,/* A B R(A), R(A+1), ..., R(A+B-1) = vararg */ | 220 | OP_VARARG,/* A B R(A), R(A+1), ..., R(A+B-2) = vararg */ |
| 221 | 221 | ||
| 222 | OP_TFORLOOP,/* A sBx if R(A+1) ~= nil then { R(A)=R(A+1); pc += sBx }*/ | 222 | OP_TFORLOOP,/* A sBx if R(A+1) ~= nil then { R(A)=R(A+1); pc += sBx }*/ |
| 223 | 223 | ||
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lvm.c,v 2.98 2009/09/28 16:32:50 roberto Exp roberto $ | 2 | ** $Id: lvm.c,v 2.99 2009/09/30 15:38:37 roberto Exp roberto $ |
| 3 | ** Lua virtual machine | 3 | ** Lua virtual machine |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| @@ -801,10 +801,10 @@ void luaV_execute (lua_State *L) { | |||
| 801 | int b = GETARG_B(i) - 1; | 801 | int b = GETARG_B(i) - 1; |
| 802 | int j; | 802 | int j; |
| 803 | int n = cast_int(base - ci->func) - cl->p->numparams - 1; | 803 | int n = cast_int(base - ci->func) - cl->p->numparams - 1; |
| 804 | if (b == LUA_MULTRET) { | 804 | if (b < 0) { /* B == 0? */ |
| 805 | b = n; /* get all var. arguments */ | ||
| 805 | Protect(luaD_checkstack(L, n)); | 806 | Protect(luaD_checkstack(L, n)); |
| 806 | ra = RA(i); /* previous call may change the stack */ | 807 | ra = RA(i); /* previous call may change the stack */ |
| 807 | b = n; | ||
| 808 | L->top = ra + n; | 808 | L->top = ra + n; |
| 809 | } | 809 | } |
| 810 | for (j = 0; j < b; j++) { | 810 | for (j = 0; j < b; j++) { |
