fix: minor stuff including fixing the var name used in modify_cyclic_calls

and carefully controling the functions we add to sorted dependencies
This commit is contained in:
microproofs
2023-09-22 17:54:43 -04:00
committed by Kasey
parent f4310bcf33
commit 2f80d07132
2 changed files with 28 additions and 5 deletions

View File

@@ -779,13 +779,35 @@ pub fn modify_cyclic_calls(
cyclic_links.get(&(var_key.clone(), variant_name.to_string()))
{
if *cyclic_name == *func_key {
let cyclic_var_name = if cyclic_name.module_name.is_empty() {
cyclic_name.function_name.to_string()
} else {
format!("{}_{}", cyclic_name.module_name, cyclic_name.function_name)
};
let index_name = names[*index].clone();
let var = AirTree::var(
ValueConstructor::public(
tipo.clone(),
ValueConstructorVariant::ModuleFn {
name: cyclic_var_name.clone(),
field_map: None,
module: "".to_string(),
arity: 2,
location: Span::empty(),
builtin: None,
},
),
cyclic_var_name,
"".to_string(),
);
*air_tree = AirTree::call(
air_tree.clone(),
var.clone(),
tipo.clone(),
vec![
air_tree.clone(),
var,
AirTree::anon_func(
names.clone(),
AirTree::local_var(index_name, tipo),