aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordaurnimator <quae@daurnimator.com>2017-03-03 22:46:39 +1100
committerdaurnimator <quae@daurnimator.com>2017-03-03 22:46:39 +1100
commitdba35fd2956f9f6b14ea8947baa11c5e483bc407 (patch)
tree67557d7f3a58d85d07b36fe303d7c83d8e9e4aa8
parenteada82cc75dd0a2ad40ad25552f8e8e2c93891f8 (diff)
downloadfengari-dba35fd2956f9f6b14ea8947baa11c5e483bc407.tar.gz
fengari-dba35fd2956f9f6b14ea8947baa11c5e483bc407.tar.bz2
fengari-dba35fd2956f9f6b14ea8947baa11c5e483bc407.zip
Remove use of 'buffer-dataview' library
-rw-r--r--package.json1
-rw-r--r--src/llex.js1
-rw-r--r--src/lundump.js3
-rw-r--r--tests/tests.js6
4 files changed, 4 insertions, 7 deletions
diff --git a/package.json b/package.json
index 7496921..d567a62 100644
--- a/package.json
+++ b/package.json
@@ -33,7 +33,6 @@
"tmp": "0.0.31"
},
"dependencies": {
- "buffer-dataview": "0.0.2",
"seedrandom": "^2.4.2"
}
}
diff --git a/src/llex.js b/src/llex.js
index 711f44b..2e79066 100644
--- a/src/llex.js
+++ b/src/llex.js
@@ -1,6 +1,5 @@
"use strict";
-const DataView = require('buffer-dataview');
const assert = require('assert');
const lapi = require('./lapi.js');
diff --git a/src/lundump.js b/src/lundump.js
index 5a6d8c4..92063a2 100644
--- a/src/lundump.js
+++ b/src/lundump.js
@@ -1,7 +1,6 @@
/*jshint esversion: 6 */
"use strict";
-const DataView = require('buffer-dataview');
const fs = require('fs');
const assert = require('assert');
@@ -110,7 +109,7 @@ class BytecodeParser {
}
readInstruction() {
- let ins = new DataView(new Buffer(this.instructionSize));
+ let ins = new DataView(new ArrayBuffer(this.instructionSize));
for (let i = 0; i < this.instructionSize; i++)
ins.setUint8(i, this.readByte());
diff --git a/tests/tests.js b/tests/tests.js
index a47aee5..d4173c3 100644
--- a/tests/tests.js
+++ b/tests/tests.js
@@ -3,7 +3,6 @@
const fs = require('fs');
const child_process = require('child_process');
const tmp = require('tmp');
-const DataView = require('buffer-dataview');
const BytecodeParser = require("../src/lundump.js");
const lauxlib = require("../src/lauxlib.js");
@@ -20,10 +19,11 @@ const toByteCode = function (luaCode) {
bclist = fs.readFileSync(`${luaFile.name}.bc.txt`, 'utf8');
- // console.log(bclist);
+ let b = fs.readFileSync(`${luaFile.name}.bc`);
+ let dv = new DataView(b.buffer.slice(b.byteOffset, b.byteOffset + b.byteLength));
return {
- dataView: new DataView(fs.readFileSync(`${luaFile.name}.bc`)),
+ dataView: dv,
bclist: bclist
};
};