Implement ? binop operator

This commit is contained in:
Sam Mohr 2025-01-16 02:44:32 -08:00
parent 9d37c906fe
commit b73e4387ae
No known key found for this signature in database
GPG key ID: EA41D161A3C1BC99
12 changed files with 291 additions and 55 deletions

View file

@ -963,6 +963,7 @@ fn push_op(buf: &mut Buf, op: BinOp) {
called_via::BinOp::Or => buf.push_str("||"),
called_via::BinOp::Pizza => buf.push_str("|>"),
called_via::BinOp::DoubleQuestion => buf.push_str("??"),
called_via::BinOp::SingleQuestion => buf.push_str("?"),
}
}
@ -2284,7 +2285,8 @@ pub fn sub_expr_requests_parens(expr: &Expr<'_>) -> bool {
| BinOp::And
| BinOp::Or
| BinOp::Pizza
| BinOp::DoubleQuestion => true,
| BinOp::DoubleQuestion
| BinOp::SingleQuestion => true,
})
}
Expr::If { .. } => true,