Fixed multiplication with percent

This commit is contained in:
bakk 2021-06-01 16:11:43 +02:00
parent 1f6b59bdae
commit 904c603d38

View File

@ -143,10 +143,9 @@ fn eval_binary_expr(
let left = eval_expr(context, left_expr, "")?; let left = eval_expr(context, left_expr, "")?;
let mut right = eval_expr(context, right_expr, "")?; let mut right = eval_expr(context, right_expr, "")?;
if let Expr::Unary(TokenKind::Percent, _) = right_expr { if let Expr::Unary(TokenKind::Percent, _) = right_expr {
right = right.mul(context, left.clone());
if let TokenKind::Star = op { if let TokenKind::Star = op {
right = right.mul(context, KalkNum::from(0.01)); return Ok(right);
} else {
right = right.mul(context, left.clone());
} }
} }