Skip to content

Commit 8234a85

Browse files
committed
compress
1 parent ad4b02e commit 8234a85

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

crates/parser/src/grammar.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ pub(crate) mod entry {
5959
}
6060

6161
pub(crate) fn stmt(p: &mut Parser) {
62-
expressions::stmt(p, expressions::StmtWithSemi::No, true);
62+
expressions::stmt(p, expressions::StmtWithSemi::No);
6363
}
6464

6565
pub(crate) fn pat(p: &mut Parser) {
@@ -103,7 +103,7 @@ pub(crate) mod entry {
103103
continue;
104104
}
105105

106-
expressions::stmt(p, expressions::StmtWithSemi::Optional, true);
106+
expressions::stmt(p, expressions::StmtWithSemi::Optional);
107107
}
108108

109109
m.complete(p, MACRO_STMTS);

crates/parser/src/grammar/expressions.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ use super::*;
55
pub(crate) use self::atom::{block_expr, match_arm_list};
66
pub(super) use self::atom::{literal, LITERAL_FIRST};
77

8+
#[derive(PartialEq, Eq)]
89
pub(super) enum StmtWithSemi {
910
Yes,
1011
No,
@@ -28,7 +29,7 @@ fn expr_no_struct(p: &mut Parser) {
2829
expr_bp(p, None, r, 1);
2930
}
3031

31-
pub(super) fn stmt(p: &mut Parser, with_semi: StmtWithSemi, prefer_expr: bool) {
32+
pub(super) fn stmt(p: &mut Parser, with_semi: StmtWithSemi) {
3233
let m = p.start();
3334
// test attr_on_expr_stmt
3435
// fn foo() {
@@ -52,7 +53,7 @@ pub(super) fn stmt(p: &mut Parser, with_semi: StmtWithSemi, prefer_expr: bool) {
5253
};
5354

5455
if let Some((cm, blocklike)) = expr_stmt(p, Some(m)) {
55-
if !(p.at(T!['}']) || (prefer_expr && p.at(EOF))) {
56+
if !(p.at(T!['}']) || (with_semi != StmtWithSemi::Yes && p.at(EOF))) {
5657
// test no_semi_after_block
5758
// fn foo() {
5859
// if true {}
@@ -149,7 +150,7 @@ pub(super) fn expr_block_contents(p: &mut Parser) {
149150
continue;
150151
}
151152

152-
stmt(p, StmtWithSemi::Yes, false);
153+
stmt(p, StmtWithSemi::Yes);
153154
}
154155
}
155156

0 commit comments

Comments
 (0)