all nebula tests pass. Had one more fix on listaccessor to finish

This commit is contained in:
Kasey White 2023-02-08 02:37:54 -05:00 committed by Lucas
parent 986a6009f7
commit 9ae28aaa88
1 changed files with 12 additions and 73 deletions

View File

@ -3774,45 +3774,15 @@ impl<'a> CodeGenerator<'a> {
} => { } => {
let value = arg_stack.pop().unwrap(); let value = arg_stack.pop().unwrap();
let mut term = arg_stack.pop().unwrap(); let mut term = arg_stack.pop().unwrap();
let list_id = self.id_gen.next();
let mut id_list = vec![]; let mut id_list = vec![];
id_list.push(list_id);
for _ in 0..names.len() { for _ in 0..names.len() {
id_list.push(self.id_gen.next()); 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 let inner_types = tipo
.get_inner_types() .get_inner_types()
.into_iter() .into_iter()
@ -3821,47 +3791,16 @@ impl<'a> CodeGenerator<'a> {
.collect_vec(); .collect_vec();
term = apply_wrap( 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( list_access_to_uplc(
names, &names,
&id_list, &id_list,
tail, tail,
current_index, 0,
term, term,
inner_types, inner_types,
check_last_item, check_last_item,
true, 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(),
},
value, value,
); );