From 0a9c80053ffcd72d076ca3792bf4a9ddb94eaf95 Mon Sep 17 00:00:00 2001 From: Edwin Cheng Date: Wed, 20 Nov 2019 12:21:31 +0800 Subject: Fix expand macro --- crates/ra_hir/src/source_binder.rs | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'crates/ra_hir') 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 { implements_trait(&canonical_ty, db, &self.resolver, krate, std_future_trait) } - pub fn expand(&self, db: &impl HirDatabase, macro_call: &ast::MacroCall) -> Option { - let def = self.resolve_macro_call(db, macro_call)?.id; - let ast_id = AstId::new(self.file_id, db.ast_id_map(self.file_id).ast_id(macro_call)); + pub fn expand( + &self, + db: &impl HirDatabase, + macro_call: Source<&ast::MacroCall>, + ) -> Option { + let def = self.resolve_macro_call(db, macro_call.value)?.id; + let ast_id = AstId::new( + macro_call.file_id, + db.ast_id_map(macro_call.file_id).ast_id(macro_call.value), + ); let macro_call_loc = MacroCallLoc { def, ast_id }; Some(Expansion { macro_call_id: db.intern_macro(macro_call_loc) }) } -- cgit v1.2.3