Make LhsExpr::AlreadyParsed a named struct

This commit is contained in:
Maybe Waffle 2023-01-14 11:28:14 +00:00
parent 5ca6f7d2c3
commit ecb1ad11d9
2 changed files with 12 additions and 6 deletions

View file

@ -164,7 +164,10 @@ impl<'a> Parser<'a> {
// Perform this outside of the `collect_tokens_trailing_token` closure,
// since our outer attributes do not apply to this part of the expression
let expr = self.with_res(Restrictions::STMT_EXPR, |this| {
this.parse_assoc_expr_with(0, LhsExpr::AlreadyParsed(expr, true))
this.parse_assoc_expr_with(
0,
LhsExpr::AlreadyParsed { expr, starts_statement: true },
)
})?;
Ok(self.mk_stmt(lo.to(self.prev_token.span), StmtKind::Expr(expr)))
} else {
@ -198,7 +201,10 @@ impl<'a> Parser<'a> {
let e = self.mk_expr(lo.to(hi), ExprKind::MacCall(mac));
let e = self.maybe_recover_from_bad_qpath(e)?;
let e = self.parse_dot_or_call_expr_with(e, lo, attrs)?;
let e = self.parse_assoc_expr_with(0, LhsExpr::AlreadyParsed(e, false))?;
let e = self.parse_assoc_expr_with(
0,
LhsExpr::AlreadyParsed { expr: e, starts_statement: false },
)?;
StmtKind::Expr(e)
};
Ok(self.mk_stmt(lo.to(hi), kind))