diff options
author | daurnimator <quae@daurnimator.com> | 2017-06-08 16:49:37 +1000 |
---|---|---|
committer | daurnimator <quae@daurnimator.com> | 2017-06-08 16:49:37 +1000 |
commit | c1a96e0cd2d0b02da6beb0b0fd07bd91fdb91288 (patch) | |
tree | a7e863133be03927fb95ab82cce0cb5af55c3965 | |
parent | c129a1d95b44be63c840d95f94409d7333d440cc (diff) | |
download | fengari-c1a96e0cd2d0b02da6beb0b0fd07bd91fdb91288.tar.gz fengari-c1a96e0cd2d0b02da6beb0b0fd07bd91fdb91288.tar.bz2 fengari-c1a96e0cd2d0b02da6beb0b0fd07bd91fdb91288.zip |
src/lvm.js: Clean up 'forlimit'
- 'casted' property was pointless
- Avoid calling unless operands are known to be integers
-rw-r--r-- | src/lvm.js | 7 |
1 files changed, 3 insertions, 4 deletions
@@ -533,9 +533,10 @@ const luaV_execute = function(L) { let init = L.stack[ra]; let plimit = L.stack[ra + 1]; let pstep = L.stack[ra + 2]; - let forlim = forlimit(plimit, pstep.value); + let forlim; - if (init.ttisinteger() && pstep.ttisinteger() && forlim.casted) { /* all values are integer */ + if (init.ttisinteger() && pstep.ttisinteger() && (forlim = forlimit(plimit, pstep.value))) { + /* all values are integer */ let initv = forlim.stopnow ? 0 : init.value; plimit.value = forlim.ilimit; init.value = (initv - pstep.value)|0; @@ -746,7 +747,6 @@ const forlimit = function(obj, step) { } return { - casted: true, stopnow: stopnow, ilimit: ilimit }; @@ -1061,7 +1061,6 @@ module.exports.cvt2str = cvt2str; module.exports.cvt2num = cvt2num; module.exports.dojump = dojump; module.exports.donextjump = donextjump; -module.exports.forlimit = forlimit; module.exports.gettable = gettable; module.exports.luaV_concat = luaV_concat; module.exports.luaV_div = luaV_div; |