From 9ae28aaa88b91183517403cc665e36ad061797f7 Mon Sep 17 00:00:00 2001 From: Kasey White Date: Wed, 8 Feb 2023 02:37:54 -0500 Subject: [PATCH] all nebula tests pass. Had one more fix on listaccessor to finish --- crates/aiken-lang/src/uplc.rs | 85 +++++------------------------------ 1 file changed, 12 insertions(+), 73 deletions(-) diff --git a/crates/aiken-lang/src/uplc.rs b/crates/aiken-lang/src/uplc.rs index cf975c62..822202a7 100644 --- a/crates/aiken-lang/src/uplc.rs +++ b/crates/aiken-lang/src/uplc.rs @@ -3774,45 +3774,15 @@ impl<'a> CodeGenerator<'a> { } => { let value = arg_stack.pop().unwrap(); let mut term = arg_stack.pop().unwrap(); + let list_id = self.id_gen.next(); let mut id_list = vec![]; + id_list.push(list_id); for _ in 0..names.len() { id_list.push(self.id_gen.next()); } - let current_index = 0; - let (first_name, names) = names.split_first().unwrap(); - - let list_id = self.id_gen.next(); - - let head_list = if tipo.is_map() { - apply_wrap( - Term::Builtin(DefaultFunction::HeadList).force_wrap(), - Term::Var( - Name { - text: format!("__list_{list_id}"), - unique: 0.into(), - } - .into(), - ), - ) - } else { - convert_data_to_type( - apply_wrap( - Term::Builtin(DefaultFunction::HeadList).force_wrap(), - Term::Var( - Name { - text: format!("__list_{list_id}"), - unique: 0.into(), - } - .into(), - ), - ), - &tipo.get_inner_types()[0], - ) - }; - let inner_types = tipo .get_inner_types() .into_iter() @@ -3821,47 +3791,16 @@ impl<'a> CodeGenerator<'a> { .collect_vec(); term = apply_wrap( - Term::Lambda { - parameter_name: Name { - text: format!("__list_{list_id}"), - unique: 0.into(), - } - .into(), - body: apply_wrap( - Term::Lambda { - parameter_name: Name { - text: first_name.clone(), - unique: 0.into(), - } - .into(), - body: apply_wrap( - list_access_to_uplc( - names, - &id_list, - tail, - current_index, - term, - inner_types, - check_last_item, - true, - ), - apply_wrap( - Term::Builtin(DefaultFunction::TailList).force_wrap(), - Term::Var( - Name { - text: format!("__list_{list_id}"), - unique: 0.into(), - } - .into(), - ), - ), - ) - .into(), - }, - head_list, - ) - .into(), - }, + list_access_to_uplc( + &names, + &id_list, + tail, + 0, + term, + inner_types, + check_last_item, + true, + ), value, );