From 9559bce311c3b6b7009b9cd09e52c75497c87035 Mon Sep 17 00:00:00 2001 From: Jonas Schievink Date: Tue, 24 Nov 2020 21:57:51 +0100 Subject: Rename `parse_macro` to `parse_macro_expansion` This does not parse macros, it expands a macro and parses the *result* --- crates/hir/src/db.rs | 2 +- crates/hir_expand/src/db.rs | 6 +++--- crates/hir_expand/src/lib.rs | 2 +- crates/ide/src/status.rs | 2 +- crates/ide_db/src/apply_change.rs | 4 ++-- crates/ide_db/src/lib.rs | 2 +- 6 files changed, 9 insertions(+), 9 deletions(-) diff --git a/crates/hir/src/db.rs b/crates/hir/src/db.rs index 07333c453..8c767b249 100644 --- a/crates/hir/src/db.rs +++ b/crates/hir/src/db.rs @@ -11,7 +11,7 @@ pub use hir_def::db::{ }; pub use hir_expand::db::{ AstDatabase, AstDatabaseStorage, AstIdMapQuery, InternEagerExpansionQuery, InternMacroQuery, - MacroArgTextQuery, MacroDefQuery, MacroExpandQuery, ParseMacroQuery, + MacroArgTextQuery, MacroDefQuery, MacroExpandQuery, ParseMacroExpansionQuery, }; pub use hir_ty::db::*; diff --git a/crates/hir_expand/src/db.rs b/crates/hir_expand/src/db.rs index 36d3307a1..a9099eb22 100644 --- a/crates/hir_expand/src/db.rs +++ b/crates/hir_expand/src/db.rs @@ -88,7 +88,7 @@ pub trait AstDatabase: SourceDatabase { #[salsa::transparent] fn macro_arg(&self, id: MacroCallId) -> Option>; fn macro_def(&self, id: MacroDefId) -> Option>; - fn parse_macro( + fn parse_macro_expansion( &self, macro_file: MacroFile, ) -> MacroResult<(Parse, Arc)>; @@ -283,12 +283,12 @@ fn parse_or_expand(db: &dyn AstDatabase, file_id: HirFileId) -> Option Some(db.parse(file_id).tree().syntax().clone()), HirFileIdRepr::MacroFile(macro_file) => { - db.parse_macro(macro_file).map(|(it, _)| it.syntax_node()).value + db.parse_macro_expansion(macro_file).map(|(it, _)| it.syntax_node()).value } } } -fn parse_macro( +fn parse_macro_expansion( db: &dyn AstDatabase, macro_file: MacroFile, ) -> MacroResult<(Parse, Arc)> { diff --git a/crates/hir_expand/src/lib.rs b/crates/hir_expand/src/lib.rs index 9fc697d6f..83e09738b 100644 --- a/crates/hir_expand/src/lib.rs +++ b/crates/hir_expand/src/lib.rs @@ -144,7 +144,7 @@ impl HirFileId { let def_tt = loc.def.ast_id?.to_node(db).token_tree()?; let macro_def = db.macro_def(loc.def)?; - let (parse, exp_map) = db.parse_macro(macro_file).value?; + let (parse, exp_map) = db.parse_macro_expansion(macro_file).value?; let macro_arg = db.macro_arg(macro_file.macro_call_id)?; Some(ExpansionInfo { diff --git a/crates/ide/src/status.rs b/crates/ide/src/status.rs index 8b4a1652e..b75f88ed9 100644 --- a/crates/ide/src/status.rs +++ b/crates/ide/src/status.rs @@ -19,7 +19,7 @@ fn syntax_tree_stats(db: &RootDatabase) -> SyntaxTreeStats { ide_db::base_db::ParseQuery.in_db(db).entries::() } fn macro_syntax_tree_stats(db: &RootDatabase) -> SyntaxTreeStats { - hir::db::ParseMacroQuery.in_db(db).entries::() + hir::db::ParseMacroExpansionQuery.in_db(db).entries::() } // Feature: Status diff --git a/crates/ide_db/src/apply_change.rs b/crates/ide_db/src/apply_change.rs index da16fa21d..987191fe3 100644 --- a/crates/ide_db/src/apply_change.rs +++ b/crates/ide_db/src/apply_change.rs @@ -76,7 +76,7 @@ impl RootDatabase { let sweep = SweepStrategy::default().discard_values().sweep_all_revisions(); base_db::ParseQuery.in_db(self).sweep(sweep); - hir::db::ParseMacroQuery.in_db(self).sweep(sweep); + hir::db::ParseMacroExpansionQuery.in_db(self).sweep(sweep); // Macros do take significant space, but less then the syntax trees // self.query(hir::db::MacroDefQuery).sweep(sweep); @@ -143,7 +143,7 @@ impl RootDatabase { hir::db::AstIdMapQuery hir::db::MacroArgTextQuery hir::db::MacroDefQuery - hir::db::ParseMacroQuery + hir::db::ParseMacroExpansionQuery hir::db::MacroExpandQuery // DefDatabase diff --git a/crates/ide_db/src/lib.rs b/crates/ide_db/src/lib.rs index 38ebdbf79..05139a651 100644 --- a/crates/ide_db/src/lib.rs +++ b/crates/ide_db/src/lib.rs @@ -113,7 +113,7 @@ impl RootDatabase { pub fn update_lru_capacity(&mut self, lru_capacity: Option) { let lru_capacity = lru_capacity.unwrap_or(base_db::DEFAULT_LRU_CAP); base_db::ParseQuery.in_db_mut(self).set_lru_capacity(lru_capacity); - hir::db::ParseMacroQuery.in_db_mut(self).set_lru_capacity(lru_capacity); + hir::db::ParseMacroExpansionQuery.in_db_mut(self).set_lru_capacity(lru_capacity); hir::db::MacroExpandQuery.in_db_mut(self).set_lru_capacity(lru_capacity); } } -- cgit v1.2.3