ceylonEnter.addOutputModuleToClassPath(pkg.getModule());
}
return;
}
String pkgName = pkg.getQualifiedNameString();
Module module = null;
// do we have a module for this package?
// FIXME: is this true? what if we have a module.ceylon at toplevel?
if(pkgName.isEmpty())
module = modules.getDefaultModule();
else{
for(Module m : modulesLoadedFromSource){
if(Util.isSubPackage(m.getNameAsString(), pkgName)){
module = m;
break;
}
}
if(module == null){
module = loadModuleFromSource(pkgName, moduleTrees, parsedTrees);
}
else if (! module.isAvailable()) {
loadModuleFromSource(pkgName, moduleTrees, parsedTrees);
}
if(module == null){
// no declaration for it, must be the default module, unless we're bootstrapping the language module,
// because we have some com.redhat.ceylon packages that must go in the language module
if(isBootstrap)
module = modules.getLanguageModule();
else
module = modules.getDefaultModule();
}
}
// bind module and package together
pkg.setModule(module);
if (!module.getPackages().contains(pkg)) {
module.getPackages().add(pkg);
}
// automatically add this module's jar to the classpath if it exists
ceylonEnter.addOutputModuleToClassPath(module);
}