Introduce separate hir::BinaryOp

Unlike ast::BinOp, it has significantly more structure to it, so it's
easier to, say, handle all assignment-like operations in the same way.
This commit is contained in:
Aleksey Kladov 2019-08-17 17:42:41 +03:00
parent 8919aa8065
commit 7e5a186c1f
4 changed files with 96 additions and 75 deletions

View file

@ -102,10 +102,6 @@ pub enum BinOp {
BitwiseOr,
/// The `&` operator for bitwise AND
BitwiseAnd,
/// The `..` operator for right-open ranges
RangeRightOpen,
/// The `..=` operator for right-closed ranges
RangeRightClosed,
/// The `=` operator for assignment
Assignment,
/// The `+=` operator for assignment after addition
@ -152,8 +148,6 @@ impl ast::BinExpr {
T![^] => BinOp::BitwiseXor,
T![|] => BinOp::BitwiseOr,
T![&] => BinOp::BitwiseAnd,
T![..] => BinOp::RangeRightOpen,
T![..=] => BinOp::RangeRightClosed,
T![=] => BinOp::Assignment,
T![+=] => BinOp::AddAssign,
T![/=] => BinOp::DivAssign,