chore: remove unused code

This commit is contained in:
microproofs 2023-10-31 14:39:39 -04:00 committed by Kasey
parent 598ec5eaef
commit 7427bac4a0
2 changed files with 9 additions and 36 deletions

View File

@ -201,10 +201,7 @@ impl<'a> CodeGenerator<'a> {
term,
};
// println!("Program: {}", program.to_pretty());
program = aiken_optimize_and_intern(program);
// println!("Program After: {}", program.to_pretty());
// This is very important to call here.
// If this isn't done, re-using the same instance

View File

@ -401,19 +401,16 @@ fn inline_single_occurrence_reducer(
let delays = delayed_execution(body);
let is_recursive_call = false;
if occurrences == 1 {
if !is_recursive_call
&& (delays == 0
|| matches!(
&arg_term,
Term::Var(_)
| Term::Constant(_)
| Term::Delay(_)
| Term::Lambda { .. }
| Term::Builtin(_),
))
if delays == 0
|| matches!(
&arg_term,
Term::Var(_)
| Term::Constant(_)
| Term::Delay(_)
| Term::Lambda { .. }
| Term::Builtin(_),
)
{
*body = substitute_term(body, parameter_name.clone(), &arg_term);
@ -447,27 +444,6 @@ fn inline_single_occurrence_reducer(
}
}
fn contains_recursive_call(body: &Term<Name>) -> bool {
match body {
Term::Delay(d) => contains_recursive_call(d.as_ref()),
Term::Lambda { body, .. } => contains_recursive_call(body.as_ref()),
Term::Apply { function, argument } => {
contains_recursive_call(function.as_ref())
|| contains_recursive_call(argument.as_ref())
|| {
let func = function.as_ref();
let arg = argument.as_ref();
matches!(func, Term::Var(_)) && *func == *arg
}
}
Term::Force(f) => contains_recursive_call(f.as_ref()),
Term::Case { .. } => todo!(),
Term::Constr { .. } => todo!(),
_ => false,
}
}
fn cast_data_reducer(term: &mut Term<Name>) {
match term {
Term::Delay(d) => {