aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/lapi.js2
-rw-r--r--src/ldebug.js7
2 files changed, 5 insertions, 4 deletions
diff --git a/src/lapi.js b/src/lapi.js
index 5f5bb3d..1b10e29 100644
--- a/src/lapi.js
+++ b/src/lapi.js
@@ -1106,6 +1106,8 @@ const lua_getextraspace = function () {
return 0;
};
+module.exports.api_incr_top = api_incr_top;
+module.exports.api_checknelems = api_checknelems;
module.exports.lua_absindex = lua_absindex;
module.exports.lua_arith = lua_arith;
module.exports.lua_atpanic = lua_atpanic;
diff --git a/src/ldebug.js b/src/ldebug.js
index 5a0e480..25a6257 100644
--- a/src/ldebug.js
+++ b/src/ldebug.js
@@ -5,6 +5,7 @@ const {
api_check,
lua_assert
} = require('./llimits.js');
+const lapi = require('./lapi.js');
const ldo = require('./ldo.js');
const lfunc = require('./lfunc.js');
const llex = require('./llex.js');
@@ -188,14 +189,12 @@ const funcinfo = function(ar, cl) {
const collectvalidlines = function(L, f) {
if (f === null || f instanceof lobject.CClosure) {
L.stack[L.top] = new lobject.TValue(CT.LUA_TNIL, null);
- L.top++;
- lua_assert(L.top <= L.ci.top, "stack overflow");
+ lapi.api_incr_top(L);
} else {
let lineinfo = f.p.lineinfo;
let t = ltable.luaH_new(L);
L.stack[L.top] = new lobject.TValue(CT.LUA_TTABLE, t);
- L.top++;
- lua_assert(L.top <= L.ci.top, "stack overflow");
+ lapi.api_incr_top(L);
let v = new lobject.TValue(CT.LUA_TBOOLEAN, true);
for (let i = 0; i < lineinfo.length; i++)
ltable.luaH_setint(t, lineinfo[i], v);