aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordaurnimator <quae@daurnimator.com>2017-05-05 14:11:42 +1000
committerdaurnimator <quae@daurnimator.com>2017-05-05 14:21:41 +1000
commitb0cdb074dcd474893c31783230127e795e676e58 (patch)
tree6e81d7412a465bd1c7915002371df7ab404df034
parent2951276b31e04d7bff330b5c7af42d87cf766cd0 (diff)
downloadfengari-b0cdb074dcd474893c31783230127e795e676e58.tar.gz
fengari-b0cdb074dcd474893c31783230127e795e676e58.tar.bz2
fengari-b0cdb074dcd474893c31783230127e795e676e58.zip
src/ldebug.js: Micro optimisation that brings code more in line with reference implementation
-rw-r--r--src/ldebug.js6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/ldebug.js b/src/ldebug.js
index 50625e5..34c6fc5 100644
--- a/src/ldebug.js
+++ b/src/ldebug.js
@@ -567,11 +567,13 @@ const luaG_ordererror = function(L, p1, p2) {
/* add src:line information to 'msg' */
const luaG_addinfo = function(L, msg, src, line) {
- let buff = ['?'.charCodeAt(0)];
+ let buff;
if (src)
buff = lobject.luaO_chunkid(src, luaconf.LUA_IDSIZE);
+ else
+ buff = ['?'.charCodeAt(0)];
- return lobject.luaO_pushfstring(L, defs.to_luastring("%s:%d: %s", true), buff, line, msg)
+ return lobject.luaO_pushfstring(L, defs.to_luastring("%s:%d: %s", true), buff, line, msg);
};
const luaG_runerror = function(L, fmt, ...argp) {