fixing issues with main modules.

This commit is contained in:
Danny Yoo 2013-03-27 16:05:06 -06:00
parent f2c2b540fd
commit 569058c2f2
2 changed files with 5 additions and 4 deletions

View File

@ -186,7 +186,7 @@
[(AliasModuleAsMain!? op) [(AliasModuleAsMain!? op)
(format "M.mainModules.push(M.modules[~s]);" (format "M.mainModules.push(~s);"
(symbol->string (ModuleLocator-name (AliasModuleAsMain!-from op))))] (symbol->string (ModuleLocator-name (AliasModuleAsMain!-from op))))]
[(FinalizeModuleInvokation!? op) [(FinalizeModuleInvokation!? op)

View File

@ -823,8 +823,9 @@
var mainModules = machine.mainModules.slice(); var mainModules = machine.mainModules.slice();
var loop = function() { var loop = function() {
if (mainModules.length > 0) { if (mainModules.length > 0) {
var nextModule = mainModules.shift(); var nextModuleName = mainModules.shift();
nextModule.invoke(machine, loop, fail); machine.modules[nextModuleName] = machine.installedModules[nextModuleName]();
machine.modules[nextModuleName].invoke(machine, loop, fail);
} else { } else {
setReadyTrue(); setReadyTrue();
succ(); succ();
@ -839,7 +840,7 @@
var i; var i;
machine = machine || runtime.currentMachine; machine = machine || runtime.currentMachine;
for (i = 0; i < machine.mainModules.length; i++) { 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)) { if(ns.hasKey(name)) {
return ns.get(name); return ns.get(name);
} }