diff --git a/whalesong/js-assembler/assemble-perform-statement.rkt b/whalesong/js-assembler/assemble-perform-statement.rkt index 4d6efa9..ba06cec 100644 --- a/whalesong/js-assembler/assemble-perform-statement.rkt +++ b/whalesong/js-assembler/assemble-perform-statement.rkt @@ -186,7 +186,7 @@ [(AliasModuleAsMain!? op) - (format "M.mainModules.push(M.modules[~s]);" + (format "M.mainModules.push(~s);" (symbol->string (ModuleLocator-name (AliasModuleAsMain!-from op))))] [(FinalizeModuleInvokation!? op) diff --git a/whalesong/js-assembler/runtime-src/runtime.js b/whalesong/js-assembler/runtime-src/runtime.js index 384f599..2624100 100644 --- a/whalesong/js-assembler/runtime-src/runtime.js +++ b/whalesong/js-assembler/runtime-src/runtime.js @@ -823,8 +823,9 @@ var mainModules = machine.mainModules.slice(); var loop = function() { if (mainModules.length > 0) { - var nextModule = mainModules.shift(); - nextModule.invoke(machine, loop, fail); + var nextModuleName = mainModules.shift(); + machine.modules[nextModuleName] = machine.installedModules[nextModuleName](); + machine.modules[nextModuleName].invoke(machine, loop, fail); } else { setReadyTrue(); succ(); @@ -839,7 +840,7 @@ var i; machine = machine || runtime.currentMachine; for (i = 0; i < machine.mainModules.length; i++) { - var ns = machine.mainModules[i].getExports(); + var ns = machine.modules[mainModules[i]].getExternalExports(); if(ns.hasKey(name)) { return ns.get(name); }