Finish simplification changes

This commit is contained in:
microproofs 2024-10-01 15:57:54 -04:00
parent c6c5cddead
commit 5fe6e3f77b
No known key found for this signature in database
GPG Key ID: 14F93C84DE6AFD17
3 changed files with 4 additions and 40 deletions

View File

@ -3564,10 +3564,6 @@ impl<'a> CodeGenerator<'a> {
.get_mut(&variant_name) .get_mut(&variant_name)
.expect("Missing Function Variant Definition"); .expect("Missing Function Variant Definition");
if params.is_empty() {
validator_hoistable.push((key, variant_name));
}
*function = HoistableFunction::Function { *function = HoistableFunction::Function {
body: hoist_body, body: hoist_body,
deps: hoist_deps, deps: hoist_deps,
@ -5082,7 +5078,6 @@ impl<'a> CodeGenerator<'a> {
) )
} }
} }
air::FunctionVariants::Constant => todo!(),
air::FunctionVariants::Cyclic(contained_functions) => { air::FunctionVariants::Cyclic(contained_functions) => {
let mut cyclic_functions = vec![]; let mut cyclic_functions = vec![];

View File

@ -31,7 +31,6 @@ pub enum FunctionVariants {
recursive_nonstatic_params: Vec<String>, recursive_nonstatic_params: Vec<String>,
}, },
Cyclic(Vec<Vec<String>>), Cyclic(Vec<Vec<String>>),
Constant,
} }
#[derive(Debug, Clone, PartialEq)] #[derive(Debug, Clone, PartialEq)]

View File

@ -21,7 +21,6 @@ pub enum Fields {
SixthField, SixthField,
SeventhField, SeventhField,
EighthField, EighthField,
NinthField,
ArgsField(usize), ArgsField(usize),
} }
@ -142,7 +141,6 @@ pub enum AirTree {
params: Vec<String>, params: Vec<String>,
recursive: bool, recursive: bool,
recursive_nonstatic_params: Vec<String>, recursive_nonstatic_params: Vec<String>,
constant: bool,
func_body: Box<AirTree>, func_body: Box<AirTree>,
then: Box<AirTree>, then: Box<AirTree>,
}, },
@ -534,28 +532,8 @@ impl AirTree {
params, params,
recursive, recursive,
recursive_nonstatic_params, recursive_nonstatic_params,
constant: false,
variant_name: variant_name.to_string(),
func_body: func_body.into(),
then: then.into(),
}
}
#[allow(clippy::too_many_arguments)] variant_name: variant_name.to_string(),
pub fn define_const(
func_name: impl ToString,
module_name: impl ToString,
func_body: AirTree,
then: AirTree,
) -> AirTree {
AirTree::DefineFunc {
func_name: func_name.to_string(),
module_name: module_name.to_string(),
variant_name: "".to_string(),
params: vec![],
recursive: false,
recursive_nonstatic_params: vec![],
constant: true,
func_body: func_body.into(), func_body: func_body.into(),
then: then.into(), then: then.into(),
} }
@ -1182,18 +1160,11 @@ impl AirTree {
params, params,
recursive, recursive,
recursive_nonstatic_params, recursive_nonstatic_params,
constant,
variant_name, variant_name,
func_body, func_body,
then, then,
} => { } => {
let variant = if *constant { let variant = if *recursive {
assert!(!recursive);
assert!(params.is_empty());
assert!(recursive_nonstatic_params.is_empty());
FunctionVariants::Constant
} else if *recursive {
FunctionVariants::Recursive { FunctionVariants::Recursive {
params: params.clone(), params: params.clone(),
recursive_nonstatic_params: recursive_nonstatic_params.clone(), recursive_nonstatic_params: recursive_nonstatic_params.clone(),
@ -2431,17 +2402,16 @@ impl AirTree {
recursive: _, recursive: _,
recursive_nonstatic_params: _, recursive_nonstatic_params: _,
variant_name: _, variant_name: _,
constant: _,
func_body, func_body,
then, then,
} => { } => {
func_body.do_traverse_tree_with( func_body.do_traverse_tree_with(
tree_path, tree_path,
current_depth + 1, current_depth + 1,
Fields::EighthField, Fields::SeventhField,
with, with,
); );
then.do_traverse_tree_with(tree_path, current_depth + 1, Fields::NinthField, with) then.do_traverse_tree_with(tree_path, current_depth + 1, Fields::EighthField, with)
} }
AirTree::DefineCyclicFuncs { AirTree::DefineCyclicFuncs {
func_name: _, func_name: _,