diff options
Diffstat (limited to 'crates/ra_hir/src')
-rw-r--r-- | crates/ra_hir/src/source_binder.rs | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/crates/ra_hir/src/source_binder.rs b/crates/ra_hir/src/source_binder.rs index 95a94c3f0..82cb66583 100644 --- a/crates/ra_hir/src/source_binder.rs +++ b/crates/ra_hir/src/source_binder.rs | |||
@@ -14,7 +14,8 @@ use hir_def::{ | |||
14 | DefWithBodyId, | 14 | DefWithBodyId, |
15 | }; | 15 | }; |
16 | use hir_expand::{ | 16 | use hir_expand::{ |
17 | name::AsName, AstId, HirFileId, MacroCallId, MacroCallLoc, MacroFileKind, Source, | 17 | hygiene::Hygiene, name::AsName, AstId, HirFileId, MacroCallId, MacroCallLoc, MacroFileKind, |
18 | Source, | ||
18 | }; | 19 | }; |
19 | use ra_syntax::{ | 20 | use ra_syntax::{ |
20 | ast::{self, AstNode}, | 21 | ast::{self, AstNode}, |
@@ -240,10 +241,10 @@ impl SourceAnalyzer { | |||
240 | pub fn resolve_macro_call( | 241 | pub fn resolve_macro_call( |
241 | &self, | 242 | &self, |
242 | db: &impl HirDatabase, | 243 | db: &impl HirDatabase, |
243 | macro_call: &ast::MacroCall, | 244 | macro_call: Source<&ast::MacroCall>, |
244 | ) -> Option<MacroDef> { | 245 | ) -> Option<MacroDef> { |
245 | // This must be a normal source file rather than macro file. | 246 | let hygiene = Hygiene::new(db, macro_call.file_id); |
246 | let path = macro_call.path().and_then(Path::from_ast)?; | 247 | let path = macro_call.value.path().and_then(|ast| Path::from_src(ast, &hygiene))?; |
247 | self.resolver.resolve_path_as_macro(db, &path).map(|it| it.into()) | 248 | self.resolver.resolve_path_as_macro(db, &path).map(|it| it.into()) |
248 | } | 249 | } |
249 | 250 | ||
@@ -445,7 +446,7 @@ impl SourceAnalyzer { | |||
445 | db: &impl HirDatabase, | 446 | db: &impl HirDatabase, |
446 | macro_call: Source<&ast::MacroCall>, | 447 | macro_call: Source<&ast::MacroCall>, |
447 | ) -> Option<Expansion> { | 448 | ) -> Option<Expansion> { |
448 | let def = self.resolve_macro_call(db, macro_call.value)?.id; | 449 | let def = self.resolve_macro_call(db, macro_call)?.id; |
449 | let ast_id = AstId::new( | 450 | let ast_id = AstId::new( |
450 | macro_call.file_id, | 451 | macro_call.file_id, |
451 | db.ast_id_map(macro_call.file_id).ast_id(macro_call.value), | 452 | db.ast_id_map(macro_call.file_id).ast_id(macro_call.value), |