| 294 | string getDasRoot ( void ); |
| 295 | |
| 296 | bool getPrerequisits ( const string & fileName, |
| 297 | const FileAccessPtr & access, |
| 298 | string &modName, |
| 299 | vector<ModuleInfo> & req, |
| 300 | vector<MissingRecord> & missing, |
| 301 | vector<RequireRecord> & circular, |
| 302 | vector<RequireRecord> & notAllowed, |
| 303 | vector<FileInfo *> & chain, |
| 304 | das_set<string> & dependencies, |
| 305 | das_hash_map<string, NamelessModuleReq> & namelessReq, |
| 306 | vector<NamelessMismatch> & namelessMismatches, |
| 307 | ModuleGroup & libGroup, |
| 308 | TextWriter * log, |
| 309 | int tab, |
| 310 | bool allowPromoted, |
| 311 | const string & reqNameHint, |
| 312 | int32_t reqLineHint ) { |
| 313 | if ( auto fi = access->getFileInfo(fileName) ) { |
| 314 | ChainGuard guard(chain,fi); |
| 315 | if ( log ) { |
| 316 | *log << string(tab,'\t') << "in " << fileName << "\n"; |
| 317 | } |
| 318 | vector<RequireRecord> ownReq = getAllRequire(fi, modName, chain, access); |
| 319 | for ( auto & modRec : ownReq ) { |
| 320 | string mod = modRec.name; |
| 321 | if ( log ) { |
| 322 | *log << string(tab,'\t') << "require " << mod << "\n"; |
| 323 | } |
| 324 | if ( !access->canBeRequired(mod, fileName, modRec.isPublic) ) |
| 325 | { |
| 326 | notAllowed.push_back({mod, modRec.line, chain, modRec.isPublic}); |
| 327 | if ( log ) { |
| 328 | *log << string(tab,'\t') << "from " << fileName << " require " << mod << " - CAN'T BE REQUIRED\n"; |
| 329 | } |
| 330 | return false; |
| 331 | } |
| 332 | auto info = access->getModuleInfo(mod, fileName); |
| 333 | auto module = Module::requireEx(mod, allowPromoted, info.fileName); |
| 334 | if ( !module ) { |
| 335 | if ( !info.moduleName.empty() ) { |
| 336 | mod = info.moduleName; |
| 337 | if ( log ) { |
| 338 | *log << string(tab,'\t') << " resolved as " << mod << "\n"; |
| 339 | } |
| 340 | } |
| 341 | module = Module::requireEx(mod, allowPromoted, info.fileName); // try native with that name AGAIN (promoted?) |
| 342 | if ( !module ) { |
| 343 | auto it_r = find_if(req.begin(), req.end(), [&] ( const ModuleInfo & reqM ) { |
| 344 | return reqM.moduleName == mod; |
| 345 | }); |
| 346 | if ( it_r==req.end() ) { |
| 347 | if ( dependencies.find(mod) != dependencies.end() ) { |
| 348 | // circular dependency |
| 349 | if ( log ) { |
| 350 | *log << string(tab,'\t') << "from " << fileName << " require " << modRec.name << " - CIRCULAR DEPENDENCY\n"; |
| 351 | } |
| 352 | circular.push_back({modRec.name, modRec.line, chain, modRec.isPublic}); |
| 353 | return false; |
no test coverage detected