1
0

formatting

This commit is contained in:
2024-11-13 20:28:10 +03:00
parent 8f7d085ae7
commit ca51061ddd
2 changed files with 5 additions and 3 deletions

View File

@@ -1,4 +1,4 @@
use std::fmt;
use std::fmt;
use crate::ast::typed::{Type, TypedExpr};
use crate::ast::{BinOp, OpCommutative};
@@ -48,7 +48,9 @@ pub fn bubble_binop_vars(expr: TypedExpr) -> TypedExpr {
*rhs1,
op1,
),
(lhs, rhs) if !lhs.is_const() && rhs.is_const() && op.swappable(&op) => (rhs, lhs, op),
(lhs, rhs) if !lhs.is_const() && rhs.is_const() && op.swappable(&op) => {
(rhs, lhs, op)
},
(lhs, rhs) if op.precedence() < lhs.precedence() && op.swappable(&op) => {
(rhs, lhs, op)
},

View File

@@ -1,7 +1,7 @@
use std::fmt;
use std::str::FromStr;
use super::{optimization, BinOp, UntypedExpr};
use super::{BinOp, UntypedExpr, optimization};
use crate::ast::optimization::OLevel;
use crate::error;
use crate::error::{SemanticError, SemanticErrorKind};