change if parse

This commit is contained in:
minish 2025-10-05 16:30:02 -04:00
parent 2bbc6386ed
commit 559d4c29ed
Signed by: min
SSH Key Fingerprint: SHA256:mf+pUTmK92Y57BuCjlkBdd82LqztTfDCQIUp0fCKABc
1 changed files with 2 additions and 2 deletions

View File

@ -162,12 +162,12 @@ where
// parse the condition
let cond = self.parse_expr(Precedence::Min, false)?;
// parse the true case
let true_case = self.parse_expr(prec, in_group)?;
let true_case = self.parse_expr(Precedence::Min, in_group)?;
// and maybe a false case
let false_case = matches!(self.try_peek(), Ok(Token::Else))
.then(|| {
self.eat();
self.parse_expr(prec, in_group)
self.parse_expr(Precedence::Min, in_group)
})
.transpose()?;
// pack