Prep the way for type casting.

This commit is contained in:
2023-05-12 17:43:20 -07:00
parent 9f8050a559
commit 8aa1465c35
6 changed files with 22 additions and 0 deletions

View File

@@ -58,6 +58,7 @@ impl PartialEq for Statement {
pub enum Expression {
Value(Location, Value),
Reference(Location, String),
Cast(Location, String, Box<Expression>),
Primitive(Location, String, Vec<Expression>),
}
@@ -72,6 +73,10 @@ impl PartialEq for Expression {
Expression::Reference(_, var2) => var1 == var2,
_ => false,
},
Expression::Cast(_, t1, e1) => match other {
Expression::Cast(_, t2, e2) => t1 == t2 && e1 == e2,
_ => false,
}
Expression::Primitive(_, prim1, args1) => match other {
Expression::Primitive(_, prim2, args2) => prim1 == prim2 && args1 == args2,
_ => false,