From a6e100af7363ad5581c568bbfa9887b707b8859e Mon Sep 17 00:00:00 2001 From: daurnimator Date: Thu, 18 Jan 2018 04:37:44 +1100 Subject: src/lapi.js: Export api_incr_top and api_checknelems --- src/lapi.js | 2 ++ src/ldebug.js | 7 +++---- 2 files changed, 5 insertions(+), 4 deletions(-) (limited to 'src') 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); -- cgit v1.2.3-70-g09d2