diff options
author | daurnimator <quae@daurnimator.com> | 2017-05-21 23:40:47 +1000 |
---|---|---|
committer | daurnimator <quae@daurnimator.com> | 2017-05-22 00:50:33 +1000 |
commit | e1257c5167c5d662c248c87c86b797f179e6e86e (patch) | |
tree | 60a1846800fe0788a5470449eba8f9567e267a7a /src/ldebug.js | |
parent | 50323a75a96cfa095c1f968dd001b0f7107a722b (diff) | |
download | fengari-e1257c5167c5d662c248c87c86b797f179e6e86e.tar.gz fengari-e1257c5167c5d662c248c87c86b797f179e6e86e.tar.bz2 fengari-e1257c5167c5d662c248c87c86b797f179e6e86e.zip |
src/ldebug.js: lineinfo is always an array in JS, check length instead
Diffstat (limited to 'src/ldebug.js')
-rw-r--r-- | src/ldebug.js | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/ldebug.js b/src/ldebug.js index ee9c891..4be14dd 100644 --- a/src/ldebug.js +++ b/src/ldebug.js @@ -23,7 +23,7 @@ const currentpc = function(ci) { }; const currentline = function(ci) { - return ci.func.value.p.lineinfo ? ci.func.value.p.lineinfo[currentpc(ci)] : -1; + return ci.func.value.p.lineinfo.length !== 0 ? ci.func.value.p.lineinfo[currentpc(ci)] : -1; }; /* @@ -626,10 +626,10 @@ const luaG_traceexec = function(L) { if (mask & defs.LUA_MASKLINE) { let p = ci.func.value.p; let npc = ci.l_savedpc; // pcRel(ci.u.l.savedpc, p); - let newline = p.lineinfo ? p.lineinfo[npc] : -1; + let newline = p.lineinfo.length !== 0 ? p.lineinfo[npc] : -1; if (npc === 0 || /* call linehook when enter a new function, */ ci.l_savedpc <= L.oldpc || /* when jump back (loop), or when */ - newline !== p.lineinfo ? p.lineinfo[L.oldpc] : -1) /* enter a new line */ + newline !== p.lineinfo.length !== 0 ? p.lineinfo[L.oldpc] : -1) /* enter a new line */ ldo.luaD_hook(L, defs.LUA_HOOKLINE, newline); /* call line hook */ } L.oldpc = ci.l_savedpc; |