aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_hir')
-rw-r--r--crates/ra_hir/src/code_model/src.rs5
-rw-r--r--crates/ra_hir/src/from_source.rs4
-rw-r--r--crates/ra_hir/src/source_binder.rs5
3 files changed, 9 insertions, 5 deletions
diff --git a/crates/ra_hir/src/code_model/src.rs b/crates/ra_hir/src/code_model/src.rs
index d9bccd902..78a454082 100644
--- a/crates/ra_hir/src/code_model/src.rs
+++ b/crates/ra_hir/src/code_model/src.rs
@@ -105,7 +105,10 @@ impl HasSource for TypeAlias {
105impl HasSource for MacroDef { 105impl HasSource for MacroDef {
106 type Ast = ast::MacroCall; 106 type Ast = ast::MacroCall;
107 fn source(self, db: &impl DefDatabase) -> InFile<ast::MacroCall> { 107 fn source(self, db: &impl DefDatabase) -> InFile<ast::MacroCall> {
108 InFile { file_id: self.id.ast_id.file_id, value: self.id.ast_id.to_node(db) } 108 InFile {
109 file_id: self.id.ast_id.expect("MacroDef without ast_id").file_id,
110 value: self.id.ast_id.expect("MacroDef without ast_id").to_node(db),
111 }
109 } 112 }
110} 113}
111impl HasSource for ImplBlock { 114impl HasSource for ImplBlock {
diff --git a/crates/ra_hir/src/from_source.rs b/crates/ra_hir/src/from_source.rs
index 6fa947759..5cb222bd3 100644
--- a/crates/ra_hir/src/from_source.rs
+++ b/crates/ra_hir/src/from_source.rs
@@ -93,9 +93,9 @@ impl FromSource for MacroDef {
93 93
94 let module_src = ModuleSource::from_child_node(db, src.as_ref().map(|it| it.syntax())); 94 let module_src = ModuleSource::from_child_node(db, src.as_ref().map(|it| it.syntax()));
95 let module = Module::from_definition(db, InFile::new(src.file_id, module_src))?; 95 let module = Module::from_definition(db, InFile::new(src.file_id, module_src))?;
96 let krate = module.krate().crate_id(); 96 let krate = Some(module.krate().crate_id());
97 97
98 let ast_id = AstId::new(src.file_id, db.ast_id_map(src.file_id).ast_id(&src.value)); 98 let ast_id = Some(AstId::new(src.file_id, db.ast_id_map(src.file_id).ast_id(&src.value)));
99 99
100 let id: MacroDefId = MacroDefId { krate, ast_id, kind }; 100 let id: MacroDefId = MacroDefId { krate, ast_id, kind };
101 Some(MacroDef { id }) 101 Some(MacroDef { id })
diff --git a/crates/ra_hir/src/source_binder.rs b/crates/ra_hir/src/source_binder.rs
index db0451059..42c392513 100644
--- a/crates/ra_hir/src/source_binder.rs
+++ b/crates/ra_hir/src/source_binder.rs
@@ -20,7 +20,8 @@ use hir_def::{
20 AssocItemId, DefWithBodyId, 20 AssocItemId, DefWithBodyId,
21}; 21};
22use hir_expand::{ 22use hir_expand::{
23 hygiene::Hygiene, name::AsName, AstId, HirFileId, InFile, MacroCallId, MacroFileKind, 23 hygiene::Hygiene, name::AsName, AstId, HirFileId, InFile, MacroCallId, MacroCallKind,
24 MacroFileKind,
24}; 25};
25use ra_syntax::{ 26use ra_syntax::{
26 ast::{self, AstNode}, 27 ast::{self, AstNode},
@@ -456,7 +457,7 @@ impl SourceAnalyzer {
456 db.ast_id_map(macro_call.file_id).ast_id(macro_call.value), 457 db.ast_id_map(macro_call.file_id).ast_id(macro_call.value),
457 ); 458 );
458 Some(Expansion { 459 Some(Expansion {
459 macro_call_id: def.as_call_id(db, ast_id), 460 macro_call_id: def.as_call_id(db, MacroCallKind::FnLike(ast_id)),
460 macro_file_kind: to_macro_file_kind(macro_call.value), 461 macro_file_kind: to_macro_file_kind(macro_call.value),
461 }) 462 })
462 } 463 }