fix tests, sprinkle more async/await (#809)

This commit is contained in:
jberg 2019-07-14 15:25:40 -07:00 committed by Jordan Eldredge
parent ea7b2d7670
commit 7ba86cf584
2 changed files with 6 additions and 6 deletions

View file

@ -3,7 +3,7 @@ const { getClass, getFormattedId } = require("./objects");
const interpret = require("./virtualMachine");
const { printCommand } = require("./prettyPrinter");
function main({ runtime, data, system, log, logger }) {
async function main({ runtime, data, system, log, logger }) {
const program = parse(data);
// Replace class hashes with actual JavaScript classes from the runtime
@ -29,8 +29,8 @@ function main({ runtime, data, system, log, logger }) {
// const logger = log ? printCommand : logger;
// TODO: Handle disposing of this.
// TODO: Handle passing in variables.
variable.hook(method.name, () => {
interpret(commandOffset, program, [], { logger });
variable.hook(method.name, async () => {
await interpret(commandOffset, program, [], { logger });
});
});
@ -42,7 +42,7 @@ function main({ runtime, data, system, log, logger }) {
// Set the System global
// TODO: We could confirm that this variable has the "system" flag set.
program.variables[0].setValue(system);
system.js_start();
await system.js_start();
}
module.exports = main;

View file

@ -12,8 +12,8 @@ class System extends MakiObject {
return "System";
}
js_start() {
this.js_trigger("onScriptLoaded");
async js_start() {
await this.js_trigger("onScriptLoaded");
}
getScriptGroup() {