diff options
author | daurnimator <quae@daurnimator.com> | 2018-01-18 07:17:59 +1100 |
---|---|---|
committer | daurnimator <quae@daurnimator.com> | 2018-01-18 07:17:59 +1100 |
commit | ed7ac85c409ffec65aa86189f49e5d46e7a110bc (patch) | |
tree | 9a02ed29652757dcf0ebc81b7db2c7da82474ca5 /src/lparser.js | |
parent | 8bedd949c894d61284b3ddd5b3bf989b651b95f8 (diff) | |
download | fengari-ed7ac85c409ffec65aa86189f49e5d46e7a110bc.tar.gz fengari-ed7ac85c409ffec65aa86189f49e5d46e7a110bc.tar.bz2 fengari-ed7ac85c409ffec65aa86189f49e5d46e7a110bc.zip |
src/: Destructure when requiring lstring.js
Diffstat (limited to 'src/lparser.js')
-rw-r--r-- | src/lparser.js | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/src/lparser.js b/src/lparser.js index ac5b232..b235367 100644 --- a/src/lparser.js +++ b/src/lparser.js @@ -105,7 +105,11 @@ const { SETARG_C, SET_OPCODE } = require('./lopcodes.js'); -const lstring = require('./lstring.js'); +const { + luaS_eqlngstr, + luaS_new, + luaS_newliteral +} = require('./lstring.js'); const ltable = require('./ltable.js'); const Proto = lfunc.Proto; const R = llex.RESERVED; @@ -118,7 +122,7 @@ const hasmultret = function(k) { const eqstr = function(a, b) { /* TODO: use plain equality as strings are cached */ - return lstring.luaS_eqlngstr(a, b); + return luaS_eqlngstr(a, b); }; class BlockCnt { @@ -584,7 +588,7 @@ const enterblock = function(fs, bl, isloop) { ** create a label named 'break' to resolve break statements */ const breaklabel = function(ls) { - let n = lstring.luaS_newliteral(ls.L, "break"); + let n = luaS_newliteral(ls.L, "break"); let l = newlabelentry(ls, ls.dyd.label, n, 0, ls.fs.pc); findgotos(ls, ls.dyd.label.arr[l]); }; @@ -1246,7 +1250,7 @@ const gotostat = function(ls, pc) { label = str_checkname(ls); else { llex.luaX_next(ls); /* skip break */ - label = lstring.luaS_newliteral(ls.L, "break"); + label = luaS_newliteral(ls.L, "break"); } let g = newlabelentry(ls, ls.dyd.gt, label, line, pc); findlabel(ls, g); /* close it if label already defined */ @@ -1658,7 +1662,7 @@ const luaY_parser = function(L, z, buff, dyd, name, firstchar) { ldo.luaD_inctop(L); L.stack[L.top-1].sethvalue(lexstate.h); funcstate.f = cl.p = new Proto(L); - funcstate.f.source = lstring.luaS_new(L, name); + funcstate.f.source = luaS_new(L, name); lexstate.buff = buff; lexstate.dyd = dyd; dyd.actvar.n = dyd.gt.n = dyd.label.n = 0; |