Skip to content

Commit

Permalink
Be more conservative about invalidating
Browse files Browse the repository at this point in the history
  • Loading branch information
muglug committed Jul 24, 2024
1 parent 618fdca commit d903176
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions src/file_scanner_analyzer/unused_symbols.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,22 @@ pub(crate) fn find_unused_definitions(
// don’t show unused definitions if we have any invalid Hack files
if analysis_result.has_invalid_hack_files {
for file_path in &analysis_result.changed_during_analysis_files {
file_system.file_hashes_and_times.remove(file_path);
codebase.files.remove(file_path);
if let Some(file_system_info) = file_system.file_hashes_and_times.get_mut(file_path) {
// reset the file info so the AST gets recomputed
*file_system_info = (0, 0);
}

if let Some(file_info) = codebase.files.get_mut(file_path) {
for node in file_info.ast_nodes.iter_mut() {
if node.children.is_empty() {
node.body_hash = None;
} else {
for node_child in node.children.iter_mut() {
node_child.body_hash = None;
}
}
}
}
}
return;
}
Expand Down

0 comments on commit d903176

Please sign in to comment.