diff options
author | bors[bot] <bors[bot]@users.noreply.github.com> | 2019-05-04 09:54:07 +0100 |
---|---|---|
committer | bors[bot] <bors[bot]@users.noreply.github.com> | 2019-05-04 09:54:07 +0100 |
commit | 8ee8542de23253ec29f1b817aeb975313875885d (patch) | |
tree | d72726979063b4856cd328e34c36a1e26e6ed944 | |
parent | 11cc8024a1897a0c844a1f7aca4b20ee34b95b50 (diff) | |
parent | 6c63a59425e256ce46d058807b64149297231982 (diff) |
Merge #1231
1231: eagarly clean astd maps r=matklad a=matklad
Co-authored-by: Aleksey Kladov <[email protected]>
-rw-r--r-- | crates/ra_hir/src/db.rs | 2 | ||||
-rw-r--r-- | crates/ra_hir/src/source_id.rs | 2 | ||||
-rw-r--r-- | crates/ra_ide_api/src/change.rs | 6 | ||||
-rw-r--r-- | crates/ra_syntax/src/grammar.ron | 2 |
4 files changed, 9 insertions, 3 deletions
diff --git a/crates/ra_hir/src/db.rs b/crates/ra_hir/src/db.rs index 8af0a3176..3ac3c79a3 100644 --- a/crates/ra_hir/src/db.rs +++ b/crates/ra_hir/src/db.rs | |||
@@ -60,7 +60,7 @@ pub trait DefDatabase: SourceDatabase { | |||
60 | #[salsa::invoke(crate::source_id::AstIdMap::ast_id_map_query)] | 60 | #[salsa::invoke(crate::source_id::AstIdMap::ast_id_map_query)] |
61 | fn ast_id_map(&self, file_id: HirFileId) -> Arc<AstIdMap>; | 61 | fn ast_id_map(&self, file_id: HirFileId) -> Arc<AstIdMap>; |
62 | 62 | ||
63 | #[salsa::invoke(crate::source_id::AstIdMap::file_item_query)] | 63 | #[salsa::invoke(crate::source_id::AstIdMap::ast_id_to_node_query)] |
64 | fn ast_id_to_node(&self, file_id: HirFileId, ast_id: ErasedFileAstId) -> TreeArc<SyntaxNode>; | 64 | fn ast_id_to_node(&self, file_id: HirFileId, ast_id: ErasedFileAstId) -> TreeArc<SyntaxNode>; |
65 | 65 | ||
66 | #[salsa::invoke(RawItems::raw_items_query)] | 66 | #[salsa::invoke(RawItems::raw_items_query)] |
diff --git a/crates/ra_hir/src/source_id.rs b/crates/ra_hir/src/source_id.rs index 0a8fb6d32..a2bc9a799 100644 --- a/crates/ra_hir/src/source_id.rs +++ b/crates/ra_hir/src/source_id.rs | |||
@@ -92,7 +92,7 @@ impl AstIdMap { | |||
92 | Arc::new(AstIdMap::from_source_file(&source_file)) | 92 | Arc::new(AstIdMap::from_source_file(&source_file)) |
93 | } | 93 | } |
94 | 94 | ||
95 | pub(crate) fn file_item_query( | 95 | pub(crate) fn ast_id_to_node_query( |
96 | db: &impl DefDatabase, | 96 | db: &impl DefDatabase, |
97 | file_id: HirFileId, | 97 | file_id: HirFileId, |
98 | ast_id: ErasedFileAstId, | 98 | ast_id: ErasedFileAstId, |
diff --git a/crates/ra_ide_api/src/change.rs b/crates/ra_ide_api/src/change.rs index 5bfdbe7e9..16b9ef3d5 100644 --- a/crates/ra_ide_api/src/change.rs +++ b/crates/ra_ide_api/src/change.rs | |||
@@ -186,6 +186,7 @@ impl RootDatabase { | |||
186 | if let Some(crate_graph) = change.crate_graph { | 186 | if let Some(crate_graph) = change.crate_graph { |
187 | self.set_crate_graph(Arc::new(crate_graph)) | 187 | self.set_crate_graph(Arc::new(crate_graph)) |
188 | } | 188 | } |
189 | self.collect_after_change() | ||
189 | } | 190 | } |
190 | 191 | ||
191 | fn apply_root_change(&mut self, root_id: SourceRootId, root_change: RootChange) { | 192 | fn apply_root_change(&mut self, root_id: SourceRootId, root_change: RootChange) { |
@@ -228,4 +229,9 @@ impl RootDatabase { | |||
228 | self.query(hir::db::RawItemsWithSourceMapQuery).sweep(sweep); | 229 | self.query(hir::db::RawItemsWithSourceMapQuery).sweep(sweep); |
229 | self.query(hir::db::BodyWithSourceMapQuery).sweep(sweep); | 230 | self.query(hir::db::BodyWithSourceMapQuery).sweep(sweep); |
230 | } | 231 | } |
232 | |||
233 | pub(crate) fn collect_after_change(&mut self) { | ||
234 | let sweep = SweepStrategy::default().discard_everything().sweep_all_revisions(); | ||
235 | self.query(hir::db::AstIdToNodeQuery).sweep(sweep) | ||
236 | } | ||
231 | } | 237 | } |
diff --git a/crates/ra_syntax/src/grammar.ron b/crates/ra_syntax/src/grammar.ron index 011ef0616..cae5d8774 100644 --- a/crates/ra_syntax/src/grammar.ron +++ b/crates/ra_syntax/src/grammar.ron | |||
@@ -674,7 +674,7 @@ Grammar( | |||
674 | "LifetimeArg": (), | 674 | "LifetimeArg": (), |
675 | 675 | ||
676 | "MacroItems": ( | 676 | "MacroItems": ( |
677 | traits: [ "ModuleItemOwner", "FnDefOwner" ], | 677 | traits: [ "ModuleItemOwner", "FnDefOwner" ], |
678 | ), | 678 | ), |
679 | 679 | ||
680 | "MacroStmts" : ( | 680 | "MacroStmts" : ( |