summaryrefslogtreecommitdiff
path: root/src/ldebug.js
diff options
context:
space:
mode:
authordaurnimator <quae@daurnimator.com>2017-05-23 17:09:03 +1000
committerdaurnimator <quae@daurnimator.com>2017-05-27 22:14:29 +1000
commitb3c87776e08f546a9994527f7c2c7fc4ec07d9a1 (patch)
treed12ee5c396408d8a0d8e5e2d2cb74f46eb1b1e19 /src/ldebug.js
parent51ea4bdd2d2ac1166911b54ba5a1aa6aa8a573dd (diff)
downloadfengari-b3c87776e08f546a9994527f7c2c7fc4ec07d9a1.tar.gz
fengari-b3c87776e08f546a9994527f7c2c7fc4ec07d9a1.tar.bz2
fengari-b3c87776e08f546a9994527f7c2c7fc4ec07d9a1.zip
Introduce setobjs2s
Diffstat (limited to 'src/ldebug.js')
-rw-r--r--src/ldebug.js9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/ldebug.js b/src/ldebug.js
index 0f387af..0231e67 100644
--- a/src/ldebug.js
+++ b/src/ldebug.js
@@ -155,7 +155,7 @@ const lua_setlocal = function(L, ar, n) {
let name = local.name;
let pos = local.pos;
if (name) {
- L.stack[pos] = L.stack[L.top - 1];
+ lobject.setobjs2s(L, pos, L.top - 1);
delete L.stack[--L.top]; /* pop value */
}
swapextra(L);
@@ -280,7 +280,8 @@ const lua_getinfo = function(L, what, ar) {
cl = func.ttisclosure() ? func.value : null;
status = auxgetinfo(L, what, ar, cl, ci);
if (what.indexOf('f'.charCodeAt(0)) >= 0) {
- L.stack[L.top++] = func;
+ lobject.setobjs2s(L, L.top, funcOff);
+ L.top++;
assert(L.top <= L.ci.top, "stack overflow");
}
@@ -590,8 +591,8 @@ const luaG_runerror = function(L, fmt, ...argp) {
const luaG_errormsg = function(L) {
if (L.errfunc !== 0) { /* is there an error handling function? */
let errfunc = L.errfunc;
- L.stack[L.top] = L.stack[L.top - 1];
- L.stack[L.top - 1] = L.stack[errfunc];
+ lobject.setobjs2s(L, L.top, L.top - 1); /* move argument */
+ lobject.setobjs2s(L, L.top - 1, errfunc); /* push function */
L.top++;
ldo.luaD_callnoyield(L, L.top - 2, 1);
}