From c96ce724a113afa569f206248eb9073ad33995ea Mon Sep 17 00:00:00 2001 From: daurnimator Date: Thu, 18 Jan 2018 06:51:37 +1100 Subject: src/lparser.js: Use destructuring assignment for llimits.js --- src/lparser.js | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/lparser.js b/src/lparser.js index d183d25..55db2dc 100644 --- a/src/lparser.js +++ b/src/lparser.js @@ -7,7 +7,10 @@ const lcode = require('./lcode.js'); const ldo = require('./ldo.js'); const lfunc = require('./lfunc.js'); const llex = require('./llex.js'); -const llimits = require('./llimits.js'); +const { + LUAI_MAXCCALLS, + MAX_INT +} = require('./llimits.js'); const lobject = require('./lobject.js'); const lopcodes = require('./lopcodes.js'); const lstring = require('./lstring.js'); @@ -383,7 +386,7 @@ const adjust_assign = function(ls, nvars, nexps, e) { const enterlevel = function(ls) { let L = ls.L; ++L.nCcalls; - checklimit(ls.fs, L.nCcalls, llimits.LUAI_MAXCCALLS, defs.to_luastring("JS levels", true)); + checklimit(ls.fs, L.nCcalls, LUAI_MAXCCALLS, defs.to_luastring("JS levels", true)); }; const leavelevel = function(ls) { @@ -652,7 +655,7 @@ const recfield = function(ls, cc) { let val = new expdesc(); if (ls.t.token === R.TK_NAME) { - checklimit(fs, cc.nh, llimits.MAX_INT, defs.to_luastring("items in a constructor", true)); + checklimit(fs, cc.nh, MAX_INT, defs.to_luastring("items in a constructor", true)); checkname(ls, key); } else /* ls->t.token === '[' */ yindex(ls, key); @@ -690,7 +693,7 @@ const lastlistfield = function(fs, cc) { const listfield = function(ls, cc) { /* listfield -> exp */ expr(ls, cc.v); - checklimit(ls.fs, cc.na, llimits.MAX_INT, defs.to_luastring("items in a constructor", true)); + checklimit(ls.fs, cc.na, MAX_INT, defs.to_luastring("items in a constructor", true)); cc.na++; cc.tostore++; }; @@ -1122,7 +1125,7 @@ const assignment = function(ls, lh, nvars) { suffixedexp(ls, nv.v); if (nv.v.k !== expkind.VINDEXED) check_conflict(ls, lh, nv.v); - checklimit(ls.fs, nvars + ls.L.nCcalls, llimits.LUAI_MAXCCALLS, defs.to_luastring("JS levels", true)); + checklimit(ls.fs, nvars + ls.L.nCcalls, LUAI_MAXCCALLS, defs.to_luastring("JS levels", true)); assignment(ls, nv, nvars + 1); } else { /* assignment -> '=' explist */ checknext(ls, char['=']); -- cgit v1.2.3-70-g09d2