From c764a6f99c71a6cc92dca68c9f7dfcb84172cc59 Mon Sep 17 00:00:00 2001 From: microproofs Date: Sat, 7 Oct 2023 16:53:45 -0400 Subject: [PATCH] fix: reset option should not reset special functions in only a multivalidator --- crates/aiken-lang/src/gen_uplc.rs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/crates/aiken-lang/src/gen_uplc.rs b/crates/aiken-lang/src/gen_uplc.rs index 7093ce58..a7689836 100644 --- a/crates/aiken-lang/src/gen_uplc.rs +++ b/crates/aiken-lang/src/gen_uplc.rs @@ -86,12 +86,15 @@ impl<'a> CodeGenerator<'a> { } } - pub fn reset(&mut self) { + pub fn reset(&mut self, reset_special_functions: bool) { self.code_gen_functions = IndexMap::new(); self.zero_arg_functions = IndexMap::new(); self.defined_functions = IndexMap::new(); self.cyclic_functions = IndexMap::new(); self.id_gen = IdGenerator::new(); + if reset_special_functions { + self.special_functions = CodeGenSpecialFuncs::new(); + } } pub fn insert_function( @@ -136,7 +139,7 @@ impl<'a> CodeGenerator<'a> { let mut term = self.uplc_code_gen(full_vec); if let Some(other) = other_fun { - self.reset(); + self.reset(false); let mut air_tree_fun_other = self.build(&other.body); @@ -207,7 +210,7 @@ impl<'a> CodeGenerator<'a> { // switching to a shared code generator caused some // instability issues and we fixed it by placing this // method here. - self.reset(); + self.reset(true); program }