diff options
-rw-r--r-- | crates/ra_hir/src/db.rs | 4 | ||||
-rw-r--r-- | crates/ra_hir/src/impl_block.rs | 9 | ||||
-rw-r--r-- | crates/ra_ide_api/src/change.rs | 2 | ||||
-rw-r--r-- | crates/ra_ide_api/src/status.rs | 15 |
4 files changed, 11 insertions, 19 deletions
diff --git a/crates/ra_hir/src/db.rs b/crates/ra_hir/src/db.rs index d84e1598b..e8b4f0ddc 100644 --- a/crates/ra_hir/src/db.rs +++ b/crates/ra_hir/src/db.rs | |||
@@ -74,6 +74,7 @@ pub trait DefDatabase: SourceDatabase { | |||
74 | fn ast_id_map(&self, file_id: HirFileId) -> Arc<AstIdMap>; | 74 | fn ast_id_map(&self, file_id: HirFileId) -> Arc<AstIdMap>; |
75 | 75 | ||
76 | #[salsa::invoke(crate::source_id::AstIdMap::file_item_query)] | 76 | #[salsa::invoke(crate::source_id::AstIdMap::file_item_query)] |
77 | #[salsa::transparent] | ||
77 | fn ast_id_to_node(&self, file_id: HirFileId, ast_id: ErasedFileAstId) -> TreeArc<SyntaxNode>; | 78 | fn ast_id_to_node(&self, file_id: HirFileId, ast_id: ErasedFileAstId) -> TreeArc<SyntaxNode>; |
78 | 79 | ||
79 | #[salsa::invoke(RawItems::raw_items_query)] | 80 | #[salsa::invoke(RawItems::raw_items_query)] |
@@ -91,9 +92,6 @@ pub trait DefDatabase: SourceDatabase { | |||
91 | #[salsa::invoke(crate::impl_block::impls_in_module)] | 92 | #[salsa::invoke(crate::impl_block::impls_in_module)] |
92 | fn impls_in_module(&self, module: Module) -> Arc<ModuleImplBlocks>; | 93 | fn impls_in_module(&self, module: Module) -> Arc<ModuleImplBlocks>; |
93 | 94 | ||
94 | #[salsa::invoke(crate::impl_block::impls_in_module_source_map_query)] | ||
95 | fn impls_in_module_source_map(&self, module: Module) -> Arc<ImplSourceMap>; | ||
96 | |||
97 | #[salsa::invoke(crate::impl_block::impls_in_module_with_source_map_query)] | 95 | #[salsa::invoke(crate::impl_block::impls_in_module_with_source_map_query)] |
98 | fn impls_in_module_with_source_map( | 96 | fn impls_in_module_with_source_map( |
99 | &self, | 97 | &self, |
diff --git a/crates/ra_hir/src/impl_block.rs b/crates/ra_hir/src/impl_block.rs index 637f6ab83..072670444 100644 --- a/crates/ra_hir/src/impl_block.rs +++ b/crates/ra_hir/src/impl_block.rs | |||
@@ -59,7 +59,7 @@ impl ImplBlock { | |||
59 | 59 | ||
60 | /// Returns the syntax of the impl block | 60 | /// Returns the syntax of the impl block |
61 | pub fn source(&self, db: &impl DefDatabase) -> (HirFileId, TreeArc<ast::ImplBlock>) { | 61 | pub fn source(&self, db: &impl DefDatabase) -> (HirFileId, TreeArc<ast::ImplBlock>) { |
62 | let source_map = db.impls_in_module_source_map(self.module); | 62 | let source_map = db.impls_in_module_with_source_map(self.module).1; |
63 | let (file_id, source) = self.module.definition_source(db); | 63 | let (file_id, source) = self.module.definition_source(db); |
64 | (file_id, source_map.get(&source, self.impl_id)) | 64 | (file_id, source_map.get(&source, self.impl_id)) |
65 | } | 65 | } |
@@ -231,10 +231,3 @@ pub(crate) fn impls_in_module_with_source_map_query( | |||
231 | pub(crate) fn impls_in_module(db: &impl DefDatabase, module: Module) -> Arc<ModuleImplBlocks> { | 231 | pub(crate) fn impls_in_module(db: &impl DefDatabase, module: Module) -> Arc<ModuleImplBlocks> { |
232 | db.impls_in_module_with_source_map(module).0 | 232 | db.impls_in_module_with_source_map(module).0 |
233 | } | 233 | } |
234 | |||
235 | pub(crate) fn impls_in_module_source_map_query( | ||
236 | db: &impl DefDatabase, | ||
237 | module: Module, | ||
238 | ) -> Arc<ImplSourceMap> { | ||
239 | db.impls_in_module_with_source_map(module).1 | ||
240 | } | ||
diff --git a/crates/ra_ide_api/src/change.rs b/crates/ra_ide_api/src/change.rs index 4b597afc0..445a94aa8 100644 --- a/crates/ra_ide_api/src/change.rs +++ b/crates/ra_ide_api/src/change.rs | |||
@@ -228,9 +228,9 @@ impl RootDatabase { | |||
228 | 228 | ||
229 | self.query(hir::db::ParseOrExpandQuery).sweep(sweep); | 229 | self.query(hir::db::ParseOrExpandQuery).sweep(sweep); |
230 | self.query(hir::db::AstIdMapQuery).sweep(sweep); | 230 | self.query(hir::db::AstIdMapQuery).sweep(sweep); |
231 | self.query(hir::db::AstIdToNodeQuery).sweep(sweep); | ||
232 | 231 | ||
233 | self.query(hir::db::RawItemsWithSourceMapQuery).sweep(sweep); | 232 | self.query(hir::db::RawItemsWithSourceMapQuery).sweep(sweep); |
233 | self.query(hir::db::ImplsInModuleWithSourceMapQuery).sweep(sweep); | ||
234 | self.query(hir::db::BodyWithSourceMapQuery).sweep(sweep); | 234 | self.query(hir::db::BodyWithSourceMapQuery).sweep(sweep); |
235 | } | 235 | } |
236 | } | 236 | } |
diff --git a/crates/ra_ide_api/src/status.rs b/crates/ra_ide_api/src/status.rs index 821106fea..822279812 100644 --- a/crates/ra_ide_api/src/status.rs +++ b/crates/ra_ide_api/src/status.rs | |||
@@ -4,11 +4,12 @@ use std::{ | |||
4 | sync::Arc, | 4 | sync::Arc, |
5 | }; | 5 | }; |
6 | 6 | ||
7 | use ra_syntax::{AstNode, Parse}; | 7 | use ra_syntax::{TreeArc, SyntaxNode}; |
8 | use ra_db::{ | 8 | use ra_db::{ |
9 | ParseQuery, FileTextQuery, SourceRootId, | 9 | FileTextQuery, SourceRootId, |
10 | salsa::{Database, debug::{DebugQueryTable, TableEntry}}, | 10 | salsa::{Database, debug::{DebugQueryTable, TableEntry}}, |
11 | }; | 11 | }; |
12 | use hir::HirFileId; | ||
12 | 13 | ||
13 | use crate::{ | 14 | use crate::{ |
14 | FileId, db::RootDatabase, | 15 | FileId, db::RootDatabase, |
@@ -16,7 +17,7 @@ use crate::{ | |||
16 | }; | 17 | }; |
17 | 18 | ||
18 | pub(crate) fn syntax_tree_stats(db: &RootDatabase) -> SyntaxTreeStats { | 19 | pub(crate) fn syntax_tree_stats(db: &RootDatabase) -> SyntaxTreeStats { |
19 | db.query(ParseQuery).entries::<SyntaxTreeStats>() | 20 | db.query(hir::db::ParseOrExpandQuery).entries::<SyntaxTreeStats>() |
20 | } | 21 | } |
21 | 22 | ||
22 | pub(crate) fn status(db: &RootDatabase) -> String { | 23 | pub(crate) fn status(db: &RootDatabase) -> String { |
@@ -72,17 +73,17 @@ impl fmt::Display for SyntaxTreeStats { | |||
72 | } | 73 | } |
73 | } | 74 | } |
74 | 75 | ||
75 | impl FromIterator<TableEntry<FileId, Parse>> for SyntaxTreeStats { | 76 | impl FromIterator<TableEntry<HirFileId, Option<TreeArc<SyntaxNode>>>> for SyntaxTreeStats { |
76 | fn from_iter<T>(iter: T) -> SyntaxTreeStats | 77 | fn from_iter<T>(iter: T) -> SyntaxTreeStats |
77 | where | 78 | where |
78 | T: IntoIterator<Item = TableEntry<FileId, Parse>>, | 79 | T: IntoIterator<Item = TableEntry<HirFileId, Option<TreeArc<SyntaxNode>>>>, |
79 | { | 80 | { |
80 | let mut res = SyntaxTreeStats::default(); | 81 | let mut res = SyntaxTreeStats::default(); |
81 | for entry in iter { | 82 | for entry in iter { |
82 | res.total += 1; | 83 | res.total += 1; |
83 | if let Some(value) = entry.value { | 84 | if let Some(tree) = entry.value.and_then(|it| it) { |
84 | res.retained += 1; | 85 | res.retained += 1; |
85 | res.retained_size += value.tree.syntax().memory_size_of_subtree(); | 86 | res.retained_size += tree.memory_size_of_subtree(); |
86 | } | 87 | } |
87 | } | 88 | } |
88 | res | 89 | res |