aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir
diff options
context:
space:
mode:
authorEdwin Cheng <[email protected]>2019-11-20 04:21:31 +0000
committerEdwin Cheng <[email protected]>2019-11-20 13:33:01 +0000
commit0a9c80053ffcd72d076ca3792bf4a9ddb94eaf95 (patch)
treefc8009de0176c6904c3dd0484775e85592c9464d /crates/ra_hir
parentb568bcfe6d94d5f4c6cdc012b766473e5b771a26 (diff)
Fix expand macro
Diffstat (limited to 'crates/ra_hir')
-rw-r--r--crates/ra_hir/src/source_binder.rs13
1 files changed, 10 insertions, 3 deletions
diff --git a/crates/ra_hir/src/source_binder.rs b/crates/ra_hir/src/source_binder.rs
index 5d9e22ee2..caa8d0082 100644
--- a/crates/ra_hir/src/source_binder.rs
+++ b/crates/ra_hir/src/source_binder.rs
@@ -405,9 +405,16 @@ impl SourceAnalyzer {
405 implements_trait(&canonical_ty, db, &self.resolver, krate, std_future_trait) 405 implements_trait(&canonical_ty, db, &self.resolver, krate, std_future_trait)
406 } 406 }
407 407
408 pub fn expand(&self, db: &impl HirDatabase, macro_call: &ast::MacroCall) -> Option<Expansion> { 408 pub fn expand(
409 let def = self.resolve_macro_call(db, macro_call)?.id; 409 &self,
410 let ast_id = AstId::new(self.file_id, db.ast_id_map(self.file_id).ast_id(macro_call)); 410 db: &impl HirDatabase,
411 macro_call: Source<&ast::MacroCall>,
412 ) -> Option<Expansion> {
413 let def = self.resolve_macro_call(db, macro_call.value)?.id;
414 let ast_id = AstId::new(
415 macro_call.file_id,
416 db.ast_id_map(macro_call.file_id).ast_id(macro_call.value),
417 );
411 let macro_call_loc = MacroCallLoc { def, ast_id }; 418 let macro_call_loc = MacroCallLoc { def, ast_id };
412 Some(Expansion { macro_call_id: db.intern_macro(macro_call_loc) }) 419 Some(Expansion { macro_call_id: db.intern_macro(macro_call_loc) })
413 } 420 }