diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2001-02-01 15:39:55 -0200 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2001-02-01 15:39:55 -0200 |
commit | 9a231afa9721e87ae5f9790dedcb73cd58472a3f (patch) | |
tree | 40ef6b8b76997218ac02906a4ed96be894bb5cb2 | |
parent | 4ab6acacdfdb5d5d29ed4d089aeda3ec6d82670b (diff) | |
download | lua-9a231afa9721e87ae5f9790dedcb73cd58472a3f.tar.gz lua-9a231afa9721e87ae5f9790dedcb73cd58472a3f.tar.bz2 lua-9a231afa9721e87ae5f9790dedcb73cd58472a3f.zip |
top must be updated when there is any error
-rw-r--r-- | lvm.c | 6 |
1 files changed, 5 insertions, 1 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lvm.c,v 1.161 2001/01/29 17:16:58 roberto Exp roberto $ | 2 | ** $Id: lvm.c,v 1.162 2001/02/01 16:03:38 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 | */ |
@@ -465,12 +465,14 @@ StkId luaV_execute (lua_State *L, const Closure *cl, StkId base) { | |||
465 | break; | 465 | break; |
466 | } | 466 | } |
467 | case OP_SETGLOBAL: { | 467 | case OP_SETGLOBAL: { |
468 | L->top = top; /* primitive set may generate an error */ | ||
468 | luaV_setglobal(L, kstr[GETARG_U(i)], top); | 469 | luaV_setglobal(L, kstr[GETARG_U(i)], top); |
469 | top--; | 470 | top--; |
470 | break; | 471 | break; |
471 | } | 472 | } |
472 | case OP_SETTABLE: { | 473 | case OP_SETTABLE: { |
473 | StkId t = top-GETARG_A(i); | 474 | StkId t = top-GETARG_A(i); |
475 | L->top = top; /* primitive set may generate an error */ | ||
474 | luaV_settable(L, t, t+1, top); | 476 | luaV_settable(L, t, t+1, top); |
475 | top -= GETARG_B(i); /* pop values */ | 477 | top -= GETARG_B(i); /* pop values */ |
476 | break; | 478 | break; |
@@ -479,6 +481,7 @@ StkId luaV_execute (lua_State *L, const Closure *cl, StkId base) { | |||
479 | int aux = GETARG_A(i) * LFIELDS_PER_FLUSH; | 481 | int aux = GETARG_A(i) * LFIELDS_PER_FLUSH; |
480 | int n = GETARG_B(i); | 482 | int n = GETARG_B(i); |
481 | Hash *arr = hvalue(top-n-1); | 483 | Hash *arr = hvalue(top-n-1); |
484 | L->top = top-n; | ||
482 | for (; n; n--) | 485 | for (; n; n--) |
483 | setobj(luaH_setnum(L, arr, n+aux), --top); | 486 | setobj(luaH_setnum(L, arr, n+aux), --top); |
484 | break; | 487 | break; |
@@ -487,6 +490,7 @@ StkId luaV_execute (lua_State *L, const Closure *cl, StkId base) { | |||
487 | int n = GETARG_U(i); | 490 | int n = GETARG_U(i); |
488 | StkId finaltop = top-2*n; | 491 | StkId finaltop = top-2*n; |
489 | Hash *arr = hvalue(finaltop-1); | 492 | Hash *arr = hvalue(finaltop-1); |
493 | L->top = finaltop; | ||
490 | for (; n; n--) { | 494 | for (; n; n--) { |
491 | top-=2; | 495 | top-=2; |
492 | setobj(luaH_set(L, arr, top), top+1); | 496 | setobj(luaH_set(L, arr, top), top+1); |