summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authordaurnimator <quae@daurnimator.com>2017-05-29 17:07:20 +1000
committerdaurnimator <quae@daurnimator.com>2017-05-29 17:07:20 +1000
commit490e035f97ace73b3ee1c1033fb412b5d1433ce2 (patch)
tree8ec646741214c2a9db1f5e68a17a4a5f1c829edc /src
parent84dfcea32ad517400e970b7cf978246367ec9e46 (diff)
downloadfengari-490e035f97ace73b3ee1c1033fb412b5d1433ce2.tar.gz
fengari-490e035f97ace73b3ee1c1033fb412b5d1433ce2.tar.bz2
fengari-490e035f97ace73b3ee1c1033fb412b5d1433ce2.zip
Fix some warnings found by closure-compiler
Diffstat (limited to 'src')
-rw-r--r--src/defs.js3
-rw-r--r--src/lapi.js4
-rw-r--r--src/lbaselib.js2
-rw-r--r--src/ldblib.js1
-rw-r--r--src/llex.js2
-rw-r--r--src/lparser.js3
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;
};