From 971263ef6285eaa26884ec81b4285431f379a0e7 Mon Sep 17 00:00:00 2001 From: Benoit Giannangeli Date: Thu, 23 Mar 2017 11:17:29 +0100 Subject: Removed unnecessary TValue test in varinfo --- src/ldebug.js | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/src/ldebug.js b/src/ldebug.js index 3b01263..aa57aef 100644 --- a/src/ldebug.js +++ b/src/ldebug.js @@ -388,7 +388,7 @@ const funcnamefromcode = function(L, ci) { return null; /* cannot find a reasonable name */ } - r.name = L.l_G.tmname[tm]; + r.name = L.l_G.tmname[tm].jsstring(); r.funcname = "metamethod"; return r; }; @@ -431,14 +431,7 @@ const varinfo = function(L, o) { kind = getobjname(ci.func.p, ci.pcOff, stkid - ci.u.l.base); } - if (kind) { - let funcname = kind.funcname instanceof TValue ? kind.funcname.jsstring() : kind.funcname; - let name = kind.name instanceof TValue ? kind.name.jsstring() : kind.name; - - return ` (${funcname} '${name}')`; - } - - return ``; + return kind ? ` (${kind.funcname} '${kind.name}')` : ``; }; const luaG_typeerror = function(L, o, op) { @@ -519,4 +512,4 @@ module.exports.luaG_typeerror = luaG_typeerror; module.exports.luaG_concaterror = luaG_concaterror; module.exports.luaG_opinterror = luaG_opinterror; module.exports.luaG_ordererror = luaG_ordererror; -module.exports.luaG_tointerror = luaG_tointerror; \ No newline at end of file +module.exports.luaG_tointerror = luaG_tointerror; -- cgit v1.2.3-70-g09d2