Wire up the math functions to the renderer.
This commit is contained in:
parent
cdd10576e8
commit
c5a0ad6786
@ -1043,13 +1043,63 @@ impl<'a> DustRenderer<'a> {
|
||||
.get_context_element_reference()
|
||||
.math_add(r.get_context_element_reference()),
|
||||
},
|
||||
"subtract" => todo!(),
|
||||
"multiply" => todo!(),
|
||||
"divide" => todo!(),
|
||||
"mod" => todo!(),
|
||||
"abs" => todo!(),
|
||||
"floor" => todo!(),
|
||||
"ceil" => todo!(),
|
||||
"subtract" => match (left_side_ce, right_side_ce) {
|
||||
(None, _) | (Some(Err(_)), _) | (_, None) | (_, Some(Err(_))) => None,
|
||||
(Some(Ok(None)), _) | (_, Some(Ok(None))) => Some(IceResult::from_owned(
|
||||
OwnedLiteral::LString("NaN".to_owned()),
|
||||
)),
|
||||
(Some(Ok(Some(l))), Some(Ok(Some(r)))) => l
|
||||
.get_context_element_reference()
|
||||
.math_subtract(r.get_context_element_reference()),
|
||||
},
|
||||
"multiply" => match (left_side_ce, right_side_ce) {
|
||||
(None, _) | (Some(Err(_)), _) | (_, None) | (_, Some(Err(_))) => None,
|
||||
(Some(Ok(None)), _) | (_, Some(Ok(None))) => Some(IceResult::from_owned(
|
||||
OwnedLiteral::LString("NaN".to_owned()),
|
||||
)),
|
||||
(Some(Ok(Some(l))), Some(Ok(Some(r)))) => l
|
||||
.get_context_element_reference()
|
||||
.math_multiply(r.get_context_element_reference()),
|
||||
},
|
||||
"divide" => match (left_side_ce, right_side_ce) {
|
||||
(None, _) | (Some(Err(_)), _) | (_, None) | (_, Some(Err(_))) => None,
|
||||
(Some(Ok(None)), _) | (_, Some(Ok(None))) => Some(IceResult::from_owned(
|
||||
OwnedLiteral::LString("NaN".to_owned()),
|
||||
)),
|
||||
(Some(Ok(Some(l))), Some(Ok(Some(r)))) => l
|
||||
.get_context_element_reference()
|
||||
.math_divide(r.get_context_element_reference()),
|
||||
},
|
||||
"mod" => match (left_side_ce, right_side_ce) {
|
||||
(None, _) | (Some(Err(_)), _) | (_, None) | (_, Some(Err(_))) => None,
|
||||
(Some(Ok(None)), _) | (_, Some(Ok(None))) => Some(IceResult::from_owned(
|
||||
OwnedLiteral::LString("NaN".to_owned()),
|
||||
)),
|
||||
(Some(Ok(Some(l))), Some(Ok(Some(r)))) => l
|
||||
.get_context_element_reference()
|
||||
.math_modulus(r.get_context_element_reference()),
|
||||
},
|
||||
"abs" => match left_side_ce {
|
||||
None | Some(Err(_)) => None,
|
||||
Some(Ok(None)) => Some(IceResult::from_owned(OwnedLiteral::LString(
|
||||
"NaN".to_owned(),
|
||||
))),
|
||||
Some(Ok(Some(num))) => num.get_context_element_reference().math_abs(),
|
||||
},
|
||||
"floor" => match left_side_ce {
|
||||
None | Some(Err(_)) => None,
|
||||
Some(Ok(None)) => Some(IceResult::from_owned(OwnedLiteral::LString(
|
||||
"NaN".to_owned(),
|
||||
))),
|
||||
Some(Ok(Some(num))) => num.get_context_element_reference().math_floor(),
|
||||
},
|
||||
"ceil" => match left_side_ce {
|
||||
None | Some(Err(_)) => None,
|
||||
Some(Ok(None)) => Some(IceResult::from_owned(OwnedLiteral::LString(
|
||||
"NaN".to_owned(),
|
||||
))),
|
||||
Some(Ok(Some(num))) => num.get_context_element_reference().math_ceil(),
|
||||
},
|
||||
_ => None,
|
||||
};
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user