From 5fbb97a0f0b78edd8f602e46c6a336b5a1aac7ae Mon Sep 17 00:00:00 2001 From: Jonas Schievink Date: Sat, 13 Mar 2021 02:24:26 +0100 Subject: Rename `item_tree` query to `file_item_tree` --- crates/hir_def/src/data.rs | 4 ++-- crates/hir_def/src/db.rs | 4 ++-- crates/hir_def/src/item_tree.rs | 4 ++-- crates/hir_def/src/nameres.rs | 2 +- crates/hir_def/src/nameres/collector.rs | 8 ++++---- 5 files changed, 11 insertions(+), 11 deletions(-) (limited to 'crates/hir_def/src') diff --git a/crates/hir_def/src/data.rs b/crates/hir_def/src/data.rs index f1772ea3d..0be868ba2 100644 --- a/crates/hir_def/src/data.rs +++ b/crates/hir_def/src/data.rs @@ -251,7 +251,7 @@ fn collect_items( return Vec::new(); } - let item_tree = db.item_tree(file_id); + let item_tree = db.file_item_tree(file_id); let crate_graph = db.crate_graph(); let cfg_options = &crate_graph[module.krate].cfg_options; @@ -292,7 +292,7 @@ fn collect_items( if let Ok(res) = res { if let Some((mark, mac)) = res.value { let src: InFile = expander.to_source(mac); - let item_tree = db.item_tree(src.file_id); + let item_tree = db.file_item_tree(src.file_id); let iter = item_tree.top_level_items().iter().filter_map(ModItem::as_assoc_item); items.extend(collect_items( diff --git a/crates/hir_def/src/db.rs b/crates/hir_def/src/db.rs index cca5a086b..276caf5b3 100644 --- a/crates/hir_def/src/db.rs +++ b/crates/hir_def/src/db.rs @@ -48,8 +48,8 @@ pub trait InternDatabase: SourceDatabase { #[salsa::query_group(DefDatabaseStorage)] pub trait DefDatabase: InternDatabase + AstDatabase + Upcast { - #[salsa::invoke(ItemTree::item_tree_query)] - fn item_tree(&self, file_id: HirFileId) -> Arc; + #[salsa::invoke(ItemTree::file_item_tree_query)] + fn file_item_tree(&self, file_id: HirFileId) -> Arc; #[salsa::invoke(crate_def_map_wait)] #[salsa::transparent] diff --git a/crates/hir_def/src/item_tree.rs b/crates/hir_def/src/item_tree.rs index 8383780e0..5f5b7151a 100644 --- a/crates/hir_def/src/item_tree.rs +++ b/crates/hir_def/src/item_tree.rs @@ -76,7 +76,7 @@ pub struct ItemTree { } impl ItemTree { - pub(crate) fn item_tree_query(db: &dyn DefDatabase, file_id: HirFileId) -> Arc { + pub(crate) fn file_item_tree_query(db: &dyn DefDatabase, file_id: HirFileId) -> Arc { let _p = profile::span("item_tree_query").detail(|| format!("{:?}", file_id)); let syntax = if let Some(node) = db.parse_or_expand(file_id) { if node.kind() == SyntaxKind::ERROR { @@ -417,7 +417,7 @@ impl ItemTreeId { } pub fn item_tree(self, db: &dyn DefDatabase) -> Arc { - db.item_tree(self.file) + db.file_item_tree(self.file) } } diff --git a/crates/hir_def/src/nameres.rs b/crates/hir_def/src/nameres.rs index 003d668ca..c97be584e 100644 --- a/crates/hir_def/src/nameres.rs +++ b/crates/hir_def/src/nameres.rs @@ -213,7 +213,7 @@ impl DefMap { ) -> Option> { let block: BlockLoc = db.lookup_intern_block(block_id); - let item_tree = db.item_tree(block.ast_id.file_id); + let item_tree = db.file_item_tree(block.ast_id.file_id); if item_tree.inner_items_of_block(block.ast_id.value).is_empty() { return None; } diff --git a/crates/hir_def/src/nameres/collector.rs b/crates/hir_def/src/nameres/collector.rs index 7ca4299b9..d0fefb5af 100644 --- a/crates/hir_def/src/nameres/collector.rs +++ b/crates/hir_def/src/nameres/collector.rs @@ -242,7 +242,7 @@ struct DefCollector<'a> { impl DefCollector<'_> { fn seed_with_top_level(&mut self) { let file_id = self.db.crate_graph()[self.def_map.krate].root_file_id; - let item_tree = self.db.item_tree(file_id.into()); + let item_tree = self.db.file_item_tree(file_id.into()); let module_id = self.def_map.root; self.def_map.modules[module_id].origin = ModuleOrigin::CrateRoot { definition: file_id }; if item_tree @@ -263,7 +263,7 @@ impl DefCollector<'_> { } fn seed_with_inner(&mut self, block: AstId) { - let item_tree = self.db.item_tree(block.file_id); + let item_tree = self.db.file_item_tree(block.file_id); let module_id = self.def_map.root; self.def_map.modules[module_id].origin = ModuleOrigin::BlockExpr { block }; if item_tree @@ -895,7 +895,7 @@ impl DefCollector<'_> { } // Then, fetch and process the item tree. This will reuse the expansion result from above. - let item_tree = self.db.item_tree(file_id); + let item_tree = self.db.file_item_tree(file_id); let mod_dir = self.mod_dirs[&module_id].clone(); ModCollector { def_collector: &mut *self, @@ -1299,7 +1299,7 @@ impl ModCollector<'_, '_> { Some((file_id, is_mod_rs)), &self.item_tree[module.visibility], ); - let item_tree = db.item_tree(file_id.into()); + let item_tree = db.file_item_tree(file_id.into()); ModCollector { def_collector: &mut *self.def_collector, macro_depth: self.macro_depth, -- cgit v1.2.3