From 8b7f58976b32ccc768e35151b77aa9ea004b7495 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Sun, 2 Jun 2019 20:15:10 +0300 Subject: don't cache parses twice Before this commit, `Parse`s for original file ended up two times in salsa's db: first, when we parse original file, and second, when we parse macro or a file. Given that parse trees are the worst ofenders in terms of memory, it makes sense to make sure we store them only once. --- crates/ra_hir/src/db.rs | 3 +++ 1 file changed, 3 insertions(+) (limited to 'crates/ra_hir/src/db.rs') diff --git a/crates/ra_hir/src/db.rs b/crates/ra_hir/src/db.rs index 872103219..3afd0994c 100644 --- a/crates/ra_hir/src/db.rs +++ b/crates/ra_hir/src/db.rs @@ -33,8 +33,11 @@ pub trait AstDatabase: SourceDatabase { #[salsa::transparent] #[salsa::invoke(crate::source_id::AstIdMap::file_item_query)] fn ast_id_to_node(&self, file_id: HirFileId, ast_id: ErasedFileAstId) -> TreeArc; + #[salsa::transparent] #[salsa::invoke(crate::ids::HirFileId::parse_or_expand_query)] fn parse_or_expand(&self, file_id: HirFileId) -> Option>; + #[salsa::invoke(crate::ids::HirFileId::parse_macro_query)] + fn parse_macro(&self, macro_file: ids::MacroFile) -> Option>; #[salsa::invoke(crate::ids::macro_def_query)] fn macro_def(&self, macro_id: MacroDefId) -> Option>; -- cgit v1.2.3