return resolveInFilesystem(s);
}
private NType resolveInFilesystem(Scope s) throws Exception {
NModuleType start = getStartModule(s);
if (start == null) {
reportUnresolvedModule();
return getType();
}
String qname = start.getTable().getPath();
String relQname;
if (isDot()) {
relQname = Util.getQnameParent(qname);
} else if (!isTop()) {
relQname = qname + "." + name.id;
} else {
// top name: first look in current dir, then sys.path
String dirQname = isInitPy() ? qname : Util.getQnameParent(qname);
relQname = dirQname + "." + name.id;
if (Indexer.idx.loadModule(relQname) == null) {
relQname = name.id;
}
}
NModuleType mod = Indexer.idx.loadModule(relQname);
if (mod == null) {
reportUnresolvedModule();
return getType();
}
setType(name.setType(mod));
if (!isTop() && mod.getFile() != null) {
Scope parentPkg = getPrevious().getTable();
NBinding mb = Indexer.idx.moduleTable.lookup(mod.getFile());
parentPkg.put(name.id, mb);
}
resolveExpr(next, s);
return getType();