mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-01 06:11:35 +00:00
Fix parsing of blocks without {
This commit is contained in:
parent
fb8fb65131
commit
359d3be308
11 changed files with 107 additions and 62 deletions
|
@ -2,7 +2,7 @@
|
|||
|
||||
mod atom;
|
||||
|
||||
pub(crate) use self::atom::match_arm_list;
|
||||
pub(crate) use self::atom::{block_expr, match_arm_list};
|
||||
pub(super) use self::atom::{literal, LITERAL_FIRST};
|
||||
use super::*;
|
||||
|
||||
|
@ -49,19 +49,6 @@ fn expr_no_struct(p: &mut Parser) {
|
|||
expr_bp(p, r, 1);
|
||||
}
|
||||
|
||||
// test block
|
||||
// fn a() {}
|
||||
// fn b() { let _ = 1; }
|
||||
// fn c() { 1; 2; }
|
||||
// fn d() { 1; 2 }
|
||||
pub(crate) fn block(p: &mut Parser) {
|
||||
if !p.at(T!['{']) {
|
||||
p.error("expected a block");
|
||||
return;
|
||||
}
|
||||
atom::block_expr(p);
|
||||
}
|
||||
|
||||
fn is_expr_stmt_attr_allowed(kind: SyntaxKind) -> bool {
|
||||
match kind {
|
||||
BIN_EXPR | RANGE_EXPR | IF_EXPR => false,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue