diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/defs.js | 3 | ||||
-rw-r--r-- | src/lapi.js | 4 | ||||
-rw-r--r-- | src/lbaselib.js | 2 | ||||
-rw-r--r-- | src/ldblib.js | 1 | ||||
-rw-r--r-- | src/llex.js | 2 | ||||
-rw-r--r-- | src/lparser.js | 3 |
6 files changed, 5 insertions, 10 deletions
diff --git a/src/defs.js b/src/defs.js index b979e03..d1b98d0 100644 --- a/src/defs.js +++ b/src/defs.js @@ -193,9 +193,8 @@ const to_luastring = function(str, cache, maxBytesToWrite) { if (!(maxBytesToWrite > 0)) // Parameter maxBytesToWrite is not optional. Negative values, 0, null, undefined and false each don't write out any bytes. return 0; - + let outIdx = 0; - let startIdx = 0; let endIdx = maxBytesToWrite - 1; // -1 for string null terminator. for (let i = 0; i < str.length; ++i) { // Gotcha: charCodeAt returns a 16-bit word that is a UTF-16 encoded code unit, not a Unicode code point of the character! So decode UTF16->UTF32->UTF8. diff --git a/src/lapi.js b/src/lapi.js index d992b0b..228bba1 100644 --- a/src/lapi.js +++ b/src/lapi.js @@ -954,7 +954,7 @@ const lua_callk = function(L, nargs, nresults, ctx, k) { assert(k === null || !(L.ci.callstatus & lstate.CIST_LUA), "cannot use continuations inside hooks"); assert(nargs + 1 < L.top - L.ci.funcOff, "not enough elements in the stack"); assert(L.status === TS.LUA_OK, "cannot do calls on non-normal thread"); - assert(nargs === defs.LUA_MULTRET || (L.ci.top - L.top >= nargs - nresults, "results from function overflow current stack size")); + assert(nargs === defs.LUA_MULTRET || (L.ci.top - L.top >= nargs - nresults), "results from function overflow current stack size"); let func = L.top - (nargs + 1); if (k !== null && L.nny === 0) { /* need to prepare continuation? */ @@ -976,7 +976,7 @@ const lua_call = function(L, n, r) { const lua_pcallk = function(L, nargs, nresults, errfunc, ctx, k) { assert(nargs + 1 < L.top - L.ci.funcOff, "not enough elements in the stack"); assert(L.status === TS.LUA_OK, "cannot do calls on non-normal thread"); - assert(nargs === defs.LUA_MULTRET || (L.ci.top - L.top >= nargs - nresults, "results from function overflow current stack size")); + assert(nargs === defs.LUA_MULTRET || (L.ci.top - L.top >= nargs - nresults), "results from function overflow current stack size"); let c = { func: null, diff --git a/src/lbaselib.js b/src/lbaselib.js index 4ba765e..04a5e8d 100644 --- a/src/lbaselib.js +++ b/src/lbaselib.js @@ -359,8 +359,6 @@ const base_funcs = { // Only with Node if (!WEB) { - const fs = require('fs'); - const luaB_loadfile = function(L) { let fname = lauxlib.luaL_optstring(L, 1, null); let mode = lauxlib.luaL_optstring(L, 2, null); diff --git a/src/ldblib.js b/src/ldblib.js index 3f18a27..ac3a2a4 100644 --- a/src/ldblib.js +++ b/src/ldblib.js @@ -344,7 +344,6 @@ const db_sethook = function(L) { const db_gethook = function(L) { let thread = getthread(L); let L1 = thread.thread; - let arg = thread.arg; let buff = []; let mask = lua.lua_gethookmask(L1); let hook = lua.lua_gethook(L1); diff --git a/src/llex.js b/src/llex.js index 5e6b9ec..905be5a 100644 --- a/src/llex.js +++ b/src/llex.js @@ -413,7 +413,7 @@ const read_string = function(ls, del, seminfo) { let will; let c; switch(ls.current) { - case char['a']: c = char['\a']; will = 'read_save'; break; + case char['a']: c = 7 /* \a isn't valid JS */; will = 'read_save'; break; case char['b']: c = char['\b']; will = 'read_save'; break; case char['f']: c = char['\f']; will = 'read_save'; break; case char['n']: c = char['\n']; will = 'read_save'; break; diff --git a/src/lparser.js b/src/lparser.js index 2dd9c7d..7fc1458 100644 --- a/src/lparser.js +++ b/src/lparser.js @@ -578,11 +578,10 @@ const leaveblock = function(fs) { }; const close_func = function(ls) { - let L = ls.L; let fs = ls.fs; - let f = fs.f; lcode.luaK_ret(fs, 0, 0); /* final return */ leaveblock(fs); + assert(fs.bl === null); ls.fs = fs.prev; }; |