|
|
|
@ -202,6 +202,7 @@ impl Castable for OwnedLiteral {
|
|
|
|
|
|
|
|
|
|
impl CompareContextElement for OwnedLiteral {
|
|
|
|
|
fn equals(&self, other: &dyn ContextElement) -> bool {
|
|
|
|
|
// println!("Literal equality check {:?} == {:?}", self, other);
|
|
|
|
|
// If its an OwnedLiteral then compare them directly,
|
|
|
|
|
// otherwise defer to the other type's implementation of
|
|
|
|
|
// CompareContextElement since the end user could add any
|
|
|
|
@ -220,27 +221,12 @@ impl CompareContextElement for OwnedLiteral {
|
|
|
|
|
OwnedLiteral::LNegativeInteger(self_num),
|
|
|
|
|
OwnedLiteral::LNegativeInteger(other_num),
|
|
|
|
|
) => self_num == other_num,
|
|
|
|
|
(OwnedLiteral::LString(self_text), _) | (_, OwnedLiteral::LString(self_text)) => {
|
|
|
|
|
false
|
|
|
|
|
}
|
|
|
|
|
(OwnedLiteral::LFloat(self_num), OwnedLiteral::LFloat(other_num)) => {
|
|
|
|
|
self_num == other_num
|
|
|
|
|
}
|
|
|
|
|
(OwnedLiteral::LPositiveInteger(self_num), OwnedLiteral::LString(other_text)) => {
|
|
|
|
|
&self_num.to_string() == other_text
|
|
|
|
|
}
|
|
|
|
|
(OwnedLiteral::LString(self_text), OwnedLiteral::LPositiveInteger(other_num)) => {
|
|
|
|
|
self_text == &other_num.to_string()
|
|
|
|
|
}
|
|
|
|
|
(OwnedLiteral::LNegativeInteger(self_num), OwnedLiteral::LString(other_text)) => {
|
|
|
|
|
&self_num.to_string() == other_text
|
|
|
|
|
}
|
|
|
|
|
(OwnedLiteral::LString(self_text), OwnedLiteral::LNegativeInteger(other_num)) => {
|
|
|
|
|
self_text == &other_num.to_string()
|
|
|
|
|
}
|
|
|
|
|
(OwnedLiteral::LFloat(self_num), OwnedLiteral::LString(other_text)) => {
|
|
|
|
|
&self_num.to_string() == other_text
|
|
|
|
|
}
|
|
|
|
|
(OwnedLiteral::LString(self_text), OwnedLiteral::LFloat(other_num)) => {
|
|
|
|
|
self_text == &other_num.to_string()
|
|
|
|
|
}
|
|
|
|
|
(OwnedLiteral::LFloat(self_num), OwnedLiteral::LPositiveInteger(other_num)) => {
|
|
|
|
|
*self_num == (*other_num as f64)
|
|
|
|
|
}
|
|
|
|
|