Use the name "data"

This commit is contained in:
Jordan Eldredge 2019-07-05 17:20:24 -07:00
parent 8806b78c0a
commit 0711ac4bbf
5 changed files with 14 additions and 10 deletions

View file

@ -8,9 +8,9 @@ const System = require("./runtime/System");
function main() {
const relativePath = process.argv[2];
const buffer = fs.readFileSync(path.join(__dirname, relativePath));
const data = fs.readFileSync(path.join(__dirname, relativePath));
const system = new System();
run({ runtime, buffer, system, log: true });
run({ runtime, data, system, log: true });
}
main();

View file

@ -2,8 +2,8 @@ const parse = require("./parser");
const { getClass } = require("./objects");
const interpret = require("./virtualMachine");
function main({ runtime, buffer, system, log }) {
const program = parse(buffer);
function main({ runtime, data, system, log }) {
const program = parse(data);
// Set the System global
program.variables[0].setValue(system);

View file

@ -6,8 +6,8 @@ const interpret = require("./interpreter");
function runFile(relativePath) {
const system = new System();
const buffer = fs.readFileSync(path.join(__dirname, relativePath));
interpret({ runtime, buffer, system, log: false });
const data = fs.readFileSync(path.join(__dirname, relativePath));
interpret({ runtime, data, system, log: false });
}
let mockMessageBox;
@ -24,7 +24,7 @@ describe("can call messageBox with hello World", () => {
const versions = [
// "v1.1.0.a9 (Winamp 3 alpha 8r)",
"v1.1.1.b3 (Winamp 3.0 build 488d)",
"v1.1.1.b3 (Winamp 3.0 full)"
"v1.1.1.b3 (Winamp 3.0 full)",
// "v1.1.13 (Winamp 5.02)",
// "v1.2.0 (Winamp 5.66)"
];

View file

@ -14,8 +14,8 @@ const PRIMITIVE_TYPES = {
// file. When we want to run in the browser, we can refactor this class to use a
// typed array: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Typed_arrays
class MakiFile {
constructor(buffer) {
this._arr = new Uint8Array(buffer);
constructor(data) {
this._arr = new Uint8Array(data);
this._i = 0;
}

View file

@ -1,16 +1,20 @@
const System = require("./System");
const Group = require("./Group");
const GuiObject = require("./GuiObject");
const MakiObject = require("./MakiObject");
class PopupMenu {}
class Container {}
class List {}
const runtime = {
"516549714a510d87b5a6e391e7f33532": MakiObject,
d6f50f6449b793fa66baf193983eaeef: System,
"45be95e5419120725fbb5c93fd17f1f9": Group,
"4ee3e1994becc636bc78cd97b028869c": GuiObject,
f4787af44ef7b2bb4be7fb9c8da8bea9: PopupMenu,
e90dc47b4ae7840d0b042cb0fcf775d2: Container
e90dc47b4ae7840d0b042cb0fcf775d2: Container,
b2023ab54ba1434d6359aebec6f30375: List,
};
module.exports = runtime;