aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authordaurnimator <quae@daurnimator.com>2017-12-10 02:08:53 +1100
committerdaurnimator <quae@daurnimator.com>2017-12-10 02:36:36 +1100
commit562ad6f874564c3770d096711f443b49f59ef686 (patch)
tree910d919dcee89c71eaeeec8465152add19dc4e9f /src
parent54c4a6a66778466630cca7a9223c760942c7ab70 (diff)
downloadfengari-562ad6f874564c3770d096711f443b49f59ef686.tar.gz
fengari-562ad6f874564c3770d096711f443b49f59ef686.tar.bz2
fengari-562ad6f874564c3770d096711f443b49f59ef686.zip
src/: Fix some linter complaints
Diffstat (limited to 'src')
-rw-r--r--src/lapi.js4
-rw-r--r--src/lauxlib.js3
-rw-r--r--src/lbaselib.js15
-rw-r--r--src/lcode.js34
-rw-r--r--src/ldblib.js16
-rw-r--r--src/ldo.js6
-rw-r--r--src/ldump.js24
-rw-r--r--src/liolib.js4
-rw-r--r--src/llex.js2
-rw-r--r--src/lmathlib.js2
-rw-r--r--src/loadlib.js2
-rw-r--r--src/lobject.js16
-rw-r--r--src/lparser.js12
-rw-r--r--src/lstrlib.js6
-rw-r--r--src/ltable.js101
-rw-r--r--src/lundump.js36
-rw-r--r--src/lvm.js6
17 files changed, 148 insertions, 141 deletions
diff --git a/src/lapi.js b/src/lapi.js
index be80672..2ae5b3c 100644
--- a/src/lapi.js
+++ b/src/lapi.js
@@ -128,8 +128,8 @@ const lua_xmove = function(from, to, n) {
*/
const lua_absindex = function(L, idx) {
return (idx > 0 || idx <= defs.LUA_REGISTRYINDEX)
- ? idx
- : (L.top - L.ci.funcOff) + idx;
+ ? idx
+ : (L.top - L.ci.funcOff) + idx;
};
const lua_gettop = function(L) {
diff --git a/src/lauxlib.js b/src/lauxlib.js
index f95f9a8..0c42a05 100644
--- a/src/lauxlib.js
+++ b/src/lauxlib.js
@@ -493,13 +493,14 @@ const luaL_tolstring = function(L, idx) {
case lua.LUA_TNIL:
lua.lua_pushliteral(L, "nil");
break;
- default:
+ default: {
let tt = luaL_getmetafield(L, idx, lua.to_luastring("__name", true));
let kind = tt === lua.LUA_TSTRING ? lua.lua_tostring(L, -1) : luaL_typename(L, idx);
lua.lua_pushfstring(L, lua.to_luastring("%s: %p"), kind, lua.lua_topointer(L, idx));
if (tt !== lua.LUA_TNIL)
lua.lua_remove(L, -2);
break;
+ }
}
}
diff --git a/src/lbaselib.js b/src/lbaselib.js
index 874a868..54e73b1 100644
--- a/src/lbaselib.js
+++ b/src/lbaselib.js
@@ -99,9 +99,11 @@ const luaB_rawset = function(L) {
return 1;
};
-const opts = ["stop", "restart", "collect",
-"count", "step", "setpause", "setstepmul",
-"isrunning"].map((e) => lua.to_luastring(e));
+const opts = [
+ "stop", "restart", "collect",
+ "count", "step", "setpause", "setstepmul",
+ "isrunning"
+].map((e) => lua.to_luastring(e));
const luaB_collectgarbage = function(L) {
lauxlib.luaL_checkoption(L, 1, lua.to_luastring("collect"), opts);
lauxlib.luaL_optinteger(L, 2, 0);
@@ -174,14 +176,15 @@ const b_str2int = function(s, base) {
} catch (e) {
return null;
}
- let r = /^[\t\v\f \n\r]*([\+\-]?)0*([0-9A-Za-z]+)[\t\v\f \n\r]*$/.exec(s);
+ let r = /^[\t\v\f \n\r]*([+-]?)0*([0-9A-Za-z]+)[\t\v\f \n\r]*$/.exec(s);
if (!r) return null;
let neg = r[1] === "-";
let digits = r[2];
let n = 0;
for (let si=0; si<digits.length; si++) {
- let digit = /\d/.test(digits[si]) ? (digits.charCodeAt(si) - '0'.charCodeAt(0))
- : (digits[si].toUpperCase().charCodeAt(0) - 'A'.charCodeAt(0) + 10);
+ let digit = /\d/.test(digits[si])
+ ? (digits.charCodeAt(si) - '0'.charCodeAt(0))
+ : (digits[si].toUpperCase().charCodeAt(0) - 'A'.charCodeAt(0) + 10);
if (digit >= base) return null; /* invalid numeral */
n = ((n * base)|0) + digit;
}
diff --git a/src/lcode.js b/src/lcode.js
index 60b7452..e7259f2 100644
--- a/src/lcode.js
+++ b/src/lcode.js
@@ -189,8 +189,8 @@ const luaK_ret = function(fs, first, nret) {
** followed by a jump. Return jump position.
*/
const condjump = function(fs, op, A, B, C) {
- luaK_codeABC(fs, op, A, B, C);
- return luaK_jump(fs);
+ luaK_codeABC(fs, op, A, B, C);
+ return luaK_jump(fs);
};
/*
@@ -389,8 +389,8 @@ const luaK_checkstack = function(fs, n) {
** Reserve 'n' registers in register stack
*/
const luaK_reserveregs = function(fs, n) {
- luaK_checkstack(fs, n);
- fs.freereg += n;
+ luaK_checkstack(fs, n);
+ fs.freereg += n;
};
/*
@@ -785,7 +785,7 @@ const luaK_storevar = function(fs, vr, ex) {
case ek.VUPVAL: {
let e = luaK_exp2anyreg(fs, ex);
luaK_codeABC(fs, OpCodesI.OP_SETUPVAL, e, vr.u.info, 0);
- break;
+ break;
}
case ek.VINDEXED: {
let op = (vr.u.ind.vt === ek.VLOCAL) ? OpCodesI.OP_SETTABLE : OpCodesI.OP_SETTABUP;
@@ -850,17 +850,17 @@ const luaK_goiftrue = function(fs, e) {
luaK_dischargevars(fs, e);
switch (e.k) {
case ek.VJMP: { /* condition? */
- negatecondition(fs, e); /* jump when it is false */
- pc = e.u.info; /* save jump position */
- break;
+ negatecondition(fs, e); /* jump when it is false */
+ pc = e.u.info; /* save jump position */
+ break;
}
case ek.VK: case ek.VKFLT: case ek.VKINT: case ek.VTRUE: {
- pc = NO_JUMP; /* always true; do nothing */
- break;
+ pc = NO_JUMP; /* always true; do nothing */
+ break;
}
default: {
- pc = jumponcond(fs, e, 0); /* jump when false */
- break;
+ pc = jumponcond(fs, e, 0); /* jump when false */
+ break;
}
}
e.f = luaK_concat(fs, e.f, pc); /* insert new jump in false list */
@@ -989,11 +989,11 @@ const constfolding = function(op, e1, e2) {
** Expression to produce final result will be encoded in 'e'.
*/
const codeunexpval = function(fs, op, e, line) {
- let r = luaK_exp2anyreg(fs, e); /* opcodes operate only on registers */
- freeexp(fs, e);
- e.u.info = luaK_codeABC(fs, op, 0, r, 0); /* generate opcode */
- e.k = lparser.expkind.VRELOCABLE; /* all those operations are relocatable */
- luaK_fixline(fs, line);
+ let r = luaK_exp2anyreg(fs, e); /* opcodes operate only on registers */
+ freeexp(fs, e);
+ e.u.info = luaK_codeABC(fs, op, 0, r, 0); /* generate opcode */
+ e.k = lparser.expkind.VRELOCABLE; /* all those operations are relocatable */
+ luaK_fixline(fs, line);
};
/*
diff --git a/src/ldblib.js b/src/ldblib.js
index 5912b5a..96db3c7 100644
--- a/src/ldblib.js
+++ b/src/ldblib.js
@@ -46,11 +46,11 @@ const db_getuservalue = function(L) {
const db_setuservalue = function(L) {
- lauxlib.luaL_checktype(L, 1, lua.LUA_TUSERDATA);
- lauxlib.luaL_checkany(L, 2);
- lua.lua_settop(L, 2);
- lua.lua_setuservalue(L, 1);
- return 1;
+ lauxlib.luaL_checktype(L, 1, lua.LUA_TUSERDATA);
+ lauxlib.luaL_checkany(L, 2);
+ lua.lua_settop(L, 2);
+ lua.lua_setuservalue(L, 1);
+ return 1;
};
/*
@@ -247,9 +247,9 @@ const checkupval = function(L, argf, argnup) {
};
const db_upvalueid = function(L) {
- let n = checkupval(L, 1, 2);
- lua.lua_pushlightuserdata(L, lua.lua_upvalueid(L, 1, n));
- return 1;
+ let n = checkupval(L, 1, 2);
+ lua.lua_pushlightuserdata(L, lua.lua_upvalueid(L, 1, n));
+ return 1;
};
const db_upvaluejoin = function(L) {
diff --git a/src/ldo.js b/src/ldo.js
index f381ca4..3adedd4 100644
--- a/src/ldo.js
+++ b/src/ldo.js
@@ -656,9 +656,9 @@ const luaD_pcall = function(L, func, u, old_top, ef) {
** Similar to 'luaD_call', but does not allow yields during the call
*/
const luaD_callnoyield = function(L, off, nResults) {
- L.nny++;
- luaD_call(L, off, nResults);
- L.nny--;
+ L.nny++;
+ luaD_call(L, off, nResults);
+ L.nny--;
};
/*
diff --git a/src/ldump.js b/src/ldump.js
index 3ab0e47..8b9b1ff 100644
--- a/src/ldump.js
+++ b/src/ldump.js
@@ -164,18 +164,18 @@ const DumpFunction = function(f, psource, D) {
};
const DumpHeader = function(D) {
- DumpLiteral(defs.LUA_SIGNATURE, D);
- DumpByte(LUAC_VERSION, D);
- DumpByte(LUAC_FORMAT, D);
- let cdata = LUAC_DATA.split('').map(e => e.charCodeAt(0));
- DumpBlock(cdata, cdata.length, D);
- DumpByte(4, D); // intSize
- DumpByte(4, D); // size_tSize
- DumpByte(4, D); // instructionSize
- DumpByte(4, D); // integerSize
- DumpByte(8, D); // numberSize
- DumpInteger(LUAC_INT, D);
- DumpNumber(LUAC_NUM, D);
+ DumpLiteral(defs.LUA_SIGNATURE, D);
+ DumpByte(LUAC_VERSION, D);
+ DumpByte(LUAC_FORMAT, D);
+ let cdata = LUAC_DATA.split('').map(e => e.charCodeAt(0));
+ DumpBlock(cdata, cdata.length, D);
+ DumpByte(4, D); // intSize
+ DumpByte(4, D); // size_tSize
+ DumpByte(4, D); // instructionSize
+ DumpByte(4, D); // integerSize
+ DumpByte(8, D); // numberSize
+ DumpInteger(LUAC_INT, D);
+ DumpNumber(LUAC_NUM, D);
};
/*
diff --git a/src/liolib.js b/src/liolib.js
index a87309a..3241011 100644
--- a/src/liolib.js
+++ b/src/liolib.js
@@ -95,11 +95,11 @@ const g_iofile = function(L, f, mode) {
};
const io_input = function(L) {
- return g_iofile(L, IO_INPUT, "r");
+ return g_iofile(L, IO_INPUT, "r");
};
const io_output = function(L) {
- return g_iofile(L, IO_OUTPUT, "w");
+ return g_iofile(L, IO_OUTPUT, "w");
};
const g_write = function(L, f, arg) {
diff --git a/src/llex.js b/src/llex.js
index cc3d0ef..9e27d02 100644
--- a/src/llex.js
+++ b/src/llex.js
@@ -415,7 +415,7 @@ const read_string = function(ls, del, seminfo) {
case char['u']: utf8esc(ls); will = 'no_save'; break;
case char['\n']: case char['\r']:
inclinenumber(ls); c = char['\n']; will = 'only_save'; break;
- case char['\\']: case char['\"']: case char['\'']:
+ case char['\\']: case char['"']: case char['\'']:
c = ls.current; will = 'read_save'; break;
case lzio.EOZ: will = 'no_save'; break; /* will raise an error next loop */
case char['z']: { /* zap following span of spaces */
diff --git a/src/lmathlib.js b/src/lmathlib.js
index f2354ca..e056fd8 100644
--- a/src/lmathlib.js
+++ b/src/lmathlib.js
@@ -27,7 +27,7 @@ const math_random = function(L) {
/* random integer in the interval [low, up] */
lauxlib.luaL_argcheck(L, low <= up, 1, lua.to_luastring("interval is empty", true));
lauxlib.luaL_argcheck(L, low >= 0 || up <= luaconf.LUA_MAXINTEGER + low, 1,
- lua.to_luastring("interval too large", true));
+ lua.to_luastring("interval too large", true));
r *= (up - low) + 1;
lua.lua_pushinteger(L, Math.floor(r) + low);
diff --git a/src/loadlib.js b/src/loadlib.js
index ef39f4f..cae377f 100644
--- a/src/loadlib.js
+++ b/src/loadlib.js
@@ -302,7 +302,7 @@ const checkload = function(L, stat, filename) {
return 2; /* return open function and file name */
} else
return lauxlib.luaL_error(L, lua.to_luastring("error loading module '%s' from file '%s':\n\t%s"),
- lua.lua_tostring(L, 1), filename, lua.lua_tostring(L, -1));
+ lua.lua_tostring(L, 1), filename, lua.lua_tostring(L, -1));
};
const searcher_Lua = function(L) {
diff --git a/src/lobject.js b/src/lobject.js
index 8754e20..97b0514 100644
--- a/src/lobject.js
+++ b/src/lobject.js
@@ -417,7 +417,7 @@ const lua_str2number = function(s) {
return null;
}
/* parseFloat ignores trailing junk, validate with regex first */
- if (!/^[\t\v\f \n\r]*[\+\-]?([0-9]+\.?[0-9]*|\.[0-9]*)([eE][\+\-]?[0-9]+)?[\t\v\f \n\r]*$/.test(s))
+ if (!/^[\t\v\f \n\r]*[+-]?([0-9]+\.?[0-9]*|\.[0-9]*)([eE][+-]?[0-9]+)?[\t\v\f \n\r]*$/.test(s))
return null;
let flt = parseFloat(s);
return !isNaN(flt) ? flt : null;
@@ -539,23 +539,25 @@ const luaO_pushvfstring = function(L, fmt, argp) {
let i = 0;
let a = 0;
let e;
- while (1) {
+ for (;;) {
e = fmt.indexOf(char['%'], i);
if (e == -1) break;
pushstr(L, fmt.slice(i, e));
switch(fmt[e+1]) {
- case char['s']:
+ case char['s']: {
let s = argp[a++];
if (s === null) s = defs.to_luastring("(null)", true);
pushstr(L, s);
break;
- case char['c']:
+ }
+ case char['c']: {
let buff = argp[a++];
if (ljstype.lisprint(buff))
pushstr(L, [buff]);
else
luaO_pushfstring(L, defs.to_luastring("<\\%d>", true), buff);
break;
+ }
case char['d']:
case char['I']:
ldo.luaD_inctop(L);
@@ -567,7 +569,7 @@ const luaO_pushvfstring = function(L, fmt, argp) {
L.stack[L.top-1].setfltvalue(argp[a++]);
luaO_tostring(L, L.stack[L.top-1]);
break;
- case char['p']:
+ case char['p']: {
let v = argp[a++];
if (v instanceof lstate.lua_State ||
v instanceof ltable.Table ||
@@ -581,15 +583,15 @@ const luaO_pushvfstring = function(L, fmt, argp) {
pushstr(L, defs.to_luastring("<id NYI>"));
}
break;
+ }
case char['U']:
pushstr(L, defs.to_luastring(String.fromCodePoint(argp[a++])));
break;
case char['%']:
pushstr(L, [char['%']]);
break;
- default: {
+ default:
ldebug.luaG_runerror(L, defs.to_luastring("invalid option '%%%c' to 'lua_pushfstring'"), fmt[e + 1]);
- }
}
n += 2;
i = e + 2;
diff --git a/src/lparser.js b/src/lparser.js
index ddd514e..2efba50 100644
--- a/src/lparser.js
+++ b/src/lparser.js
@@ -118,7 +118,7 @@ class FuncState {
}
}
- /* description of active local variable */
+/* description of active local variable */
class Vardesc {
constructor() {
this.idx = NaN; /* variable index in stack */
@@ -214,7 +214,7 @@ const check_match = function(ls, what, who, where) {
else
llex.luaX_syntaxerror(ls, lobject.luaO_pushfstring(ls.L,
defs.to_luastring("%s expected (to close %s at line %d)"),
- llex.luaX_token2str(ls, what), llex.luaX_token2str(ls, who), where));
+ llex.luaX_token2str(ls, what), llex.luaX_token2str(ls, who), where));
}
};
@@ -504,8 +504,8 @@ const breaklabel = function(ls) {
*/
const undefgoto = function(ls, gt) {
let msg = llex.isreserved(gt.name)
- ? "<%s> at line %d not inside a loop"
- : "no visible label '%s' for <goto> at line %d";
+ ? "<%s> at line %d not inside a loop"
+ : "no visible label '%s' for <goto> at line %d";
msg = lobject.luaO_pushfstring(ls.L, defs.to_luastring(msg), gt.name.getstr(), gt.line);
semerror(ls, msg);
};
@@ -1166,8 +1166,8 @@ const checkrepeated = function(fs, ll, label) {
for (let i = fs.bl.firstlabel; i < ll.n; i++) {
if (eqstr(label, ll.arr[i].name)) {
let msg = lobject.luaO_pushfstring(fs.ls.L,
- defs.to_luastring("label '%s' already defined on line %d", true),
- label.getstr(), ll.arr[i].line);
+ defs.to_luastring("label '%s' already defined on line %d", true),
+ label.getstr(), ll.arr[i].line);
semerror(fs.ls, msg);
}
}
diff --git a/src/lstrlib.js b/src/lstrlib.js
index 80a5f55..88518e7 100644
--- a/src/lstrlib.js
+++ b/src/lstrlib.js
@@ -607,8 +607,8 @@ const str_pack = function(L) {
case KOption.Kstring: { /* strings with length count */
let s = lauxlib.luaL_checkstring(L, arg);
let len = s.length;
- lauxlib.luaL_argcheck(L, size >= 4 /* sizeof(size_t) */ ||
- len < (1 << (size * NB)),
+ lauxlib.luaL_argcheck(L,
+ size >= 4 /* sizeof(size_t) */ || len < (1 << (size * NB)),
arg, lua.to_luastring("string length does not fit in given size", true));
packint(b, len, h.islittle, size, 0); /* pack length */
b.push(...s);
@@ -1331,7 +1331,7 @@ const add_value = function(ms, b, s, e, tr) {
lua.lua_pushlstring(L, ms.src.slice(s, e), e - s); /* keep original text */
} else if (!lua.lua_isstring(L, -1))
lauxlib.luaL_error(L, lua.to_luastring("invalid replacement value (a %s)"), lauxlib.luaL_typename(L, -1));
- lauxlib.luaL_addvalue(b); /* add result to accumulator */
+ lauxlib.luaL_addvalue(b); /* add result to accumulator */
};
const str_gsub = function(L) {
diff --git a/src/ltable.js b/src/ltable.js
index f7b1167..cf8b1da 100644
--- a/src/ltable.js
+++ b/src/ltable.js
@@ -24,58 +24,59 @@ const get_lightuserdata_hash = function(v) {
const table_hash = function(L, key) {
switch(key.type) {
- case CT.LUA_TNIL:
- return ldebug.luaG_runerror(L, defs.to_luastring("table index is nil", true));
- case CT.LUA_TNUMFLT:
- if (isNaN(key.value))
- return ldebug.luaG_runerror(L, defs.to_luastring("table index is NaN", true));
- /* fall through */
- case CT.LUA_TNUMINT: /* takes advantage of floats and integers being same in JS */
- case CT.LUA_TBOOLEAN:
- case CT.LUA_TTABLE:
- case CT.LUA_TLCL:
- case CT.LUA_TLCF:
- case CT.LUA_TCCL:
- case CT.LUA_TUSERDATA:
- case CT.LUA_TTHREAD:
- return key.value;
- case CT.LUA_TSHRSTR:
- case CT.LUA_TLNGSTR:
- return lstring.luaS_hashlongstr(key.tsvalue());
- case CT.LUA_TLIGHTUSERDATA:
- let v = key.value;
- switch(typeof v) {
- case "string":
- /* possible conflict with LUA_TSTRING.
- prefix this string with "*" so they don't clash */
- return "*" + v;
- case "number":
- /* possible conflict with LUA_TNUMBER.
- turn into string and prefix with "#" to avoid clash with other strings */
- return "#" + v;
- case "boolean":
- /* possible conflict with LUA_TBOOLEAN. use strings ?true and ?false instead */
- return v?"?true":"?false";
- case "function":
- /* possible conflict with LUA_TLCF.
- indirect via a weakmap */
- return get_lightuserdata_hash(v);
- case "object":
- /* v could be a lua_State, CClosure, LClosure, Table or Userdata from this state as returned by lua_topointer */
- if ((v instanceof lstate.lua_State && v.l_G === L.l_G) ||
- v instanceof Table ||
- v instanceof lobject.Udata ||
- v instanceof lobject.LClosure ||
- v instanceof lobject.CClosure) {
- /* indirect via a weakmap */
- return get_lightuserdata_hash(v);
- }
+ case CT.LUA_TNIL:
+ return ldebug.luaG_runerror(L, defs.to_luastring("table index is nil", true));
+ case CT.LUA_TNUMFLT:
+ if (isNaN(key.value))
+ return ldebug.luaG_runerror(L, defs.to_luastring("table index is NaN", true));
/* fall through */
- default:
- return v;
+ case CT.LUA_TNUMINT: /* takes advantage of floats and integers being same in JS */
+ case CT.LUA_TBOOLEAN:
+ case CT.LUA_TTABLE:
+ case CT.LUA_TLCL:
+ case CT.LUA_TLCF:
+ case CT.LUA_TCCL:
+ case CT.LUA_TUSERDATA:
+ case CT.LUA_TTHREAD:
+ return key.value;
+ case CT.LUA_TSHRSTR:
+ case CT.LUA_TLNGSTR:
+ return lstring.luaS_hashlongstr(key.tsvalue());
+ case CT.LUA_TLIGHTUSERDATA: {
+ let v = key.value;
+ switch(typeof v) {
+ case "string":
+ /* possible conflict with LUA_TSTRING.
+ prefix this string with "*" so they don't clash */
+ return "*" + v;
+ case "number":
+ /* possible conflict with LUA_TNUMBER.
+ turn into string and prefix with "#" to avoid clash with other strings */
+ return "#" + v;
+ case "boolean":
+ /* possible conflict with LUA_TBOOLEAN. use strings ?true and ?false instead */
+ return v?"?true":"?false";
+ case "function":
+ /* possible conflict with LUA_TLCF.
+ indirect via a weakmap */
+ return get_lightuserdata_hash(v);
+ case "object":
+ /* v could be a lua_State, CClosure, LClosure, Table or Userdata from this state as returned by lua_topointer */
+ if ((v instanceof lstate.lua_State && v.l_G === L.l_G) ||
+ v instanceof Table ||
+ v instanceof lobject.Udata ||
+ v instanceof lobject.LClosure ||
+ v instanceof lobject.CClosure) {
+ /* indirect via a weakmap */
+ return get_lightuserdata_hash(v);
+ }
+ /* fall through */
+ default:
+ return v;
+ }
}
- default:
- throw new Error("unknown key type: " + key.type);
+ default:
+ throw new Error("unknown key type: " + key.type);
}
};
diff --git a/src/lundump.js b/src/lundump.js
index b25a955..ff87903 100644
--- a/src/lundump.js
+++ b/src/lundump.js
@@ -145,24 +145,24 @@ class BytecodeParser {
let t = this.readByte();
switch (t) {
- case defs.CT.LUA_TNIL:
- f.k.push(new lobject.TValue(defs.CT.LUA_TNIL, null));
- break;
- case defs.CT.LUA_TBOOLEAN:
- f.k.push(new lobject.TValue(defs.CT.LUA_TBOOLEAN, this.readByte() !== 0));
- break;
- case defs.CT.LUA_TNUMFLT:
- f.k.push(new lobject.TValue(defs.CT.LUA_TNUMFLT, this.readNumber()));
- break;
- case defs.CT.LUA_TNUMINT:
- f.k.push(new lobject.TValue(defs.CT.LUA_TNUMINT, this.readInteger()));
- break;
- case defs.CT.LUA_TSHRSTR:
- case defs.CT.LUA_TLNGSTR:
- f.k.push(new lobject.TValue(defs.CT.LUA_TLNGSTR, this.readString()));
- break;
- default:
- this.error(`unrecognized constant '${t}'`);
+ case defs.CT.LUA_TNIL:
+ f.k.push(new lobject.TValue(defs.CT.LUA_TNIL, null));
+ break;
+ case defs.CT.LUA_TBOOLEAN:
+ f.k.push(new lobject.TValue(defs.CT.LUA_TBOOLEAN, this.readByte() !== 0));
+ break;
+ case defs.CT.LUA_TNUMFLT:
+ f.k.push(new lobject.TValue(defs.CT.LUA_TNUMFLT, this.readNumber()));
+ break;
+ case defs.CT.LUA_TNUMINT:
+ f.k.push(new lobject.TValue(defs.CT.LUA_TNUMINT, this.readInteger()));
+ break;
+ case defs.CT.LUA_TSHRSTR:
+ case defs.CT.LUA_TLNGSTR:
+ f.k.push(new lobject.TValue(defs.CT.LUA_TLNGSTR, this.readString()));
+ break;
+ default:
+ this.error(`unrecognized constant '${t}'`);
}
}
}
diff --git a/src/lvm.js b/src/lvm.js
index ffc1d74..1898f3b 100644
--- a/src/lvm.js
+++ b/src/lvm.js
@@ -78,15 +78,15 @@ const luaV_finishOp = function(L) {
};
const RA = function(L, base, i) {
- return base + i.A;
+ return base + i.A;
};
const RB = function(L, base, i) {
- return base + i.B;
+ return base + i.B;
};
const RC = function(L, base, i) {
- return base + i.C;
+ return base + i.C;
};
const RKB = function(L, base, k, i) {