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:
parent
f4310bcf33
commit
2f80d07132
|
@ -2823,6 +2823,7 @@ impl<'a> CodeGenerator<'a> {
|
|||
|
||||
*dep_path = func_tree_path.common_ancestor(dep_path);
|
||||
}
|
||||
sorted_function_vec.push((generic_func, variant));
|
||||
}
|
||||
HoistableFunction::Link(_) => todo!("Deal with Link later"),
|
||||
HoistableFunction::CyclicLink(cyclic_name) => {
|
||||
|
@ -2876,10 +2877,10 @@ impl<'a> CodeGenerator<'a> {
|
|||
|
||||
*dep_path = func_tree_path.common_ancestor(dep_path);
|
||||
}
|
||||
sorted_function_vec.push((generic_func, variant));
|
||||
}
|
||||
}
|
||||
|
||||
sorted_function_vec.push((generic_func, variant));
|
||||
sorting_attempts += 1;
|
||||
}
|
||||
sorted_function_vec.dedup();
|
||||
|
@ -3083,6 +3084,7 @@ impl<'a> CodeGenerator<'a> {
|
|||
}
|
||||
}
|
||||
}
|
||||
sorted_dep_vec.push((dep.0.clone(), dep.1.clone()));
|
||||
}
|
||||
HoistableFunction::CyclicFunction { deps, .. } => {
|
||||
for (dep_generic_func, dep_variant) in deps.iter() {
|
||||
|
@ -3094,6 +3096,7 @@ impl<'a> CodeGenerator<'a> {
|
|||
deps_vec.insert(0, (dep_generic_func.clone(), dep_variant.clone()));
|
||||
}
|
||||
}
|
||||
sorted_dep_vec.push((dep.0.clone(), dep.1.clone()));
|
||||
}
|
||||
HoistableFunction::Link(_) => todo!("Deal with Link later"),
|
||||
HoistableFunction::CyclicLink(cyclic_func) => {
|
||||
|
@ -3117,8 +3120,6 @@ impl<'a> CodeGenerator<'a> {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
sorted_dep_vec.push((dep.0.clone(), dep.1.clone()));
|
||||
}
|
||||
|
||||
sorted_dep_vec.dedup();
|
||||
|
|
|
@ -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),
|
||||
|
|
Loading…
Reference in New Issue