no longer panic on unimplemented division

not implemented, but makes fuzzing less noisy
This commit is contained in:
Connor Skees 2020-08-19 20:04:20 -04:00
parent f2d1a82f34
commit f9c163e557

View File

@ -499,6 +499,11 @@ impl<'a, 'b: 'a> ValueVisitor<'a, 'b> {
return Ok(Value::Dimension(None, Unit::None, true)); return Ok(Value::Dimension(None, Unit::None, true));
} }
if num2.is_zero() {
// todo: Infinity and -Infinity
return Err(("Infinity not yet implemented.", self.span).into());
}
// `unit(1em / 1em)` => `""` // `unit(1em / 1em)` => `""`
if unit == unit2 { if unit == unit2 {
Value::Dimension(Some(num / num2), Unit::None, true) Value::Dimension(Some(num / num2), Unit::None, true)
@ -523,7 +528,12 @@ impl<'a, 'b: 'a> ValueVisitor<'a, 'b> {
// within the `Value` enum // within the `Value` enum
} else { } else {
// todo: remember to account for `Mul` and `Div` // todo: remember to account for `Mul` and `Div`
todo!("non-comparable inverse units") // todo!("non-comparable inverse units")
return Err((
"Division of non-comparable units not yet supported.",
self.span,
)
.into());
} }
} else { } else {
Value::String( Value::String(