update blocklike

This commit is contained in:
jnyfah 2025-01-16 12:11:55 +01:00
parent 11717ca5d4
commit e3deeec2f2
5 changed files with 10 additions and 13 deletions

View file

@ -134,12 +134,10 @@ pub(super) fn let_stmt(p: &mut Parser<'_>, with_semi: Semicolon) {
// test_err let_else_right_curly_brace
// fn func() { let Some(_) = {Some(1)} else { panic!("h") };}
if let Some(expr) = expr_after_eq {
if let Some(token) = expr.last_token(p) {
if token == T!['}'] {
p.error(
"right curly brace `}` before `else` in a `let...else` statement not allowed"
)
}
if BlockLike::is_blocklike(&expr, p) {
p.error(
"right curly brace `}` before `else` in a `let...else` statement not allowed",
)
}
}

View file

@ -198,7 +198,7 @@ pub(super) fn atom_expr(
}
};
let blocklike =
if BlockLike::is_blocklike(done.kind()) { BlockLike::Block } else { BlockLike::NotBlock };
if BlockLike::is_blocklike(&done, p) { BlockLike::Block } else { BlockLike::NotBlock };
Some((done, blocklike))
}