Update most of the tests and builder functions to use the new delay_branch_functions
This commit is contained in:
parent
d7e9fef4d3
commit
4cf81a19b1
|
@ -1198,8 +1198,7 @@ pub fn list_access_to_uplc(
|
||||||
}
|
}
|
||||||
|
|
||||||
return Term::var("empty_list")
|
return Term::var("empty_list")
|
||||||
.choose_list(term.delay(), otherwise_delayed)
|
.delay_empty_choose_list(term, otherwise_delayed)
|
||||||
.force()
|
|
||||||
.lambda("empty_list");
|
.lambda("empty_list");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1272,11 +1271,10 @@ pub fn list_access_to_uplc(
|
||||||
} else if tail_present {
|
} else if tail_present {
|
||||||
// Custom error instead of trying to do head_item on a possibly empty list.
|
// Custom error instead of trying to do head_item on a possibly empty list.
|
||||||
Term::var(tail_name.to_string())
|
Term::var(tail_name.to_string())
|
||||||
.choose_list(
|
.delay_filled_choose_list(
|
||||||
otherwise_delayed.clone(),
|
otherwise_delayed.clone(),
|
||||||
head_item(name, tipo, &tail_name, acc).delay(),
|
head_item(name, tipo, &tail_name, acc),
|
||||||
)
|
)
|
||||||
.force()
|
|
||||||
.lambda(tail_name)
|
.lambda(tail_name)
|
||||||
} else if otherwise_delayed == Term::Error.delay() {
|
} else if otherwise_delayed == Term::Error.delay() {
|
||||||
// Check head is last item in this list
|
// Check head is last item in this list
|
||||||
|
@ -1286,14 +1284,13 @@ pub fn list_access_to_uplc(
|
||||||
&tail_name,
|
&tail_name,
|
||||||
Term::tail_list()
|
Term::tail_list()
|
||||||
.apply(Term::var(tail_name.to_string()))
|
.apply(Term::var(tail_name.to_string()))
|
||||||
.choose_list(acc.delay(), Term::Error.delay())
|
.delayed_choose_list(acc, Term::Error),
|
||||||
.force(),
|
|
||||||
)
|
)
|
||||||
.lambda(tail_name)
|
.lambda(tail_name)
|
||||||
} else {
|
} else {
|
||||||
// Custom error if list is not empty after this head
|
// Custom error if list is not empty after this head
|
||||||
Term::var(tail_name.to_string())
|
Term::var(tail_name.to_string())
|
||||||
.choose_list(
|
.delay_filled_choose_list(
|
||||||
otherwise_delayed.clone(),
|
otherwise_delayed.clone(),
|
||||||
head_item(
|
head_item(
|
||||||
name,
|
name,
|
||||||
|
@ -1301,12 +1298,12 @@ pub fn list_access_to_uplc(
|
||||||
&tail_name,
|
&tail_name,
|
||||||
Term::tail_list()
|
Term::tail_list()
|
||||||
.apply(Term::var(tail_name.to_string()))
|
.apply(Term::var(tail_name.to_string()))
|
||||||
.choose_list(acc.delay(), otherwise_delayed.clone())
|
.delay_empty_choose_list(
|
||||||
.force(),
|
acc,
|
||||||
)
|
otherwise_delayed.clone(),
|
||||||
.delay(),
|
),
|
||||||
|
),
|
||||||
)
|
)
|
||||||
.force()
|
|
||||||
.lambda(tail_name)
|
.lambda(tail_name)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1333,7 +1330,7 @@ pub fn list_access_to_uplc(
|
||||||
// case for a custom error if the list is empty at this point
|
// case for a custom error if the list is empty at this point
|
||||||
|
|
||||||
Term::var(tail_name.to_string())
|
Term::var(tail_name.to_string())
|
||||||
.choose_list(
|
.delay_filled_choose_list(
|
||||||
otherwise_delayed.clone(),
|
otherwise_delayed.clone(),
|
||||||
head_item(
|
head_item(
|
||||||
name,
|
name,
|
||||||
|
@ -1342,10 +1339,8 @@ pub fn list_access_to_uplc(
|
||||||
acc.apply(
|
acc.apply(
|
||||||
Term::tail_list().apply(Term::var(tail_name.to_string())),
|
Term::tail_list().apply(Term::var(tail_name.to_string())),
|
||||||
),
|
),
|
||||||
)
|
),
|
||||||
.delay(),
|
|
||||||
)
|
)
|
||||||
.force()
|
|
||||||
.lambda(tail_name)
|
.lambda(tail_name)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue