diff options
author | daurnimator <quae@daurnimator.com> | 2017-05-05 14:11:42 +1000 |
---|---|---|
committer | daurnimator <quae@daurnimator.com> | 2017-05-05 14:21:41 +1000 |
commit | b0cdb074dcd474893c31783230127e795e676e58 (patch) | |
tree | 6e81d7412a465bd1c7915002371df7ab404df034 /src/ldebug.js | |
parent | 2951276b31e04d7bff330b5c7af42d87cf766cd0 (diff) | |
download | fengari-b0cdb074dcd474893c31783230127e795e676e58.tar.gz fengari-b0cdb074dcd474893c31783230127e795e676e58.tar.bz2 fengari-b0cdb074dcd474893c31783230127e795e676e58.zip |
src/ldebug.js: Micro optimisation that brings code more in line with reference implementation
Diffstat (limited to 'src/ldebug.js')
-rw-r--r-- | src/ldebug.js | 6 |
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) { |