aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir/src
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_hir/src')
-rw-r--r--crates/ra_hir/src/code_model/src.rs11
1 files changed, 8 insertions, 3 deletions
diff --git a/crates/ra_hir/src/code_model/src.rs b/crates/ra_hir/src/code_model/src.rs
index 6d116ee75..c4e62f799 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, Module, 9 Const, Either, Enum, EnumVariant, FieldSource, Function, HasBody, HirFileId, MacroDef,
10 ModuleSource, Static, Struct, StructField, Trait, TypeAlias, Union, 10 MacroDefId, Module, ModuleSource, Static, Struct, StructField, Trait, TypeAlias, Union,
11}; 11};
12 12
13pub use hir_expand::Source; 13pub use hir_expand::Source;
@@ -140,10 +140,15 @@ impl HasSource for TypeAlias {
140 self.id.source(db) 140 self.id.source(db)
141 } 141 }
142} 142}
143
143impl HasSource for MacroDef { 144impl HasSource for MacroDef {
144 type Ast = ast::MacroCall; 145 type Ast = ast::MacroCall;
145 fn source(self, db: &(impl DefDatabase + AstDatabase)) -> Source<ast::MacroCall> { 146 fn source(self, db: &(impl DefDatabase + AstDatabase)) -> Source<ast::MacroCall> {
146 Source { file_id: self.id.ast_id.file_id(), ast: self.id.ast_id.to_node(db) } 147 let ast_id = match self.id {
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) }
147 } 152 }
148} 153}
149 154