diff options
author | Aleksey Kladov <[email protected]> | 2019-05-13 23:52:31 +0100 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2019-05-14 07:03:43 +0100 |
commit | caa8663c08e1724af2abcde11fa937937d76aa14 (patch) | |
tree | d05cf30716a7791cfc0d8fcfe522a7132b5fff06 /crates/ra_hir/src/expr.rs | |
parent | 16c740526233b01980efdbb680b55718a71bb0e1 (diff) |
allow expanding expressions
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; |