| 84 | } |
| 85 | |
| 86 | bool PythonAPICache::checkCacheIsValid( |
| 87 | PathId cacheFileId, const ::PythonAPICache::Reader& root) const { |
| 88 | FileSystem* const fileSystem = FileSystem::getInstance(); |
| 89 | const ::Header::Reader& sourceHeader = root.getHeader(); |
| 90 | |
| 91 | SymbolTable* const targetSymbols = |
| 92 | m_listener->getCompileSourceFile()->getSymbolTable(); |
| 93 | |
| 94 | const std::string scriptFile(root.getScriptFile().cStr()); |
| 95 | const PathId scriptFileId = |
| 96 | fileSystem->toPathId(fileSystem->remap(scriptFile), targetSymbols); |
| 97 | |
| 98 | std::filesystem::file_time_type ct = fileSystem->modtime(cacheFileId); |
| 99 | std::filesystem::file_time_type ft = fileSystem->modtime(scriptFileId); |
| 100 | |
| 101 | if (ft == std::filesystem::file_time_type::min()) { |
| 102 | return false; |
| 103 | } |
| 104 | if (ct == std::filesystem::file_time_type::min()) { |
| 105 | return false; |
| 106 | } |
| 107 | if (ct < ft) { |
| 108 | return false; |
| 109 | } |
| 110 | |
| 111 | return checkIfCacheIsValid(sourceHeader, kSchemaVersion, cacheFileId, |
| 112 | m_listener->getParseFile()->getFileId(LINE1)); |
| 113 | } |
| 114 | |
| 115 | bool PythonAPICache::checkCacheIsValid(PathId cacheFileId) const { |
| 116 | if (!cacheFileId) return false; |
nothing calls this directly
no test coverage detected