summaryrefslogtreecommitdiff
path: root/src/lundump.js
diff options
context:
space:
mode:
authorBenoit Giannangeli <benoit.giannangeli@boursorama.fr>2017-02-03 15:18:55 +0100
committerBenoit Giannangeli <benoit.giannangeli@boursorama.fr>2017-02-03 15:18:55 +0100
commit2cf246d68c5e658eb6c36a00ac35c7862a54e90e (patch)
treeab9c4587af63b80093d866798383bd4ae6b98dca /src/lundump.js
parent90161c463fc8725d3d39b699dbf7e591874c47fb (diff)
downloadfengari-2cf246d68c5e658eb6c36a00ac35c7862a54e90e.tar.gz
fengari-2cf246d68c5e658eb6c36a00ac35c7862a54e90e.tar.bz2
fengari-2cf246d68c5e658eb6c36a00ac35c7862a54e90e.zip
TValue
Diffstat (limited to 'src/lundump.js')
-rw-r--r--src/lundump.js26
1 files changed, 6 insertions, 20 deletions
diff --git a/src/lundump.js b/src/lundump.js
index 896fb31..f2f91f1 100644
--- a/src/lundump.js
+++ b/src/lundump.js
@@ -6,6 +6,7 @@ const fs = require('fs');
const assert = require('assert');
const LClosure = require('./lobject.js').LClosure;
+const TValue = require('./lobject.js').TValue;
const Proto = require('./lfunc.js').Proto;
const constant_types = require('./lua.js').constant_types;
const OpCodes = require('./lopcodes.js');
@@ -163,39 +164,24 @@ class BytecodeParser {
switch (t) {
case constant_types.LUA_TNIL:
- f.k.push({
- type: constant_types.LUA_TNIL,
- value: null
- });
+ f.k.push(new TValue(constant_types.LUA_TNIL, null));
console.log(` LUA_TNIL = ${f.k[f.k.length - 1].value}`);
break;
case constant_types.LUA_TBOOLEAN:
- f.k.push({
- type: constant_types.LUA_TBOOLEAN,
- value: this.readByte()
- });
+ f.k.push(new TValue(constant_types.LUA_TBOOLEAN, this.readByte()));
console.log(` LUA_TBOOLEAN = ${f.k[f.k.length - 1].value}`);
break;
case constant_types.LUA_TNUMFLT:
- f.k.push({
- type: constant_types.LUA_TNUMFLT,
- value: this.readNumber()
- });
+ f.k.push(new TValue(constant_types.LUA_TNUMFLT, this.readNumber()));
console.log(` LUA_TNUMFLT = ${f.k[f.k.length - 1].value}`);
break;
case constant_types.LUA_TNUMINT:
- f.k.push({
- type: constant_types.LUA_TNUMINT,
- value: this.readInteger()
- });
+ f.k.push(new TValue(constant_types.LUA_TNUMINT, this.readInteger()));
console.log(` LUA_TNUMINT = ${f.k[f.k.length - 1].value}`);
break;
case constant_types.LUA_TSHRSTR:
case constant_types.LUA_TLNGSTR:
- f.k.push({
- type: constant_types.LUA_TLNGSTR,
- value: this.readString()
- });
+ f.k.push(new TValue(constant_types.LUA_TLNGSTR, this.readString()));
console.log(` LUA_TLNGSTR = ${f.k[f.k.length - 1].value}`);
break;
default: