mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-01 22:31:43 +00:00
always wrap block into an expression
This commit is contained in:
parent
a8397deab9
commit
3c2dea7f55
5 changed files with 19 additions and 14 deletions
|
@ -40,6 +40,11 @@ pub(crate) fn block(p: &mut Parser) {
|
|||
p.error("expected a block");
|
||||
return;
|
||||
}
|
||||
atom::block_expr(p, None);
|
||||
}
|
||||
|
||||
pub(crate) fn naked_block(p: &mut Parser) {
|
||||
assert!(p.at(T!['{']));
|
||||
let m = p.start();
|
||||
p.bump();
|
||||
expr_block_contents(p);
|
||||
|
|
|
@ -463,10 +463,10 @@ fn match_guard(p: &mut Parser) -> CompletedMarker {
|
|||
// unsafe {};
|
||||
// 'label: {};
|
||||
// }
|
||||
fn block_expr(p: &mut Parser, m: Option<Marker>) -> CompletedMarker {
|
||||
pub(super) fn block_expr(p: &mut Parser, m: Option<Marker>) -> CompletedMarker {
|
||||
assert!(p.at(T!['{']));
|
||||
let m = m.unwrap_or_else(|| p.start());
|
||||
block(p);
|
||||
naked_block(p);
|
||||
m.complete(p, BLOCK_EXPR)
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue