diff options
Diffstat (limited to 'crates/ra_hir/src/expr.rs')
-rw-r--r-- | crates/ra_hir/src/expr.rs | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/crates/ra_hir/src/expr.rs b/crates/ra_hir/src/expr.rs index 288f85b01..9618236e5 100644 --- a/crates/ra_hir/src/expr.rs +++ b/crates/ra_hir/src/expr.rs | |||
@@ -830,14 +830,11 @@ where | |||
830 | 830 | ||
831 | if let Some(def) = self.resolver.resolve_macro_call(path) { | 831 | if let Some(def) = self.resolver.resolve_macro_call(path) { |
832 | let call_id = MacroCallLoc { def, ast_id }.id(self.db); | 832 | let call_id = MacroCallLoc { def, ast_id }.id(self.db); |
833 | if let Some(tt) = self.db.macro_expand(call_id).ok() { | 833 | let file_id = call_id.as_file(MacroFileKind::Expr); |
834 | if let Some(expr) = mbe::token_tree_to_expr(&tt).ok() { | 834 | if let Some(node) = self.db.parse_or_expand(file_id) { |
835 | if let Some(expr) = ast::Expr::cast(&*node) { | ||
835 | log::debug!("macro expansion {}", expr.syntax().debug_dump()); | 836 | log::debug!("macro expansion {}", expr.syntax().debug_dump()); |
836 | let old_file_id = std::mem::replace( | 837 | let old_file_id = std::mem::replace(&mut self.current_file_id, file_id); |
837 | &mut self.current_file_id, | ||
838 | //BUG | ||
839 | call_id.as_file(MacroFileKind::Items), | ||
840 | ); | ||
841 | let id = self.collect_expr(&expr); | 838 | let id = self.collect_expr(&expr); |
842 | self.current_file_id = old_file_id; | 839 | self.current_file_id = old_file_id; |
843 | return id; | 840 | return id; |