aboutsummaryrefslogtreecommitdiff
path: root/crates
diff options
context:
space:
mode:
authorJonas Schievink <[email protected]>2020-11-24 20:57:51 +0000
committerJonas Schievink <[email protected]>2020-11-24 20:57:51 +0000
commit9559bce311c3b6b7009b9cd09e52c75497c87035 (patch)
treef28435190d7f830acb6335da5eeaa83a458b5e2a /crates
parentf9d0d511011b7071c621ac3f7c64c4aaec7f2dfb (diff)
Rename `parse_macro` to `parse_macro_expansion`
This does not parse macros, it expands a macro and parses the *result*
Diffstat (limited to 'crates')
-rw-r--r--crates/hir/src/db.rs2
-rw-r--r--crates/hir_expand/src/db.rs6
-rw-r--r--crates/hir_expand/src/lib.rs2
-rw-r--r--crates/ide/src/status.rs2
-rw-r--r--crates/ide_db/src/apply_change.rs4
-rw-r--r--crates/ide_db/src/lib.rs2
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::{
11}; 11};
12pub use hir_expand::db::{ 12pub use hir_expand::db::{
13 AstDatabase, AstDatabaseStorage, AstIdMapQuery, InternEagerExpansionQuery, InternMacroQuery, 13 AstDatabase, AstDatabaseStorage, AstIdMapQuery, InternEagerExpansionQuery, InternMacroQuery,
14 MacroArgTextQuery, MacroDefQuery, MacroExpandQuery, ParseMacroQuery, 14 MacroArgTextQuery, MacroDefQuery, MacroExpandQuery, ParseMacroExpansionQuery,
15}; 15};
16pub use hir_ty::db::*; 16pub use hir_ty::db::*;
17 17
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 {
88 #[salsa::transparent] 88 #[salsa::transparent]
89 fn macro_arg(&self, id: MacroCallId) -> Option<Arc<(tt::Subtree, mbe::TokenMap)>>; 89 fn macro_arg(&self, id: MacroCallId) -> Option<Arc<(tt::Subtree, mbe::TokenMap)>>;
90 fn macro_def(&self, id: MacroDefId) -> Option<Arc<(TokenExpander, mbe::TokenMap)>>; 90 fn macro_def(&self, id: MacroDefId) -> Option<Arc<(TokenExpander, mbe::TokenMap)>>;
91 fn parse_macro( 91 fn parse_macro_expansion(
92 &self, 92 &self,
93 macro_file: MacroFile, 93 macro_file: MacroFile,
94 ) -> MacroResult<(Parse<SyntaxNode>, Arc<mbe::TokenMap>)>; 94 ) -> MacroResult<(Parse<SyntaxNode>, Arc<mbe::TokenMap>)>;
@@ -283,12 +283,12 @@ fn parse_or_expand(db: &dyn AstDatabase, file_id: HirFileId) -> Option<SyntaxNod
283 match file_id.0 { 283 match file_id.0 {
284 HirFileIdRepr::FileId(file_id) => Some(db.parse(file_id).tree().syntax().clone()), 284 HirFileIdRepr::FileId(file_id) => Some(db.parse(file_id).tree().syntax().clone()),
285 HirFileIdRepr::MacroFile(macro_file) => { 285 HirFileIdRepr::MacroFile(macro_file) => {
286 db.parse_macro(macro_file).map(|(it, _)| it.syntax_node()).value 286 db.parse_macro_expansion(macro_file).map(|(it, _)| it.syntax_node()).value
287 } 287 }
288 } 288 }
289} 289}
290 290
291fn parse_macro( 291fn parse_macro_expansion(
292 db: &dyn AstDatabase, 292 db: &dyn AstDatabase,
293 macro_file: MacroFile, 293 macro_file: MacroFile,
294) -> MacroResult<(Parse<SyntaxNode>, Arc<mbe::TokenMap>)> { 294) -> MacroResult<(Parse<SyntaxNode>, Arc<mbe::TokenMap>)> {
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 {
144 let def_tt = loc.def.ast_id?.to_node(db).token_tree()?; 144 let def_tt = loc.def.ast_id?.to_node(db).token_tree()?;
145 145
146 let macro_def = db.macro_def(loc.def)?; 146 let macro_def = db.macro_def(loc.def)?;
147 let (parse, exp_map) = db.parse_macro(macro_file).value?; 147 let (parse, exp_map) = db.parse_macro_expansion(macro_file).value?;
148 let macro_arg = db.macro_arg(macro_file.macro_call_id)?; 148 let macro_arg = db.macro_arg(macro_file.macro_call_id)?;
149 149
150 Some(ExpansionInfo { 150 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 {
19 ide_db::base_db::ParseQuery.in_db(db).entries::<SyntaxTreeStats>() 19 ide_db::base_db::ParseQuery.in_db(db).entries::<SyntaxTreeStats>()
20} 20}
21fn macro_syntax_tree_stats(db: &RootDatabase) -> SyntaxTreeStats { 21fn macro_syntax_tree_stats(db: &RootDatabase) -> SyntaxTreeStats {
22 hir::db::ParseMacroQuery.in_db(db).entries::<SyntaxTreeStats>() 22 hir::db::ParseMacroExpansionQuery.in_db(db).entries::<SyntaxTreeStats>()
23} 23}
24 24
25// Feature: Status 25// 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 {
76 let sweep = SweepStrategy::default().discard_values().sweep_all_revisions(); 76 let sweep = SweepStrategy::default().discard_values().sweep_all_revisions();
77 77
78 base_db::ParseQuery.in_db(self).sweep(sweep); 78 base_db::ParseQuery.in_db(self).sweep(sweep);
79 hir::db::ParseMacroQuery.in_db(self).sweep(sweep); 79 hir::db::ParseMacroExpansionQuery.in_db(self).sweep(sweep);
80 80
81 // Macros do take significant space, but less then the syntax trees 81 // Macros do take significant space, but less then the syntax trees
82 // self.query(hir::db::MacroDefQuery).sweep(sweep); 82 // self.query(hir::db::MacroDefQuery).sweep(sweep);
@@ -143,7 +143,7 @@ impl RootDatabase {
143 hir::db::AstIdMapQuery 143 hir::db::AstIdMapQuery
144 hir::db::MacroArgTextQuery 144 hir::db::MacroArgTextQuery
145 hir::db::MacroDefQuery 145 hir::db::MacroDefQuery
146 hir::db::ParseMacroQuery 146 hir::db::ParseMacroExpansionQuery
147 hir::db::MacroExpandQuery 147 hir::db::MacroExpandQuery
148 148
149 // DefDatabase 149 // 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 {
113 pub fn update_lru_capacity(&mut self, lru_capacity: Option<usize>) { 113 pub fn update_lru_capacity(&mut self, lru_capacity: Option<usize>) {
114 let lru_capacity = lru_capacity.unwrap_or(base_db::DEFAULT_LRU_CAP); 114 let lru_capacity = lru_capacity.unwrap_or(base_db::DEFAULT_LRU_CAP);
115 base_db::ParseQuery.in_db_mut(self).set_lru_capacity(lru_capacity); 115 base_db::ParseQuery.in_db_mut(self).set_lru_capacity(lru_capacity);
116 hir::db::ParseMacroQuery.in_db_mut(self).set_lru_capacity(lru_capacity); 116 hir::db::ParseMacroExpansionQuery.in_db_mut(self).set_lru_capacity(lru_capacity);
117 hir::db::MacroExpandQuery.in_db_mut(self).set_lru_capacity(lru_capacity); 117 hir::db::MacroExpandQuery.in_db_mut(self).set_lru_capacity(lru_capacity);
118 } 118 }
119} 119}