Implement logic in comparison helpers to perform type casting. Casting to non-number not yet implemented.

This commit is contained in:
Tom Alexander 2020-06-14 16:30:21 -04:00
parent 5dff03bb37
commit d47e004084
Signed by: talexander
GPG Key ID: D3A179C9A53C0EDE

View File

@ -1019,7 +1019,7 @@ impl<'a> DustRenderer<'a> {
.as_ref()
.map(|ice| ice.get_context_element_reference())
});
let right_side_ce = right_side.as_ref().map(|maybe_ice| {
let mut right_side_ce = right_side.as_ref().map(|maybe_ice| {
maybe_ice
.as_ref()
.map(|ice| ice.get_context_element_reference())
@ -1037,6 +1037,16 @@ impl<'a> DustRenderer<'a> {
// If key did not exist at all, return None
return None;
}
let right_side_cast = match (right_side_ce, type_rendered) {
(Some(Ok(ce)), Some(target_type)) => ce.cast_to_type(&target_type),
_ => None,
};
match right_side_cast.as_ref() {
Some(ice) => {
right_side_ce = Some(Ok(ice.get_context_element_reference()));
}
None => (),
}
match tag {
// Special case: when comparing two RVPaths, if the path
// points to the same value then they are equal. This is