diff options
Diffstat (limited to 'crates/ra_hir/src')
-rw-r--r-- | crates/ra_hir/src/source_binder.rs | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/crates/ra_hir/src/source_binder.rs b/crates/ra_hir/src/source_binder.rs index cbfeca3ab..287cea880 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}, |
@@ -236,10 +237,10 @@ impl SourceAnalyzer { | |||
236 | pub fn resolve_macro_call( | 237 | pub fn resolve_macro_call( |
237 | &self, | 238 | &self, |
238 | db: &impl HirDatabase, | 239 | db: &impl HirDatabase, |
239 | macro_call: &ast::MacroCall, | 240 | macro_call: Source<&ast::MacroCall>, |
240 | ) -> Option<MacroDef> { | 241 | ) -> Option<MacroDef> { |
241 | // This must be a normal source file rather than macro file. | 242 | let hygiene = Hygiene::new(db, macro_call.file_id); |
242 | let path = macro_call.path().and_then(Path::from_ast)?; | 243 | let path = macro_call.value.path().and_then(|ast| Path::from_src(ast, &hygiene))?; |
243 | self.resolver.resolve_path_as_macro(db, &path).map(|it| it.into()) | 244 | self.resolver.resolve_path_as_macro(db, &path).map(|it| it.into()) |
244 | } | 245 | } |
245 | 246 | ||
@@ -441,12 +442,14 @@ impl SourceAnalyzer { | |||
441 | db: &impl HirDatabase, | 442 | db: &impl HirDatabase, |
442 | macro_call: Source<&ast::MacroCall>, | 443 | macro_call: Source<&ast::MacroCall>, |
443 | ) -> Option<Expansion> { | 444 | ) -> Option<Expansion> { |
444 | let def = self.resolve_macro_call(db, macro_call.value)?.id; | 445 | let def = self.resolve_macro_call(db, macro_call)?.id; |
445 | let ast_id = AstId::new( | 446 | let ast_id = AstId::new( |
446 | macro_call.file_id, | 447 | macro_call.file_id, |
447 | db.ast_id_map(macro_call.file_id).ast_id(macro_call.value), | 448 | db.ast_id_map(macro_call.file_id).ast_id(macro_call.value), |
448 | ); | 449 | ); |
449 | let macro_call_loc = MacroCallLoc { def, ast_id }; | 450 | let macro_call_loc = MacroCallLoc { def, ast_id }; |
451 | let kind = to_macro_file_kind(macro_call.value); | ||
452 | dbg!(kind); | ||
450 | Some(Expansion { | 453 | Some(Expansion { |
451 | macro_call_id: db.intern_macro(macro_call_loc), | 454 | macro_call_id: db.intern_macro(macro_call_loc), |
452 | macro_file_kind: to_macro_file_kind(macro_call.value), | 455 | macro_file_kind: to_macro_file_kind(macro_call.value), |