From 5fe6e3f77b2cf9ac9aceda6b634fd9cf39fa2f39 Mon Sep 17 00:00:00 2001 From: microproofs Date: Tue, 1 Oct 2024 15:57:54 -0400 Subject: [PATCH] Finish simplification changes --- crates/aiken-lang/src/gen_uplc.rs | 5 ---- crates/aiken-lang/src/gen_uplc/air.rs | 1 - crates/aiken-lang/src/gen_uplc/tree.rs | 38 +++----------------------- 3 files changed, 4 insertions(+), 40 deletions(-) diff --git a/crates/aiken-lang/src/gen_uplc.rs b/crates/aiken-lang/src/gen_uplc.rs index 7af21a78..e2f1abad 100644 --- a/crates/aiken-lang/src/gen_uplc.rs +++ b/crates/aiken-lang/src/gen_uplc.rs @@ -3564,10 +3564,6 @@ impl<'a> CodeGenerator<'a> { .get_mut(&variant_name) .expect("Missing Function Variant Definition"); - if params.is_empty() { - validator_hoistable.push((key, variant_name)); - } - *function = HoistableFunction::Function { body: hoist_body, deps: hoist_deps, @@ -5082,7 +5078,6 @@ impl<'a> CodeGenerator<'a> { ) } } - air::FunctionVariants::Constant => todo!(), air::FunctionVariants::Cyclic(contained_functions) => { let mut cyclic_functions = vec![]; diff --git a/crates/aiken-lang/src/gen_uplc/air.rs b/crates/aiken-lang/src/gen_uplc/air.rs index 6845d8d0..b3f2f8e6 100644 --- a/crates/aiken-lang/src/gen_uplc/air.rs +++ b/crates/aiken-lang/src/gen_uplc/air.rs @@ -31,7 +31,6 @@ pub enum FunctionVariants { recursive_nonstatic_params: Vec, }, Cyclic(Vec>), - Constant, } #[derive(Debug, Clone, PartialEq)] diff --git a/crates/aiken-lang/src/gen_uplc/tree.rs b/crates/aiken-lang/src/gen_uplc/tree.rs index b1a7a87a..bb14e770 100644 --- a/crates/aiken-lang/src/gen_uplc/tree.rs +++ b/crates/aiken-lang/src/gen_uplc/tree.rs @@ -21,7 +21,6 @@ pub enum Fields { SixthField, SeventhField, EighthField, - NinthField, ArgsField(usize), } @@ -142,7 +141,6 @@ pub enum AirTree { params: Vec, recursive: bool, recursive_nonstatic_params: Vec, - constant: bool, func_body: Box, then: Box, }, @@ -534,28 +532,8 @@ impl AirTree { params, recursive, recursive_nonstatic_params, - constant: false, - variant_name: variant_name.to_string(), - func_body: func_body.into(), - then: then.into(), - } - } - #[allow(clippy::too_many_arguments)] - 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, + variant_name: variant_name.to_string(), func_body: func_body.into(), then: then.into(), } @@ -1182,18 +1160,11 @@ impl AirTree { params, recursive, recursive_nonstatic_params, - constant, variant_name, func_body, then, } => { - let variant = if *constant { - assert!(!recursive); - assert!(params.is_empty()); - assert!(recursive_nonstatic_params.is_empty()); - - FunctionVariants::Constant - } else if *recursive { + let variant = if *recursive { FunctionVariants::Recursive { params: params.clone(), recursive_nonstatic_params: recursive_nonstatic_params.clone(), @@ -2431,17 +2402,16 @@ impl AirTree { recursive: _, recursive_nonstatic_params: _, variant_name: _, - constant: _, func_body, then, } => { func_body.do_traverse_tree_with( tree_path, current_depth + 1, - Fields::EighthField, + Fields::SeventhField, 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 { func_name: _,