unsigned TypeResolver::checkUnresolvedType(const UnresolvedType* type, bool used_public) { IdentifierExpr* moduleName = type->getModuleName(); IdentifierExpr* typeName = type->getTypeName(); SourceLocation tLoc = typeName->getLocation(); const std::string& tName = typeName->getName(); Decl* D = 0; if (moduleName) { // mod.type const std::string& mName = moduleName->getName(); const Module* mod = globals.findUsedModule(mName, moduleName->getLocation(), used_public); if (!mod) return 1; Decl* modDecl = globals.findSymbol(mName, moduleName->getLocation(), true, used_public); assert(modDecl); moduleName->setDecl(modDecl); D = globals.findSymbolInModule(tName, tLoc, mod); } else { D = globals.findSymbol(tName, tLoc, true, used_public); } if (!D) return 1; TypeDecl* TD = dyncast<TypeDecl>(D); if (!TD) { StringBuilder name; type->printLiteral(name); Diags.Report(tLoc, diag::err_not_a_typename) << name.c_str(); return 1; } bool external = globals.isExternal(D->getModule()); if (used_public &&!external && !TD->isPublic()) { StringBuilder name; type->printLiteral(name); Diags.Report(tLoc, diag::err_non_public_type) << AnalyserUtils::fullName(TD->getModule()->getName(), TD->getName()); //Diags.Report(tLoc, diag::err_non_public_type) << name; return 1; } D->setUsed(); if (used_public || external) D->setUsedPublic(); typeName->setDecl(TD); return 0; }