summaryrefslogtreecommitdiff
path: root/src/lundump.js
diff options
context:
space:
mode:
authordaurnimator <quae@daurnimator.com>2018-01-11 23:44:38 +1100
committerdaurnimator <quae@daurnimator.com>2018-01-11 23:44:38 +1100
commit970c179a034ad53f6a64f987070e78bf1de5e6fa (patch)
tree7a2b7b055d886f03adb86a4ac9ab46fa5aa4bfd5 /src/lundump.js
parenta39f24f204a15cb4587e75b38424952fe444d9d2 (diff)
downloadfengari-970c179a034ad53f6a64f987070e78bf1de5e6fa.tar.gz
fengari-970c179a034ad53f6a64f987070e78bf1de5e6fa.tar.bz2
fengari-970c179a034ad53f6a64f987070e78bf1de5e6fa.zip
Remove defs.CT alias for defs.constant_types
Diffstat (limited to 'src/lundump.js')
-rw-r--r--src/lundump.js31
1 files changed, 20 insertions, 11 deletions
diff --git a/src/lundump.js b/src/lundump.js
index ee1e738..bf1b7e6 100644
--- a/src/lundump.js
+++ b/src/lundump.js
@@ -10,6 +10,15 @@ const lopcodes = require('./lopcodes.js');
const lstring = require('./lstring.js');
const lzio = require('./lzio.js');
+const {
+ LUA_TBOOLEAN,
+ LUA_TLNGSTR,
+ LUA_TNIL,
+ LUA_TNUMFLT,
+ LUA_TNUMINT,
+ LUA_TSHRSTR
+} = defs.constant_types;
+
let LUAC_DATA = [0x19, 0x93, defs.char["\r"], defs.char["\n"], 0x1a, defs.char["\n"]];
class BytecodeParser {
@@ -145,21 +154,21 @@ class BytecodeParser {
let t = this.readByte();
switch (t) {
- case defs.CT.LUA_TNIL:
- f.k.push(new lobject.TValue(defs.CT.LUA_TNIL, null));
+ case LUA_TNIL:
+ f.k.push(new lobject.TValue(LUA_TNIL, null));
break;
- case defs.CT.LUA_TBOOLEAN:
- f.k.push(new lobject.TValue(defs.CT.LUA_TBOOLEAN, this.readByte() !== 0));
+ case LUA_TBOOLEAN:
+ f.k.push(new lobject.TValue(LUA_TBOOLEAN, this.readByte() !== 0));
break;
- case defs.CT.LUA_TNUMFLT:
- f.k.push(new lobject.TValue(defs.CT.LUA_TNUMFLT, this.readNumber()));
+ case LUA_TNUMFLT:
+ f.k.push(new lobject.TValue(LUA_TNUMFLT, this.readNumber()));
break;
- case defs.CT.LUA_TNUMINT:
- f.k.push(new lobject.TValue(defs.CT.LUA_TNUMINT, this.readInteger()));
+ case LUA_TNUMINT:
+ f.k.push(new lobject.TValue(LUA_TNUMINT, this.readInteger()));
break;
- case defs.CT.LUA_TSHRSTR:
- case defs.CT.LUA_TLNGSTR:
- f.k.push(new lobject.TValue(defs.CT.LUA_TLNGSTR, this.readString()));
+ case LUA_TSHRSTR:
+ case LUA_TLNGSTR:
+ f.k.push(new lobject.TValue(LUA_TLNGSTR, this.readString()));
break;
default:
this.error(`unrecognized constant '${t}'`);