mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-02 22:54:58 +00:00
Expand macros in blocks to expressions for now
Expanding to statements isn't handled properly yet and breaks things.
This commit is contained in:
parent
2223620313
commit
5e096def15
2 changed files with 6 additions and 5 deletions
|
@ -437,9 +437,7 @@ where
|
||||||
None => self.alloc_expr(Expr::Missing, syntax_ptr),
|
None => self.alloc_expr(Expr::Missing, syntax_ptr),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// FIXME expand to statements in statement position
|
||||||
// FIXME implement HIR for these:
|
|
||||||
ast::Expr::Label(_e) => self.alloc_expr(Expr::Missing, syntax_ptr),
|
|
||||||
ast::Expr::MacroCall(e) => match self.expander.enter_expand(self.db, e) {
|
ast::Expr::MacroCall(e) => match self.expander.enter_expand(self.db, e) {
|
||||||
Some((mark, expansion)) => {
|
Some((mark, expansion)) => {
|
||||||
let id = self.collect_expr(expansion);
|
let id = self.collect_expr(expansion);
|
||||||
|
@ -448,6 +446,9 @@ where
|
||||||
}
|
}
|
||||||
None => self.alloc_expr(Expr::Missing, syntax_ptr),
|
None => self.alloc_expr(Expr::Missing, syntax_ptr),
|
||||||
},
|
},
|
||||||
|
|
||||||
|
// FIXME implement HIR for these:
|
||||||
|
ast::Expr::Label(_e) => self.alloc_expr(Expr::Missing, syntax_ptr),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -183,8 +183,8 @@ fn to_fragment_kind(db: &dyn AstDatabase, macro_call_id: MacroCallId) -> Fragmen
|
||||||
// FIXME: Handle Pattern
|
// FIXME: Handle Pattern
|
||||||
FragmentKind::Expr
|
FragmentKind::Expr
|
||||||
}
|
}
|
||||||
EXPR_STMT => FragmentKind::Statements,
|
// FIXME: Expand to statements in appropriate positions; HIR lowering needs to handle that
|
||||||
BLOCK => FragmentKind::Statements,
|
EXPR_STMT | BLOCK => FragmentKind::Expr,
|
||||||
ARG_LIST => FragmentKind::Expr,
|
ARG_LIST => FragmentKind::Expr,
|
||||||
TRY_EXPR => FragmentKind::Expr,
|
TRY_EXPR => FragmentKind::Expr,
|
||||||
TUPLE_EXPR => FragmentKind::Expr,
|
TUPLE_EXPR => FragmentKind::Expr,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue