Rename/cleanups

This commit is contained in:
Jacob Dufault 2017-08-15 22:45:42 -07:00
parent 7901653698
commit d5bdf8ce0a

View File

@ -818,7 +818,7 @@ struct IndexManager {
//} // namespace //} // namespace
enum class FileParseState { enum class FileParseQuery {
NeedsParse, NeedsParse,
DoesNotNeedParse, DoesNotNeedParse,
BadFile BadFile
@ -840,29 +840,27 @@ std::vector<Index_DoIdMap> DoParseFile(
auto file_needs_parse = [&](const std::string& path) { auto file_needs_parse = [&](const std::string& path) {
optional<int64_t> modification_timestamp = GetLastModificationTime(path); optional<int64_t> modification_timestamp = GetLastModificationTime(path);
if (!modification_timestamp) if (!modification_timestamp)
return FileParseState::BadFile; return FileParseQuery::BadFile;
optional<int64_t> last_cached_modification = timestamp_manager->GetLastCachedModificationTime(cache_loader, path); optional<int64_t> last_cached_modification = timestamp_manager->GetLastCachedModificationTime(cache_loader, path);
if (!last_cached_modification || modification_timestamp != *last_cached_modification) { if (!last_cached_modification || modification_timestamp != *last_cached_modification) {
file_consumer_shared->Reset(path); file_consumer_shared->Reset(path);
return FileParseState::NeedsParse; return FileParseQuery::NeedsParse;
} }
return FileParseState::DoesNotNeedParse; return FileParseQuery::DoesNotNeedParse;
}; };
// Check timestamps and update |file_consumer_shared|. // Check timestamps and update |file_consumer_shared|.
bool needs_reparse = false; FileParseQuery path_state = file_needs_parse(path);
FileParseState path_state = file_needs_parse(path); if (path_state == FileParseQuery::BadFile)
if (path_state == FileParseState::BadFile)
return result; return result;
if (path_state == FileParseState::NeedsParse) bool needs_reparse = path_state == FileParseQuery::NeedsParse;
needs_reparse = true;
for (const std::string& dependency : previous_index->dependencies) { for (const std::string& dependency : previous_index->dependencies) {
assert(!dependency.empty()); assert(!dependency.empty());
if (file_needs_parse(dependency) == FileParseState::NeedsParse) { if (file_needs_parse(dependency) == FileParseQuery::NeedsParse) {
LOG_S(INFO) << "Timestamp has changed for " << dependency; LOG_S(INFO) << "Timestamp has changed for " << dependency;
needs_reparse = true; needs_reparse = true;
// SUBTLE: Do not break here, as |file_consumer_shared| is updated // SUBTLE: Do not break here, as |file_consumer_shared| is updated