Remove some prints and switch an uneeded isize to usize since it can't be negative

This commit is contained in:
microproofs 2025-01-09 16:08:13 +07:00
parent 19b4b9df0f
commit c1ed0dcbb5
No known key found for this signature in database
GPG Key ID: 14F93C84DE6AFD17
3 changed files with 6 additions and 9 deletions

View File

@ -217,10 +217,8 @@ impl<'a> CodeGenerator<'a> {
fn finalize(&mut self, mut term: Term<Name>) -> Program<Name> {
term = self.special_functions.apply_used_functions(term);
println!("PROG BEFORE IS {}", term.to_pretty());
let program = aiken_optimize_and_intern(self.new_program(term));
println!("PROG IS {}", program.to_pretty());
let program = aiken_optimize_and_intern(self.new_program(term));
// This is very important to call here.
// If this isn't done, re-using the same instance

View File

@ -64,7 +64,6 @@ fn assert_uplc(source_code: &str, expected: Term<Name>, should_fail: bool, verbo
version: (1, 1, 0),
term: expected,
};
println!("BEFORE OPT IS {}", expected.to_pretty());
let expected = optimize::aiken_optimize_and_intern(expected);

View File

@ -90,8 +90,8 @@ pub const NO_INLINE: &str = "__no_inline__";
#[derive(PartialEq, PartialOrd, Default, Debug, Clone)]
pub struct VarLookup {
found: bool,
occurrences: isize,
delays: isize,
occurrences: usize,
delays: usize,
no_inline: bool,
}
@ -123,7 +123,7 @@ impl VarLookup {
}
}
pub fn delay_if_found(self, delay_amount: isize) -> Self {
pub fn delay_if_found(self, delay_amount: usize) -> Self {
if self.found {
Self {
found: self.found,
@ -1113,7 +1113,7 @@ impl Term<Name> {
}
}
Term::Delay(body) => {
let not_forced = isize::from(force_stack.pop().is_none());
let not_forced = usize::from(force_stack.pop().is_none());
body.var_occurrences(search_for, arg_stack, force_stack)
.delay_if_found(not_forced)
@ -1130,7 +1130,7 @@ impl Term<Name> {
{
VarLookup::new()
} else {
let not_applied: isize = isize::from(arg_stack.pop().is_none());
let not_applied = usize::from(arg_stack.pop().is_none());
body.var_occurrences(search_for, arg_stack, force_stack)
.delay_if_found(not_applied)
}