From b0cdb074dcd474893c31783230127e795e676e58 Mon Sep 17 00:00:00 2001 From: daurnimator Date: Fri, 5 May 2017 14:11:42 +1000 Subject: src/ldebug.js: Micro optimisation that brings code more in line with reference implementation --- src/ldebug.js | 6 ++++-- 1 file 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) { -- cgit v1.2.3-70-g09d2