checkpoint commit

This commit is contained in:
microproofs 2023-09-05 17:27:13 -04:00 committed by Kasey
parent 0fb9837ddf
commit ced818c455
2 changed files with 38 additions and 31 deletions

View File

@ -2673,7 +2673,7 @@ impl<'a> CodeGenerator<'a> {
let strong_connections = algo::tarjan_scc(&graph); let strong_connections = algo::tarjan_scc(&graph);
for connections in strong_connections { for (index, connections) in strong_connections.into_iter().enumerate() {
// If there's only one function, then it's only self recursive // If there's only one function, then it's only self recursive
if connections.len() < 2 { if connections.len() < 2 {
continue; continue;
@ -2683,6 +2683,11 @@ impl<'a> CodeGenerator<'a> {
.iter() .iter()
.map(|index| values.get(index).unwrap()) .map(|index| values.get(index).unwrap())
.collect_vec(); .collect_vec();
let function_key = FunctionAccessKey {
function_name: format!("__cyclic_function_{}", index),
module_name: "".to_string(),
};
} }
// Rest of code is for hoisting functions // Rest of code is for hoisting functions
@ -2699,7 +2704,8 @@ impl<'a> CodeGenerator<'a> {
.get(&variant) .get(&variant)
.unwrap_or_else(|| panic!("Missing Function Variant Definition")); .unwrap_or_else(|| panic!("Missing Function Variant Definition"));
if let HoistableFunction::Function { deps, params, .. } = function { match function {
HoistableFunction::Function { deps, params, .. } => {
if !params.is_empty() { if !params.is_empty() {
for (dep_generic_func, dep_variant) in deps.iter() { for (dep_generic_func, dep_variant) in deps.iter() {
if !(dep_generic_func == &generic_func && dep_variant == &variant) { if !(dep_generic_func == &generic_func && dep_variant == &variant) {
@ -2730,8 +2736,9 @@ impl<'a> CodeGenerator<'a> {
*dep_path = func_tree_path.common_ancestor(dep_path); *dep_path = func_tree_path.common_ancestor(dep_path);
} }
} else { }
todo!("Deal with Link later") HoistableFunction::Link(_) => todo!("Deal with Link later"),
HoistableFunction::CyclicLink(_) => {}
} }
sorted_function_vec.push((generic_func, variant)); sorted_function_vec.push((generic_func, variant));

View File

@ -889,7 +889,7 @@ impl AirTree {
module_name: module_name.clone(), module_name: module_name.clone(),
variant_name: variant_name.clone(), variant_name: variant_name.clone(),
contained_functions: contained_functions contained_functions: contained_functions
.into_iter() .iter()
.map(|(params, _)| params.clone()) .map(|(params, _)| params.clone())
.collect_vec(), .collect_vec(),
}); });