mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-01 06:11:35 +00:00
allow expanding expressions
This commit is contained in:
parent
16c7405262
commit
caa8663c08
2 changed files with 8 additions and 7 deletions
|
@ -830,14 +830,11 @@ where
|
|||
|
||||
if let Some(def) = self.resolver.resolve_macro_call(path) {
|
||||
let call_id = MacroCallLoc { def, ast_id }.id(self.db);
|
||||
if let Some(tt) = self.db.macro_expand(call_id).ok() {
|
||||
if let Some(expr) = mbe::token_tree_to_expr(&tt).ok() {
|
||||
let file_id = call_id.as_file(MacroFileKind::Expr);
|
||||
if let Some(node) = self.db.parse_or_expand(file_id) {
|
||||
if let Some(expr) = ast::Expr::cast(&*node) {
|
||||
log::debug!("macro expansion {}", expr.syntax().debug_dump());
|
||||
let old_file_id = std::mem::replace(
|
||||
&mut self.current_file_id,
|
||||
//BUG
|
||||
call_id.as_file(MacroFileKind::Items),
|
||||
);
|
||||
let old_file_id = std::mem::replace(&mut self.current_file_id, file_id);
|
||||
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