From 7ab3254e90780bacfd096de84eab31778ae09a26 Mon Sep 17 00:00:00 2001 From: daurnimator Date: Fri, 12 May 2017 17:12:08 +1000 Subject: .is_vararg should be a boolean --- src/lfunc.js | 2 +- src/lparser.js | 4 ++-- src/lundump.js | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/lfunc.js b/src/lfunc.js index 40c0905..7e324da 100644 --- a/src/lfunc.js +++ b/src/lfunc.js @@ -17,7 +17,7 @@ class Proto { this.lineinfo = []; // map from opcodes to source lines (debug information) this.upvalues = []; // upvalue information this.numparams = 0; // number of fixed parameters - this.is_vararg = 0; + this.is_vararg = false; this.maxstacksize = 0; // number of registers needed by this function this.locvars = []; // information about local variables (debug information) this.linedefined = 0; // debug information diff --git a/src/lparser.js b/src/lparser.js index 3c50163..324425c 100644 --- a/src/lparser.js +++ b/src/lparser.js @@ -745,7 +745,7 @@ const parlist = function(ls) { let fs = ls.fs; let f = fs.f; let nparams = 0; - f.is_vararg = 0; + f.is_vararg = false; if (ls.t.token !== char[')']) { /* is 'parlist' not empty? */ do { switch (ls.t.token) { @@ -756,7 +756,7 @@ const parlist = function(ls) { } case R.TK_DOTS: { /* param -> '...' */ llex.luaX_next(ls); - f.is_vararg = 1; /* declared vararg */ + f.is_vararg = true; /* declared vararg */ break; } default: llex.luaX_syntaxerror(ls, defs.to_luastring(" or '...' expected", true)); diff --git a/src/lundump.js b/src/lundump.js index 3c35710..eeb77f4 100644 --- a/src/lundump.js +++ b/src/lundump.js @@ -212,7 +212,7 @@ class BytecodeParser { f.linedefined = this.readInt(); f.lastlinedefined = this.readInt(); f.numparams = this.readByte(); - f.is_vararg = this.readByte(); + f.is_vararg = this.readByte() !== 0; f.maxstacksize = this.readByte(); this.readCode(f); this.readConstants(f); -- cgit v1.2.3-70-g09d2