aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir/src
diff options
context:
space:
mode:
authorEdwin Cheng <[email protected]>2019-11-11 10:45:55 +0000
committerEdwin Cheng <[email protected]>2019-11-11 10:48:16 +0000
commit4f7df2aac107c0de2cab851f2a4f1ab369511fc8 (patch)
tree9f78811b31771c2822c0852c4527ad145f845e70 /crates/ra_hir/src
parentc4aa8b63bcea5faa23da56b679cafbdbad6892f1 (diff)
Add MacroDefKind
Diffstat (limited to 'crates/ra_hir/src')
-rw-r--r--crates/ra_hir/src/code_model/src.rs11
1 files changed, 3 insertions, 8 deletions
diff --git a/crates/ra_hir/src/code_model/src.rs b/crates/ra_hir/src/code_model/src.rs
index c4e62f799..6d116ee75 100644
--- a/crates/ra_hir/src/code_model/src.rs
+++ b/crates/ra_hir/src/code_model/src.rs
@@ -6,8 +6,8 @@ use crate::{
6 adt::VariantDef, 6 adt::VariantDef,
7 db::{AstDatabase, DefDatabase, HirDatabase}, 7 db::{AstDatabase, DefDatabase, HirDatabase},
8 ids::AstItemDef, 8 ids::AstItemDef,
9 Const, Either, Enum, EnumVariant, FieldSource, Function, HasBody, HirFileId, MacroDef, 9 Const, Either, Enum, EnumVariant, FieldSource, Function, HasBody, HirFileId, MacroDef, Module,
10 MacroDefId, Module, ModuleSource, Static, Struct, StructField, Trait, TypeAlias, Union, 10 ModuleSource, Static, Struct, StructField, Trait, TypeAlias, Union,
11}; 11};
12 12
13pub use hir_expand::Source; 13pub use hir_expand::Source;
@@ -140,15 +140,10 @@ impl HasSource for TypeAlias {
140 self.id.source(db) 140 self.id.source(db)
141 } 141 }
142} 142}
143
144impl HasSource for MacroDef { 143impl HasSource for MacroDef {
145 type Ast = ast::MacroCall; 144 type Ast = ast::MacroCall;
146 fn source(self, db: &(impl DefDatabase + AstDatabase)) -> Source<ast::MacroCall> { 145 fn source(self, db: &(impl DefDatabase + AstDatabase)) -> Source<ast::MacroCall> {
147 let ast_id = match self.id { 146 Source { file_id: self.id.ast_id.file_id(), ast: self.id.ast_id.to_node(db) }
148 MacroDefId::DeclarativeMacro(it) => it.ast_id,
149 MacroDefId::BuiltinMacro(it) => it.ast_id,
150 };
151 Source { file_id: ast_id.file_id(), ast: ast_id.to_node(db) }
152 } 147 }
153} 148}
154 149