aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir_expand/src/hygiene.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_hir_expand/src/hygiene.rs')
-rw-r--r--crates/ra_hir_expand/src/hygiene.rs20
1 files changed, 12 insertions, 8 deletions
diff --git a/crates/ra_hir_expand/src/hygiene.rs b/crates/ra_hir_expand/src/hygiene.rs
index 2e8a533f7..cb554ae4b 100644
--- a/crates/ra_hir_expand/src/hygiene.rs
+++ b/crates/ra_hir_expand/src/hygiene.rs
@@ -9,7 +9,7 @@ use ra_syntax::ast;
9use crate::{ 9use crate::{
10 db::AstDatabase, 10 db::AstDatabase,
11 name::{AsName, Name}, 11 name::{AsName, Name},
12 HirFileId, HirFileIdRepr, MacroDefKind, 12 HirFileId, HirFileIdRepr, MacroCallId, MacroDefKind,
13}; 13};
14 14
15#[derive(Debug)] 15#[derive(Debug)]
@@ -22,14 +22,18 @@ impl Hygiene {
22 pub fn new(db: &impl AstDatabase, file_id: HirFileId) -> Hygiene { 22 pub fn new(db: &impl AstDatabase, file_id: HirFileId) -> Hygiene {
23 let def_crate = match file_id.0 { 23 let def_crate = match file_id.0 {
24 HirFileIdRepr::FileId(_) => None, 24 HirFileIdRepr::FileId(_) => None,
25 HirFileIdRepr::MacroFile(macro_file) => { 25 HirFileIdRepr::MacroFile(macro_file) => match macro_file.macro_call_id {
26 let loc = db.lookup_intern_macro(macro_file.macro_call_id); 26 MacroCallId::LazyMacro(id) => {
27 match loc.def.kind { 27 let loc = db.lookup_intern_macro(id);
28 MacroDefKind::Declarative => loc.def.krate, 28 match loc.def.kind {
29 MacroDefKind::BuiltIn(_) => None, 29 MacroDefKind::Declarative => loc.def.krate,
30 MacroDefKind::BuiltInDerive(_) => None, 30 MacroDefKind::BuiltIn(_) => None,
31 MacroDefKind::BuiltInDerive(_) => None,
32 MacroDefKind::BuiltInEager(_) => None,
33 }
31 } 34 }
32 } 35 MacroCallId::EagerMacro(_id) => None,
36 },
33 }; 37 };
34 Hygiene { def_crate } 38 Hygiene { def_crate }
35 } 39 }