feat: less clone, avoid evaluating not depended thunk
This commit is contained in:
@@ -9,7 +9,7 @@ use crate::{
|
||||
|
||||
use super::{Dep, Func, Ir, LoadFunc, MaybeThunk, SccAnalyzer, SccNode, Thunk};
|
||||
|
||||
#[derive(Clone, Copy, Unwrap)]
|
||||
#[derive(Clone, Copy, Unwrap, Debug)]
|
||||
pub enum Index {
|
||||
Thunk(usize),
|
||||
Func(usize),
|
||||
@@ -169,9 +169,11 @@ impl DowngradeContext {
|
||||
}
|
||||
|
||||
pub fn new_dep(&mut self, this: Index, dep: Dep) -> Result<()> {
|
||||
#[cfg(debug_assertions)]
|
||||
println!("{this:?} => {dep:?}");
|
||||
match this {
|
||||
Index::Thunk(idx) => {
|
||||
if dep == Dep::Thunk(idx) {
|
||||
if dep == Dep::Thunk(idx) && !matches!(self.thunks[idx].0, Ir::List(_)) {
|
||||
return Err(Error::DowngradeError(
|
||||
"infinite recursion encountered".into(),
|
||||
));
|
||||
|
||||
Reference in New Issue
Block a user