use crate::prelude::*;
impl Runtime {
pub fn equal_literally(&self, left: &Obj, right: &Obj) -> bool {
match left {
Obj::Identifier(a) => match right {
Obj::Identifier(b) => a.to_string() == b.to_string(),
_ => false,
},
Obj::IdentifierWithMod(a) => match right {
Obj::IdentifierWithMod(b) => {
if a.mod_name == b.mod_name {
a.name == b.name
} else {
match (
self.module_manager
.module_name_and_path_map
.get(&a.mod_name),
self.module_manager
.module_name_and_path_map
.get(&b.mod_name),
) {
(Some(p1), Some(p2)) => p1 == p2 && a.name == b.name,
_ => false,
}
}
}
_ => false,
},
Obj::FieldAccess(a) => match right {
Obj::FieldAccess(b) => a.to_string() == b.to_string(),
_ => false,
},
Obj::FieldAccessWithMod(a) => match right {
Obj::FieldAccessWithMod(b) => {
if a.mod_name == b.mod_name {
a.name == b.name && a.field == b.field
} else {
match (
self.module_manager
.module_name_and_path_map
.get(&a.mod_name),
self.module_manager
.module_name_and_path_map
.get(&b.mod_name),
) {
(Some(p1), Some(p2)) => {
p1 == p2 && a.name == b.name && a.field == b.field
}
_ => false,
}
}
}
_ => false,
},
Obj::FnObj(f) => match right {
Obj::FnObj(g) => f.to_string() == g.to_string(),
_ => false,
},
Obj::Number(n) => match right {
Obj::Number(m) => n.to_string() == m.to_string(),
_ => false,
},
Obj::Add(a) => match right {
Obj::Add(b) => a.to_string() == b.to_string(),
_ => false,
},
Obj::Sub(a) => match right {
Obj::Sub(b) => a.to_string() == b.to_string(),
_ => false,
},
Obj::Mul(a) => match right {
Obj::Mul(b) => a.to_string() == b.to_string(),
_ => false,
},
Obj::Div(a) => match right {
Obj::Div(b) => a.to_string() == b.to_string(),
_ => false,
},
Obj::Mod(a) => match right {
Obj::Mod(b) => a.to_string() == b.to_string(),
_ => false,
},
Obj::Pow(a) => match right {
Obj::Pow(b) => a.to_string() == b.to_string(),
_ => false,
},
Obj::MatrixAdd(a) => match right {
Obj::MatrixAdd(b) => a.to_string() == b.to_string(),
_ => false,
},
Obj::MatrixSub(a) => match right {
Obj::MatrixSub(b) => a.to_string() == b.to_string(),
_ => false,
},
Obj::MatrixMul(a) => match right {
Obj::MatrixMul(b) => a.to_string() == b.to_string(),
_ => false,
},
Obj::MatrixScalarMul(a) => match right {
Obj::MatrixScalarMul(b) => a.to_string() == b.to_string(),
_ => false,
},
Obj::MatrixPow(a) => match right {
Obj::MatrixPow(b) => a.to_string() == b.to_string(),
_ => false,
},
Obj::Abs(a) => match right {
Obj::Abs(b) => a.to_string() == b.to_string(),
_ => false,
},
Obj::Log(a) => match right {
Obj::Log(b) => a.to_string() == b.to_string(),
_ => false,
},
Obj::Max(a) => match right {
Obj::Max(b) => a.to_string() == b.to_string(),
_ => false,
},
Obj::Min(a) => match right {
Obj::Min(b) => a.to_string() == b.to_string(),
_ => false,
},
Obj::Union(a) => match right {
Obj::Union(b) => a.to_string() == b.to_string(),
_ => false,
},
Obj::Intersect(a) => match right {
Obj::Intersect(b) => a.to_string() == b.to_string(),
_ => false,
},
Obj::SetMinus(a) => match right {
Obj::SetMinus(b) => a.to_string() == b.to_string(),
_ => false,
},
Obj::SetDiff(a) => match right {
Obj::SetDiff(b) => a.to_string() == b.to_string(),
_ => false,
},
Obj::Cup(a) => match right {
Obj::Cup(b) => a.to_string() == b.to_string(),
_ => false,
},
Obj::Cap(a) => match right {
Obj::Cap(b) => a.to_string() == b.to_string(),
_ => false,
},
Obj::ListSet(a) => match right {
Obj::ListSet(b) => a.to_string() == b.to_string(),
_ => false,
},
Obj::SetBuilder(a) => match right {
Obj::SetBuilder(b) => a.to_string() == b.to_string(),
_ => false,
},
Obj::FnSet(a) => match right {
Obj::FnSet(b) => a.to_string() == b.to_string(),
_ => false,
},
Obj::StandardSet(StandardSet::NPos) => match right {
Obj::StandardSet(StandardSet::NPos) => true,
_ => false,
},
Obj::StandardSet(StandardSet::N) => match right {
Obj::StandardSet(StandardSet::N) => true,
_ => false,
},
Obj::StandardSet(StandardSet::Q) => match right {
Obj::StandardSet(StandardSet::Q) => true,
_ => false,
},
Obj::StandardSet(StandardSet::Z) => match right {
Obj::StandardSet(StandardSet::Z) => true,
_ => false,
},
Obj::StandardSet(StandardSet::R) => match right {
Obj::StandardSet(StandardSet::R) => true,
_ => false,
},
Obj::Cart(a) => match right {
Obj::Cart(b) => a.to_string() == b.to_string(),
_ => false,
},
Obj::CartDim(a) => match right {
Obj::CartDim(b) => a.to_string() == b.to_string(),
_ => false,
},
Obj::Proj(a) => match right {
Obj::Proj(b) => a.to_string() == b.to_string(),
_ => false,
},
Obj::TupleDim(a) => match right {
Obj::TupleDim(b) => a.to_string() == b.to_string(),
_ => false,
},
Obj::Tuple(a) => match right {
Obj::Tuple(b) => a.to_string() == b.to_string(),
_ => false,
},
Obj::Count(a) => match right {
Obj::Count(b) => a.to_string() == b.to_string(),
_ => false,
},
Obj::Range(a) => match right {
Obj::Range(b) => a.to_string() == b.to_string(),
_ => false,
},
Obj::ClosedRange(a) => match right {
Obj::ClosedRange(b) => a.to_string() == b.to_string(),
_ => false,
},
Obj::FiniteSeqSet(a) => match right {
Obj::FiniteSeqSet(b) => a.to_string() == b.to_string(),
_ => false,
},
Obj::SeqSet(a) => match right {
Obj::SeqSet(b) => a.to_string() == b.to_string(),
_ => false,
},
Obj::FiniteSeqListObj(a) => match right {
Obj::FiniteSeqListObj(b) => a.to_string() == b.to_string(),
_ => false,
},
Obj::MatrixSet(a) => match right {
Obj::MatrixSet(b) => a.to_string() == b.to_string(),
_ => false,
},
Obj::MatrixListObj(a) => match right {
Obj::MatrixListObj(b) => a.to_string() == b.to_string(),
_ => false,
},
Obj::PowerSet(a) => match right {
Obj::PowerSet(b) => a.to_string() == b.to_string(),
_ => false,
},
Obj::Choose(a) => match right {
Obj::Choose(b) => a.to_string() == b.to_string(),
_ => false,
},
Obj::ObjAtIndex(a) => match right {
Obj::ObjAtIndex(b) => a.to_string() == b.to_string(),
_ => false,
},
Obj::StandardSet(StandardSet::QPos) => match right {
Obj::StandardSet(StandardSet::QPos) => true,
_ => false,
},
Obj::StandardSet(StandardSet::RPos) => match right {
Obj::StandardSet(StandardSet::RPos) => true,
_ => false,
},
Obj::StandardSet(StandardSet::QNeg) => match right {
Obj::StandardSet(StandardSet::QNeg) => true,
_ => false,
},
Obj::StandardSet(StandardSet::ZNeg) => match right {
Obj::StandardSet(StandardSet::ZNeg) => true,
_ => false,
},
Obj::StandardSet(StandardSet::RNeg) => match right {
Obj::StandardSet(StandardSet::RNeg) => true,
_ => false,
},
Obj::StandardSet(StandardSet::QNz) => match right {
Obj::StandardSet(StandardSet::QNz) => true,
_ => false,
},
Obj::StandardSet(StandardSet::ZNz) => match right {
Obj::StandardSet(StandardSet::ZNz) => true,
_ => false,
},
Obj::StandardSet(StandardSet::RNz) => match right {
Obj::StandardSet(StandardSet::RNz) => true,
_ => false,
},
Obj::FamilyObj(a) => match right {
Obj::FamilyObj(b) => a.to_string() == b.to_string(),
_ => false,
},
Obj::StructObj(a) => match right {
Obj::StructObj(b) => a.to_string() == b.to_string(),
_ => false,
},
}
}
}