aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir/src/expr.rs
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2019-05-13 23:12:07 +0100
committerAleksey Kladov <[email protected]>2019-05-14 07:03:43 +0100
commit101b3abfd70cc988b24f30a610d46a3986df54d3 (patch)
tree61a44635319fae9a4670b4a660c72b462aec682f /crates/ra_hir/src/expr.rs
parentee0ab7c00b4b8c5375c14b44e3d7288ebf0d732d (diff)
store macro kind in HirFileId
Diffstat (limited to 'crates/ra_hir/src/expr.rs')
-rw-r--r--crates/ra_hir/src/expr.rs11
1 files changed, 7 insertions, 4 deletions
diff --git a/crates/ra_hir/src/expr.rs b/crates/ra_hir/src/expr.rs
index a2b5db1a1..288f85b01 100644
--- a/crates/ra_hir/src/expr.rs
+++ b/crates/ra_hir/src/expr.rs
@@ -6,11 +6,11 @@ use rustc_hash::FxHashMap;
6use ra_arena::{Arena, RawId, impl_arena_id, map::ArenaMap}; 6use ra_arena::{Arena, RawId, impl_arena_id, map::ArenaMap};
7use ra_syntax::{ 7use ra_syntax::{
8 SyntaxNodePtr, AstPtr, AstNode, 8 SyntaxNodePtr, AstPtr, AstNode,
9 ast::{self, LoopBodyOwner, ArgListOwner, NameOwner, LiteralKind,ArrayExprKind, TypeAscriptionOwner} 9 ast::{self, LoopBodyOwner, ArgListOwner, NameOwner, LiteralKind,ArrayExprKind, TypeAscriptionOwner},
10}; 10};
11 11
12use crate::{ 12use crate::{
13 Path, Name, HirDatabase, Resolver,DefWithBody, Either, HirFileId, MacroCallLoc, 13 Path, Name, HirDatabase, Resolver,DefWithBody, Either, HirFileId, MacroCallLoc, MacroFileKind,
14 name::AsName, 14 name::AsName,
15 type_ref::{Mutability, TypeRef}, 15 type_ref::{Mutability, TypeRef},
16}; 16};
@@ -833,8 +833,11 @@ where
833 if let Some(tt) = self.db.macro_expand(call_id).ok() { 833 if let Some(tt) = self.db.macro_expand(call_id).ok() {
834 if let Some(expr) = mbe::token_tree_to_expr(&tt).ok() { 834 if let Some(expr) = mbe::token_tree_to_expr(&tt).ok() {
835 log::debug!("macro expansion {}", expr.syntax().debug_dump()); 835 log::debug!("macro expansion {}", expr.syntax().debug_dump());
836 let old_file_id = 836 let old_file_id = std::mem::replace(
837 std::mem::replace(&mut self.current_file_id, call_id.into()); 837 &mut self.current_file_id,
838 //BUG
839 call_id.as_file(MacroFileKind::Items),
840 );
838 let id = self.collect_expr(&expr); 841 let id = self.collect_expr(&expr);
839 self.current_file_id = old_file_id; 842 self.current_file_id = old_file_id;
840 return id; 843 return id;