Simplifying PR per reviewers request

This commit is contained in:
Micah Kendall
2024-04-01 23:17:50 +11:00
committed by Lucas
parent d39dbd6697
commit ff4ddfbe1b
6 changed files with 11 additions and 91 deletions

View File

@@ -354,11 +354,6 @@ pub enum AirTree {
msg: Box<AirTree>,
then: Box<AirTree>,
},
Emit {
tipo: Rc<Type>,
msg: Box<AirTree>,
then: Box<AirTree>,
},
// End Expressions
}
@@ -836,7 +831,7 @@ impl AirTree {
}
}
pub fn emit(msg: AirTree, tipo: Rc<Type>, then: AirTree) -> AirTree {
AirTree::Emit {
AirTree::Trace {
tipo,
msg: msg.into(),
then: then.into(),
@@ -1391,11 +1386,6 @@ impl AirTree {
msg.create_air_vec(air_vec);
then.create_air_vec(air_vec);
}
AirTree::Emit { tipo, msg, then } => {
air_vec.push(Air::Emit { tipo: tipo.clone() });
msg.create_air_vec(air_vec);
then.create_air_vec(air_vec);
}
}
}
@@ -1417,8 +1407,7 @@ impl AirTree {
| AirTree::Constr { tipo, .. }
| AirTree::RecordUpdate { tipo, .. }
| AirTree::ErrorTerm { tipo, .. }
| AirTree::Trace { tipo, .. }
| AirTree::Emit { tipo, .. } => tipo.clone(),
| AirTree::Trace { tipo, .. } => tipo.clone(),
AirTree::Void => void(),
AirTree::Var { constructor, .. } => constructor.tipo.clone(),
AirTree::Fn { func_body, .. } => func_body.return_type(),
@@ -1474,8 +1463,7 @@ impl AirTree {
| AirTree::If { tipo, .. }
| AirTree::Constr { tipo, .. }
| AirTree::ErrorTerm { tipo, .. }
| AirTree::Trace { tipo, .. }
| AirTree::Emit { tipo, .. } => vec![tipo],
| AirTree::Trace { tipo, .. } => vec![tipo],
AirTree::Var { constructor, .. } => {
vec![constructor.tipo.borrow_mut()]
}
@@ -1959,23 +1947,6 @@ impl AirTree {
apply_with_func_last,
);
}
AirTree::Emit { msg, then, .. } => {
msg.do_traverse_tree_with(
tree_path,
current_depth + 1,
index_count.next_number(),
with,
apply_with_func_last,
);
then.do_traverse_tree_with(
tree_path,
current_depth + 1,
index_count.next_number(),
with,
apply_with_func_last,
);
}
AirTree::DefineFunc {
func_body, then, ..
} => {
@@ -2320,15 +2291,6 @@ impl AirTree {
panic!("Tree Path index outside tree children nodes")
}
}
AirTree::Emit { msg, then, .. } => {
if *index == 0 {
msg.as_mut().do_find_air_tree_node(tree_path_iter)
} else if *index == 1 {
then.as_mut().do_find_air_tree_node(tree_path_iter)
} else {
panic!("Tree Path index outside tree children nodes")
}
}
_ => {
panic!("A tree node with no children was encountered with a longer tree path.")
}