mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-01 06:11:35 +00:00
store macro kind in HirFileId
This commit is contained in:
parent
ee0ab7c00b
commit
101b3abfd7
4 changed files with 38 additions and 21 deletions
|
@ -6,11 +6,11 @@ use rustc_hash::FxHashMap;
|
|||
use ra_arena::{Arena, RawId, impl_arena_id, map::ArenaMap};
|
||||
use ra_syntax::{
|
||||
SyntaxNodePtr, AstPtr, AstNode,
|
||||
ast::{self, LoopBodyOwner, ArgListOwner, NameOwner, LiteralKind,ArrayExprKind, TypeAscriptionOwner}
|
||||
ast::{self, LoopBodyOwner, ArgListOwner, NameOwner, LiteralKind,ArrayExprKind, TypeAscriptionOwner},
|
||||
};
|
||||
|
||||
use crate::{
|
||||
Path, Name, HirDatabase, Resolver,DefWithBody, Either, HirFileId, MacroCallLoc,
|
||||
Path, Name, HirDatabase, Resolver,DefWithBody, Either, HirFileId, MacroCallLoc, MacroFileKind,
|
||||
name::AsName,
|
||||
type_ref::{Mutability, TypeRef},
|
||||
};
|
||||
|
@ -833,8 +833,11 @@ where
|
|||
if let Some(tt) = self.db.macro_expand(call_id).ok() {
|
||||
if let Some(expr) = mbe::token_tree_to_expr(&tt).ok() {
|
||||
log::debug!("macro expansion {}", expr.syntax().debug_dump());
|
||||
let old_file_id =
|
||||
std::mem::replace(&mut self.current_file_id, call_id.into());
|
||||
let old_file_id = std::mem::replace(
|
||||
&mut self.current_file_id,
|
||||
//BUG
|
||||
call_id.as_file(MacroFileKind::Items),
|
||||
);
|
||||
let id = self.collect_expr(&expr);
|
||||
self.current_file_id = old_file_id;
|
||||
return id;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue