aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir_def
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2019-12-08 10:35:30 +0000
committerGitHub <[email protected]>2019-12-08 10:35:30 +0000
commitffcdd25cc8e7f1fd7fb4e3e8478c4cd1adfbf843 (patch)
tree973ccea0049ee917a7f901a7e0238f7ef6c984bc /crates/ra_hir_def
parent9e551d5452232d1d44e4bba754392beaa3a7628f (diff)
parent509fedd9d2f228c6dca762cbf06c31af34ac0c75 (diff)
Merge #2497
2497: Remove MacroFileKind r=matklad a=edwin0cheng This PR move `to_macro_file_kind` to `hir_expand::db` and use it to get the `FragmentKind` directly, such that we can remove `MacroFileKind`. Co-authored-by: Edwin Cheng <[email protected]>
Diffstat (limited to 'crates/ra_hir_def')
-rw-r--r--crates/ra_hir_def/src/body.rs6
-rw-r--r--crates/ra_hir_def/src/nameres/collector.rs4
2 files changed, 4 insertions, 6 deletions
diff --git a/crates/ra_hir_def/src/body.rs b/crates/ra_hir_def/src/body.rs
index 7b385f3fd..b3bc336cf 100644
--- a/crates/ra_hir_def/src/body.rs
+++ b/crates/ra_hir_def/src/body.rs
@@ -6,9 +6,7 @@ pub mod scope;
6use std::{ops::Index, sync::Arc}; 6use std::{ops::Index, sync::Arc};
7 7
8use either::Either; 8use either::Either;
9use hir_expand::{ 9use hir_expand::{hygiene::Hygiene, AstId, HirFileId, InFile, MacroCallKind, MacroDefId};
10 hygiene::Hygiene, AstId, HirFileId, InFile, MacroCallKind, MacroDefId, MacroFileKind,
11};
12use ra_arena::{map::ArenaMap, Arena}; 10use ra_arena::{map::ArenaMap, Arena};
13use ra_syntax::{ast, AstNode, AstPtr}; 11use ra_syntax::{ast, AstNode, AstPtr};
14use rustc_hash::FxHashMap; 12use rustc_hash::FxHashMap;
@@ -49,7 +47,7 @@ impl Expander {
49 if let Some(path) = macro_call.path().and_then(|path| self.parse_path(path)) { 47 if let Some(path) = macro_call.path().and_then(|path| self.parse_path(path)) {
50 if let Some(def) = self.resolve_path_as_macro(db, &path) { 48 if let Some(def) = self.resolve_path_as_macro(db, &path) {
51 let call_id = def.as_call_id(db, MacroCallKind::FnLike(ast_id)); 49 let call_id = def.as_call_id(db, MacroCallKind::FnLike(ast_id));
52 let file_id = call_id.as_file(MacroFileKind::Expr); 50 let file_id = call_id.as_file();
53 if let Some(node) = db.parse_or_expand(file_id) { 51 if let Some(node) = db.parse_or_expand(file_id) {
54 if let Some(expr) = ast::Expr::cast(node) { 52 if let Some(expr) = ast::Expr::cast(node) {
55 log::debug!("macro expansion {:#?}", expr.syntax()); 53 log::debug!("macro expansion {:#?}", expr.syntax());
diff --git a/crates/ra_hir_def/src/nameres/collector.rs b/crates/ra_hir_def/src/nameres/collector.rs
index 08693cb13..6a01e3ab7 100644
--- a/crates/ra_hir_def/src/nameres/collector.rs
+++ b/crates/ra_hir_def/src/nameres/collector.rs
@@ -7,7 +7,7 @@ use hir_expand::{
7 builtin_derive::find_builtin_derive, 7 builtin_derive::find_builtin_derive,
8 builtin_macro::find_builtin_macro, 8 builtin_macro::find_builtin_macro,
9 name::{self, AsName, Name}, 9 name::{self, AsName, Name},
10 HirFileId, MacroCallId, MacroCallKind, MacroDefId, MacroDefKind, MacroFileKind, 10 HirFileId, MacroCallId, MacroCallKind, MacroDefId, MacroDefKind,
11}; 11};
12use ra_cfg::CfgOptions; 12use ra_cfg::CfgOptions;
13use ra_db::{CrateId, FileId}; 13use ra_db::{CrateId, FileId};
@@ -545,7 +545,7 @@ where
545 self.macro_stack_monitor.increase(macro_def_id); 545 self.macro_stack_monitor.increase(macro_def_id);
546 546
547 if !self.macro_stack_monitor.is_poison(macro_def_id) { 547 if !self.macro_stack_monitor.is_poison(macro_def_id) {
548 let file_id: HirFileId = macro_call_id.as_file(MacroFileKind::Items); 548 let file_id: HirFileId = macro_call_id.as_file();
549 let raw_items = self.db.raw_items(file_id); 549 let raw_items = self.db.raw_items(file_id);
550 let mod_dir = self.mod_dirs[&module_id].clone(); 550 let mod_dir = self.mod_dirs[&module_id].clone();
551 ModCollector { 551 ModCollector {