chore: remove unused code
This commit is contained in:
parent
598ec5eaef
commit
7427bac4a0
|
@ -201,10 +201,7 @@ impl<'a> CodeGenerator<'a> {
|
||||||
term,
|
term,
|
||||||
};
|
};
|
||||||
|
|
||||||
// println!("Program: {}", program.to_pretty());
|
|
||||||
|
|
||||||
program = aiken_optimize_and_intern(program);
|
program = aiken_optimize_and_intern(program);
|
||||||
// println!("Program After: {}", program.to_pretty());
|
|
||||||
|
|
||||||
// This is very important to call here.
|
// This is very important to call here.
|
||||||
// If this isn't done, re-using the same instance
|
// If this isn't done, re-using the same instance
|
||||||
|
|
|
@ -401,11 +401,8 @@ fn inline_single_occurrence_reducer(
|
||||||
|
|
||||||
let delays = delayed_execution(body);
|
let delays = delayed_execution(body);
|
||||||
|
|
||||||
let is_recursive_call = false;
|
|
||||||
|
|
||||||
if occurrences == 1 {
|
if occurrences == 1 {
|
||||||
if !is_recursive_call
|
if delays == 0
|
||||||
&& (delays == 0
|
|
||||||
|| matches!(
|
|| matches!(
|
||||||
&arg_term,
|
&arg_term,
|
||||||
Term::Var(_)
|
Term::Var(_)
|
||||||
|
@ -413,7 +410,7 @@ fn inline_single_occurrence_reducer(
|
||||||
| Term::Delay(_)
|
| Term::Delay(_)
|
||||||
| Term::Lambda { .. }
|
| Term::Lambda { .. }
|
||||||
| Term::Builtin(_),
|
| Term::Builtin(_),
|
||||||
))
|
)
|
||||||
{
|
{
|
||||||
*body = substitute_term(body, parameter_name.clone(), &arg_term);
|
*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>) {
|
fn cast_data_reducer(term: &mut Term<Name>) {
|
||||||
match term {
|
match term {
|
||||||
Term::Delay(d) => {
|
Term::Delay(d) => {
|
||||||
|
|
Loading…
Reference in New Issue