From c46768d13dd34bbe878cc62eca4af873ffbb7c22 Mon Sep 17 00:00:00 2001 From: Edwin Cheng Date: Sun, 10 Nov 2019 11:03:24 +0800 Subject: Add basic bultin macro infrastructure --- crates/ra_hir_expand/src/hygiene.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'crates/ra_hir_expand/src/hygiene.rs') diff --git a/crates/ra_hir_expand/src/hygiene.rs b/crates/ra_hir_expand/src/hygiene.rs index 77428ec99..6b682d3ab 100644 --- a/crates/ra_hir_expand/src/hygiene.rs +++ b/crates/ra_hir_expand/src/hygiene.rs @@ -9,7 +9,7 @@ use crate::{ db::AstDatabase, either::Either, name::{AsName, Name}, - HirFileId, HirFileIdRepr, + HirFileId, HirFileIdRepr, MacroDefId, }; #[derive(Debug)] @@ -24,7 +24,10 @@ impl Hygiene { HirFileIdRepr::FileId(_) => None, HirFileIdRepr::MacroFile(macro_file) => { let loc = db.lookup_intern_macro(macro_file.macro_call_id); - Some(loc.def.krate) + match loc.def { + MacroDefId::DeclarativeMacro(it) => Some(it.krate), + MacroDefId::BuiltinMacro(_) => None, + } } }; Hygiene { def_crate } -- cgit v1.2.3 From 4f7df2aac107c0de2cab851f2a4f1ab369511fc8 Mon Sep 17 00:00:00 2001 From: Edwin Cheng Date: Mon, 11 Nov 2019 18:45:55 +0800 Subject: Add MacroDefKind --- crates/ra_hir_expand/src/hygiene.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'crates/ra_hir_expand/src/hygiene.rs') diff --git a/crates/ra_hir_expand/src/hygiene.rs b/crates/ra_hir_expand/src/hygiene.rs index 6b682d3ab..379562a2c 100644 --- a/crates/ra_hir_expand/src/hygiene.rs +++ b/crates/ra_hir_expand/src/hygiene.rs @@ -9,7 +9,7 @@ use crate::{ db::AstDatabase, either::Either, name::{AsName, Name}, - HirFileId, HirFileIdRepr, MacroDefId, + HirFileId, HirFileIdRepr, MacroDefKind, }; #[derive(Debug)] @@ -24,9 +24,9 @@ impl Hygiene { HirFileIdRepr::FileId(_) => None, HirFileIdRepr::MacroFile(macro_file) => { let loc = db.lookup_intern_macro(macro_file.macro_call_id); - match loc.def { - MacroDefId::DeclarativeMacro(it) => Some(it.krate), - MacroDefId::BuiltinMacro(_) => None, + match loc.def.kind { + MacroDefKind::Declarative => Some(loc.def.krate), + MacroDefKind::BuiltIn(_) => None, } } }; -- cgit v1.2.3